add triangles

This commit is contained in:
nek0 2023-01-06 05:04:14 +01:00
parent 0ebe818007
commit 925359acc3

View file

@ -138,9 +138,26 @@ initScene = do
, objectMaterial = "defaultMesh" , objectMaterial = "defaultMesh"
, objectMatrix = identity , objectMatrix = identity
} }
triangles = V.concatMap
(\y ->
V.map
(\x ->
let
translationMatrix = mkTransformation (Quaternion 1 (V3 0 0 0)) (V3 x 0 y)
scaleMatrix = scaled (V4 0.2 0.2 0.2 1)
in
RenderObject
{ objectMesh = "triangle"
, objectMaterial = "defaultMesh"
, objectMatrix = translationMatrix !*! scaleMatrix
}
)
(V.fromList [-20 .. 20])
)
(V.fromList [-20 .. 20])
renderableContainer <- asks renderables renderableContainer <- asks renderables
renderableVector <- liftIO $ STM.atomically $ STM.readTMVar renderableContainer renderableVector <- liftIO $ STM.atomically $ STM.readTMVar renderableContainer
void $ liftIO $ STM.atomically $ STM.swapTMVar renderableContainer $ void $ liftIO $ STM.atomically $ STM.swapTMVar renderableContainer $
renderableVector `V.snoc` mask (renderableVector `V.snoc` mask) V.++ triangles