aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/ps1vert.vs
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders/ps1vert.vs')
-rw-r--r--assets/shaders/ps1vert.vs26
1 files changed, 26 insertions, 0 deletions
diff --git a/assets/shaders/ps1vert.vs b/assets/shaders/ps1vert.vs
new file mode 100644
index 0000000..7d8d506
--- /dev/null
+++ b/assets/shaders/ps1vert.vs
@@ -0,0 +1,26 @@
+#version 330
+
+in vec3 vertexPosition;
+in vec2 vertexTexCoord;
+in vec3 vertexNormal;
+in vec4 vertexColor;
+
+uniform mat4 mvp;
+
+noperspective out vec2 fragTexCoord;
+noperspective out vec3 fragColor;
+
+void main()
+{
+ vec2 res = vec2(160.0, 120.0);
+ fragTexCoord = vertexTexCoord;
+ fragColor = vertexColor.rgb;
+
+ vec4 pop = mvp*vec4(vertexPosition, 1.0);
+ gl_Position = pop;
+ gl_Position.xyz = pop.xyz / pop.w;
+ gl_Position.xy = floor(res * gl_Position.xy) / res;
+ gl_Position.xyz *= pop.w;
+
+ fragColor = mix(fragColor, vec3(0.0), clamp(smoothstep(20.0, 24.0, length(pop.xyz)), 0.0, 1.0));
+} \ No newline at end of file