mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-04 10:40:09 -06:00
(#3596) added vertex normals to ring quad vertex attribs
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
in vec2 vs_st;
|
||||
in float vs_screenSpaceDepth;
|
||||
in vec4 shadowCoords;
|
||||
in vec3 vs_normal;
|
||||
|
||||
uniform sampler2DShadow shadowMapTexture;
|
||||
uniform sampler1D ringTextureFwrd;
|
||||
|
||||
@@ -28,10 +28,12 @@
|
||||
|
||||
layout(location = 0) in vec2 in_position;
|
||||
layout(location = 1) in vec2 in_st;
|
||||
layout(location = 2) in vec3 in_normal;
|
||||
|
||||
out vec2 vs_st;
|
||||
out float vs_screenSpaceDepth;
|
||||
out vec4 shadowCoords;
|
||||
out vec3 vs_normal;
|
||||
|
||||
uniform dmat4 modelViewProjectionMatrix;
|
||||
|
||||
@@ -43,6 +45,7 @@ uniform dmat4 shadowMatrix;
|
||||
|
||||
void main() {
|
||||
vs_st = in_st;
|
||||
vs_normal = mat3(modelViewProjectionMatrix) * in_normal;
|
||||
|
||||
dvec4 positionClipSpace = modelViewProjectionMatrix * dvec4(in_position, 0.0, 1.0);
|
||||
vec4 positionClipSpaceZNorm = z_normalization(vec4(positionClipSpace));
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
in vec2 vs_st;
|
||||
in float vs_screenSpaceDepth;
|
||||
in vec4 shadowCoords;
|
||||
in vec3 vs_normal;
|
||||
|
||||
uniform sampler2DShadow shadowMapTexture;
|
||||
uniform sampler1D ringTexture;
|
||||
|
||||
@@ -28,10 +28,12 @@
|
||||
|
||||
layout(location = 0) in vec2 in_position;
|
||||
layout(location = 1) in vec2 in_st;
|
||||
layout(location = 2) in vec3 in_normal;
|
||||
|
||||
out vec2 vs_st;
|
||||
out float vs_screenSpaceDepth;
|
||||
out vec4 shadowCoords;
|
||||
out vec3 vs_normal;
|
||||
|
||||
uniform dmat4 modelViewProjectionMatrix;
|
||||
|
||||
@@ -43,6 +45,7 @@ uniform dmat4 shadowMatrix;
|
||||
|
||||
void main() {
|
||||
vs_st = in_st;
|
||||
vs_normal = mat3(modelViewProjectionMatrix) * in_normal;
|
||||
|
||||
dvec4 positionClipSpace = modelViewProjectionMatrix * dvec4(in_position, 0.0, 1.0);
|
||||
vec4 positionClipSpaceZNorm = z_normalization(vec4(positionClipSpace));
|
||||
|
||||
@@ -769,15 +769,18 @@ void RingsComponent::createPlane() {
|
||||
GLfloat y;
|
||||
GLfloat s;
|
||||
GLfloat t;
|
||||
GLfloat nx;
|
||||
GLfloat ny;
|
||||
GLfloat nz;
|
||||
};
|
||||
|
||||
const std::array<VertexData, 6> vertices = {
|
||||
VertexData{ -size, -size, 0.f, 0.f },
|
||||
VertexData{ size, size, 1.f, 1.f },
|
||||
VertexData{ -size, size, 0.f, 1.f },
|
||||
VertexData{ -size, -size, 0.f, 0.f },
|
||||
VertexData{ size, -size, 1.f, 0.f },
|
||||
VertexData{ size, size, 1.f, 1.f },
|
||||
VertexData{ -size, -size, 0.f, 0.f, 0.f, 0.f, 1.f },
|
||||
VertexData{ size, size, 1.f, 1.f, 0.f, 0.f, 1.f },
|
||||
VertexData{ -size, size, 0.f, 1.f, 0.f, 0.f, 1.f },
|
||||
VertexData{ -size, -size, 0.f, 0.f, 0.f, 0.f, 1.f },
|
||||
VertexData{ size, -size, 1.f, 0.f, 0.f, 0.f, 1.f },
|
||||
VertexData{ size, size, 1.f, 1.f, 0.f, 0.f, 1.f },
|
||||
};
|
||||
|
||||
glBindVertexArray(_quad);
|
||||
@@ -801,6 +804,15 @@ void RingsComponent::createPlane() {
|
||||
sizeof(VertexData),
|
||||
reinterpret_cast<void*>(offsetof(VertexData, s))
|
||||
);
|
||||
glEnableVertexAttribArray(2);
|
||||
glVertexAttribPointer(
|
||||
2,
|
||||
3,
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
sizeof(VertexData),
|
||||
reinterpret_cast<void*>(offsetof(VertexData, nx))
|
||||
);
|
||||
}
|
||||
|
||||
void RingsComponent::compileShadowShader() {
|
||||
|
||||
Reference in New Issue
Block a user