From 4b199cf04af83f59895d4d1e9a2d8443c1ec8e06 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 3 Apr 2012 09:36:14 -0700 Subject: started the flag material --- assets/images/us_flag.png | Bin 0 -> 9946 bytes assets/shaders/Flag.frag.glsl | 13 +++++++++++++ assets/shaders/Flag.vert.glsl | 29 +++++++++++++++++++++-------- 3 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 assets/images/us_flag.png create mode 100644 assets/shaders/Flag.frag.glsl (limited to 'assets') diff --git a/assets/images/us_flag.png b/assets/images/us_flag.png new file mode 100644 index 00000000..1545edc2 Binary files /dev/null and b/assets/images/us_flag.png differ diff --git a/assets/shaders/Flag.frag.glsl b/assets/shaders/Flag.frag.glsl new file mode 100644 index 00000000..79d4bec3 --- /dev/null +++ b/assets/shaders/Flag.frag.glsl @@ -0,0 +1,13 @@ +#ifdef GL_ES +precision highp float; +#endif + +uniform sampler2D u_tex0; + +varying vec2 v_uv; + +void main(void) +{ + vec3 col = texture2D(u_tex0, v_uv).xyz; + gl_FragColor = vec4(col,1.0); +} \ No newline at end of file diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index 7dc932a7..9da0ee1c 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl @@ -16,20 +16,33 @@ attribute vec2 texcoord; // scalar uniforms uniform float u_time; +uniform float u_waveWidth; +uniform float u_waveHeight; // matrix uniforms uniform mat4 u_mvMatrix; uniform mat4 u_projMatrix; uniform mat4 u_worldMatrix; +// varying variables +varying vec2 v_uv; + void main() { - float angle = (u_time%360)*2; - - a_pos.z = sin( a_pos.x + angle); - a_pos.z += sin( a_pos.y/2 + angle); - a_pos.z *= a_pos.x * 0.09; - gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; - - gl_FragColor = v_color; + float pi = 3.14159; + float angle = mod(u_time, pi)*2.0; + + vec3 v = a_pos; + v_uv = texcoord; + + vec2 pos = texcoord; + float tmp = pos.x; pos.x = pos.y; pos.y = tmp; + pos.x = pos.x * 1.0*pi * u_waveWidth; + pos.y = pos.y * 1.0*pi * u_waveWidth; + + v.z = sin( pos.x + angle); + v.z += sin( pos.y/2.0 + angle); + v.z *= v.y * 0.09 * u_waveHeight; + + gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; } -- cgit v1.2.3 From 0f31002ca696c1ef303d2926a504afd27305e94f Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 4 Apr 2012 05:52:54 -0700 Subject: Added Flag material --- assets/shaders/Flag.vert.glsl | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'assets') diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index 9da0ee1c..a5e8b2f7 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl @@ -27,22 +27,21 @@ uniform mat4 u_worldMatrix; // varying variables varying vec2 v_uv; + void main() { - float pi = 3.14159; - float angle = mod(u_time, pi)*2.0; + float pi = 3.14159; + float angle = u_time; - vec3 v = a_pos; v_uv = texcoord; - vec2 pos = texcoord; - float tmp = pos.x; pos.x = pos.y; pos.y = tmp; - pos.x = pos.x * 1.0*pi * u_waveWidth; - pos.y = pos.y * 1.0*pi * u_waveWidth; + float x = 2.0*pi*texcoord.x/u_waveWidth; + float y = 2.0*pi*texcoord.y; - v.z = sin( pos.x + angle); - v.z += sin( pos.y/2.0 + angle); - v.z *= v.y * 0.09 * u_waveHeight; + vec3 v = a_pos; + v.z = sin( x + angle ) - 2.0*u_waveHeight; + v.z += sin( 0.2*y + angle); + v.z *= x * 0.09 * u_waveHeight; gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; } -- cgit v1.2.3 From 32c973351bc6f4d682205b788dc6235fc9452e07 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 4 Apr 2012 16:58:43 -0700 Subject: added copyright info to flag frag shader --- assets/shaders/Flag.frag.glsl | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'assets') diff --git a/assets/shaders/Flag.frag.glsl b/assets/shaders/Flag.frag.glsl index 79d4bec3..b05b4888 100644 --- a/assets/shaders/Flag.frag.glsl +++ b/assets/shaders/Flag.frag.glsl @@ -1,3 +1,10 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + #ifdef GL_ES precision highp float; #endif -- cgit v1.2.3 From b6a8f72f670a8edee35554a4ca3a0618c526d651 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 5 Apr 2012 05:30:55 -0700 Subject: Re-added taper and twist-vert materials. --- assets/images/cloud10.png | Bin 0 -> 58580 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 assets/images/cloud10.png (limited to 'assets') diff --git a/assets/images/cloud10.png b/assets/images/cloud10.png new file mode 100644 index 00000000..2d87a4de Binary files /dev/null and b/assets/images/cloud10.png differ -- cgit v1.2.3 From c1a6cacf364d79cbf23b41e7089a1a6d39afea85 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 10 Apr 2012 10:12:49 -0700 Subject: Cloud material --- assets/shaders/Cloud.frag.glsl | 23 +++++++++++++++++++++++ assets/shaders/Cloud.vert.glsl | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 assets/shaders/Cloud.frag.glsl create mode 100644 assets/shaders/Cloud.vert.glsl (limited to 'assets') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl new file mode 100644 index 00000000..522e17bb --- /dev/null +++ b/assets/shaders/Cloud.frag.glsl @@ -0,0 +1,23 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + +uniform sampler2D u_tex0; +uniform float u_surfaceAlpha; + +varying vec4 v_Colors; +varying vec2 v_texCoord0; + + +void main() +{ + gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; +} + \ No newline at end of file diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl new file mode 100644 index 00000000..fbd7f40b --- /dev/null +++ b/assets/shaders/Cloud.vert.glsl @@ -0,0 +1,42 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + +// attributes +attribute vec3 a_pos; +attribute vec2 texcoord; + +// uniforms +uniform float u_time; +uniform float u_zmin; +uniform float u_zmax; +uniform float u_surfaceAlpha; + +// matrix uniforms +uniform mat4 u_mvMatrix; +uniform mat4 u_projMatrix; +uniform mat4 u_worldMatrix; + +// varying +varying vec2 v_texCoord0; + +// constants +const float zSpeed = 1.0; + + +void main() +{ + // Transform position + vec4 pos = a_pos; + pos.z += u+time*zSpeed; + gl_Position = u_projMatrix * u_mvMatrix * pos; + + v_texCoord0 = texcoord; +} \ No newline at end of file -- cgit v1.2.3 From 1b7592f81c9b47c2b42d78efe385cd979d54d3ca Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 11 Apr 2012 06:24:05 -0700 Subject: Cloud material --- assets/shaders/Cloud.vert.glsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'assets') diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index fbd7f40b..c673e40c 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl @@ -34,8 +34,8 @@ const float zSpeed = 1.0; void main() { // Transform position - vec4 pos = a_pos; - pos.z += u+time*zSpeed; + vec4 pos = vec4(a_pos,1); + pos.z += u_time*zSpeed; gl_Position = u_projMatrix * u_mvMatrix * pos; v_texCoord0 = texcoord; -- cgit v1.2.3 From 331b2ad4d602016f9bb3d03be759fd81fed50c10 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 13 Apr 2012 07:08:42 -0700 Subject: Cloud Material --- assets/shaders/Cloud.frag.glsl | 4 ++-- assets/shaders/Cloud.vert.glsl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'assets') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index 522e17bb..b07bb627 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -12,12 +12,12 @@ precision highp float; uniform sampler2D u_tex0; uniform float u_surfaceAlpha; -varying vec4 v_Colors; varying vec2 v_texCoord0; void main() { - gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; + // gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; + gl_FragColor = vec4(1,0,0,1); } \ No newline at end of file diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index c673e40c..9a235349 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl @@ -35,7 +35,7 @@ void main() { // Transform position vec4 pos = vec4(a_pos,1); - pos.z += u_time*zSpeed; + //pos.z += u_time*zSpeed; gl_Position = u_projMatrix * u_mvMatrix * pos; v_texCoord0 = texcoord; -- cgit v1.2.3 From 8992d9baf542135e910bb59328a592d9e330703a Mon Sep 17 00:00:00 2001 From: hwc487 Date: Sun, 15 Apr 2012 05:16:34 -0700 Subject: Cloud Material --- assets/shaders/Basic.vert.glsl | 3 +++ assets/shaders/BasicTex.frag.glsl | 19 +++++++++++++++++++ assets/shaders/Cloud.frag.glsl | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 assets/shaders/BasicTex.frag.glsl (limited to 'assets') diff --git a/assets/shaders/Basic.vert.glsl b/assets/shaders/Basic.vert.glsl index 0d5b8d63..f96f8322 100755 --- a/assets/shaders/Basic.vert.glsl +++ b/assets/shaders/Basic.vert.glsl @@ -14,6 +14,8 @@ precision highp float; attribute vec3 a_pos; attribute vec2 texcoord; +// varying +varying vec2 v_texCoord0; // matrix uniforms uniform mat4 u_mvMatrix; @@ -22,5 +24,6 @@ uniform mat4 u_worldMatrix; void main(void) { + v_texCoord0 = texcoord; gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0) ; } \ No newline at end of file diff --git a/assets/shaders/BasicTex.frag.glsl b/assets/shaders/BasicTex.frag.glsl new file mode 100644 index 00000000..a716e77d --- /dev/null +++ b/assets/shaders/BasicTex.frag.glsl @@ -0,0 +1,19 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + + +#ifdef GL_ES +precision highp float; +#endif + +uniform sampler2D u_tex0; + +varying vec2 v_texCoord0; + + +void main() { + gl_FragColor = texture2D(u_tex0, v_texCoord0); +} diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index b07bb627..ba1ef39e 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -17,7 +17,7 @@ varying vec2 v_texCoord0; void main() { - // gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; - gl_FragColor = vec4(1,0,0,1); + gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; + //gl_FragColor = texture2D(u_tex0, v_texCoord0); } \ No newline at end of file -- cgit v1.2.3 From c0aa5e88890fbf74124d019df96c33215da99f17 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 16 Apr 2012 05:59:01 -0700 Subject: Cloud material --- assets/shaders/Cloud.frag.glsl | 5 +++-- assets/shaders/Cloud.vert.glsl | 12 ++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'assets') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index ba1ef39e..c21dcf97 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -17,7 +17,8 @@ varying vec2 v_texCoord0; void main() { - gl_FragColor = texture2D(u_tex0, v_texCoord0) * u_surfaceAlpha; - //gl_FragColor = texture2D(u_tex0, v_texCoord0); + vec4 c = texture2D(u_tex0, v_texCoord0); + //c.a *= u_surfaceAlpha; + gl_FragColor = c; } \ No newline at end of file diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index 9a235349..c8ca9f3f 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl @@ -28,14 +28,22 @@ uniform mat4 u_worldMatrix; varying vec2 v_texCoord0; // constants -const float zSpeed = 1.0; +const float zSpeed = 2.0; void main() { // Transform position vec4 pos = vec4(a_pos,1); - //pos.z += u_time*zSpeed; + float dz = u_time*zSpeed; + float n = floor( dz/(u_zmax-u_zmin) ); + dz -= n*(u_zmax - u_zmin); + float z = pos.z + dz; + if (z > u_zmax) + { + z = u_zmin + (z - u_zmax); + } + pos.z = z; gl_Position = u_projMatrix * u_mvMatrix * pos; v_texCoord0 = texcoord; -- cgit v1.2.3 From 447268000c379f619c78d7132c81e23b5c252598 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 17 Apr 2012 09:20:49 -0700 Subject: Cloud material --- assets/shaders/Cloud.frag.glsl | 4 ++-- assets/shaders/Cloud.vert.glsl | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'assets') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index c21dcf97..3d466a24 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -18,7 +18,7 @@ varying vec2 v_texCoord0; void main() { vec4 c = texture2D(u_tex0, v_texCoord0); - //c.a *= u_surfaceAlpha; - gl_FragColor = c; + c.a *= u_surfaceAlpha; + gl_FragColor = c; } \ No newline at end of file diff --git a/assets/shaders/Cloud.vert.glsl b/assets/shaders/Cloud.vert.glsl index c8ca9f3f..acd581fc 100644 --- a/assets/shaders/Cloud.vert.glsl +++ b/assets/shaders/Cloud.vert.glsl @@ -22,19 +22,19 @@ uniform float u_surfaceAlpha; // matrix uniforms uniform mat4 u_mvMatrix; uniform mat4 u_projMatrix; -uniform mat4 u_worldMatrix; // varying varying vec2 v_texCoord0; // constants -const float zSpeed = 2.0; +const float zSpeed = 10.0; void main() { // Transform position vec4 pos = vec4(a_pos,1); + float dz = u_time*zSpeed; float n = floor( dz/(u_zmax-u_zmin) ); dz -= n*(u_zmax - u_zmin); @@ -44,6 +44,7 @@ void main() z = u_zmin + (z - u_zmax); } pos.z = z; + gl_Position = u_projMatrix * u_mvMatrix * pos; v_texCoord0 = texcoord; -- cgit v1.2.3 From ae7eb87564632ce7c676bd728b8ff2710ff0bb83 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 18 Apr 2012 15:44:26 -0700 Subject: Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Snapping_II Conflicts: js/tools/Rotate3DToolBase.js js/tools/RotateStage3DTool.js js/tools/Translate3DToolBase.js js/tools/modifier-tool-base.js --- assets/images/CL13.png | Bin 0 -> 40537 bytes assets/shaders/Cloud.frag.glsl | 3 ++- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 assets/images/CL13.png (limited to 'assets') diff --git a/assets/images/CL13.png b/assets/images/CL13.png new file mode 100644 index 00000000..236eb3f8 Binary files /dev/null and b/assets/images/CL13.png differ diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index 3d466a24..3f858b7a 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -18,7 +18,8 @@ varying vec2 v_texCoord0; void main() { vec4 c = texture2D(u_tex0, v_texCoord0); - c.a *= u_surfaceAlpha; + //c.a *= u_surfaceAlpha; + if ((c.r == 0.0) && (c.b == 0.0) && (c.g == 0.0) && (c.a == 1.0)) c = vec4( 0.0, 0.0, 1.0, 1.0 ); gl_FragColor = c; } \ No newline at end of file -- cgit v1.2.3 From 1e649405d66f17d6acddb9055b181bba7ad70566 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 16 May 2012 13:41:48 -0700 Subject: Exposing parameters in Water Material --- assets/shaders/Water2.frag.glsl | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'assets') diff --git a/assets/shaders/Water2.frag.glsl b/assets/shaders/Water2.frag.glsl index 39b6aa55..49b2b647 100644 --- a/assets/shaders/Water2.frag.glsl +++ b/assets/shaders/Water2.frag.glsl @@ -8,20 +8,27 @@ uniform vec2 u_resolution; const float PI = 3.1415926535897932; //speed -const float speed = 0.2; +//const float speed = 0.2; const float speed_x = 0.3; const float speed_y = 0.3; // geometry -const float intensity = 3.; +//const float intensity = 3.; const int steps = 8; const float frequency = 4.0; const int angle = 7; // better when a prime // reflection and emboss -const float delta = 20.; +//const float delta = 20.; const float intence = 400.; -const float emboss = 0.3; +//const float emboss = 0.3; + +// uniforms +uniform float u_emboss; +uniform float u_delta; +//uniform float u_intence; +uniform float u_intensity; +uniform float u_speed; //---------- crystals effect @@ -34,9 +41,9 @@ const float emboss = 0.3; { vec2 adjc = coord; theta = delta_theta*float(i); - adjc.x += cos(theta)*u_time*speed + u_time * speed_x; - adjc.y -= sin(theta)*u_time*speed - u_time * speed_y; - col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*intensity; + adjc.x += cos(theta)*u_time*u_speed + u_time * speed_x; + adjc.y -= sin(theta)*u_time*u_speed - u_time * speed_y; + col = col + cos( (adjc.x*cos(theta) - adjc.y*sin(theta))*frequency)*u_intensity; } return cos(col); @@ -49,18 +56,17 @@ void main(void) vec2 p = (gl_FragCoord.xy) / u_resolution.xy, c1 = p, c2 = p; float cc1 = col(c1); -c2.x += u_resolution.x/delta; -float dx = emboss*(cc1-col(c2))/delta; +c2.x += u_resolution.x/u_delta; +float dx = u_emboss*(cc1-col(c2))/u_delta; c2.x = p.x; -c2.y += u_resolution.y/delta; -float dy = emboss*(cc1-col(c2))/delta; +c2.y += u_resolution.y/u_delta; +float dy = u_emboss*(cc1-col(c2))/u_delta; c1.x += dx; c1.y = -(c1.y+dy); float alpha = 1.+dot(dx,dy)*intence; gl_FragColor = texture2D(u_tex0,c1)*(alpha); -// gl_FragColor = vec4(col(p),0,0,1); } -- cgit v1.2.3 From dc92188fef67d7a2032173d7746fbc16a951a366 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 17 May 2012 15:15:43 -0700 Subject: Exposing parameters for pulse and plasma materials --- assets/shaders/Pulse.frag.glsl | 12 +++++++++--- assets/shaders/plasma.frag.glsl | 16 +++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'assets') diff --git a/assets/shaders/Pulse.frag.glsl b/assets/shaders/Pulse.frag.glsl index b24c9bef..9aeb05c9 100644 --- a/assets/shaders/Pulse.frag.glsl +++ b/assets/shaders/Pulse.frag.glsl @@ -6,16 +6,22 @@ uniform float u_time; uniform vec2 u_resolution; uniform sampler2D u_tex0; +uniform float u_speed; +uniform float u_xscale; +uniform float u_yscale; + void main(void) { vec2 halfres = u_resolution.xy/2.0; vec2 cPos = gl_FragCoord.xy; - cPos.x -= 0.5*halfres.x*sin(u_time/2.0)+0.3*halfres.x*cos(u_time)+halfres.x; - cPos.y -= 0.4*halfres.y*sin(u_time/5.0)+0.3*halfres.y*cos(u_time)+halfres.y; + float time = u_time * u_speed; + + cPos.x -= u_xscale*halfres.x*sin(time/2.0)+0.3*halfres.x*cos(time)+halfres.x; + cPos.y -= u_yscale*halfres.y*sin(time/5.0)+0.3*halfres.y*cos(time)+halfres.y; float cLength = length(cPos); - vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-u_time*10.0)/25.0; + vec2 uv = gl_FragCoord.xy/u_resolution.xy+(cPos/cLength)*sin(cLength/30.0-time*10.0)/25.0; vec3 col = texture2D(u_tex0,uv).xyz*50.0/cLength; gl_FragColor = vec4(col,1.0); diff --git a/assets/shaders/plasma.frag.glsl b/assets/shaders/plasma.frag.glsl index 248288a6..4a5ac3da 100644 --- a/assets/shaders/plasma.frag.glsl +++ b/assets/shaders/plasma.frag.glsl @@ -16,15 +16,21 @@ precision highp float; varying vec2 v_uv; uniform float u_time; -uniform vec4 color; + +uniform float u_wave; +uniform float u_wave1; +uniform float u_wave2; +uniform float u_speed; void main(void) { float x = v_uv.x ; float y = v_uv.y ; - float time = u_time; - float wave = (cos(time + y / 0.2 + cos(x / 0.3 + cos((y / 0.1))))); - float wave1 = (sin(abs(wave + y/0.6))); - float wave2 = (sin(abs(wave1 + y/0.8))); + float time = u_time*u_speed; + + float wave = (cos(time + y / (u_wave+0.2) + cos(x / (u_wave+0.3) + cos((y / (u_wave+0.1)))))); + float wave1 = (sin(abs(wave + y/u_wave1))); + float wave2 = (sin(abs(wave1 + y/u_wave2))); + gl_FragColor = vec4( abs(vec3(wave2,wave1,wave)),1.0); } -- cgit v1.2.3 From cc3b66f817c9d72ca247d5ff789a08ec5b57a2b5 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 22 May 2012 08:38:38 -0700 Subject: Editable material properties --- assets/shaders/test_fshader.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'assets') diff --git a/assets/shaders/test_fshader.glsl b/assets/shaders/test_fshader.glsl index 629d1878..229b8989 100755 --- a/assets/shaders/test_fshader.glsl +++ b/assets/shaders/test_fshader.glsl @@ -32,7 +32,7 @@ uniform sampler2D depthMap; uniform vec4 u_matAmbient; uniform vec4 u_matDiffuse; uniform vec4 u_matSpecular; -uniform float u_matShininess; +//uniform float u_matShininess; uniform vec4 u_matEmission; uniform float u_renderGlow; -- cgit v1.2.3 From 50ede4afa801f53caff7939dad0408f9a0a8b744 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 22 May 2012 15:44:51 -0700 Subject: Editable parameters for flag, pulse, uber, and radial gradient materials. --- assets/shaders/Flag.vert.glsl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'assets') diff --git a/assets/shaders/Flag.vert.glsl b/assets/shaders/Flag.vert.glsl index a5e8b2f7..1c842cb0 100644 --- a/assets/shaders/Flag.vert.glsl +++ b/assets/shaders/Flag.vert.glsl @@ -16,6 +16,7 @@ attribute vec2 texcoord; // scalar uniforms uniform float u_time; +uniform float u_speed; uniform float u_waveWidth; uniform float u_waveHeight; @@ -30,8 +31,9 @@ varying vec2 v_uv; void main() { - float pi = 3.14159; - float angle = u_time; + float time = u_time * u_speed; + const float pi = 3.14159; + float angle = time; v_uv = texcoord; @@ -39,9 +41,11 @@ void main() float y = 2.0*pi*texcoord.y; vec3 v = a_pos; - v.z = sin( x + angle ) - 2.0*u_waveHeight; + v.z = sin( x + angle ); v.z += sin( 0.2*y + angle); - v.z *= x * 0.09 * u_waveHeight; + v.z *= u_waveHeight; + v.z -= 2.0*u_waveHeight; + v.z *= x * 0.09; gl_Position = u_projMatrix * u_mvMatrix * vec4(v,1.0) ; } -- cgit v1.2.3 From 725c2175f20b5e0829518f725fd26cc077748bdf Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 25 May 2012 13:35:10 -0700 Subject: Parameters for twistVertex material --- assets/shaders/Cloud.frag.glsl | 2 -- assets/shaders/TwistVert.frag.glsl | 1 - assets/shaders/TwistVert.vert.glsl | 11 ++--------- 3 files changed, 2 insertions(+), 12 deletions(-) (limited to 'assets') diff --git a/assets/shaders/Cloud.frag.glsl b/assets/shaders/Cloud.frag.glsl index 2447fd79..cd70d1a0 100644 --- a/assets/shaders/Cloud.frag.glsl +++ b/assets/shaders/Cloud.frag.glsl @@ -18,8 +18,6 @@ varying vec2 v_texCoord0; void main() { vec4 c = texture2D(u_tex0, v_texCoord0); - //c.a *= u_surfaceAlpha; - //if ((c.r == 0.0) && (c.b == 0.0) && (c.g == 0.0) && (c.a == 1.0)) c = vec4( 0.0, 0.0, 1.0, 1.0 ); gl_FragColor = c; } \ No newline at end of file diff --git a/assets/shaders/TwistVert.frag.glsl b/assets/shaders/TwistVert.frag.glsl index f8490615..01c32c42 100644 --- a/assets/shaders/TwistVert.frag.glsl +++ b/assets/shaders/TwistVert.frag.glsl @@ -28,5 +28,4 @@ void main() col = texture2D(u_tex1, v_texcoord).xyz; gl_FragColor = vec4(col, 1.0); - //gl_FragColor = v_color; } diff --git a/assets/shaders/TwistVert.vert.glsl b/assets/shaders/TwistVert.vert.glsl index 29cb30ea..9734063d 100644 --- a/assets/shaders/TwistVert.vert.glsl +++ b/assets/shaders/TwistVert.vert.glsl @@ -19,7 +19,7 @@ attribute vec2 texcoord; uniform float u_limit1; uniform float u_limit2; uniform float u_twistAmount; -uniform float u_center; +//uniform float u_center; // texture sampler uniforms uniform sampler2D u_tex0; @@ -63,17 +63,14 @@ void main(void) vec2 uv = texcoord; v_texcoord = texcoord; - //v_color = vec4(texcoord.x, texcoord.y, 0, 1); - v_zNormal = 1.0; if (uv.x < u_limit2) { float angle = GetAngle( uv.x ); float cs = cos(angle), sn = sin(angle); - pos.y -= u_center; vec3 ctrPt = pos; - float y = pos.y*cs - pos.z*sn + u_center; + float y = pos.y*cs - pos.z*sn; // + u_center; pos.z = pos.y*sn + pos.z*cs; pos.y = y; @@ -85,11 +82,7 @@ void main(void) cs = cos(angle); sn = sin(angle); rotMat = mat3( vec3( 1.0, 0.0, 0.0 ), vec3( 0.0, cs, sn ), vec3( 0.0, -sn, cs ) ); pt2 = rotMat * pt2; - pt0.y += u_center; pt1.y += u_center; pt2.y += u_center; - //vec4 nrm = u_projMatrix * u_mvMatrix * vec4( cross(pt1-pt0, pt2-pt0), 1.0 ); vec4 nrm = vec4( cross(pt1-pt0, pt2-pt0), 1.0 ); - - //v_zNormal = normal.y*sn + normal.z*cs; v_zNormal = -nrm.z; } -- cgit v1.2.3 From 129b5282ef35f320ea39d1878d2b5f77ae73a3e2 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 29 May 2012 14:36:59 -0700 Subject: Fixed authortime & runtime for twist vertex shader. --- assets/canvas-runtime.js | 3305 ++++++++++++++++++++++++---------------------- 1 file changed, 1690 insertions(+), 1615 deletions(-) (limited to 'assets') diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js index 67d53963..f4bfa0ae 100644 --- a/assets/canvas-runtime.js +++ b/assets/canvas-runtime.js @@ -28,60 +28,60 @@ NinjaCvsRt.initWebGl = function (rootElement, directory) { /////////////////////////////////////////////////////////////////////// NinjaCvsRt.CanvasDataManager = Object.create(Object.prototype, { - loadGLData: { - value: function(root, valueArray, assetPath) { - if (assetPath) - this._assetPath = assetPath.slice(); - - var value = valueArray; - var nWorlds = value.length; - for (var i=0; i= 0.001) - { - var scale = len/sum; - rtnVec = []; - for (i = 0; i