1module Graphics.WebGL (mapTriangle, zipTriangle, loadTex, model, webgl) where
3{-| The WebGL API is for high performance drawing.
5# Triangle Convenience Functions
6@docs Triangle, mapTriangle, zipTriangle
9Shaders are created using glsl blocks.
12vertex : Shader { a | pos : V3 } {} {}
18 gl_Position = vec4(pos,1.0);
25@docs loadTex, model, webgl
29import Graphics.Element (Element)
31import Native.Graphics.WebGL
34unsafeCoerceGLSL : String -> Shader attr unif vary
35unsafeCoerceGLSL = Native.Graphics.WebGL.unsafeCoerceGLSL
37{-| Triangles are only homogenous 3-tuples. Each element describes something about each vertex, and must be a record to be used with GLSL shaders.
39type Triangle a = (a,a,a)
41{-| Apply a function to each vertex -}
42mapTriangle : (a -> b) -> Triangle a -> Triangle b
43mapTriangle f (x,y,z) = (f x, f y, f z)
45{-| Apply an arity-2 function element-wise on 2 triangles -}
46zipTriangle : (a -> b -> c) -> Triangle a -> Triangle b -> Triangle c
47zipTriangle f (x,y,z) (x',y',z') = (f x x', f y y', f z z')
49{-| Opaque Shader Type -}
50data Shader attr unif vary = Shader
52{-| Opaque Texture Type -}
55{-| Load an image url as a texture -}
56loadTex : String -> Signal (Response Texture)
57loadTex = Native.Graphics.WebGL.loadTex
59{-| Opaque Model Type -}
62{-| A model is a collection of a fragment shader, a vertex shader, attribute data, and uniform data. -}
63model : Shader attr unif vary -> Shader {} unif vary -> [Triangle attr] -> unif -> Model
64model = Native.Graphics.WebGL.model
66{-| Render a WebGL scene with the given dimensions and models -}
67webgl : (Int,Int) -> [Model] -> Element
68webgl = Native.Graphics.WebGL.webgl
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list