blob: 9ca422d54a83f2efed58ccd406a2a91b7cb3c016 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
makeFrame (cam :: Mat 4 4 Float)
(skybox :: Texture)
(skypoints :: PrimitiveStream Point ((Vec 3 Float)))
= imageFrame (emptyDepthImage 1, emptyColorImage (V4 0 0 0.4 1))
`overlay`
skypoints
& mapPrimitives (\((p)) -> ( cam *. V4 p%x p%y p%z 1, V3 p%x (-p%y) (-p%z) ) )
& rasterizePrimitives (PointCtx (PointSize 1.0)
1.0 -- GL_POINT_FADE_THRESHOLD
UpperLeft) -- texture y increases downward
((Smooth))
& mapFragments (\((d)) -> ((texture2D (Sampler PointFilter MirroredRepeat skybox) d%xy )))
& accumulateWith (DepthOp Always True, ColorOp NoBlending (V4 True True True True))
textureCubeSlot s = Texture2DSlot s
main = renderFrame $
makeFrame (Uniform "Cam")
(textureCubeSlot "Skybox")
(fetch "skypoints" ((Attribute "position")))
|