aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-09 14:35:44 -0700
committerValerio Virgillito2012-07-09 14:35:44 -0700
commit84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch)
tree3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/lib/rdge
parentc0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff)
parent40c6eb2c06b34f65a74d59ef9687251952858bab (diff)
downloadninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts: js/components/gradientpicker.reel/gradientpicker.js js/components/tools-properties/text-properties.reel/text-properties.js js/document/views/base.js js/document/views/design.js js/helper-classes/3D/StageLine.js js/helper-classes/3D/draw-utils.js js/lib/drawing/world.js js/lib/geom/circle.js js/lib/geom/line.js js/lib/geom/rectangle.js js/lib/geom/shape-primitive.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/flag-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/water-material.js js/panels/Materials/materials-library-panel.reel/materials-library-panel.html js/panels/Materials/materials-library-panel.reel/materials-library-panel.js js/panels/Materials/materials-popup.reel/materials-popup.html js/panels/Materials/materials-popup.reel/materials-popup.js js/tools/LineTool.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/lib/rdge')
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js164
-rw-r--r--js/lib/rdge/materials/cloud-material.js708
-rw-r--r--js/lib/rdge/materials/deform-material.js92
-rw-r--r--js/lib/rdge/materials/flag-material.js156
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js64
-rw-r--r--js/lib/rdge/materials/fly-material.js142
-rw-r--r--js/lib/rdge/materials/julia-material.js132
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js142
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js218
-rw-r--r--js/lib/rdge/materials/mandel-material.js136
-rwxr-xr-xjs/lib/rdge/materials/material-parser.js4
-rwxr-xr-xjs/lib/rdge/materials/material.js534
-rw-r--r--js/lib/rdge/materials/plasma-material.js166
-rw-r--r--js/lib/rdge/materials/pulse-material.js312
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js84
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js166
-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.js60
-rw-r--r--js/lib/rdge/materials/tunnel-material.js90
-rw-r--r--js/lib/rdge/materials/twist-material.js84
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js288
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js266
-rw-r--r--js/lib/rdge/materials/water-material.js274
-rw-r--r--js/lib/rdge/materials/z-invert-material.js102
-rw-r--r--js/lib/rdge/texture.js608
27 files changed, 2630 insertions, 2630 deletions
diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js
index 97efe441..044dc59b 100755
--- a/js/lib/rdge/materials/bump-metal-material.js
+++ b/js/lib/rdge/materials/bump-metal-material.js
@@ -40,63 +40,63 @@ 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._defaultLightDiff = [0.3, 0.3, 0.3, 1.0]; 47 this._defaultLightDiff = [0.3, 0.3, 0.3, 1.0];
48 this._defaultDiffuseTexture = "assets/images/metal.png"; 48 this._defaultDiffuseTexture = "assets/images/metal.png";
49 this._defaultSpecularTexture = "assets/images/silver.png"; 49 this._defaultSpecularTexture = "assets/images/silver.png";
50 this._defaultNormalTexture = "assets/images/normalMap.png"; 50 this._defaultNormalTexture = "assets/images/normalMap.png";
51 51
52 // array textures indexed by shader uniform name 52 // array textures indexed by shader uniform name
53 this._glTextures = []; 53 this._glTextures = [];
54 54
55 this._speed = 1.0; 55 this._speed = 1.0;
56 56
57 /////////////////////////////////////////////////////////////////////// 57 ///////////////////////////////////////////////////////////////////////
58 // Property Accessors 58 // Property Accessors
59 /////////////////////////////////////////////////////////////////////// 59 ///////////////////////////////////////////////////////////////////////
60 this.isAnimated = function() { return true; }; 60 this.isAnimated = function() { return true; };
61 this.getShaderDef = function() { return bumpMetalMaterialDef; }; 61 this.getShaderDef = function() { return bumpMetalMaterialDef; };
62 62
63 /////////////////////////////////////////////////////////////////////// 63 ///////////////////////////////////////////////////////////////////////
64 // Material Property Accessors 64 // Material Property Accessors
65 /////////////////////////////////////////////////////////////////////// 65 ///////////////////////////////////////////////////////////////////////
66 this._propNames = ["u_light0Diff", "u_colMap", "u_normalMap", "u_glowMap" ]; 66 this._propNames = ["u_light0Diff", "u_colMap", "u_normalMap", "u_glowMap" ];
67 this._propLabels = ["Diffuse Color", "Diffuse Map", "Bump Map", "Specular Map" ]; 67 this._propLabels = ["Diffuse Color", "Diffuse Map", "Bump Map", "Specular Map" ];
68 this._propTypes = ["color", "file", "file", "file" ]; 68 this._propTypes = ["color", "file", "file", "file" ];
69 this._propValues = []; 69 this._propValues = [];
70 70
71 this._propValues[ this._propNames[0] ] = this._defaultLightDiff; 71 this._propValues[ this._propNames[0] ] = this._defaultLightDiff;
72 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0); 72 this._propValues[ this._propNames[1] ] = this._defaultDiffuseTexture.slice(0);
73 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0); 73 this._propValues[ this._propNames[2] ] = this._defaultNormalTexture.slice(0);
74 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0); 74 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0);
75 75
76 76
77 /////////////////////////////////////////////////////////////////////// 77 ///////////////////////////////////////////////////////////////////////
78 // Methods 78 // Methods
79 /////////////////////////////////////////////////////////////////////// 79 ///////////////////////////////////////////////////////////////////////
80 80
81 this.init = function( world ) 81 this.init = function( world )
82 { 82 {
83 // save the world 83 // save the world
84 if (world) { 84 if (world) {
85 this.setWorld( world ); 85 this.setWorld( world );
86 } 86 }
87 87
88 // set up the shader 88 // set up the shader
89 this._shader = new RDGE.jshader(); 89 this._shader = new RDGE.jshader();
90 this._shader.def = bumpMetalMaterialDef; 90 this._shader.def = bumpMetalMaterialDef;
91 this._shader.init(); 91 this._shader.init();
92 92
93 // set up the material node 93 // set up the material node
94 this._materialNode = RDGE.createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() ); 94 this._materialNode = RDGE.createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() );
95 this._materialNode.setShader(this._shader); 95 this._materialNode.setShader(this._shader);
96 96
97 this.setShaderValues(); 97 this.setShaderValues();
98 this.update(0); 98 this.update(0);
99 }; 99 };
100 100
101 this.resetToDefault = function() 101 this.resetToDefault = function()
102 { 102 {
@@ -106,38 +106,38 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
106 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0); 106 this._propValues[ this._propNames[3] ] = this._defaultSpecularTexture.slice(0);
107 for (var i=0; i<4; i++) 107 for (var i=0; i<4; i++)
108 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] ); 108 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
109 }; 109};
110}; 110};
111 111
112 112
113/////////////////////////////////////////////////////////////////////////////////////// 113///////////////////////////////////////////////////////////////////////////////////////
114// RDGE shader 114// RDGE shader
115 115
116// shader spec (can also be loaded from a .JSON file, or constructed at runtime) 116// shader spec (can also be loaded from a .JSON file, or constructed at runtime)
117var bumpMetalMaterialDef = bumpMetalShaderDef = 117var bumpMetalMaterialDef = bumpMetalShaderDef =
118{ 118{
119 'shaders': 119 'shaders':
120 { 120 {
121 // this shader is being referenced by file 121 // this shader is being referenced by file
122 'defaultVShader':"assets/shaders/test_vshader.glsl", 122 'defaultVShader':"assets/shaders/test_vshader.glsl",
123 'defaultFShader':"assets/shaders/test_fshader.glsl", 123 'defaultFShader':"assets/shaders/test_fshader.glsl",
124 124
125 // this shader is inline 125 // this shader is inline
126 'dirLightVShader': "\ 126 'dirLightVShader': "\
127 uniform mat4 u_mvMatrix;\ 127 uniform mat4 u_mvMatrix;\
128 uniform mat4 u_normalMatrix;\ 128 uniform mat4 u_normalMatrix;\
129 uniform mat4 u_projMatrix;\ 129 uniform mat4 u_projMatrix;\
130 uniform mat4 u_worldMatrix;\ 130 uniform mat4 u_worldMatrix;\
131 attribute vec3 a_pos;\ 131 attribute vec3 a_pos;\
132 attribute vec3 a_nrm;\ 132 attribute vec3 a_nrm;\
133 varying vec3 vNormal;\ 133 varying vec3 vNormal;\
134 varying vec3 vPos;\ 134 varying vec3 vPos;\
135 void main() {\ 135 void main() {\
136 vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\ 136 vNormal.xyz = (u_normalMatrix*vec4(a_nrm, 0.0)).xyz;\
137 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ 137 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\
138 vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\ 138 vPos = (u_worldMatrix * vec4(a_pos,1.0)).xyz;\
139 }", 139 }",
140 'dirLightFShader': "\ 140 'dirLightFShader': "\
141 precision highp float;\ 141 precision highp float;\
142 uniform vec4 u_light1Diff;\ 142 uniform vec4 u_light1Diff;\
143 uniform vec3 u_light1Pos;\ 143 uniform vec3 u_light1Pos;\
@@ -154,37 +154,37 @@ var bumpMetalMaterialDef = bumpMetalShaderDef =