void plVertCoder::IDecode(hsStream* S, unsigned char*& dest, unsigned char format) { int i; // The X, Y, Z coordinates of this vertex IDecodeFloat(S, kPosition, 0, dest); IDecodeFloat(S, kPosition, 1, dest); IDecodeFloat(S, kPosition, 2, dest); // Weights int count = (format & plGBufferGroup::kSkinWeightMask) >> 4; if (count > 0) { for (i=0; i<count; i++) IDecodeFloat(S, kWeight, i, dest); // Skin index if (format & kSkinIndices) { *(int*)dest = S->readInt(); dest += sizeof(int); } } // Normal IDecodeNormal(S, dest); IDecodeColor(S, dest); *(int*)dest = 0; dest += sizeof(int); // UVW Coordinates for (i=0; i<(format & kUVCountMask); i++) { IDecodeFloat(S, kUVW+i, 0, dest); IDecodeFloat(S, kUVW+i, 1, dest); IDecodeFloat(S, kUVW+i, 2, dest); } }
inline void plVertCoder::IDecode(hsStream* s, uint8_t*& dst, const uint32_t stride, const uint8_t format) { IDecodeFloat(s, kPosition, 0, dst, stride); IDecodeFloat(s, kPosition, 1, dst, stride); IDecodeFloat(s, kPosition, 2, dst, stride); // Weights and indices? const int numWeights = INumWeights(format); if( numWeights ) { int j; for( j = 0; j < numWeights; j++ ) IDecodeFloat(s, kWeight, j, dst, stride); if( format & plGBufferGroup::kSkinIndices ) { uint32_t* idx = (uint32_t*)dst; *idx = s->ReadLE32(); dst += 4; } } IDecodeNormal(s, dst, stride); IDecodeColor(s, dst, stride); // COLOR2 uint32_t* trash = (uint32_t*)dst; *trash = 0; dst += 4; const int numUVWs = format & plGBufferGroup::kUVCountMask; int i; for( i = 0; i < numUVWs; i++ ) { IDecodeFloat(s, kUVW + i, 0, dst, stride); IDecodeFloat(s, kUVW + i, 1, dst, stride); IDecodeFloat(s, kUVW + i, 2, dst, stride); } }