raaaa
This commit is contained in:
parent
97a53e49f7
commit
89ab1281b5
2
c3d.c
2
c3d.c
|
@ -490,7 +490,7 @@ int main() {
|
|||
bool run3d = true;
|
||||
|
||||
if (true) {
|
||||
Object3D t = ReadObjectFromFile("cube.obj");
|
||||
Object3D t = ReadObjectFromFile("mario.obj");
|
||||
for (int i = 0; i < t.triangles->length; i++) {
|
||||
// printf("t: %f\n", t.triangles->arr[i].a.x);
|
||||
TriArrayAppend(&tarr, t.triangles->arr[i]);
|
||||
|
|
7
reader.c
7
reader.c
|
@ -91,7 +91,7 @@ Object3D ReadObjectFromFile(char *fname) {
|
|||
tarr.length = 0;
|
||||
|
||||
CMaterialArray cmats;
|
||||
cmats.arr = malloc(10 * sizeof(CMaterial));
|
||||
cmats.arr = malloc(50 * sizeof(CMaterial));
|
||||
cmats.length = 0;
|
||||
|
||||
out.triangles = &tarr;
|
||||
|
@ -146,6 +146,11 @@ Object3D ReadObjectFromFile(char *fname) {
|
|||
|
||||
fclose(f);
|
||||
printf("Loaded model %s with %d tris\n", fname, tarr.length);
|
||||
|
||||
printf("Mats Loaded\n");
|
||||
for (int i = 0; i < cmats.length; i++) {
|
||||
printf("%s\n", cmats.arr[i].name);
|
||||
}
|
||||
return out;
|
||||
|
||||
// TODO: use file object and read each line
|
||||
|
|
Loading…
Reference in a new issue