mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-28 07:59:37 -06:00
Apply transforms to ModelProjection
This commit is contained in:
@@ -37,13 +37,15 @@ out vec4 vs_ndc;
|
||||
|
||||
uniform mat4 ProjectorMatrix;
|
||||
uniform mat4 ModelTransform;
|
||||
uniform mat4 meshTransform;
|
||||
uniform mat4 meshNormalTransform;
|
||||
|
||||
uniform vec3 boresight;
|
||||
|
||||
void main() {
|
||||
vec4 raw_pos = psc_to_meter(in_position, vec2(1.0, 0.0));
|
||||
vec4 raw_pos = psc_to_meter((meshTransform * in_position), vec2(1.0, 0.0));
|
||||
vs_position = ProjectorMatrix * ModelTransform * raw_pos;
|
||||
vs_normal = normalize(ModelTransform * vec4(in_normal,0));
|
||||
vs_normal = normalize(ModelTransform * meshNormalTransform * vec4(in_normal,0));
|
||||
vs_ndc = vs_position / vs_position.w;
|
||||
|
||||
//match clipping plane
|
||||
|
||||
@@ -39,10 +39,12 @@ uniform mat4 modelViewTransform;
|
||||
uniform mat4 projectionTransform;
|
||||
uniform vec3 cameraDirectionWorldSpace;
|
||||
uniform float _magnification;
|
||||
uniform mat4 meshTransform;
|
||||
uniform mat4 meshNormalTransform;
|
||||
|
||||
|
||||
void main() {
|
||||
vec4 position = in_position; // Position already in homogenous coordinates
|
||||
vec4 position = meshTransform * in_position; // Position already in homogenous coordinates
|
||||
position.xyz *= pow(10, _magnification);
|
||||
vs_positionCameraSpace = modelViewTransform * position;
|
||||
vec4 positionClipSpace = projectionTransform * vs_positionCameraSpace;
|
||||
@@ -52,5 +54,5 @@ void main() {
|
||||
gl_Position = vs_positionScreenSpace;
|
||||
|
||||
// The normal transform should be the transposed inverse of the model transform?
|
||||
vs_normalViewSpace = normalize(mat3(modelViewTransform) * in_normal);
|
||||
vs_normalViewSpace = normalize(mat3(modelViewTransform) * (mat3(meshNormalTransform) * in_normal));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user