simple (but inefficent) traces added.

This commit is contained in:
Andreas Ortmann 2016-09-29 09:16:34 +02:00
parent 62e38d1d0b
commit 1a3fd63250
2 changed files with 31 additions and 0 deletions

View file

@ -73,6 +73,8 @@ namespace endofthejedi {
renderShips();
renderMissiles();
renderTraces();
//glDisable(GL_DEPTH_TEST);
renderParticles();
//glEnable(GL_DEPTH_TEST);
@ -244,4 +246,31 @@ namespace endofthejedi {
return model;
}
void RendererPolygon3d::renderTraces()
{
//std::vector<glm::vec2> points;
//points.push_back(glm::vec2(0.0, 0.0));
//points.push_back(glm::vec2(0.1, 0.02));
//points.push_back(glm::vec2(0.2, 0.05));
//points.push_back(glm::vec2(0.3, 0.1));
//points.push_back(glm::vec2(0.4, 0.2));
//points.push_back(glm::vec2(0.5, 0.4));
//points.push_back(glm::vec2(0.6, 0.8));
//points.push_back(glm::vec2(0.7, 1.0));
// revert to default
glUseProgram(0);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glColor3f(0.0, 0.0, 1.0);
for (const game::Trace *trace : m_state->traces) {
glBegin(GL_LINE_STRIP);
for (const game::Trace::TracePoint &tp : trace->points) {
glVertex2f(tp.position.x, tp.position.y);
}
glEnd();
}
}
}

View file

@ -46,6 +46,8 @@ namespace endofthejedi {
// do the actual computation with these values
glm::mat4 computeModelMatrix(const glm::vec2 &pos, float scale, float angle=0.0);
void renderTraces();
private:
// all models are also here (for easy reloading etc.)
std::vector<PolygonModel*> m_models;