Increased the geometry resolution of the flames.

This commit is contained in:
Faerbit 2015-05-31 15:23:54 +02:00
parent c8ba61ca56
commit 030f8b298a
2 changed files with 12 additions and 23 deletions

View File

@ -3,7 +3,7 @@
uniform mat4 modelViewProjectionMatrix; uniform mat4 modelViewProjectionMatrix;
uniform float time; uniform float time;
uniform bool bottom; uniform bool bottom;
uniform bool left; uniform int circle_index;
uniform vec2 skew; uniform vec2 skew;
layout(points) in; layout(points) in;
@ -75,19 +75,11 @@ void main() {
for (i; i<render_end; i+=step) { for (i; i<render_end; i+=step) {
float downRadius = radiusFunction(i); float downRadius = radiusFunction(i);
float upRadius = radiusFunction(i+step); float upRadius = radiusFunction(i+step);
float circle_end = 0.0; int j = int(resolution/2.0) * circle_index;
int j = 0; int circle_end = int(resolution/2.0) * (circle_index + 1);
if (left) {
j = 0;
circle_end = resolution/2.0;
}
else {
j = int(resolution/2.0);
circle_end = resolution;
}
for (j; j<circle_end; j++) { for (j; j<circle_end; j++) {
float leftAngle = PI * 2.0 / resolution * j; float leftAngle = PI * 2.0 / resolution / 4.0 * j;
float rightAngle = PI * 2.0 / resolution * (j+1); float rightAngle = PI * 2.0 / resolution / 4.0 * (j+1);
vec4 offset = vec4(cos(rightAngle) * downRadius, i, -sin(rightAngle) * downRadius, 0.0); vec4 offset = vec4(cos(rightAngle) * downRadius, i, -sin(rightAngle) * downRadius, 0.0);
gl_Position = gl_in[0].gl_Position + modelViewProjectionMatrix * offset; gl_Position = gl_in[0].gl_Position + modelViewProjectionMatrix * offset;

View File

@ -42,14 +42,11 @@ void Flame::render(SharedShaderProgram shader, glm::mat4 viewProjectionMatrix, f
shader->setUniform("withColor", withColor); shader->setUniform("withColor", withColor);
shader->setUniform("time", time); shader->setUniform("time", time);
shader->setUniform("skew", skewing); shader->setUniform("skew", skewing);
shader->setUniform("bottom", true); for (int i = 0; i<8; i++) {
shader->setUniform("left", true); shader->setUniform("bottom", true);
vao->render(); shader->setUniform("circle_index", i);
shader->setUniform("left", false); vao->render();
vao->render(); shader->setUniform("bottom", false);
shader->setUniform("bottom", false); vao->render();
shader->setUniform("left", true); }
vao->render();
shader->setUniform("left", false);
vao->render();
} }