-
Notifications
You must be signed in to change notification settings - Fork 619
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1151 from SomaZ/rend2
Rend2
- Loading branch information
Showing
111 changed files
with
93,833 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,6 +169,130 @@ typedef struct md3Header_s { | |
int ofsEnd; // end of file | ||
} md3Header_t; | ||
|
||
/* | ||
============================================================================== | ||
MDR file format | ||
============================================================================== | ||
*/ | ||
|
||
/* | ||
* Here are the definitions for Ravensoft's model format of md4. Raven stores their | ||
* playermodels in .mdr files, in some games, which are pretty much like the md4 | ||
* format implemented by ID soft. It seems like ID's original md4 stuff is not used at all. | ||
* MDR is being used in EliteForce, JediKnight2 and Soldiers of Fortune2 (I think). | ||
* So this comes in handy for anyone who wants to make it possible to load player | ||
* models from these games. | ||
* This format has bone tags, which is similar to the thing you have in md3 I suppose. | ||
* Raven has released their version of md3view under GPL enabling me to add support | ||
* to this codebase. Thanks to Steven Howes aka Skinner for helping with example | ||
* source code. | ||
* | ||
* - Thilo Schulz ([email protected]) | ||
*/ | ||
|
||
#define MDR_IDENT (('5'<<24)+('M'<<16)+('D'<<8)+'R') | ||
#define MDR_VERSION 2 | ||
#define MDR_MAX_BONES 128 | ||
|
||
typedef struct { | ||
int boneIndex; // these are indexes into the boneReferences, | ||
float boneWeight; // not the global per-frame bone list | ||
vec3_t offset; | ||
} mdrWeight_t; | ||
|
||
typedef struct { | ||
vec3_t normal; | ||
vec2_t texCoords; | ||
int numWeights; | ||
mdrWeight_t weights[1]; // variable sized | ||
} mdrVertex_t; | ||
|
||
typedef struct { | ||
int indexes[3]; | ||
} mdrTriangle_t; | ||
|
||
typedef struct { | ||
int ident; | ||
|
||
char name[MAX_QPATH]; // polyset name | ||
char shader[MAX_QPATH]; | ||
int shaderIndex; // for in-game use | ||
|
||
int ofsHeader; // this will be a negative number | ||
|
||
int numVerts; | ||
int ofsVerts; | ||
|
||
int numTriangles; | ||
int ofsTriangles; | ||
|
||
// Bone references are a set of ints representing all the bones | ||
// present in any vertex weights for this surface. This is | ||
// needed because a model may have surfaces that need to be | ||
// drawn at different sort times, and we don't want to have | ||
// to re-interpolate all the bones for each surface. | ||
int numBoneReferences; | ||
int ofsBoneReferences; | ||
|
||
int ofsEnd; // next surface follows | ||
} mdrSurface_t; | ||
|
||
typedef struct { | ||
float matrix[3][4]; | ||
} mdrBone_t; | ||
|
||
typedef struct { | ||
vec3_t bounds[2]; // bounds of all surfaces of all LOD's for this frame | ||
vec3_t localOrigin; // midpoint of bounds, used for sphere cull | ||
float radius; // dist from localOrigin to corner | ||
char name[16]; | ||
mdrBone_t bones[1]; // [numBones] | ||
} mdrFrame_t; | ||
|
||
typedef struct { | ||
unsigned char Comp[24]; // MC_COMP_BYTES is in MatComp.h, but don't want to couple | ||
} mdrCompBone_t; | ||
|
||
typedef struct { | ||
vec3_t bounds[2]; // bounds of all surfaces of all LOD's for this frame | ||
vec3_t localOrigin; // midpoint of bounds, used for sphere cull | ||
float radius; // dist from localOrigin to corner | ||
mdrCompBone_t bones[1]; // [numBones] | ||
} mdrCompFrame_t; | ||
|
||
typedef struct { | ||
int numSurfaces; | ||
int ofsSurfaces; // first surface, others follow | ||
int ofsEnd; // next lod follows | ||
} mdrLOD_t; | ||
|
||
typedef struct { | ||
int boneIndex; | ||
char name[32]; | ||
} mdrTag_t; | ||
|
||
typedef struct { | ||
int ident; | ||
int version; | ||
|
||
char name[MAX_QPATH]; // model name | ||
|
||
// frames and bones are shared by all levels of detail | ||
int numFrames; | ||
int numBones; | ||
int ofsFrames; // mdrFrame_t[numFrames] | ||
|
||
// each level of detail has completely separate sets of surfaces | ||
int numLODs; | ||
int ofsLODs; | ||
|
||
int numTags; | ||
int ofsTags; | ||
|
||
int ofsEnd; // end of file | ||
} mdrHeader_t; | ||
|
||
/* | ||
============================================================================== | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.