* refactoring
This commit is contained in:
parent
9e4bda9242
commit
6da68e1667
3 changed files with 2 additions and 28 deletions
|
@ -522,32 +522,6 @@ void RendererPolygon3d::renderPlanets() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererPolygon3d::renderSun() {
|
|
||||||
m_planetModel->bind();
|
|
||||||
|
|
||||||
// TODO: put material into attributes and render witd glDrawInstanced
|
|
||||||
// too (same for missiles)
|
|
||||||
for (const game::Planet *planet : m_state->planets) {
|
|
||||||
|
|
||||||
if (planet->material != game::Planet::Material::Sun)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
glm::mat4 model = computeModelMatrix(planet);
|
|
||||||
glUniformMatrix4fv(m_shader_game_objects.location("model"), 1, GL_FALSE,
|
|
||||||
glm::value_ptr(model));
|
|
||||||
|
|
||||||
glm::vec3 c = planet->getColor();
|
|
||||||
glUniform3f(m_shader_game_objects.location("materialColor"), c.x, c.y,
|
|
||||||
c.z);
|
|
||||||
glUniform1i(m_shader_game_objects.location("materialSeed"),
|
|
||||||
planet->seed);
|
|
||||||
glUniform1i(m_shader_game_objects.location("materialKind"),
|
|
||||||
(int)planet->material);
|
|
||||||
|
|
||||||
m_planetModel->render();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void RendererPolygon3d::renderMissiles() {
|
void RendererPolygon3d::renderMissiles() {
|
||||||
// TODO: add fire trail for missiles near the sun
|
// TODO: add fire trail for missiles near the sun
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ namespace endofthejedi {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void renderPlanets();
|
void renderPlanets();
|
||||||
void renderSun();
|
|
||||||
void renderMissiles();
|
void renderMissiles();
|
||||||
void renderShips();
|
void renderShips();
|
||||||
void renderParticles();
|
void renderParticles();
|
||||||
|
|
|
@ -164,6 +164,7 @@ namespace game {
|
||||||
Player *player = playerForId(playerId);
|
Player *player = playerForId(playerId);
|
||||||
if (player != nullptr) {
|
if (player != nullptr) {
|
||||||
for (Missile *missile : player->missiles) {
|
for (Missile *missile : player->missiles) {
|
||||||
|
player->missiles.remove(missile);
|
||||||
missile->player = nullptr;
|
missile->player = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue