From 038946ca49f1369ca894f345cc55004d15aa1d19 Mon Sep 17 00:00:00 2001 From: mtgmonkey Date: Tue, 2 Dec 2025 19:34:54 +0100 Subject: [PATCH] add some types and dangerous expressions --- src/Language/GLSL.hs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Language/GLSL.hs b/src/Language/GLSL.hs index b61dfe0..24338b8 100644 --- a/src/Language/GLSL.hs +++ b/src/Language/GLSL.hs @@ -81,6 +81,10 @@ instance GLSLExpression Expression where " = " <> (toGLSLText variable1) <> ";\n" + toGLSLText + (DangerousExpression text) = + text <> + "\n" instance GLSLExpression RequestedGLVersion where toGLSLText i = show i @@ -91,6 +95,7 @@ instance GLSLExpression RequestedGLType where instance GLSLExpression ParameterQualifier where toGLSLText In = "in" toGLSLText Out = "out" + toGLSLText Uniform = "uniform" instance GLSLExpression Variable where toGLSLText GL_POSITION = "gl_Position" @@ -98,6 +103,9 @@ instance GLSLExpression Variable where instance GLSLExpression GLSLType where toGLSLText (GLSLVec4 _) = "vec4" + toGLSLText (GLSLVec3 _) = "vec3" + toGLSLText (GLSLVec2 _) = "vec2" + toGLSLText (GLSLMat4 _) = "mat4" toGLSLText GLSLFloat = "float" -- TYPES -- @@ -116,6 +124,7 @@ data RequestedGLType data ParameterQualifier = In | Out + | Uniform deriving (Eq, Show) data LayoutQualifier @@ -135,6 +144,9 @@ data Variable data GLSLType = GLSLFloat | GLSLVec4 GLSLType + | GLSLVec3 GLSLType + | GLSLVec2 GLSLType + | GLSLMat4 GLSLType deriving (Eq, Show) -- expressions @@ -153,6 +165,8 @@ data Expression | VariableAssignment Variable Variable + | DangerousExpression + Text deriving Show -- errors