|
|
|
|
@ -63,28 +63,28 @@ initCubeMesh()
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
shader_program* |
|
|
|
|
getShaderByName(const char* name, ShaderArray* s_arr) |
|
|
|
|
getShaderByName(const char* name, GLContext* gl_ctx) |
|
|
|
|
{ |
|
|
|
|
u64 hash = utilFNV64a_str(name); |
|
|
|
|
|
|
|
|
|
for (u32 i = 0; i < s_arr->count; i++) { |
|
|
|
|
if (utilFNV64a_str(s_arr->shaders[i].name) == hash) |
|
|
|
|
return &s_arr->shaders[i]; |
|
|
|
|
for (u32 i = 0; i < gl_ctx->num_shaders; i++) { |
|
|
|
|
if (utilFNV64a_str(gl_ctx->shaders[i].name) == hash) |
|
|
|
|
return &gl_ctx->shaders[i]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::cout << "shader not found, " << name << "\n"; |
|
|
|
|
printf("%s(), shader not found, %s\n", __FUNCTION__, name); |
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
shader_program* |
|
|
|
|
getShaderByID(ShaderArray* sarr, GLuint prog_id) |
|
|
|
|
getShaderByID(GLContext* gl_ctx, GLuint prog_id) |
|
|
|
|
{ |
|
|
|
|
for (u32 i = 0; i < sarr->count; i++) { |
|
|
|
|
if (sarr->shaders[i].prog_id) |
|
|
|
|
return &sarr->shaders[i]; |
|
|
|
|
for (u32 i = 0; i < gl_ctx->num_shaders; i++) { |
|
|
|
|
if (gl_ctx->shaders[i].prog_id) |
|
|
|
|
return &gl_ctx->shaders[i]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::cout << "Error, shader not found\n"; |
|
|
|
|
printf("%s(), shader not found, %d\n", __FUNCTION__, prog_id); |
|
|
|
|
return nullptr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -254,7 +254,7 @@ loadScene(RenderState* rs)
|
|
|
|
|
//model* tex_cube = getModel(rs, "data/textured_cube.gltf");
|
|
|
|
|
|
|
|
|
|
// TODO: load debug shader from libTangerine for textured_cube
|
|
|
|
|
shader_program* s = getShaderByName("default", rs->gl_ctx->shader_arr); |
|
|
|
|
shader_program* s = getShaderByName("default", rs->gl_ctx); |
|
|
|
|
|
|
|
|
|
if (!s) |
|
|
|
|
return false; |
|
|
|
|
|