planet distribution is nice now and one sun is always placed with bigger radius and space nearby.

This commit is contained in:
Andreas Ortmann 2016-09-30 23:15:51 +02:00
parent f2bdadd49f
commit 0b71aad1f7
5 changed files with 86 additions and 45 deletions

View file

@ -171,7 +171,8 @@ namespace endofthejedi {
glm::vec3 c = planet->getColor();
glUniform3f(m_shader.location("materialColor"), c.x, c.y, c.z);
glUniform1f(m_shader.location("materialKind"), (float) planet->material);
glUniform1i(m_shader.location("materialSeed"), planet->seed);
glUniform1i(m_shader.location("materialKind"), (int) planet->material);
m_planetModel->render();
}
@ -294,16 +295,22 @@ namespace endofthejedi {
void RendererPolygon3d::configureLightningInShader()
{
glm::vec3 c = glm::vec3(1.0, 1.0, 0.8);
glUniform3f(m_shader.location("lightColor"), c.x, c.y, c.z);
// TODO: add a few small lights for explosions so they lit the
// surroundsings
// TODO: use the sun planet color for this!
glm::vec3 c = glm::vec3(1.0, 1.0, 0.8);
glm::vec3 p = glm::vec3(0.3f, 0.4f, 0.0f);
for (const game::Planet *planet : m_state->planets) {
if (planet->material == game::Planet::Material::Sun) {
p = glm::vec3(planet->position, 0.0);
c = planet->getColor();
break;
}
}
glUniform3f(m_shader.location("lightPosition"), p.x, p.y, p.z);
glUniform3f(m_shader.location("lightColor"), c.x, c.y, c.z);
}
}