aboutsummaryrefslogtreecommitdiff
path: root/engine/src/core-data/Common/MatDefs/Misc/Sky.vert
diff options
context:
space:
mode:
Diffstat (limited to 'engine/src/core-data/Common/MatDefs/Misc/Sky.vert')
-rw-r--r--engine/src/core-data/Common/MatDefs/Misc/Sky.vert25
1 files changed, 25 insertions, 0 deletions
diff --git a/engine/src/core-data/Common/MatDefs/Misc/Sky.vert b/engine/src/core-data/Common/MatDefs/Misc/Sky.vert
new file mode 100644
index 0000000..0426f87
--- /dev/null
+++ b/engine/src/core-data/Common/MatDefs/Misc/Sky.vert
@@ -0,0 +1,25 @@
+uniform mat4 g_ViewMatrix;
+uniform mat4 g_ProjectionMatrix;
+uniform mat4 g_WorldMatrix;
+
+uniform vec3 m_NormalScale;
+
+attribute vec3 inPosition;
+attribute vec3 inNormal;
+
+varying vec3 direction;
+
+void main(){
+ // set w coordinate to 0
+ vec4 pos = vec4(inPosition, 0.0);
+
+ // compute rotation only for view matrix
+ pos = g_ViewMatrix * pos;
+
+ // now find projection
+ pos.w = 1.0;
+ gl_Position = g_ProjectionMatrix * pos;
+
+ vec4 normal = vec4(inNormal * m_NormalScale, 0.0);
+ direction = normalize( (g_WorldMatrix * normal).xyz );
+}