From a42ff1bb9bd1f88c05ad36b976d66faf69c24fee Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Sat, 24 Oct 2020 16:12:39 -0400 Subject: [PATCH] get assimp_loading example working --- examples/assimp_loading/main.cpp | 30 ++++++++++++++++++------------ examples/data/spaceship.glb | 4 ++-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/examples/assimp_loading/main.cpp b/examples/assimp_loading/main.cpp index 4dc3adc..9ddf998 100644 --- a/examples/assimp_loading/main.cpp +++ b/examples/assimp_loading/main.cpp @@ -50,8 +50,8 @@ doRenderLoop(render_state* rs, frame_callback_fn callback_fn, Entity* entities, int main() { + // TODO: would be nice to be able to pass in viewport_dims, window title here render_state* rs = renInit(); - meInitAssimp(); // TODO: entInit() doesn't allocate memory because we want to do the allocation in @@ -60,21 +60,27 @@ main() // TODO: this should be handled in entInit entSetWorldPosition(spaceship, 0, 0, 0); - - // set entity scale, rotation, world_transform to defaults :( ... - - // need to finish loading binary texture data in mesh::loadDiffuseTexture() + spaceship.scale = glm::vec3(20, 20, 20); + spaceship.rotation = glm::vec4(0, 0, 0, 0); // setup camera - glm::vec3 cam_pos(0, -100, 100); - cameraInitPerspective(rs->cam, cam_pos, spaceship.translation, rs->cam.world_up); - - if (entInit(spaceship, "../data/spaceship.glb", rs->default_shader)) { + cameraInitPerspective( + rs->cam, + glm::vec3(200, -150, 150), + spaceship.translation, + glm::vec3(0,0,1) + ); + + // TODO: renderer::setDefaults() allocates 10 lights based on a MACRO in renderer.cpp + // probably need an interface to add more than that + // add a light + rs->num_lights = 1; + rs->lights[0].position = glm::vec3(200, -150, 150); + + if (entInit(spaceship, "../data/spaceship.glb", rs->default_shader)) doRenderLoop(rs, doFrameCallback, &spaceship, 1); - } else { + else LOG(Error) << "Error initializing entity, exiting\n"; - } - // TODO: way more cleanup to do :(, see hexgame::cleanUp() meShutdownAssimp(); diff --git a/examples/data/spaceship.glb b/examples/data/spaceship.glb index 862b13b..0728575 100644 --- a/examples/data/spaceship.glb +++ b/examples/data/spaceship.glb @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c075f0f1a06aca2fb1ee073ea35dc9ddca170b8b20d6e4cd6b225efd406e77ef -size 637804 +oid sha256:78de8f432fcbfa9490f2bd4b8d0eba2af56fe3c2c1ffb67b92220b60f73647f2 +size 614084