From 2558df0c7a2b004f8c6de8f6ee639574b7a519e2 Mon Sep 17 00:00:00 2001 From: Alex Lende Date: Thu, 29 Jun 2017 13:41:13 -0500 Subject: [PATCH] Added code examples for linear algebra --- index.html | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index 95b8b82..a9feef5 100644 --- a/index.html +++ b/index.html @@ -198,33 +198,60 @@

Linear Algebra

Vectors

-
+
+

+    type Vec4
+     -- Four dimensional vector type
+
+    vec4 : Float -> Float -> Float -> Float -> Vec4
+     -- Creates a new 4-element vector with the given x, y, z, and w values.
+                    

Matrices

-
+
+

+    type Mat4
+    -- 4x4 matrix type
+
+    makeFromList : List Float -> Maybe Mat4
+    -- Creates a matrix from a list of elements. Returns Nothing if the length of the list is not exactly 16 (4x4).
+                    

Transformations

-
+
- +

+    makePerspective : Float -> Float -> Float -> Float -> Mat4
+    -- Creates a matrix for a perspective projection with fov-y, aspect, z-near, z-far
+
+    makeRotate : Float -> Vec3 -> Mat4
+    -- Creates a matrix for rotation in radians about the 3-element vector axis.
+
+    makeScale : Vec3 -> Mat4
+    -- Creates a matrix for scaling each of the x, y, and z axes.
+
+    makeTranslate : Vec3 -> Mat4
+    -- Creates a matrix for translating each of the x, y, and z axes.
+                    
+

Coordinate Systems

@@ -400,9 +427,9 @@

Elm WebGL

Compiler

-

Uses Language.GLSL.Parser to parse and compile glsl shaders from Elm source code

+

Uses Haskell's Language.GLSL.Parser to parse and compile glsl shaders from Elm source code for type checking


-    fragmentShader : Shader {} {} {}
+    fragmentShader : Shader Attributes Uniforms Varyings
     fragmentShader =
         [glsl|