aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials')
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js154
-rw-r--r--js/lib/rdge/materials/cloud-material.js704
-rw-r--r--js/lib/rdge/materials/deform-material.js88
-rw-r--r--js/lib/rdge/materials/flag-material.js160
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js60
-rw-r--r--js/lib/rdge/materials/fly-material.js136
-rw-r--r--js/lib/rdge/materials/julia-material.js128
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js136
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js214
-rw-r--r--js/lib/rdge/materials/mandel-material.js130
-rwxr-xr-xjs/lib/rdge/materials/material-parser.js4
-rwxr-xr-xjs/lib/rdge/materials/material.js574
-rw-r--r--js/lib/rdge/materials/plasma-material.js160
-rw-r--r--js/lib/rdge/materials/pulse-material.js308
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js84
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js170
-rw-r--r--js/lib/rdge/materials/relief-tunnel-material.js84
-rw-r--r--js/lib/rdge/materials/square-tunnel-material.js84
-rw-r--r--js/lib/rdge/materials/star-material.js100
-rw-r--r--js/lib/rdge/materials/taper-material.js56
-rw-r--r--js/lib/rdge/materials/tunnel-material.js86
-rw-r--r--js/lib/rdge/materials/twist-material.js84
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js290
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js262
-rw-r--r--js/lib/rdge/materials/water-material.js272
-rw-r--r--js/lib/rdge/materials/z-invert-material.js102
26 files changed, 2315 insertions, 2315 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js
index 3db3df1d..bcc092f9 100755
--- a/js/lib/rdge/materials/bump-metal-material.js
+++ b/js/lib/rdge/materials/bump-metal-material.js
@@ -40,62 +40,62 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
40 /////////////////////////////////////////////////////////////////////// 40 ///////////////////////////////////////////////////////////////////////
41 // Instance variables 41 // Instance variables
42 /////////////////////////////////////////////////////////////////////// 42 ///////////////////////////////////////////////////////////////////////
43 this._name = "Bump Metal"; 43 this._name = "Bump Metal";
44 this._shaderName = "bumpMetal"; 44 this._shaderName = "bumpMetal";
45 45
46 46
47 this._defaultDiffuseTexture = "assets/images/metal.png"; 47 this._defaultDiffuseTexture = "assets/images/metal.png";
48 this._defaultSpecularTexture = "assets/images/silver.png"; 48 this._defaultSpecularTexture = "assets/images/silver.png";
49 this._defaultNormalTexture = "assets/images/normalMap.png"; 49 this._defaultNormalTexture = "assets/images/normalMap.png";
50 50
51 // array textures indexed by shader uniform name 51 // array textures indexed by shader uniform name
52 this._glTextures = []; 52 this._glTextures = [];
53 53
54 this._speed = 1.0; 54 this._speed = 1.0;
55 55
56 /////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////
57 // Property Accessors 57 // Property Accessors
58 /////////////////////////////////////////////////////////////////////// 58 ///////////////////////////////////////////////////////////////////////
59 this.isAnimated = function() { return true; }; 59 this.isAnimated = function() { return true; };
60 this.getShaderDef = function() { return bumpMetalMaterialDef; }; 60 this.getShaderDef = function() { return bumpMetalMaterialDef; };
61 61
62 /////////////////////////////////////////////////////////////////////// 62 ///////////////////////////////////////////////////////////////////////
63 // Material Property Accessors 63 // Material Property Accessors
64 /////////////////////////////////////////////////////////////////////// 64 ///////////////////////////////////////////////////////////////////////
65 this._propNames = ["u_light0Diff", "u_colMap", "u_normalMap", "u_glowMap" ]; 65 this._propNames = ["u_light0Diff", "u_colMap", "u_normalMap", "u_glowMap" ];
66 this._propLabels = ["Diffuse Color", "Diffuse Map", "Bump Map", "Specular Map" ]; 66 this._propLabels = ["Diffuse Color", "Diffuse Map", "Bump Map", "Specular Map" ];
67 this._propTypes = ["color", "file", "file", "file" ]; 67 this._propTypes = ["color", "file", "file", "file" ];
68 this._propValues = []; 68 this._propValues = [];
69 69
70 this._propValues[ this._propNames[0] ] = [0.3, 0.3, 0.3, 1.0]; 70 this._propValues[ this._propNames[0] ] = [0.3, 0.3, 0.3, 1.0];
71 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0); 71 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0);
72 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0); 72 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0);
73 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0); 73 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0);
74 74
75 75
76 /////////////////////////////////////////////////////////////////////// 76 ///////////////////////////////////////////////////////////////////////
77 // Methods 77 // Methods
78 /////////////////////////////////////////////////////////////////////// 78 ///////////////////////////////////////////////////////////////////////
79 79
80 this.init = function( world ) 80 this.init = function( world )
81 { 81 {
82 // save the world 82 // save the world
83 if (world) { 83 if (world) {
84 this.setWorld( world ); 84 this.setWorld( world );
85 } 85 }
86 86
87 // set up the shader 87 // set up the shader
88 this._shader = new RDGE.jshader(); 88 this._shader = new RDGE.jshader();
89 this._shader.def = bumpMetalMaterialDef; 89 this._shader.def = bumpMetalMaterialDef;
90 this._shader.init(); 90 this._shader.init();
91 91
92 // set up the material node 92 // set up the material node
93 this._materialNode = RDGE.createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() ); 93 this._materialNode = RDGE.createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() );
94 this._materialNode.setShader(this._shader); 94 this._materialNode.setShader(this._shader);
95 95
96 this.setShaderValues(); 96 this.setShaderValues();
97 this.update(0); 97 this.update(0);
98 }; 98 };
99}; 99};
100 100
101/////////////////////////////////////////////////////////////////////////////////////// 101///////////////////////////////////////////////////////////////////////////////////////
@@ -104,28 +104,28 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
104// shader spec (can also be loaded from a .JSON file, or constructed at runtime) 104// shader spec (can also be loaded from a .JSON file, or constructed at runtime)
105var bumpMetalMaterialDef = bumpMetalShaderDef = 105var bumpMetalMaterialDef = bumpMetalShaderDef =
106{ 106{
107 'shaders': 107 'shaders':
108 { 108 {
109 // this shader is being referenced by file 109 // this shader is being referenced by file
110 'defaultVShader':"assets/shaders/test_vshader.glsl", 110 'defaultVShader':"assets/shaders/test_vshader.glsl",
111 'defaultFShader':"assets/shaders/test_fshader.glsl", 111 'defaultFShader':"assets/shaders/test_fshader.glsl",
112 112
113 // this shader is inline 113 // this shader is inline
114 'dirLightVShader': "\ 114 'dirLightVShader': "\
115 uniform mat4 u_mvMatrix;\ 115 uniform mat4 u_mvMatrix;\
116 uniform mat4 u_normalMatrix;\ 116 uniform mat4 u_normalMatrix;\
117 uniform mat4 u_projMatrix;\ 117 uniform mat4 u_projMatrix;\
118 uniform mat4 u_worldMatrix;\ 118 uniform mat4 u_worldMatrix;\
119 attribute vec3 a_pos;\ 119 attribute vec3 a_pos;\
120 attribute vec3 a_nrm;\ 120 attribute vec3 a_nrm;\
121 varying vec3 vNormal;\ 121 varying vec3 vNormal;\
122 varying vec3 vPos;\ 122 varying vec3 vPos;\
123 void main() {\ 123 void main() {\
124 vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\ 124 vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\
125 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ 125 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\
126 vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\ 126 vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\
127 }", 127 }",
128 'dirLightFShader': "\ 128 'dirLightFShader': "\
129 precision highp float;\ 129 precision highp float;\
130 uniform vec4 u_light1Diff;\ 130 uniform vec4 u_light1Diff;\
131 uniform vec3 u_light1Pos;\ 131 uniform vec3 u_light1Pos;\
@@ -142,29 +142,29 @@ var bumpMetalMaterialDef = bumpMetalShaderDef =
142 float alpha2 = max(0.0, 1.0 - ( (light2.x*light2.x)/range + (light2.y*light2.y)/range + (light2.z*light2.z)/range));\ 142 float alpha2 = max(0.0, 1.0 - ( (light2.x*light2.x)/range + (light2.y*light2.y)/range + (light2.z*light2.z)/range));\
143 gl_FragColor = vec4((u_light2Diff*alpha2 + u_light1Diff*alpha1).rgb, 1.0);\ 143 gl_FragColor = vec4((u_light2Diff*alpha2 + u_light1Diff*alpha1).rgb, 1.0);\
144 }" 144 }"
145 }, 145 },
146 'techniques': 146 'techniques':
147 { 147 {
148 'default': 148 'default':
149 [ 149 [
150 { 150 {
151 'vshader' : 'defaultVShader', 151 'vshader' : 'defaultVShader',
152 'fshader' : 'defaultFShader', 152 'fshader' : 'defaultFShader',
153 // attributes 153 // attributes