|
|
|
@ -105,7 +105,7 @@ addTexture(SDL_Handles &handles, const char * path) |
|
|
|
if (!image) |
|
|
|
if (!image) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LOG(ERROR) << "IMG_Load: " << IMG_GetError() << "\n"; |
|
|
|
LOG(ERROR) << "IMG_Load: " << IMG_GetError() << "\n"; |
|
|
|
return 1; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
GLuint tex_id; |
|
|
|
GLuint tex_id; |
|
|
|
@ -451,6 +451,9 @@ createScene(std::vector<hex_info>* hexes, Entity* entities, uint32 entity_count) |
|
|
|
rgInitEntity(&entities[i]); |
|
|
|
rgInitEntity(&entities[i]); |
|
|
|
entities[i].ren_group->shader = sp; |
|
|
|
entities[i].ren_group->shader = sp; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//mi->model_transform = glm::scale(glm::mat4(1), glm::vec3(100, 100, 100));
|
|
|
|
|
|
|
|
//entityTranslate(&g_game_state->entities[1], 640, 500, 0);
|
|
|
|
#else |
|
|
|
#else |
|
|
|
if (!rgInitEntity(&entities[0])) { |
|
|
|
if (!rgInitEntity(&entities[0])) { |
|
|
|
LOG(ERROR) << "Error initialzing entity\n"; |
|
|
|
LOG(ERROR) << "Error initialzing entity\n"; |
|
|
|
@ -464,7 +467,7 @@ createScene(std::vector<hex_info>* hexes, Entity* entities, uint32 entity_count) |
|
|
|
//g_test_light.light_ID = glGetUniformLocation(g_entity_render_group.program_id, "light_position");
|
|
|
|
//g_test_light.light_ID = glGetUniformLocation(g_entity_render_group.program_id, "light_position");
|
|
|
|
if (entities[0].ren_group != nullptr) { |
|
|
|
if (entities[0].ren_group != nullptr) { |
|
|
|
g_test_light.light_ID = glGetUniformLocation(entities[0].ren_group->shader.program_id, "light_position"); |
|
|
|
g_test_light.light_ID = glGetUniformLocation(entities[0].ren_group->shader.program_id, "light_position"); |
|
|
|
g_test_light.position = glm::vec3(640, 500, 400); // above center of hexgrid
|
|
|
|
g_test_light.position = glm::vec3(800, 300, 400); // above center of hexgrid
|
|
|
|
g_test_light.direction = glm::vec3(0, 0, 0) - g_test_light.position; // back towards test entity
|
|
|
|
g_test_light.direction = glm::vec3(0, 0, 0) - g_test_light.position; // back towards test entity
|
|
|
|
g_test_light.color = glm::vec3(1.f, 1.f, 1.f); |
|
|
|
g_test_light.color = glm::vec3(1.f, 1.f, 1.f); |
|
|
|
g_test_light.intensity = 1.f; |
|
|
|
g_test_light.intensity = 1.f; |
|
|
|
@ -585,12 +588,8 @@ renderFrame(std::vector<hex_info> *hexes, Entity* entities, uint32 entity_count) |
|
|
|
|
|
|
|
|
|
|
|
// entities
|
|
|
|
// entities
|
|
|
|
for (uint i = 0; i < entity_count; i++) { |
|
|
|
for (uint i = 0; i < entity_count; i++) { |
|
|
|
|
|
|
|
|
|
|
|
// TODO: find a way to store model xform on the meMeshGroup object
|
|
|
|
|
|
|
|
glm::mat4 model_transform = entities[i].mesh_group.meshes[0]->model_transform; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rgDraw( |
|
|
|
rgDraw( |
|
|
|
entities[i].ren_group, model_transform, m_view, m_projection, |
|
|
|
entities[i].ren_group, entities[i].world_transform , m_view, m_projection, |
|
|
|
g_test_light.position, g_test_light.light_ID |
|
|
|
g_test_light.position, g_test_light.light_ID |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|