diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-13 19:45:54 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-13 19:45:54 +0000 |
commit | 8566e63b26f9e7ee809c03394743a0576c499378 (patch) | |
tree | cdcef5b698a224003ba54507dc24cbb27a57cbbe /gfx/gl/shaders | |
parent | Add glContainer::at override to update a single item (diff) | |
download | ilt-8566e63b26f9e7ee809c03394743a0576c499378.tar.bz2 ilt-8566e63b26f9e7ee809c03394743a0576c499378.tar.xz ilt-8566e63b26f9e7ee809c03394743a0576c499378.zip |
We only need 3x3 matrix for model rotation spec
Diffstat (limited to 'gfx/gl/shaders')
-rw-r--r-- | gfx/gl/shaders/commonPoint.glsl | 4 | ||||
-rw-r--r-- | gfx/gl/shaders/commonShadowPoint.glsl | 4 | ||||
-rw-r--r-- | gfx/gl/shaders/dynamicPoint.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/dynamicPointInst.vs | 4 | ||||
-rw-r--r-- | gfx/gl/shaders/fixedPoint.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/pointLight.vs | 4 | ||||
-rw-r--r-- | gfx/gl/shaders/shadowDynamicPoint.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/shadowDynamicPointInst.vs | 4 | ||||
-rw-r--r-- | gfx/gl/shaders/shadowFixedPoint.vs | 2 | ||||
-rw-r--r-- | gfx/gl/shaders/spotLight.vs | 4 |
10 files changed, 16 insertions, 16 deletions
diff --git a/gfx/gl/shaders/commonPoint.glsl b/gfx/gl/shaders/commonPoint.glsl index a9817fb..2d9e388 100644 --- a/gfx/gl/shaders/commonPoint.glsl +++ b/gfx/gl/shaders/commonPoint.glsl @@ -16,9 +16,9 @@ getMaterialDetail(uint midx) void main() { - FragPos = (model * vec4(position, 1.0)).xyz + modelPos; + FragPos = (model * position) + modelPos; TexCoords = texCoord; - Normal = (model * vec4(normal, 0.0)).xyz; + Normal = (model * normal); Colour = colour; Material = getMaterialDetail(material); diff --git a/gfx/gl/shaders/commonShadowPoint.glsl b/gfx/gl/shaders/commonShadowPoint.glsl index 216642e..47722d6 100644 --- a/gfx/gl/shaders/commonShadowPoint.glsl +++ b/gfx/gl/shaders/commonShadowPoint.glsl @@ -1,7 +1,7 @@ void main() { - vec4 worldPos = model * vec4(position, 1.0); - gl_Position = viewProjection * vec4(worldPos.xyz - viewPoint + modelPos, 1); + vec3 worldPos = model * position; + gl_Position = viewProjection * vec4(worldPos - viewPoint + modelPos, 1); gl_Position.z = max(gl_Position.z, -1); } diff --git a/gfx/gl/shaders/dynamicPoint.vs b/gfx/gl/shaders/dynamicPoint.vs index 097cd11..7551688 100644 --- a/gfx/gl/shaders/dynamicPoint.vs +++ b/gfx/gl/shaders/dynamicPoint.vs @@ -6,7 +6,7 @@ include(`materialInterface.glsl') uniform mat4 viewProjection; uniform ivec3 viewPoint; -uniform mat4 model; +uniform mat3 model; uniform ivec3 modelPos; include(`commonPoint.glsl') diff --git a/gfx/gl/shaders/dynamicPointInst.vs b/gfx/gl/shaders/dynamicPointInst.vs index 529fe1d..69eab0c 100644 --- a/gfx/gl/shaders/dynamicPointInst.vs +++ b/gfx/gl/shaders/dynamicPointInst.vs @@ -6,7 +6,7 @@ include(`materialInterface.glsl') uniform mat4 viewProjection; uniform ivec3 viewPoint; -layout(location = 5) in mat4 model; -layout(location = 9) in ivec3 modelPos; +layout(location = 5) in mat3 model; +layout(location = 8) in ivec3 modelPos; include(`commonPoint.glsl') diff --git a/gfx/gl/shaders/fixedPoint.vs b/gfx/gl/shaders/fixedPoint.vs index 3cea737..5cfe9b3 100644 --- a/gfx/gl/shaders/fixedPoint.vs +++ b/gfx/gl/shaders/fixedPoint.vs @@ -6,7 +6,7 @@ include(`materialInterface.glsl') uniform mat4 viewProjection; uniform ivec3 viewPoint; -const mat4 model = mat4(1); +const mat3 model = mat3(1); const vec3 modelPos = ivec3(0); include(`commonPoint.glsl') diff --git a/gfx/gl/shaders/pointLight.vs b/gfx/gl/shaders/pointLight.vs index c538207..fbd031c 100644 --- a/gfx/gl/shaders/pointLight.vs +++ b/gfx/gl/shaders/pointLight.vs @@ -3,8 +3,8 @@ layout(location = 0) in vec3 v_position; layout(location = 1) in vec3 v_colour; layout(location = 2) in float v_kq; -layout(location = 3) in mat4 model; -layout(location = 7) in ivec3 modelPos; +layout(location = 3) in mat3 model; +layout(location = 6) in ivec3 modelPos; uniform ivec3 viewPoint; diff --git a/gfx/gl/shaders/shadowDynamicPoint.vs b/gfx/gl/shaders/shadowDynamicPoint.vs index f21b3b6..bf0f0a1 100644 --- a/gfx/gl/shaders/shadowDynamicPoint.vs +++ b/gfx/gl/shaders/shadowDynamicPoint.vs @@ -4,7 +4,7 @@ include(`meshIn.glsl') uniform mat4 viewProjection; uniform ivec3 viewPoint; -uniform mat4 model; +uniform mat3 model; uniform ivec3 modelPos; include(`commonShadowPoint.glsl') diff --git a/gfx/gl/shaders/shadowDynamicPointInst.vs b/gfx/gl/shaders/shadowDynamicPointInst.vs index 28a62d9..b0b80da 100644 --- a/gfx/gl/shaders/shadowDynamicPointInst.vs +++ b/gfx/gl/shaders/shadowDynamicPointInst.vs @@ -4,7 +4,7 @@ include(`meshIn.glsl') uniform mat4 viewProjection; uniform ivec3 viewPoint; -layout(location = 5) in mat4 model; -layout(location = 9) in ivec3 modelPos; +layout(location = 5) in mat3 model; +layout(location = 8) in ivec3 modelPos; include(`commonShadowPoint.glsl') diff --git a/gfx/gl/shaders/shadowFixedPoint.vs b/gfx/gl/shaders/shadowFixedPoint.vs index 168d5f1..307aac2 100644 --- a/gfx/gl/shaders/shadowFixedPoint.vs +++ b/gfx/gl/shaders/shadowFixedPoint.vs @@ -4,7 +4,7 @@ include(`meshIn.glsl') uniform mat4 viewProjection; uniform ivec3 viewPoint; -const mat4 model = mat4(1); +const mat3 model = mat3(1); const ivec3 modelPos = ivec3(0); include(`commonShadowPoint.glsl') diff --git a/gfx/gl/shaders/spotLight.vs b/gfx/gl/shaders/spotLight.vs index eed8778..e0196c3 100644 --- a/gfx/gl/shaders/spotLight.vs +++ b/gfx/gl/shaders/spotLight.vs @@ -5,8 +5,8 @@ layout(location = 1) in vec3 v_direction; layout(location = 2) in vec3 v_colour; layout(location = 3) in float v_kq; layout(location = 4) in float v_arc; -layout(location = 5) in mat4 model; -layout(location = 9) in ivec3 modelPos; +layout(location = 5) in mat3 model; +layout(location = 8) in ivec3 modelPos; uniform ivec3 viewPoint; |