diff options
-rw-r--r-- | assets/canvas-runtime.js | 1 | ||||
-rw-r--r-- | assets/descriptor.json | 4 | ||||
-rw-r--r-- | assets/images/paris.png | bin | 0 -> 4108 bytes | |||
-rw-r--r-- | assets/images/powderblue.png | bin | 0 -> 176 bytes | |||
-rw-r--r-- | assets/images/raiders.png | bin | 0 -> 5674 bytes | |||
-rw-r--r-- | assets/shaders/Paris.frag.glsl | 68 | ||||
-rw-r--r-- | js/io/system/ninjalibrary.json | 2 | ||||
-rwxr-xr-x | js/lib/geom/geom-obj.js | 2 | ||||
-rw-r--r-- | js/lib/rdge/materials/radial-blur-material.js | 2 | ||||
-rw-r--r-- | js/lib/rdge/materials/water-material.js | 84 | ||||
-rwxr-xr-x | js/models/materials-model.js | 5 |
11 files changed, 162 insertions, 6 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js index 7f2dc8ab..dd909e26 100644 --- a/assets/canvas-runtime.js +++ b/assets/canvas-runtime.js | |||
@@ -526,6 +526,7 @@ function RuntimeGeomObj() | |||
526 | 526 | ||
527 | case "deform": | 527 | case "deform": |
528 | case "water": | 528 | case "water": |
529 | case "paris": | ||
529 | case "tunnel": | 530 | case "tunnel": |
530 | case "reliefTunnel": | 531 | case "reliefTunnel": |
531 | case "squareTunnel": | 532 | case "squareTunnel": |
diff --git a/assets/descriptor.json b/assets/descriptor.json index af0520dd..85fbc996 100644 --- a/assets/descriptor.json +++ b/assets/descriptor.json | |||
@@ -21,6 +21,9 @@ | |||
21 | "images/cubelight.png", | 21 | "images/cubelight.png", |
22 | "images/random_normal.png", | 22 | "images/random_normal.png", |
23 | "images/white.png", | 23 | "images/white.png", |
24 | "images/paris.png", | ||
25 | "images/powderblue.png", | ||
26 | "images/raiders.png", | ||
24 | "shaders/Basic.frag.glsl", | 27 | "shaders/Basic.frag.glsl", |
25 | "shaders/TwistVert.vert.glsl", | 28 | "shaders/TwistVert.vert.glsl", |
26 | "shaders/Basic.vert.glsl", | 29 | "shaders/Basic.vert.glsl", |
@@ -36,6 +39,7 @@ | |||
36 | "shaders/Keleidoscope.frag.glsl", | 39 | "shaders/Keleidoscope.frag.glsl", |
37 | "shaders/plasma.frag.glsl", | 40 | "shaders/plasma.frag.glsl", |
38 | "shaders/Mandel.frag.glsl", | 41 | "shaders/Mandel.frag.glsl", |
42 | "shaders/Paris.frag.glsl", | ||
39 | "shaders/plasma.vert.glsl", | 43 | "shaders/plasma.vert.glsl", |
40 | "shaders/Pulse.frag.glsl", | 44 | "shaders/Pulse.frag.glsl", |
41 | "shaders/radialBlur.frag.glsl", | 45 | "shaders/radialBlur.frag.glsl", |
diff --git a/assets/images/paris.png b/assets/images/paris.png new file mode 100644 index 00000000..b7ef6c7b --- /dev/null +++ b/assets/images/paris.png | |||
Binary files differ | |||
diff --git a/assets/images/powderblue.png b/assets/images/powderblue.png new file mode 100644 index 00000000..a4ef33b4 --- /dev/null +++ b/assets/images/powderblue.png | |||
Binary files differ | |||
diff --git a/assets/images/raiders.png b/assets/images/raiders.png new file mode 100644 index 00000000..64c39c89 --- /dev/null +++ b/assets/images/raiders.png | |||
Binary files differ | |||
diff --git a/assets/shaders/Paris.frag.glsl b/assets/shaders/Paris.frag.glsl new file mode 100644 index 00000000..690b1453 --- /dev/null +++ b/assets/shaders/Paris.frag.glsl | |||
@@ -0,0 +1,68 @@ | |||
1 | #ifdef GL_ES | ||
2 | precision highp float; | ||
3 | #endif | ||
4 | |||
5 | uniform sampler2D u_tex0; | ||
6 | uniform float u_time; | ||
7 | uniform vec2 u_resolution; | ||
8 | const float PI = 3.1415926535897932; | ||
9 | |||
10 | //speed | ||
11 | |||
12 | const float speed = 0.1; | ||
13 | const float speed_x = 0.075; | ||
14 | const float speed_y = 0.000; | ||
15 | |||
16 | // geometry | ||
17 | const float intensity = 1.5; | ||
18 | const int steps = 8; | ||
19 | //const float frequency = 4.0; | ||
20 | const float frequency = 2.0; | ||
21 | const int angle = 7; // better when a prime | ||
22 | |||
23 | // reflection and emboss | ||
24 | const float delta = 20.; | ||
25 | const float intence = 400.; | ||
26 | const float emboss = 0.3; | ||
27 | |||
28 | //---------- crystals effect | ||
29 | |||
30 | float col(vec2 coord) | ||
31 | { | ||
32 | float delta_theta = 2.0 * PI / float(angle); | ||
33 | float col = 0.0; | ||
34 | float theta = 0.0; | ||
35 | for (int i = 0; i < steps; i++) | ||
36 | { | ||
37 | vec2 adjc = coord; | ||
38 | theta = delta_theta*float(i); | ||
39 | adjc.x += cos(theta)*u_time*speed + u_time * speed_x; | ||
40 | adjc.y -= sin(theta)*u_time*speed - u_time * speed_y; | ||
41 | col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*intensity; | ||
42 | } | ||
43 | |||
44 | return cos(col); | ||
45 | } | ||
46 | |||
47 | //---------- main | ||
48 | |||
49 | void main(void) | ||
50 | { | ||
51 | vec2 p = (gl_FragCoord.xy) / u_resolution.xy, c1 = p, c2 = p; | ||
52 | float cc1 = col(c1); | ||
53 | |||
54 | c2.x += u_resolution.x/delta; | ||
55 | float dx = emboss*(cc1-col(c2))/delta; | ||
56 | |||
57 | c2.x = p.x; | ||
58 | c2.y += u_resolution.y/delta; | ||
59 | float dy = emboss*(cc1-col(c2))/delta; | ||
60 | |||
61 | c1.x += dx; | ||
62 | c1.y = -(c1.y+dy); | ||
63 | |||
64 | float alpha = 1.+dot(dx,dy)*intence; | ||
65 | gl_FragColor = texture2D(u_tex0,c1)*(alpha); | ||
66 | // gl_FragColor = vec4(col(p),0,0,1); | ||
67 | |||
68 | } | ||
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json index 00ee7ed2..a863a135 100644 --- a/js/io/system/ninjalibrary.json +++ b/js/io/system/ninjalibrary.json | |||
@@ -1,6 +1,6 @@ | |||
1 | { | 1 | { |
2 | "libraries": [ | 2 | "libraries": [ |
3 | {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0.0"}, | 3 | {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.6.0.0"}, |
4 | {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.1.0"} | 4 | {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.1.2"} |
5 | ] | 5 | ] |
6 | } \ No newline at end of file | 6 | } \ No newline at end of file |
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 75b7808b..dbef4859 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js | |||
@@ -301,6 +301,7 @@ var GeomObj = function GLGeomObj() { | |||
301 | case "plasma": | 301 | case "plasma": |
302 | case "deform": | 302 | case "deform": |
303 | case "water": | 303 | case "water": |
304 | case "paris": | ||
304 | case "tunnel": | 305 | case "tunnel": |
305 | case "reliefTunnel": | 306 | case "reliefTunnel": |
306 | case "squareTunnel": | 307 | case "squareTunnel": |
@@ -373,6 +374,7 @@ var GeomObj = function GLGeomObj() { | |||
373 | case "plasma": | 374 | case "plasma": |
374 | case "deform": | 375 | case "deform": |
375 | case "water": | 376 | case "water": |
377 | case "paris": | ||
376 | case "tunnel": | 378 | case "tunnel": |
377 | case "reliefTunnel": | 379 | case "reliefTunnel": |
378 | case "squareTunnel": | 380 | case "squareTunnel": |
diff --git a/js/lib/rdge/materials/radial-blur-material.js b/js/lib/rdge/materials/radial-blur-material.js index 91eebcff..f4a4baa2 100644 --- a/js/lib/rdge/materials/radial-blur-material.js +++ b/js/lib/rdge/materials/radial-blur-material.js | |||
@@ -275,7 +275,6 @@ var radialBlurMaterialDef = | |||
275 | }; | 275 | }; |
276 | 276 | ||
277 | 277 | ||
278 | /* | ||
279 | var RaidersMaterial = function RaidersMaterial() | 278 | var RaidersMaterial = function RaidersMaterial() |
280 | { | 279 | { |
281 | // initialize the inherited members | 280 | // initialize the inherited members |
@@ -295,7 +294,6 @@ if (typeof exports === "object") | |||
295 | { | 294 | { |
296 | exports.RaidersMaterial = RaidersMaterial; | 295 | exports.RaidersMaterial = RaidersMaterial; |
297 | } | 296 | } |
298 | */ | ||
299 | 297 | ||
300 | 298 | ||
301 | RadialBlurMaterial.prototype = new Material(); | 299 | RadialBlurMaterial.prototype = new Material(); |
diff --git a/js/lib/rdge/materials/water-material.js b/js/lib/rdge/materials/water-material.js index 565055a1..b7413f55 100644 --- a/js/lib/rdge/materials/water-material.js +++ b/js/lib/rdge/materials/water-material.js | |||
@@ -117,7 +117,6 @@ var waterMaterialDef = | |||
117 | } | 117 | } |
118 | }; | 118 | }; |
119 | 119 | ||
120 | /* | ||
121 | var ParisMaterial = function ParisMaterial() | 120 | var ParisMaterial = function ParisMaterial() |
122 | { | 121 | { |
123 | // initialize the inherited members | 122 | // initialize the inherited members |
@@ -125,19 +124,98 @@ var ParisMaterial = function ParisMaterial() | |||
125 | this.inheritedFrom(); | 124 | this.inheritedFrom(); |
126 | 125 | ||
127 | this._name = "ParisMaterial"; | 126 | this._name = "ParisMaterial"; |
128 | this._shaderName = "water"; | 127 | this._shaderName = "paris"; |
129 | 128 | ||
130 | this._texMap = 'assets/images/paris.png'; | 129 | this._texMap = 'assets/images/paris.png'; |
131 | this._propValues[ this._propNames[0] ] = this._texMap.slice(0); | 130 | this._propValues[ this._propNames[0] ] = this._texMap.slice(0); |
132 | 131 | ||
133 | this._diffuseColor = [0.5, 0.5, 0.5, 0.5]; | 132 | this._diffuseColor = [0.5, 0.5, 0.5, 0.5]; |
134 | this._propValues[ this._propNames[1] ] = this._diffuseColor.slice(); | 133 | this._propValues[ this._propNames[1] ] = this._diffuseColor.slice(); |
134 | |||
135 | // duplcate method requirde | ||
136 | this.dup = function( world ) { | ||
137 | // allocate a new uber material | ||
138 | var newMat = new ParisMaterial(); | ||
139 | |||
140 | // copy over the current values; | ||
141 | var propNames = [], propValues = [], propTypes = [], propLabels = []; | ||
142 | this.getAllProperties( propNames, propValues, propTypes, propLabels); | ||
143 | var n = propNames.length; | ||
144 | for (var i=0; i<n; i++) | ||
145 | newMat.setProperty( propNames[i], propValues[i] ); | ||
146 | |||
147 | return newMat; | ||
148 | }; | ||
149 | |||
150 | this.init = function( world ) { | ||
151 | // save the world | ||
152 | if (world) this.setWorld( world ); | ||
153 | |||
154 | // set up the shader | ||
155 | this._shader = new jshader(); | ||
156 | this._shader.def = parisMaterialDef; | ||
157 | this._shader.init(); | ||
158 |