diff options
Diffstat (limited to 'hello_obj.lc')
-rw-r--r-- | hello_obj.lc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/hello_obj.lc b/hello_obj.lc new file mode 100644 index 0000000..baf0edd --- /dev/null +++ b/hello_obj.lc | |||
@@ -0,0 +1,24 @@ | |||
1 | makeFrame (time :: Float) | ||
2 | (color :: Vec 4 Float) | ||
3 | (texture :: Texture) | ||
4 | (prims :: PrimitiveStream Triangle (Vec 4 Float, Vec 3 Float, Vec 3 Float)) | ||
5 | |||
6 | = imageFrame (emptyDepthImage 1, emptyColorImage (V4 0 0 0.4 1)) | ||
7 | `overlay` | ||
8 | prims | ||
9 | & mapPrimitives (\(p,n,uvw) -> | ||
10 | ( perspective 0.1 100 45 1 | ||
11 | *. lookat (V3 0 0 5) (V3 0 0 0) (V3 0 1 0) | ||
12 | *. rotMatrixX time | ||
13 | *. rotMatrixZ time | ||
14 | *. p | ||
15 | , V2 uvw%x (1 - uvw%y) )) | ||
16 | & rasterizePrimitives (TriangleCtx CullBack PolygonFill NoOffset LastVertex) ((Smooth)) | ||
17 | & mapFragments (\((uv)) -> ((color * texture2D (Sampler PointFilter MirroredRepeat texture) uv ))) | ||
18 | & accumulateWith (DepthOp Less True, ColorOp NoBlending (V4 True True True True)) | ||
19 | |||
20 | main = renderFrame $ | ||
21 | makeFrame (Uniform "time") | ||
22 | (Uniform "diffuseColor") | ||
23 | (Texture2DSlot "diffuseTexture") | ||
24 | (fetch "objects" (Attribute "position", Attribute "normal", Attribute "uvw")) | ||