writemesh() variable previousBatch renamed to endOfPrevious

This commit is contained in:
surkeh 2018-04-19 14:48:32 -07:00
parent 889a3e44a6
commit 9b70b10565

View File

@ -25,22 +25,22 @@ void writemesh(const struct MeshHeader *mh,
// batch data the same treatment.
struct BatchData * newBatches = malloc(newmh.numBatch * sizeof(struct BatchData));
uint64_t previousBatch = 0;
uint64_t endOfPrevious = 0;
for (int i = 0; i < newmh.numBatch; i++) {
newBatches[i] = (m -> b) -> bd[i];
unsigned int nVertices = m -> b -> bd[i].numVertex;
if (previousBatch == 0) {
if (endOfPrevious == 0) {
newBatches[i].offsetPositions = newmh.offsetBatches + ( newmh.numBatch * sizeof(struct BatchData));
}
else {
newBatches[i].offsetPositions = previousBatch;
newBatches[i].offsetPositions = endOfPrevious;
}
newBatches[i].offsetNormals = newBatches[i].offsetPositions + (sizeof(struct Coordinate) * nVertices);
newBatches[i].offsetUVs = newBatches[i].offsetNormals + (sizeof(struct Coordinate) * nVertices);
newBatches[i].offsetBoneIndexes = newBatches[i].offsetUVs + (sizeof(struct UVs) * nVertices);
newBatches[i].offsetBoneWeights = newBatches[i].offsetBoneIndexes + (sizeof(struct BoneIndexes) * nVertices);
append(fn, (char*)(&newBatches[i]), sizeof(struct BatchData));
previousBatch = newBatches[i].offsetBoneWeights + (sizeof(struct BoneWeights) * nVertices);;
endOfPrevious = newBatches[i].offsetBoneWeights + (sizeof(struct BoneWeights) * nVertices);;
}
for (int i = 0; i < newmh.numBatch; i++) {