aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorEric Guzman2012-06-20 19:42:03 -0700
committerEric Guzman2012-06-20 19:42:03 -0700
commit3270aac4980c908f305fb53abadda5121ff6b9cb (patch)
tree6255aaab239fde71b1f4862dd70de7be62f48b85 /assets
parenta5d93daf6fdccbfee160d6a8ba08f6b6d4b9d7cc (diff)
parent87377c81da06abf6d656017859830a3ab2902f0e (diff)
downloadninja-3270aac4980c908f305fb53abadda5121ff6b9cb.tar.gz
Merge branch 'binding' of github.com:dhg637/ninja-internal into binding
Diffstat (limited to 'assets')
-rw-r--r--assets/canvas-runtime.js3452
-rw-r--r--assets/descriptor.json2
-rw-r--r--assets/images/CL13.pngbin0 -> 40537 bytes
-rw-r--r--assets/images/cloud10.pngbin0 -> 58580 bytes
-rw-r--r--assets/images/us_flag.pngbin0 -> 9946 bytes
-rwxr-xr-xassets/shaders/Basic.vert.glsl3
-rw-r--r--assets/shaders/BasicTex.frag.glsl19
-rw-r--r--assets/shaders/Cloud.frag.glsl23
-rw-r--r--assets/shaders/Cloud.vert.glsl51
-rw-r--r--assets/shaders/Deform.frag.glsl3
-rw-r--r--assets/shaders/Flag.frag.glsl20
-rw-r--r--assets/shaders/Flag.vert.glsl32
-rw-r--r--assets/shaders/Fly.frag.glsl5
-rw-r--r--assets/shaders/Julia.frag.glsl3
-rw-r--r--assets/shaders/Keleidoscope.frag.glsl8
-rw-r--r--assets/shaders/Mandel.frag.glsl9
-rw-r--r--assets/shaders/Pulse.frag.glsl12
-rw-r--r--assets/shaders/ReliefTunnel.frag.glsl7
-rw-r--r--assets/shaders/SquareTunnel.frag.glsl3
-rw-r--r--assets/shaders/Star.frag.glsl11
-rw-r--r--assets/shaders/Taper.vert.glsl2
-rw-r--r--assets/shaders/Tunnel.frag.glsl3
-rw-r--r--assets/shaders/Twist.frag.glsl7
-rw-r--r--assets/shaders/TwistVert.frag.glsl1
-rw-r--r--assets/shaders/TwistVert.vert.glsl11
-rw-r--r--assets/shaders/Water2.frag.glsl30
-rw-r--r--assets/shaders/ZInvert.frag.glsl7
-rw-r--r--assets/shaders/plasma.frag.glsl16
-rw-r--r--assets/shaders/radialBlur.frag.glsl5
-rwxr-xr-xassets/shaders/test_fshader.glsl2
30 files changed, 2132 insertions, 1615 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index 6268f0bb..13b36540 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -56,60 +56,64 @@ NinjaCvsRt.initWebGl = function (rootElement, directory, data) {
56/////////////////////////////////////////////////////////////////////// 56///////////////////////////////////////////////////////////////////////
57NinjaCvsRt.CanvasDataManager = Object.create(Object.prototype, { 57NinjaCvsRt.CanvasDataManager = Object.create(Object.prototype, {
58 58
59 loadGLData: { 59 loadGLData: {
60 value: function(root, valueArray, assetPath) { 60 value: function(root, valueArray, assetPath) {
61 if (assetPath) 61 if (assetPath)
62 this._assetPath = assetPath.slice(); 62 this._assetPath = assetPath.slice();
63 63
64 var value = valueArray; 64 var value = valueArray;
65 var nWorlds = value.length; 65 var nWorlds = value.length;
66 for (var i=0; i<nWorlds; i++) 66 for (var i=0; i<nWorlds; i++)
67 { 67 {
68 var importStr = value[i]; 68 var importStr = value[i];
69 69
70 // there should be some version information in 70 // there should be some version information in
71 // the form of 'v0.0;' Pull that off. (the trailing ';' should 71 // the form of 'v0.0;' Pull that off. (the trailing ';' should
72 // be in the first 24 characters). 72 // be in the first 24 characters).
73 var index = importStr.indexOf( ';' ); 73 var index = importStr.indexOf( ';' );
74 if ((importStr[0] === 'v') && (index < 24)) 74 if ((importStr[0] === 'v') && (index < 24))
75 { 75 {
76 // JSON format. pull off the version info 76 // JSON format. pull off the version info
77 importStr = importStr.substr( index+1 ); 77 importStr = importStr.substr( index+1 );
78 78
79 var jObj = JSON.parse( importStr ); 79 var jObj = JSON.parse( importStr );
80 var id = jObj.id; 80 var id = jObj.id;
81 if (id) 81 if (id)
82 { 82 {
83 var canvas = this.findCanvasWithID( id, root ); 83 var canvas = this.findCanvasWithID( id, root );
84 if (canvas) 84 if (canvas)
85 { 85 {
86// new NinjaCvsRt.GLRuntime( canvas, jObj, assetPath ); 86// new NinjaCvsRt.GLRuntime( canvas, jObj, assetPath );
87 var glRt = Object.create(NinjaCvsRt.GLRuntime, {}); 87 var glRt = Object.create(NinjaCvsRt.GLRuntime, {});
88 glRt.renderWorld(canvas, jObj, this._assetPath); 88 glRt.renderWorld(canvas, jObj, this._assetPath);
89 } 89 }
90 } 90 else
91 } 91 {
92 } 92 console.log( "***** COULD NOT FIND CANVAS WITH ID " + id + " *****" );
93 } 93 }
94 }, 94 }
95 95 }
96 findCanvasWithID: { 96 }
97 value: function(id, elt) { 97 }
98 var cid = elt.getAttribute( "data-RDGE-id" ); 98 },
99 if (cid == id) return elt; 99
100 100 findCanvasWithID: {
101 if (elt.children) 101 value: function(id, elt) {
102 { 102 var cid = elt.getAttribute( "data-RDGE-id" );
103 var nKids = elt.children.length; 103 if (cid == id) return elt;
104 for (var i=0; i<nKids; i++) 104
105 { 105 if (elt.children)
106 var child = elt.children[i]; 106 {
107 var foundElt = this.findCanvasWithID( id, child ); 107 var nKids = elt.children.length;
108 if (foundElt) return foundElt; 108 for (var i=0; i<nKids; i++)
109 } 109 {
110 } 110 var child = elt.children[i];
111 } 111 var foundElt = this.findCanvasWithID( id, child );
112 } 112 if (foundElt) return foundElt;
113 }
114 }
115 }
116 }
113}); 117});
114 118
115/////////////////////////////////////////////////////////////////////// 119///////////////////////////////////////////////////////////////////////
@@ -117,266 +121,266 @@ NinjaCvsRt.CanvasDataManager = Object.create(Object.prototype, {
117// Manages runtime fora WebGL canvas 121// Manages runtime fora WebGL canvas
118/////////////////////////////////////////////////////////////////////// 122///////////////////////////////////////////////////////////////////////
119NinjaCvsRt.GLRuntime = Object.create(Object.prototype, { 123NinjaCvsRt.GLRuntime = Object.create(Object.prototype, {
120 /////////////////////////////////////////////////////////////////////// 124 ///////////////////////////////////////////////////////////////////////
121 // Instance variables 125 // Instance variables
122 /////////////////////////////////////////////////////////////////////// 126 ///////////////////////////////////////////////////////////////////////
123 _canvas: { value: null, writable: true }, 127 _canvas: { value: null, writable: true },
124 _context : { value: null, writable: true }, 128 _context : { value: null, writable: true },
125 //this._importStr = importStr; 129 //this._importStr = importStr;
126 _jObj: { value: null, writable: true }, 130 _jObj: { value: null, writable: true },
127 131
128 _renderer: { value: null, writable: true }, 132 _renderer: { value: null, writable: true },
129 myScene: { value: null, writable: true }, 133 myScene: { value: null, writable: true },
130 light: { value: null, writable: true }, 134 light: { value: null, writable: true },
131 light2: { value: null, writable: true }, 135 light2: { value: null, writable: true },
132 _rootNode: { value: null, writable: true }, 136 _rootNode: { value: null, writable: true },
133 137
134 _firstRender: { value: true, writable: true }, 138 _firstRender: { value: true, writable: true },
135 _renderCount: { value: -1, writable: true }, 139 _renderCount: { value: -1, writable: true },
136 _initialized: { value: false, writable: true }, 140 _initialized: { value: false, writable: true },
137 141
138 _useWebGL: { value: false, writable: true }, 142 _useWebGL: { value: false, writable: true },
139 _assetPath: { value: undefined, writable: true }, 143 _assetPath: { value: undefined, writable: true },
140 144
141 // view parameters 145 // view parameters
142 _fov: { value: 45.0, writable: true }, 146 _fov: { value: 45.0, writable: true },
143 _zNear: { value: 0.1, writable: true }, 147 _zNear: { value: 0.1, writable: true },
144 _zFar: { value: 100.0, writable: true }, 148 _zFar: { value: 100.0, writable: true },
145 _viewDist: { value: 5.0, writable: true }, 149 _viewDist: { value: 5.0, writable: true },
146 150
147 elapsed: { value: 0, writable: true }, 151 elapsed: { value: 0, writable: true },
148 152
149 _aspect: { value: 1, writable: true }, 153 _aspect: { value: 1, writable: true },
150 154
151 //this._geomRoot = null; 155 //this._geomRoot = null;
152 _rootChildren: { value: [], writable: true }, 156 _rootChildren: { value: [], writable: true },
153 157
154 // all "live" materials 158 // all "live" materials
155 _materials: { value: [], writable: true }, 159 _materials: { value: [], writable: true },
156 160
157 renderWorld: { 161 renderWorld: {
158 value: function(canvas, jObj, assetPath) { 162 value: function(canvas, jObj, assetPath) {
159 this._materials = []; 163 this._materials = [];
160 this._rootChildren = []; 164 this._rootChildren = [];
161 this._canvas = canvas; 165 this._canvas = canvas;
162 this._aspect = this._canvas.width/this._canvas.height; 166 this._aspect = this._canvas.width/this._canvas.height;
163 167
164 this._jObj= jObj; 168 this._jObj= jObj;
165 169
166 // provide the mapping for the asset directory 170 // provide the mapping for the asset directory
167 if (assetPath) { 171 if (assetPath) {
168