Compare commits

..

1 Commits

Author SHA1 Message Date
mtgmonkey
fa90055518 correct example, add TODO in GLSL.hs, add export generateGLSL 2025-11-30 19:09:48 +01:00
2 changed files with 12 additions and 6 deletions

View File

@@ -13,10 +13,16 @@ module Language.GLSL
, VariableName
, Variable(..)
, GLSLType(..)
, generateGLSL
, generateCheckedGLSL
)
where
-- TODO
--
-- -[ ] Add support for multiple shaders in sequence
-- -[ ] Add check if the previous shader output the next shader's inputs
-- IMPORTS --
import Relude
@@ -29,7 +35,7 @@ class GLSLExpression a where
instance GLSLExpression Program where
toGLSLText expressions =
foldr ((<>)) "}" $ map (toGLSLText) expressions
foldr ((<>)) "}\n" $ map (toGLSLText) expressions
instance GLSLExpression Expression where
toGLSLText
@@ -87,7 +93,7 @@ instance GLSLExpression ParameterQualifier where
toGLSLText Out = "out"
instance GLSLExpression Variable where
toGLSLText GL_POSITION = "gl_position"
toGLSLText GL_POSITION = "gl_Position"
toGLSLText (Variable name _) = name
instance GLSLExpression GLSLType where

View File

@@ -24,10 +24,10 @@ main = do
fragShader :: Program
fragShader =
[ VersionDeclaration 450 Core
, VariableDeclaration Nothing In fragColorIn
, VariableDeclaration Nothing Out fragColorOut
, VariableDeclaration Nothing In fragColorOut
, VariableDeclaration Nothing Out fragColor
, MainStart
, VariableAssignment fragColorOut fragColorIn
, VariableAssignment fragColor fragColorOut
]
vertShader :: Program
@@ -41,7 +41,7 @@ vertShader =
, VariableAssignment fragColorOut vertexColor
]
fragColorIn = Variable "fragColorIn" $ GLSLVec4 GLSLFloat
fragColor = Variable "fragColor" $ GLSLVec4 GLSLFloat
fragColorOut = Variable "fragColorOut" $ GLSLVec4 GLSLFloat
vertexPosition = Variable "vertexPosition" $ GLSLVec4 GLSLFloat
vertexColor = Variable "vertexColor" $ GLSLVec4 GLSLFloat