9 #define PVRTMODELPOD_TAG_MASK (0x80000000)
10 #define PVRTMODELPOD_TAG_START (0x00000000)
11 #define PVRTMODELPOD_TAG_END (0x80000000)
23 ePODFileVersion = 1000,
27 ePODFileEndiannessMisMatch = -402456576,
29 ePODFileColourBackground = 2000,
30 ePODFileColourAmbient,
48 ePODFileMatName = 3000,
49 ePODFileMatIdxTexDiffuse,
55 ePODFileMatEffectFile,
56 ePODFileMatEffectName,
57 ePODFileMatIdxTexAmbient,
58 ePODFileMatIdxTexSpecularColour,
59 ePODFileMatIdxTexSpecularLevel,
60 ePODFileMatIdxTexBump,
61 ePODFileMatIdxTexEmissive,
62 ePODFileMatIdxTexGlossiness,
63 ePODFileMatIdxTexOpacity,
64 ePODFileMatIdxTexReflection,
65 ePODFileMatIdxTexRefraction,
66 ePODFileMatBlendSrcRGB,
68 ePODFileMatBlendDstRGB,
70 ePODFileMatBlendOpRGB,
72 ePODFileMatBlendColour,
73 ePODFileMatBlendFactor,
76 ePODFileTexName = 4000,
78 ePODFileNodeIdx = 5000,
81 ePODFileNodeIdxParent,
87 ePODFileNodeAnimScale,
89 ePODFileNodeAnimMatrix,
90 ePODFileNodeAnimFlags,
91 ePODFileNodeAnimPosIdx,
92 ePODFileNodeAnimRotIdx,
93 ePODFileNodeAnimScaleIdx,
94 ePODFileNodeAnimMatrixIdx,
96 ePODFileMeshNumVtx = 6000,
100 ePODFileMeshStripLength,
101 ePODFileMeshNumStrips,
109 ePODFileMeshBoneWeight,
110 ePODFileMeshInterleaved,
111 ePODFileMeshBoneBatches,
112 ePODFileMeshBoneBatchBoneCnts,
113 ePODFileMeshBoneBatchOffsets,
114 ePODFileMeshBoneBatchBoneMax,
115 ePODFileMeshBoneBatchCnt,
116 ePODFileMeshUnpackMatrix,
118 ePODFileLightIdxTgt = 7000,
121 ePODFileLightConstantAttenuation,
122 ePODFileLightLinearAttenuation,
123 ePODFileLightQuadraticAttenuation,
124 ePODFileLightFalloffAngle,
125 ePODFileLightFalloffExponent,
127 ePODFileCamIdxTgt = 8000,
133 ePODFileDataType = 9000,
142 ePODBlendFunc_ZERO=0,
144 ePODBlendFunc_BLEND_FACTOR,
145 ePODBlendFunc_ONE_MINUS_BLEND_FACTOR,
147 ePODBlendFunc_SRC_COLOR = 0x0300,
148 ePODBlendFunc_ONE_MINUS_SRC_COLOR,
149 ePODBlendFunc_SRC_ALPHA,
150 ePODBlendFunc_ONE_MINUS_SRC_ALPHA,
151 ePODBlendFunc_DST_ALPHA,
152 ePODBlendFunc_ONE_MINUS_DST_ALPHA,
153 ePODBlendFunc_DST_COLOR,
154 ePODBlendFunc_ONE_MINUS_DST_COLOR,
155 ePODBlendFunc_SRC_ALPHA_SATURATE,
157 ePODBlendFunc_CONSTANT_COLOR = 0x8001,
158 ePODBlendFunc_ONE_MINUS_CONSTANT_COLOR,
159 ePODBlendFunc_CONSTANT_ALPHA,
160 ePODBlendFunc_ONE_MINUS_CONSTANT_ALPHA
167 EPODDataUnsignedShort,
174 EPODDataUnsignedByte,
179 EPODDataUnsignedByteNorm,
180 EPODDataUnsignedShortNorm,
187 : type(EPODDataNone), num(0), stride(0), pOffset(NULL), dynamicallyAllocated(
false)
194 bool dynamicallyAllocated;
202 std::istream& stream,
207 static void ReadMarker (std::istream& stream, u32* pName, u32* pLength);
209 static void ReadArray (std::istream& stream, u8* pData, u32 numByte);
210 static void ReadArray16(std::istream& stream, u16* pData, u32 size);
211 static void ReadArray32(std::istream& stream, u32* pData, u32 size);
213 static void ReadString(std::istream& stream, std::string &destString);
215 static void ReadCPODData(std::istream& stream, u32 fileOffset, u32 fileSize, u32 spec,
ePODData* pData,
bool validData);
217 static u32 GetDataTypeSize (EPVRTDataType type);
219 template <
typename T>
220 static void ReadS32(std::istream& stream, T* value)
224 stream.read((
char*)( &ub[0] ), 4);
226 int *pn = (
int*)value;
227 *pn = (int) ((ub[3] << 24) | (ub[2] << 16) | (ub[1] << 8) | ub[0]);
230 template <
typename T>
231 static void Read32(std::istream& stream, T* value)
235 stream.read((
char*)( &ub[0] ), 4);
237 unsigned int *pn = (
unsigned int*)value;
238 *pn = (
unsigned int) ((ub[3] << 24) | (ub[2] << 16) | (ub[1] << 8) | ub[0]);
242 template <
typename T>
243 static void Read16(std::istream& stream, T* value)
247 stream.read((
char*)( &ub[0] ), 2);
249 unsigned short *pn = (
unsigned short*)value;
250 *pn = (
unsigned short) ((ub[1] << 8) | ub[0]);