Implement basic GLB model loading
This commit is contained in:
1 parent
4249023d33
commit
221d68906d
4 files changed
+529
-4
No files matched your search
@@ -1,5 +1,5 @@
|
||||
#include "gpu.h"
|
||||
#include "model_format_utah.h"
|
||||
#include "model_format_glb.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
||||
fprintf(stderr, "Usage: %s PATH/TO/MODEL\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
model_t model = model_format_utah_read(argv[1]);
|
||||
model_t model = model_format_glb_read(argv[1]);
|
||||
|
||||
// Set up window
|
||||
glfwInit();
|
||||
@@ -74,9 +74,14 @@ int main(int argc, char *argv[])
|
||||
const vec3_t cam = { 0, 4, -4 };
|
||||
const vec3_t tgt = { 0, 0.5, 0 };
|
||||
mvp_t mvp = {
|
||||
.model = MAT4_SCALE(0.667),
|
||||
.model = (mat4_t) {
|
||||
{ 0, 0, -1, 0 },
|
||||
{ -1, 0, 0, 0 },
|
||||
{ 0, 1, 0, 0 },
|
||||
{ 0, 0, 0, 1 },
|
||||
},
|
||||
.view = mat4_lookat(cam, tgt, (vec3_t) { 0, 1, 0 }),
|
||||
.proj = mat4_perspective((float)W / H, PI / 6, 0.1, 10.0),
|
||||
.proj = mat4_perspective((float)W / H, PI / 12, 0.1, 10.0),
|
||||
};
|
||||
|
||||
const mat4_t rotx = MAT4_ROTATE_X(PI / 128);
|
||||
|
||||
Reference in new issue
Block a user