Added another two render calls to further increase the number of vertices of the flame.

This commit is contained in:
Faerbit 2015-03-01 18:19:19 +01:00
parent 6e33af8e61
commit bb090fcf91
2 changed files with 21 additions and 7 deletions

View File

@ -3,6 +3,7 @@
uniform mat4 viewProjectionMatrix;
uniform float time;
uniform bool bottom;
uniform bool left;
layout(points) in;
layout(triangle_strip, max_vertices = 256) out;
@ -14,7 +15,7 @@ const float sin_p2 = 2;
const float ex_p1 = 1.093;
const float ex_p2 = 1.9996;
const float begin = 0;
const float end = 2.3;
const float end = 2.5;
float radiusFunction(float x) {
if (x < transition_point) {
@ -38,13 +39,20 @@ void main() {
i = (end-begin)/2.0;
render_end = end;
}
for (i; i<render_end-step; i+=step) {
for (i; i<render_end; i+=step) {
float downRadius = radiusFunction(i);
float upRadius = 0.0f;
if (i < end - (step+0.0001)) {
upRadius = radiusFunction(i+step);
float upRadius = radiusFunction(i+step);
float circle_end = 0.0;
int j = 0;
if (left) {
j = 0;
circle_end = resolution/2.0;
}
for (int j = 0; j<resolution; j++) {
else {
j = int(resolution/2.0);
circle_end = resolution;
}
for (j; j<circle_end; j++) {
float leftAngle = PI * 2.0 / resolution * j;
float rightAngle = PI * 2.0 / resolution * (j+1);

View File

@ -243,8 +243,14 @@ void Graphics::render(double time)
flameShader->setUniform("viewProjectionMatrix", lightingViewProjectionMatrix);
flameShader->setUniform("time", (float) time);
flameShader->setUniform("bottom", true);
flameShader->setUniform("left", true);
flame_positions->render();
flameShader->setUniform("left", false);
flame_positions->render();
flameShader->setUniform("bottom", false);
flameShader->setUniform("left", true);
flame_positions->render();
flameShader->setUniform("left", false);
flame_positions->render();
glDisable(GL_CULL_FACE);