mirror of
https://notabug.org/scuti/lib3ddevil1
synced 2024-11-22 22:03:00 +05:30
Initialized pointers for arrays in struct Batch
This commit is contained in:
parent
fb962d2ffe
commit
ad357afc36
@ -76,6 +76,8 @@ void printmeshbatch(struct Batch*);
|
|||||||
|
|
||||||
void printpositions(struct Positions*, unsigned int);
|
void printpositions(struct Positions*, unsigned int);
|
||||||
|
|
||||||
|
void printnormals(struct Normals*, unsigned int);
|
||||||
|
|
||||||
// ** = 'pass by reference' of a pointer to struct
|
// ** = 'pass by reference' of a pointer to struct
|
||||||
bool getmeshheader(struct MeshHeader**, unsigned int i, const char * const);
|
bool getmeshheader(struct MeshHeader**, unsigned int i, const char * const);
|
||||||
|
|
||||||
|
@ -49,6 +49,16 @@ void printpositions(struct Positions *p, unsigned int count) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void printnormals(struct Normals *n, unsigned int count) {
|
||||||
|
if (n == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
unsigned int i;
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
printf("(%f, %f, %f)\n", (n[i]).x, (n[i]).y, (n[i]).z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool getmeshheader(struct MeshHeader **hs,
|
bool getmeshheader(struct MeshHeader **hs,
|
||||||
unsigned int i,
|
unsigned int i,
|
||||||
const char * const filedata) {
|
const char * const filedata) {
|
||||||
@ -76,12 +86,10 @@ bool getmeshbatch(struct Batch **b,
|
|||||||
unsigned int offset = h -> offsetBatches;
|
unsigned int offset = h -> offsetBatches;
|
||||||
*b = (struct Batch*)(filedata + offset);
|
*b = (struct Batch*)(filedata + offset);
|
||||||
(*b) -> p = (struct Positions*)(filedata + ((*b) -> offsetPositions));
|
(*b) -> p = (struct Positions*)(filedata + ((*b) -> offsetPositions));
|
||||||
printf("p = %x\n", (*b) -> offsetPositions);
|
(*b) -> n = (struct Normals*)(filedata + ((*b) -> offsetNormals));
|
||||||
printpositions((*b) -> p, 3);
|
(*b) -> u = (struct UVs*)(filedata + ((*b) -> offsetUVs));
|
||||||
(*b) -> n = NULL;
|
(*b) -> bi = (struct BoneIndexes*)(filedata + ((*b) -> offsetBoneIndexes));
|
||||||
(*b) -> u = NULL;
|
(*b) -> bw = (struct BoneWeights*)(filedata + ((*b) -> offsetBoneWeights));
|
||||||
(*b) -> bi = NULL;
|
|
||||||
(*b) -> bw = NULL;
|
|
||||||
done = true;
|
done = true;
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ void extractmeshes(const char *filedata,
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
bool ok;
|
bool ok;
|
||||||
//h -> numMesh
|
//h -> numMesh
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 1; i < 2; i++) {
|
||||||
ok = getmeshheader(&mh, i, filedata);
|
ok = getmeshheader(&mh, i, filedata);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
getmeshbatch(&b, mh, filedata);
|
getmeshbatch(&b, mh, filedata);
|
||||||
|
Loading…
Reference in New Issue
Block a user