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