This commit is contained in:
j3d1 2022-03-09 00:56:20 +01:00
parent fb73ec7c7f
commit e1a41a526d
8 changed files with 38 additions and 33 deletions

View file

@ -153,27 +153,25 @@ void RendererPolygon3d::setup() {
m_postprocess_fbo.attachTexture(GL_COLOR_ATTACHMENT0,
m_postprocess_tex0.getName());
renderBackgroundImage();
renderBackgroundImage();
//float s = 0.1;
//glClearColor(s, s, 1.2*s, 1.0);
//float s = 0.1;
//glClearColor(s, s, 1.2*s, 1.0);
m_shader_game_objects.bind();
m_shader_game_objects.bind();
// TODO: add ONE sun planet
// TODO: add lights for explosions
// TODO: add ONE sun planet
// TODO: add lights for explosions
configureLightningInShader(&m_shader_game_objects);
configureLightningInShader(&m_shader_game_objects);
//std::cout<<"setting aspect ratio: " << m_aspectRatio << std::endl;
//std::cout<<"setting aspect ratio: " << m_aspectRatio << std::endl;
renderPlanets();
renderShips();
renderMissiles();
renderParticles();
renderTraces();
renderPlanets();
renderShips();
renderMissiles();
renderParticles();
renderTraces();
glUniform1f(m_shader_game_objects.location("aspectRatio"), m_aspectRatio);
m_postprocess_tex1.bind();
@ -184,14 +182,12 @@ void RendererPolygon3d::setup() {
m_shader_game_objects.bind();
configureLightningInShader(&m_shader_game_objects);
glUniform1f(m_shader_game_objects.location("aspectRatio"), m_aspectRatio);
renderPlanets();
renderShips();
renderMissiles();
renderParticles();
renderTraces();
// postprocessing
m_postprocess_shader.bind();
//glColor3f(1.0, 0.0, 0.0);
@ -520,6 +516,10 @@ void RendererPolygon3d::renderPlanets() {
m_planetModel->render();
}
}
/*
void RendererPolygon3d::renderSun() {
m_planetModel->bind();
@ -553,8 +553,8 @@ void RendererPolygon3d::renderMissiles() {
m_missileModel->bind();
for (const game::Missile *missile : m_missiles) {
glm::vec3 c = glm::vec3(1.0, 1.0, 0.3);
glUniform3f(m_shader_game_objects.location("materialColor"), c.x, c.y, c.z);
glm::vec3 c = glm::vec3(missile->color);
glUniform3f(m_shader_game_objects.location("materialColor"), c.x/2, c.y/2, c.z/2);
// TODO: rename functions so their name represents what args they
// take
@ -665,6 +665,7 @@ void RendererPolygon3d::renderMissiles() {
glUseProgram(0);
// TODO dont use line mode. make that with own quads
glPolygonMode(GL_FRONT, GL_LINE);
for (const game::Trace *trace : m_state->traces) {
float fade_out = 1.0;
@ -680,7 +681,7 @@ void RendererPolygon3d::renderMissiles() {
}
glEnd();
}
glLineWidth(1.0f);
glLineWidth(1.0f);
glPolygonMode(GL_FRONT, GL_FILL);
}

View file

@ -38,6 +38,7 @@ namespace endofthejedi {
void renderMissiles();
void renderShips();
void renderParticles();
void renderText(const char *text, float x, float y, float sx, float sy);
void addModel(const std::string &filename, PolygonModel **dest);