|
|
|
@ -14,6 +14,30 @@ |
|
|
|
#define UTIL_IMPLEMENTATION |
|
|
|
#define UTIL_IMPLEMENTATION |
|
|
|
#include "util.h" |
|
|
|
#include "util.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
* === TODO: === |
|
|
|
|
|
|
|
* - work on cleaner interface for initEntity and loadScene... |
|
|
|
|
|
|
|
* - full lighting model |
|
|
|
|
|
|
|
* - test complex entities |
|
|
|
|
|
|
|
* - node animations... |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* === TODONE: === |
|
|
|
|
|
|
|
* - don't allocate Asset structure on asset arena |
|
|
|
|
|
|
|
* - store on RenderState as reference |
|
|
|
|
|
|
|
* - store asset arena to asset structure |
|
|
|
|
|
|
|
* - condense get_X_ByPath functions with assetLoad functions |
|
|
|
|
|
|
|
* - move to asset interface |
|
|
|
|
|
|
|
* - load diffuse texture automatically when loading a model |
|
|
|
|
|
|
|
* - move entity structure and functions to new file? |
|
|
|
|
|
|
|
* - load diffuse texture into OpenGL, and store GLTexture structure onto |
|
|
|
|
|
|
|
* GLContext |
|
|
|
|
|
|
|
* - need a cache algorithm starting in initEntity() |
|
|
|
|
|
|
|
* - check for GLTexture by path hash |
|
|
|
|
|
|
|
* - load texture into gl if not cached |
|
|
|
|
|
|
|
* - pass result GLTexture to loadGLMesh() |
|
|
|
|
|
|
|
* - update loadScene function with textured models, and test texture loading |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct SDLHandles |
|
|
|
struct SDLHandles |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -248,7 +272,6 @@ loadScene(RenderState* rs) |
|
|
|
shader_program* s_debug = getShaderByName("debug", rs->gl_ctx); |
|
|
|
shader_program* s_debug = getShaderByName("debug", rs->gl_ctx); |
|
|
|
if (!s_default || !s_debug) return false; |
|
|
|
if (!s_default || !s_debug) return false; |
|
|
|
|
|
|
|
|
|
|
|
// TODO: full lighting model
|
|
|
|
|
|
|
|
model* tex_cube = getModelByPath(&rs->assets, "../data/textured_cube.gltf"); |
|
|
|
model* tex_cube = getModelByPath(&rs->assets, "../data/textured_cube.gltf"); |
|
|
|
assert(tex_cube != nullptr); |
|
|
|
assert(tex_cube != nullptr); |
|
|
|
const mesh& texmesh = tex_cube->meshes[0]; |
|
|
|
const mesh& texmesh = tex_cube->meshes[0]; |
|
|
|
|