|
|
|
|
@ -17,7 +17,7 @@ doFrameCallback(render_state* rs)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
doRenderLoop(render_state* rs, frame_callback_fn callback_fn, Entity* entities, uint entity_count) |
|
|
|
|
doRenderLoop(render_state* rs, frame_callback_fn callback_fn, entity* entities, uint entity_count) |
|
|
|
|
{ |
|
|
|
|
// TODO: move frame delay to renderFrame()
|
|
|
|
|
const uint TARGET_FPS = 60; |
|
|
|
|
@ -46,7 +46,7 @@ doRenderLoop(render_state* rs, frame_callback_fn callback_fn, Entity* entities,
|
|
|
|
|
* render_group -> entities -> render_object(s) |
|
|
|
|
* -> mesh_info ? |
|
|
|
|
*/ |
|
|
|
|
renRenderFrame(rs, entities, entity_count); |
|
|
|
|
renRenderFrame(rs); |
|
|
|
|
SDL_GL_SwapWindow(rs->handles.window); |
|
|
|
|
frameTime = SDL_GetTicks() - frameStart; |
|
|
|
|
|
|
|
|
|
@ -67,18 +67,19 @@ main()
|
|
|
|
|
|
|
|
|
|
// TODO: entInit() doesn't allocate memory because we want to do the allocation in
|
|
|
|
|
// one big block, but this is really clunky to use
|
|
|
|
|
Entity spaceship; |
|
|
|
|
entity spaceship; |
|
|
|
|
|
|
|
|
|
// TODO: this should be handled in entInit
|
|
|
|
|
entSetWorldPosition(spaceship, 0, 0, 0); |
|
|
|
|
spaceship.scale = glm::vec3(20, 20, 20); |
|
|
|
|
spaceship.rotation = glm::vec4(0, 0, 0, 0); |
|
|
|
|
entScale(spaceship, glm::vec3(20, 20, 20)); |
|
|
|
|
// TODO: implement setting rotation from entity
|
|
|
|
|
//spaceship.rotation = glm::vec4(0, 0, 0, 0);
|
|
|
|
|
|
|
|
|
|
// setup camera
|
|
|
|
|
cameraInitPerspective( |
|
|
|
|
rs->cam, |
|
|
|
|
glm::vec3(200, -150, 150), |
|
|
|
|
spaceship.translation, |
|
|
|
|
glm::vec3(0, 0, 0), |
|
|
|
|
glm::vec3(0,0,1) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
@ -96,7 +97,7 @@ main()
|
|
|
|
|
// NOTE: testing assimp animation info
|
|
|
|
|
logDebugAnimationInfo("../data/spaceship.glb"); |
|
|
|
|
|
|
|
|
|
if (entInit(spaceship, "../data/spaceship.glb", rs->default_shader)) |
|
|
|
|
if (entInit(spaceship, "../data/spaceship.glb")) |
|
|
|
|
doRenderLoop(rs, doFrameCallback, &spaceship, 1); |
|
|
|
|
else |
|
|
|
|
LOG(Error) << "Error initializing entity, exiting\n"; |
|
|
|
|
|