* refactoring

This commit is contained in:
end 2016-10-06 00:17:04 +02:00
parent 9e4bda9242
commit 6da68e1667
3 changed files with 2 additions and 28 deletions

View file

@ -224,7 +224,7 @@ void RendererPolygon3d::render(const game::State *state) {
m_postprocess_tex0.bind(); m_postprocess_tex0.bind();
glActiveTexture(GL_TEXTURE1); glActiveTexture(GL_TEXTURE1);
m_postprocess_tex1.bind(); m_postprocess_tex1.bind();
glColor3f(1.0, 0.0, 0.0); glColor3f(1.0, 0.0, 0.0);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glVertex2f(-1.0f, -1.0f); glVertex2f(-1.0f, -1.0f);
@ -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

View file

@ -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();

View file

@ -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;
} }