From a3312a4c53b08843531dda91152ae43933350e74 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Tue, 10 Nov 2020 18:14:26 -0500 Subject: [PATCH] use glm::vec3 in entSetWorldPosition() --- examples/assimp_loading/main.cpp | 3 ++- include/entity.h | 3 +-- src/entity.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/assimp_loading/main.cpp b/examples/assimp_loading/main.cpp index 28e9b86..8a8dce1 100644 --- a/examples/assimp_loading/main.cpp +++ b/examples/assimp_loading/main.cpp @@ -40,6 +40,7 @@ doRenderLoop(render_state* rs, frame_callback_fn callback_fn) callback_fn(rs); + // TODO: need to implement new roDraw() and call from renRenderFrame() renRenderFrame(rs); SDL_GL_SwapWindow(rs->handles.window); frameTime = SDL_GetTicks() - frameStart; @@ -66,7 +67,7 @@ main() entity spaceship = group_1->entities[0]; // TODO: this should be handled in entInit - entSetWorldPosition(spaceship, 0, 0, 0); + entSetWorldPosition(spaceship, glm::vec3(0, 0, 0)); entScale(spaceship, glm::vec3(20, 20, 20)); // TODO: implement setting rotation from entity //spaceship.rotation = glm::vec4(0, 0, 0, 0); diff --git a/include/entity.h b/include/entity.h index 1b20b7e..7a9731b 100644 --- a/include/entity.h +++ b/include/entity.h @@ -32,8 +32,7 @@ bool entInit(entity& e, const char* model_path); void entFree(entity& e); -// TODO: just use glm::vec3 here also -void entSetWorldPosition(entity& e, float x, float y, float z); +void entSetWorldPosition(entity& e, glm::vec3 v); void entTranslate(entity& e, glm::vec3 v); diff --git a/src/entity.cpp b/src/entity.cpp index c76879c..6652393 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -21,7 +21,7 @@ entInit(entity& e, const char* model_path) { e.world_transform = glm::mat4(1.0); entScale(e, glm::vec3(1.0)); - entSetWorldPosition(e, 0, 0, 0); + entSetWorldPosition(e, glm::vec3(0, 0, 0)); if (meLoadFromFile(e.mesh_group, model_path) && loadMeshIntoGL(e)) @@ -53,11 +53,11 @@ entFree(entity& e) } void -entSetWorldPosition(entity& e, float x, float y, float z) +entSetWorldPosition(entity& e, glm::vec3 v) { - e.world_transform[3][0] = x; - e.world_transform[3][1] = y; - e.world_transform[3][2] = z; + e.world_transform[3][0] = v.x; + e.world_transform[3][1] = v.y; + e.world_transform[3][2] = v.z; } void