Tried to further improve the rendering of the flame; didn't quite work.
This commit is contained in:
parent
805a5f19b5
commit
813d50ee94
@ -5,14 +5,19 @@ uniform vec3 camera;
|
||||
in vec3 fColor;
|
||||
|
||||
in GS_OUT {
|
||||
vec3 normal;
|
||||
smooth vec3 normal;
|
||||
smooth vec3 position;
|
||||
}fs_in;
|
||||
|
||||
out vec4 oColor;
|
||||
|
||||
|
||||
void main() {
|
||||
float dotProduct = dot(fs_in.normal, camera);
|
||||
vec3 color = fColor * dotProduct;
|
||||
oColor = vec4(color, 0.5);
|
||||
float dotProduct = dot(normalize(fs_in.normal), normalize(camera - fs_in.position));
|
||||
if (dotProduct < 0.1 && dotProduct > 0.0){
|
||||
oColor = vec4(1.0, 0.0, 0.0, 0.5);
|
||||
}
|
||||
else {
|
||||
oColor = vec4(fColor, 0.5);
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,11 @@ uniform bool bottom;
|
||||
uniform bool left;
|
||||
|
||||
layout(points) in;
|
||||
layout(triangle_strip, max_vertices = 102) out;
|
||||
layout(triangle_strip, max_vertices = 78) out;
|
||||
|
||||
out GS_OUT {
|
||||
vec3 normal;
|
||||
smooth vec3 normal;
|
||||
smooth vec3 position;
|
||||
}gs_out;
|
||||
|
||||
in vec3 Color[];
|
||||
@ -66,27 +67,31 @@ void main() {
|
||||
float rightAngle = PI * 2.0 / resolution * (j+1);
|
||||
|
||||
vec4 offset = vec4(cos(rightAngle) * downRadius, i, -sin(rightAngle) * downRadius, 0.0);
|
||||
vec4 position0 = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||
gl_Position = position0;
|
||||
gs_out.normal = -vec3(position0 - gl_in[0].gl_Position);
|
||||
vec4 position = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||
gl_Position = position;
|
||||
gs_out.normal = vec3(position - gl_in[0].gl_Position);
|
||||
gs_out.position = vec3(position);
|
||||
EmitVertex();
|
||||
|
||||
offset = vec4(cos(rightAngle) * upRadius, i + step, -sin(rightAngle) * upRadius, 0.0);
|
||||
vec4 position1 = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||
gl_Position = position1;
|
||||
gs_out.normal = -vec3(position1 - gl_in[0].gl_Position);
|
||||
position = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||
gl_Position = position;
|
||||
gs_out.normal = vec3(position - gl_in[0].gl_Position);
|
||||
gs_out.position = vec3(position);
|
||||
EmitVertex();
|
||||
|
||||
offset = vec4(cos(leftAngle) * downRadius, i, -sin(leftAngle) * downRadius, 0.0);
|
||||
vec4 position2 = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||
gl_Position = position2;
|
||||
gs_out.normal = -vec3(position2 - gl_in[0].gl_Position);
|
||||
position = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||
gl_Position = position;
|
||||
gs_out.normal = vec3(position - gl_in[0].gl_Position);
|
||||
gs_out.position = vec3(position);
|
||||
EmitVertex();
|
||||
|
||||
offset = vec4(cos(leftAngle) * upRadius, i + step, -sin(leftAngle) * upRadius, 0.0);
|
||||
vec4 position3 = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||
gl_Position = position3;
|
||||
gs_out.normal = -vec3(position3 - gl_in[0].gl_Position);
|
||||
position = gl_in[0].gl_Position + viewProjectionMatrix * offset;
|
||||
gl_Position = position;
|
||||
gs_out.normal = vec3(position - gl_in[0].gl_Position);
|
||||
gs_out.position = vec3(position);
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
||||
|
Loading…
Reference in New Issue
Block a user