on master help sign in
added some more of MJS, and needed my own custom makeCoords util matrix
ed58c3fJohn P Mayer Jr
libraries/MJS.elm+16
@@ -15,6 +15,9 @@ v3 = Native.MJS.v3
15v3add : V3 -> V3 -> V3
15v3add : V3 -> V3 -> V3
16v3add = Native.MJS.v3add
16v3add = Native.MJS.v3add
17
17
18+v3sub : V3 -> V3 -> V3
19+v3sub = Native.MJS.v3sub
20+
18v3length : V3 -> Float
21v3length : V3 -> Float
19v3length = Native.MJS.v3length
22v3length = Native.MJS.v3length
20
23
@@ -24,6 +27,12 @@ v3normalize = Native.MJS.v3normalize
24v3scale : V3 -> Float -> V3
27v3scale : V3 -> Float -> V3
25v3scale = Native.MJS.v3scale
28v3scale = Native.MJS.v3scale
26
29
30+v3dot : V3 -> V3 -> Float
31+v3dot = Native.MJS.v3dot
32+
33+v3cross : V3 -> V3 -> V3
34+v3cross = Native.MJS.v3cross
35+
27v3mul4x4 : M4x4 -> V3 -> V3
36v3mul4x4 : M4x4 -> V3 -> V3
28v3mul4x4 = Native.MJS.v3mul4x4
37v3mul4x4 = Native.MJS.v3mul4x4
29
38
@@ -36,8 +45,15 @@ m4x4mul = Native.MJS.m4x4mul
36m4x4makeRotate : Float -> V3 -> M4x4
45m4x4makeRotate : Float -> V3 -> M4x4
37m4x4makeRotate = Native.MJS.m4x4makeRotate
46m4x4makeRotate = Native.MJS.m4x4makeRotate
38
47
48+m4x4makeTranslate : V3 -> M4x4
49+m4x4makeTranslate = Native.MJS.m4x4makeTranslate
50+
39m4x4makeLookAt : V3 -> V3 -> V3 -> M4x4
51m4x4makeLookAt : V3 -> V3 -> V3 -> M4x4
40m4x4makeLookAt = Native.MJS.m4x4makeLookAt
52m4x4makeLookAt = Native.MJS.m4x4makeLookAt
41
53
42m4x4makePerspective : Float -> Float -> Float -> Float -> M4x4
54m4x4makePerspective : Float -> Float -> Float -> Float -> M4x4
43m4x4makePerspective = Native.MJS.m4x4makePerspective
55m4x4makePerspective = Native.MJS.m4x4makePerspective
56+
57+{- Custom constructor for supplying arbitrary x,y,z axis -}
58+m4x4makeCoords : V3 -> V3 -> V3 -> M4x4
59+m4x4makeCoords = Native.MJS.m4x4makeCoords
libraries/Native/MJS.js+26
@@ -1844,6 +1844,31 @@ Elm.Native.MJS.make = function(elm) {
1844 return r;
1844 return r;
1845 };
1845 };
1846
1846
1847+ M4x4.makeCoords = function M4x4_makeCoords(vx,vy,vz) {
1848+
1849+ var r = new MJS_FLOAT_ARRAY_TYPE(16);
1850+
1851+ r[0] = vx[0];
1852+ r[1] = vx[1];
1853+ r[2] = vx[2];
1854+ r[3] = 0;
1855+ r[4] = vy[0];
1856+ r[5] = vy[1];
1857+ r[6] = vy[2];
1858+ r[7] = 0;
1859+ r[8] = vz[0];
1860+ r[9] = vz[1];
1861+ r[10] = vz[2];
1862+ r[11] = 0;
1863+ r[12] = 0;
1864+ r[13] = 0;
1865+ r[14] = 0;
1866+ r[15] = 1;
1867+
1868+ return r;
1869+
1870+ };
1871+
1847 return {
1872 return {
1848 V3: V3,
1873 V3: V3,
1849 v3: F3(V3.$),
1874 v3: F3(V3.$),
@@ -1896,6 +1921,7 @@ Elm.Native.MJS.make = function(elm) {
1896 m4x4_transformPointFffine (m, v, r) {
1921 m4x4_transformPointFffine (m, v, r) {
1897 m4x4_transformLineFffine(m, v, r) {
1922 m4x4_transformLineFffine(m, v, r) {
1898 */
1923 */
1924+ m4x4makeCoords: F3(M4x4.makeCoords),
1899 };
1925 };
1900
1926
1901}
1927}