diff options
68 files changed, 2317 insertions, 512 deletions
diff --git a/assets/shaders/plasma.frag.glsl b/assets/shaders/plasma.frag.glsl index 2ab8f49c..248288a6 100644 --- a/assets/shaders/plasma.frag.glsl +++ b/assets/shaders/plasma.frag.glsl | |||
@@ -22,11 +22,9 @@ void main(void) | |||
22 | { | 22 | { |
23 | float x = v_uv.x ; | 23 | float x = v_uv.x ; |
24 | float y = v_uv.y ; | 24 | float y = v_uv.y ; |
25 | float time = color.x; | 25 | float time = u_time; |
26 | float wave = (cos(time + y / 0.2 + cos(x / 0.3 + cos((y / 0.1))))); | 26 | float wave = (cos(time + y / 0.2 + cos(x / 0.3 + cos((y / 0.1))))); |
27 | float wave1 = (sin(abs(wave + y/0.6))); | 27 | float wave1 = (sin(abs(wave + y/0.6))); |
28 | float wave2 = (sin(abs(wave1 + y/0.8))); | 28 | float wave2 = (sin(abs(wave1 + y/0.8))); |
29 | float tmp = u_time * 0.1; | ||
30 | gl_FragColor = vec4( abs(vec3(wave2,wave1,wave)),1.0); | 29 | gl_FragColor = vec4( abs(vec3(wave2,wave1,wave)),1.0); |
31 | //gl_FragColor = color; | ||
32 | } | 30 | } |
diff --git a/js/document/html-document.js b/js/document/html-document.js index b9b68972..05c7d6c0 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -8,7 +8,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
8 | // | 8 | // |
9 | var Montage = require("montage/core/core").Montage, | 9 | var Montage = require("montage/core/core").Montage, |
10 | TextDocument = require("js/document/text-document").TextDocument, | 10 | TextDocument = require("js/document/text-document").TextDocument, |
11 | NJUtils = require("js/lib/NJUtils").NJUtils; | 11 | NJUtils = require("js/lib/NJUtils").NJUtils, |
12 | CanvasDataManager = require("js/lib/rdge/runtime/CanvasDataManager").CanvasDataManager, | ||
13 | GLWorld = require("js/lib/drawing/world").World; | ||
12 | //////////////////////////////////////////////////////////////////////// | 14 | //////////////////////////////////////////////////////////////////////// |
13 | // | 15 | // |
14 | exports.HTMLDocument = Montage.create(TextDocument, { | 16 | exports.HTMLDocument = Montage.create(TextDocument, { |
@@ -206,13 +208,113 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
206 | var elt = this.documentRoot; | 208 | var elt = this.documentRoot; |
207 | if (elt) | 209 | if (elt) |
208 | { | 210 | { |
209 | console.log( "load canvas data: " , value ); | 211 | // FOR JOSE: The following commented out lines are what the runtime |
210 | var cdm = new CanvasDataManager(); | 212 | // version should execute. |
211 | cdm.loadGLData(elt, value); | 213 | // var loadForRuntime = true; |
214 | // if (loadForRuntime) | ||
215 | // { | ||
216 | // var cdm = new CanvasDataManager(); | ||
217 | // cdm.loadGLData(elt, value ); | ||
218 | // } | ||
219 | // else | ||
220 | { | ||
221 | var nWorlds= value.length; | ||
222 | for (var i=0; i<nWorlds; i++) | ||
223 | { | ||
224 | var importStr = value[i]; | ||
225 | var startIndex = importStr.indexOf( "id: " ); | ||
226 | if (startIndex >= 0) | ||
227 | { | ||
228 | var endIndex = importStr.indexOf( "\n", startIndex ); | ||
229 | if (endIndex > 0) | ||
230 | { | ||
231 | var id = importStr.substring( startIndex+4, endIndex ); | ||
232 | if (id) | ||
233 | { | ||
234 | var canvas = this.findCanvasWithID( id, elt ); | ||
235 | if (canvas) | ||
236 | { | ||
237 | if (!canvas.elementModel) | ||
238 | { | ||
239 | NJUtils.makeElementModel(canvas, "Canvas", "shape", true); | ||
240 | } | ||
241 | |||
242 | if (canvas.elementModel) | ||
243 | { | ||
244 | if (canvas.elementModel.shapeModel.GLWorld) | ||
245 | canvas.elementModel.shapeModel.GLWorld.clearTree(); | ||
246 | |||
247 | var index = importStr.indexOf( "webGL: " ); | ||
248 | var useWebGL = (index >= 0) | ||
249 | var world = new GLWorld( canvas, useWebGL ); | ||
250 | world.import( importStr ); | ||
251 | |||
252 | this.buildShapeModel( canvas.elementModel, world ); | ||
253 | } | ||
254 | } | ||
255 | } | ||
256 | } | ||
257 | } | ||
258 | } | ||
259 | } | ||
212 | } | 260 | } |
213 | } | 261 | } |
214 | }, | 262 | }, |
215 | 263 | ||
264 | buildShapeModel: | ||
265 | { | ||
266 | value: function( elementModel, world ) | ||
267 | { | ||
268 | var shapeModel = elementModel.shapeModel; | ||
269 | shapeModel.shapeCount = 1; // for now... | ||
270 | shapeModel.useWebGl = world._useWebGL; | ||
271 | shapeModel.GLWorld = world; | ||
272 | var root = world.getGeomRoot(); | ||
273 | if (root) | ||
274 | { | ||
275 | shapeModel.GLGeomObj = root; | ||