From bb4da39a73cbd6fbe83f3b7c9ed5ae60fe58dd6b Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Wed, 15 Feb 2012 14:23:19 -0800 Subject: Tool Icons : New layout Signed-off-by: Armen Kesablyan --- .../layout/tool-button.reel/tool-button.html | 7 +-- .../layout/tool-button.reel/tool-button.js | 21 ++----- .../layout/tools-list.reel/tools-list.html | 17 +++++- js/data/tools-data.js | 66 +++++++++++----------- 4 files changed, 57 insertions(+), 54 deletions(-) (limited to 'js') diff --git a/js/components/layout/tool-button.reel/tool-button.html b/js/components/layout/tool-button.reel/tool-button.html index 81a9b927..476b66f3 100644 --- a/js/components/layout/tool-button.reel/tool-button.html +++ b/js/components/layout/tool-button.reel/tool-button.html @@ -16,8 +16,7 @@ "module": "js/components/layout/tool-button.reel", "name": "ToolButton", "properties": { - "element": {"#": "buttonBackground"}, - "button": {"#": "toolBarButton"} + "element": {"#": "toolBarButton"} } } } @@ -27,9 +26,7 @@ -
-
-
+
diff --git a/js/components/layout/tool-button.reel/tool-button.js b/js/components/layout/tool-button.reel/tool-button.js index 509512d0..5cb0e7fc 100644 --- a/js/components/layout/tool-button.reel/tool-button.js +++ b/js/components/layout/tool-button.reel/tool-button.js @@ -11,8 +11,6 @@ var defaultEventManager = require("montage/core/event/event-manager").defaultEve exports.ToolButton = Montage.create(Component, { - button: { value: null }, - data: { value: null }, _selected: { value: null }, @@ -64,32 +62,25 @@ exports.ToolButton = Montage.create(Component, { oneway: true }); } + + this.element.classList.add(this.data.id) } }, draw: { enumerable: false, value: function() { - var buttonid; - if(this.data.container) { - buttonid = this.data.subtools[this._subselected].id; this.element.title = this.data.subtools[this._subselected].toolTip; - this.button.classList.remove( this.data.subtools[this._currentSubSelected].id + "Unpressed" ); - this.button.classList.remove( this.data.subtools[this._currentSubSelected].id + "Pressed" ); + this.element.classList.remove(this.data.subtools[this._currentSubSelected].id); + this.element.classList.add(this.data.subtools[this._subselected].id); this._currentSubSelected = this._subselected; - } else { - buttonid = this.data.id; } if(this._selected) { - this.element.classList.add( "buttonSelected" ); - this.button.classList.remove( buttonid + "Unpressed" ); - this.button.classList.add( buttonid + "Pressed" ); + this.element.classList.add("active"); } else { - this.element.classList.remove( "buttonSelected" ); - this.button.classList.remove( buttonid + "Pressed" ); - this.button.classList.add( buttonid + "Unpressed" ); + this.element.classList.remove("active"); } } }, diff --git a/js/components/layout/tools-list.reel/tools-list.html b/js/components/layout/tools-list.reel/tools-list.html index e12fd59b..c47359bf 100644 --- a/js/components/layout/tools-list.reel/tools-list.html +++ b/js/components/layout/tools-list.reel/tools-list.html @@ -25,6 +25,21 @@ } }, + "groupLine": { + "module": "js/components/layout/tool-button.reel", + "name": "ToolButton", + "properties": { + "element": {"#": "groupLine"} + }, + "bindings": { + "data": { + "boundObject": {"@": "repetition1"}, + "boundObjectPropertyPath": "objectAtCurrentIteration", + "oneway": true + } + } + }, + "repetition1": { "module": "montage/ui/repetition.reel", "name": "Repetition", @@ -163,9 +178,9 @@
+
-
diff --git a/js/data/tools-data.js b/js/data/tools-data.js index de965dbc..8356c422 100644 --- a/js/data/tools-data.js +++ b/js/data/tools-data.js @@ -157,39 +157,39 @@ exports.ToolsData = Montage.create(Montage, { "container": false, "selected": false }, - { - "id": "InkBottleTool", - "properties": "inkbottleProperties", - "spriteSheet": true, - "action": "InkBottleTool", - "toolTip": "Ink Bottle Tool", - "cursor": "url('images/tools/inkbottle_down.png'), default", - "lastInGroup": false, - "container": false, - "selected": false - }, - { - "id": "EyedropperTool", - "properties": "eyedropperProperties", - "spriteSheet": true, - "action": "EyedropperTool", - "toolTip": "Eyedropper Tool", - "cursor": "url('images/tools/eyedropper_down.png'), default", - "lastInGroup": false, - "container": false, - "selected": false - }, - { - "id": "EraserTool", - "properties": "eraserProperties", - "spriteSheet": true, - "action": "EraserTool", - "toolTip": "Eraser Tool", - "cursor": "auto", - "lastInGroup": false, - "container": false, - "selected": false - }, +// { +// "id": "InkBottleTool", +// "properties": "inkbottleProperties", +// "spriteSheet": true, +// "action": "InkBottleTool", +// "toolTip": "Ink Bottle Tool", +// "cursor": "url('images/tools/inkbottle_down.png'), default", +// "lastInGroup": false, +// "container": false, +// "selected": false +// }, +// { +// "id": "EyedropperTool", +// "properties": "eyedropperProperties", +// "spriteSheet": true, +// "action": "EyedropperTool", +// "toolTip": "Eyedropper Tool", +// "cursor": "url('images/tools/eyedropper_down.png'), default", +// "lastInGroup": false, +// "container": false, +// "selected": false +// }, +// { +// "id": "EraserTool", +// "properties": "eraserProperties", +// "spriteSheet": true, +// "action": "EraserTool", +// "toolTip": "Eraser Tool", +// "cursor": "auto", +// "lastInGroup": false, +// "container": false, +// "selected": false +// }, { "id": "RotateStageTool3D", "properties": "rotateStageProperties", -- cgit v1.2.3 From 92873714dd6ffb259e6c5a27da2ade773d7b00f9 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Wed, 15 Feb 2012 15:04:37 -0800 Subject: New Icons: Last set had imperfections Signed-off-by: Armen Kesablyan --- .../layout/tools-list.reel/tools-list.html | 12 ++++++---- js/data/tools-data.js | 28 +++++++++++----------- 2 files changed, 21 insertions(+), 19 deletions(-) (limited to 'js') diff --git a/js/components/layout/tools-list.reel/tools-list.html b/js/components/layout/tools-list.reel/tools-list.html index c47359bf..2c5617e5 100644 --- a/js/components/layout/tools-list.reel/tools-list.html +++ b/js/components/layout/tools-list.reel/tools-list.html @@ -26,15 +26,15 @@ }, "groupLine": { - "module": "js/components/layout/tool-button.reel", - "name": "ToolButton", + "module": "montage/ui/condition.reel", + "name": "Condition", "properties": { "element": {"#": "groupLine"} }, "bindings": { - "data": { + "condition": { "boundObject": {"@": "repetition1"}, - "boundObjectPropertyPath": "objectAtCurrentIteration", + "boundObjectPropertyPath": "objectAtCurrentIteration.lastInGroup", "oneway": true } } @@ -178,7 +178,9 @@
-
+
+
+
diff --git a/js/data/tools-data.js b/js/data/tools-data.js index 8356c422..4847fa7c 100644 --- a/js/data/tools-data.js +++ b/js/data/tools-data.js @@ -28,7 +28,7 @@ exports.ToolsData = Montage.create(Montage, { "action": "SubselectionTool", "toolTip": "Subselect Tool", "cursor": "auto", - "lastInGroup": false, + "lastInGroup": true, "container": false, "selected": false }, @@ -153,7 +153,7 @@ exports.ToolsData = Montage.create(Montage, { "action": "FillTool", "toolTip": "Fill Tool", "cursor": "url('images/tools/bucket_down.png'), default", - "lastInGroup": false, + "lastInGroup": true, "container": false, "selected": false }, @@ -168,17 +168,17 @@ exports.ToolsData = Montage.create(Montage, { // "container": false, // "selected": false // }, -// { -// "id": "EyedropperTool", -// "properties": "eyedropperProperties", -// "spriteSheet": true, -// "action": "EyedropperTool", -// "toolTip": "Eyedropper Tool", -// "cursor": "url('images/tools/eyedropper_down.png'), default", -// "lastInGroup": false, -// "container": false, -// "selected": false -// }, + { + "id": "EyedropperTool", + "properties": "eyedropperProperties", + "spriteSheet": true, + "action": "EyedropperTool", + "toolTip": "Eyedropper Tool", + "cursor": "url('images/tools/eyedropper_down.png'), default", + "lastInGroup": false, + "container": false, + "selected": false + }, // { // "id": "EraserTool", // "properties": "eraserProperties", @@ -219,7 +219,7 @@ exports.ToolsData = Montage.create(Montage, { "action": "ZoomTool", "toolTip": "Zoom Tool (Z)", "cursor": "url('images/cursors/zoom.png'),default", - "lastInGroup": false, + "lastInGroup": true, "container": false, "selected": false } -- cgit v1.2.3 From 7e08bdbd9db21880783b56a31b480ba33f3b5327 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Thu, 16 Feb 2012 11:33:18 -0800 Subject: Tool Button Fixes Signed-off-by: Armen Kesablyan --- js/components/layout/subtool-button.reel/subtool-button.html | 7 ++----- js/components/layout/subtool-button.reel/subtool-button.js | 10 +++------- js/ninja.reel/ninja.html | 3 --- 3 files changed, 5 insertions(+), 15 deletions(-) (limited to 'js') diff --git a/js/components/layout/subtool-button.reel/subtool-button.html b/js/components/layout/subtool-button.reel/subtool-button.html index 9dad007d..24fce57c 100644 --- a/js/components/layout/subtool-button.reel/subtool-button.html +++ b/js/components/layout/subtool-button.reel/subtool-button.html @@ -16,8 +16,7 @@ "module": "js/components/layout/subtool-button.reel", "name": "SubToolButton", "properties": { - "element": {"#": "buttonBackground"}, - "button": {"#": "toolBarButton"} + "element": {"#": "toolButton"} } } } @@ -26,9 +25,7 @@ -
-
-
+
diff --git a/js/components/layout/subtool-button.reel/subtool-button.js b/js/components/layout/subtool-button.reel/subtool-button.js index d1adca43..2b066f24 100644 --- a/js/components/layout/subtool-button.reel/subtool-button.js +++ b/js/components/layout/subtool-button.reel/subtool-button.js @@ -35,7 +35,7 @@ exports.SubToolButton = Montage.create(Component, { boundObjectPropertyPath: "selected", oneway: false }); - + this.element.classList.add(this.data.id); } }, @@ -43,13 +43,9 @@ exports.SubToolButton = Montage.create(Component, { enumerable: false, value: function() { if(this._selected) { - this.element.classList.add( "buttonSelected" ); - this.button.classList.remove( this.data.id + "Unpressed" ); - this.button.classList.add( this.data.id + "Pressed" ); + this.element.classList.add("active"); } else { - this.element.classList.remove( "buttonSelected" ); - this.button.classList.remove( this.data.id + "Pressed" ); - this.button.classList.add( this.data.id + "Unpressed" ); + this.element.classList.remove("active"); } } }, diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index c8625159..1db5373e 100644 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -340,9 +340,6 @@
- - -
-- cgit v1.2.3 From 96a0a8c916533eb5625816192ed38488f639326d Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 22 Feb 2012 11:00:20 -0800 Subject: Integrating canvas-2d drawing and WebGL fixes, including adding back WebGL materials. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/RDGE/GLCircle.js | 10 +- js/helper-classes/RDGE/GLLine.js | 594 +++++++++++---------- js/helper-classes/RDGE/GLRectangle.js | 117 +--- js/helper-classes/RDGE/GLWorld.js | 45 +- js/helper-classes/RDGE/Materials/DeformMaterial.js | 133 +++++ js/helper-classes/RDGE/Materials/FlyMaterial.js | 133 +++++ js/helper-classes/RDGE/Materials/JuliaMaterial.js | 150 ++++++ .../RDGE/Materials/KeleidoscopeMaterial.js | 149 ++++++ js/helper-classes/RDGE/Materials/MandelMaterial.js | 151 ++++++ js/helper-classes/RDGE/Materials/PlasmaMaterial.js | 134 +++++ js/helper-classes/RDGE/Materials/PulseMaterial.js | 253 +++++++++ .../RDGE/Materials/RadialBlurMaterial.js | 246 +++++++++ .../RDGE/Materials/ReliefTunnelMaterial.js | 133 +++++ .../RDGE/Materials/SquareTunnelMaterial.js | 133 +++++ js/helper-classes/RDGE/Materials/StarMaterial.js | 133 +++++ js/helper-classes/RDGE/Materials/TaperMaterial.js | 223 ++++++++ js/helper-classes/RDGE/Materials/TunnelMaterial.js | 133 +++++ js/helper-classes/RDGE/Materials/TwistMaterial.js | 149 ++++++ .../RDGE/Materials/TwistVertMaterial.js | 248 +++++++++ js/helper-classes/RDGE/Materials/WaterMaterial.js | 133 +++++ .../RDGE/Materials/ZInvertMaterial.js | 133 +++++ js/helper-classes/RDGE/MaterialsLibrary.js | 59 ++ .../RDGE/src/core/script/precompiled.js | 10 +- js/helper-classes/RDGE/src/core/script/runtime.js | 14 +- .../RDGE/src/core/script/scenegraphNodes.js | 8 +- .../RDGE/src/tools/compile-rdge-core.bat | 4 + .../RDGE/src/tools/compile-rdge-core.sh | 3 + js/helper-classes/RDGE/src/tools/compiler.jar | Bin 0 -> 4927265 bytes js/helper-classes/RDGE/src/tools/rdge-compiled.js | 454 ++++++++++++++++ js/io/ui/cloudpopup.reel/cloudpopup.js | 4 + js/panels/Materials/Materials.xml | 2 +- js/preloader/Preloader.js | 21 +- 32 files changed, 3675 insertions(+), 437 deletions(-) create mode 100644 js/helper-classes/RDGE/Materials/DeformMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/FlyMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/JuliaMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/MandelMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/PlasmaMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/PulseMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/RadialBlurMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/ReliefTunnelMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/SquareTunnelMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/StarMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/TaperMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/TunnelMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/TwistMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/TwistVertMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/WaterMaterial.js create mode 100644 js/helper-classes/RDGE/Materials/ZInvertMaterial.js create mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.bat create mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.sh create mode 100644 js/helper-classes/RDGE/src/tools/compiler.jar create mode 100644 js/helper-classes/RDGE/src/tools/rdge-compiled.js (limited to 'js') diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js index 08057778..5b32547e 100755 --- a/js/helper-classes/RDGE/GLCircle.js +++ b/js/helper-classes/RDGE/GLCircle.js @@ -400,7 +400,10 @@ function GLCircle() ctx.lineWidth = 0; ctx.fillStyle = "#990000"; if (this._fillColor) - ctx.fillStyle = MathUtils.colorToHex( this._fillColor ); + { + var c = "rgba(" + 255*this._fillColor[0] + "," + 255*this._fillColor[1] + "," + 255*this._fillColor[2] + "," + this._fillColor[3] + ")"; + ctx.fillStyle = c; + } // draw the fill ctx.beginPath(); @@ -460,7 +463,10 @@ function GLCircle() ctx.lineWidth = lineWidth; ctx.strokeStyle = "#0000ff"; if (this._strokeColor) - ctx.strokeStyle = MathUtils.colorToHex( this._strokeColor ); + { + var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255*this._strokeColor[2] + "," + this._strokeColor[3] + ")"; + ctx.strokeStyle = c; + } // draw the stroke p = MathUtils.transformPoint( bezPts[0], mat ); diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js index 5ec51230..0d815145 100755 --- a/js/helper-classes/RDGE/GLLine.js +++ b/js/helper-classes/RDGE/GLLine.js @@ -11,74 +11,74 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot /////////////////////////////////////////////////////////////////////// function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj) { - /////////////////////////////////////////////////////////////////////// - // Instance variables - /////////////////////////////////////////////////////////////////////// - this._width = 2.0; - this._height = 2.0; - this._xOffset = 0; - this._yOffset = 0; - - // If line doesn't fit in canvas world, we had to grow the canvas by this much on either side - this._xAdj = 0; - this._yAdj = 0; - - this._slope = 0; + /////////////////////////////////////////////////////////////////////// + // Instance variables + /////////////////////////////////////////////////////////////////////// + this._width = 2.0; + this._height = 2.0; + this._xOffset = 0; + this._yOffset = 0; + + // If line doesn't fit in canvas world, we had to grow the canvas by this much on either side + this._xAdj = 0; + this._yAdj = 0; + + this._slope = 0; - this._strokeWidth = 0.25; + this._strokeWidth = 0.25; - this._strokeStyle = "Solid"; - this._scaleX = 1.0; - this._scaleY = 1.0; + this._strokeStyle = "Solid"; + this._scaleX = 1.0; + this._scaleY = 1.0; - if (arguments.length > 0) - { - this._width = width; - this._height = height; - this._xOffset = xOffset; - this._yOffset = yOffset; + if (arguments.length > 0) + { + this._width = width; + this._height = height; + this._xOffset = xOffset; + this._yOffset = yOffset; - this._xAdj = xAdj; - this._yAdj = yAdj; + this._xAdj = xAdj; + this._yAdj = yAdj; - this._slope = slope; - this._strokeWidth = strokeSize; - this._strokeColor = strokeColor; + this._slope = slope; + this._strokeWidth = strokeSize; + this._strokeColor = strokeColor; - this._strokeStyle = strokeStyle; - this._scaleX = (world.getViewportWidth())/(world.getViewportHeight()); - } + this._strokeStyle = strokeStyle; + this._scaleX = (world.getViewportWidth())/(world.getViewportHeight()); + } - this._strokeVerticesLen = 0; + this._strokeVerticesLen = 0; - this.m_world = world; + this.m_world = world; this._materialAmbient = [0.2, 0.2, 0.2, 1.0]; this._materialDiffuse = [0.4, 0.4, 0.4, 1.0]; this._materialSpecular = [0.4, 0.4, 0.4, 1.0]; - // initialize the inherited members - this.inheritedFrom = GLGeomObj; - this.inheritedFrom(); + // initialize the inherited members + this.inheritedFrom = GLGeomObj; + this.inheritedFrom(); - if(strokeMaterial) - { - this._strokeMaterial = strokeMaterial; - } + if(strokeMaterial) + { + this._strokeMaterial = strokeMaterial; + } - /////////////////////////////////////////////////////////////////////// - // Property Accessors - /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + // Property Accessors + /////////////////////////////////////////////////////////////////////// this.getStrokeWidth = function() { return this._strokeWidth; } this.setStrokeWidth = function(w) { this._strokeWidth = w; } this.getStrokeMaterial = function() { return this._strokeMaterial; } this.setStrokeMaterial = function(m) { this._strokeMaterial = m; } - this.getStrokeColor = function() { return this._strokeColor; } + this.getStrokeColor = function() { return this._strokeColor; } //this.setStrokeColor = function(c) { this._strokeColor = c; } - this.getStrokeStyle = function() { return this._strokeStyle; } + this.getStrokeStyle = function() { return this._strokeStyle; } this.setStrokeStyle = function(s) { this._strokeStyle = s; } this.getFillMaterial = function() { return null; } @@ -86,24 +86,24 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro this.setStrokeMaterial = function(m) { this._strokeMaterial = m; } this.getStrokeMaterial = function() { return this._strokeMaterial; } - this.getWidth = function() { return this._width; } + this.getWidth = function() { return this._width; } this.setWidth = function(w) { this._width = w; } this.getHeight = function() { return this._height; } this.setHeight = function(h) { this._height = h; } - this.getXAdj = function() { return this._xAdj; } + this.getXAdj = function() { return this._xAdj; } this.setXAdj = function(x) { this._xAdj = x; } - this.getYAdj = function() { return this._yAdj; } + this.getYAdj = function() { return this._yAdj; } this.setYAdj = function(y) { this._yAdj = y; } - this.getSlope = function() { return this._slope; } + this.getSlope = function() { return this._slope; } this.setSlope = function(m) { this._slope = m; } - this.geomType = function() { return this.GEOM_TYPE_LINE; } + this.geomType = function() { return this.GEOM_TYPE_LINE; } - /////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// this.export = function() @@ -137,14 +137,14 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro this._yOffset = Number( this.getPropertyFromString( "yoff: ", importStr ) ); this._width = Number( this.getPropertyFromString( "width: ", importStr ) ); this._height = Number( this.getPropertyFromString( "height: ", importStr ) ); - this._xAdj = Number( this.getPropertyFromString( "xAdj: ", importStr ) ); - this._yAdj = Number( this.getPropertyFromString( "yAdj: ", importStr ) ); + this._xAdj = Number( this.getPropertyFromString( "xAdj: ", importStr ) ); + this._yAdj = Number( this.getPropertyFromString( "yAdj: ", importStr ) ); this._strokeWidth = Number( this.getPropertyFromString( "strokeWidth: ", importStr ) ); var slope = this.getPropertyFromString( "slope: ", importStr ); - if(isNaN(Number(slope))) - this._slope = slope; - else - this._slope = Number(slope); + if(isNaN(Number(slope))) + this._slope = slope; + else + this._slope = Number(slope); var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr ); this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr ); @@ -160,28 +160,28 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro } - /////////////////////////////////////////////////////////////////////// - // Methods - /////////////////////////////////////////////////////////////////////// - this.buildBuffers = function() - { - // get the world - var world = this.getWorld(); - if (!world) throw( "null world in buildBuffers" ); + /////////////////////////////////////////////////////////////////////// + // Methods + /////////////////////////////////////////////////////////////////////// + this.buildBuffers = function() + { + // get the world + var world = this.getWorld(); + if (!world) throw( "null world in buildBuffers" ); if (!world._useWebGL) return; // make sure RDGE has the correct context g_Engine.setContext( world.getCanvas().uuid ); - // create the gl buffer - var gl = world.getGLContext(); + // create the gl buffer + var gl = world.getGLContext(); - this._strokeVerticesLen = 0; + this._strokeVerticesLen = 0; - var strokeVertices = []; - var strokeTextures = []; - var strokeNormals = []; - var strokeColors = []; + var strokeVertices = []; + var strokeTextures = []; + var strokeNormals = []; + var strokeColors = []; // var scaleMat = Matrix.I(3); // scaleMat.elements[0][0] = this._scaleX; @@ -193,7 +193,7 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro var vpw = world.getViewportWidth(), vph = world.getViewportHeight(); var xNDC = 2*this._xOffset/vpw, yNDC = 2*this._yOffset/vph, xFillNDC = this._width/vpw, yFillNDC = this._height/vph, - xAdjNDC = this._xAdj/vpw, yAdjNDC = this._yAdj/vph, + xAdjNDC = this._xAdj/vpw, yAdjNDC = this._yAdj/vph, xStrokeNDC = this._strokeWidth/vpw, yStrokeNDC = this._strokeWidth/vph; var aspect = world.getAspect(); @@ -218,160 +218,180 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro var xStroke = -z*(r-l)/(2.0*zn)*xStrokeNDC, yStroke = -z*(t-b)/(2.0*zn)*yStrokeNDC; - // get the x & y adjustments size + // get the x & y adjustments size var xAdj = -z*(r-l)/(2.0*zn)*xAdjNDC*2, yAdj = -z*(t-b)/(2.0*zn)*yAdjNDC*2; - this._primArray = []; - this._materialArray = []; + this._primArray = []; + this._materialArray = []; this._materialTypeArray = []; - this._materialNodeArray = []; - - this._scaleX = (world._viewportWidth)/(world._viewportHeight); - - var innerX = xFill-xStroke; - var innerY = yFill-yStroke; - -// if( (this._strokeStyle === "Dashed") || (this._strokeStyle === "Dotted") ) -// { -// var sLen = this.createStippledStrokes(strokeVertices, this._strokeWidth, this._slope, this._strokeStyle, innerX, innerY); -// this._strokeVerticesLen += sLen; -// } -// else - { - if(this._slope === "vertical") - { - strokeVertices = [ - -xFill+x, yFill+y, 0.0, - xFill+x, yFill+y, 0.0, - -xFill+x, -yFill+y, 0.0, - - xFill+x, -yFill+y, 0.0, - -xFill+x, -yFill+y, 0.0, - xFill+x, yFill+y, 0.0 - ]; - } - else if(this._slope === "horizontal") - { - // right now, this is the same as vertical line because, - // our canvas is the same size as us. - // But, we will need to use this when drawing in an existing GLWorld with other shapes - strokeVertices = [ - -xFill+x, yFill+y, 0.0, - xFill+x, yFill+y, 0.0, - -xFill+x, -yFill+y, 0.0, - - xFill+x, -yFill+y, 0.0, - -xFill+x, -yFill+y, 0.0, - xFill+x, yFill+y, 0.0 - ]; - } - else if(this._slope > 0) - { - // if slope is positive, draw a line from top-left to bottom-right - strokeVertices = [ - -xFill+x, yFill-2*yAdj+y, 0.0, - -xFill+2*xAdj+x, yFill+y, 0.0, - xFill-2*xAdj+x, -yFill+y, 0.0, - - xFill+x, -yFill+2*yAdj+y, 0.0, - xFill-2*xAdj+x, -yFill+y, 0.0, - -xFill+2*xAdj+x, yFill+y, 0.0 - ]; - } - else - { - // else slope is negative, draw a line from bottom-left to top-right - strokeVertices = [ - -xFill+x, -yFill+2*yAdj+y, 0.0, - -xFill+2*xAdj+x, -yFill+y, 0.0, - xFill-2*xAdj+x, yFill+y, 0.0, - - xFill+x, yFill-2*yAdj+y, 0.0, - xFill-2*xAdj+x, yFill+y, 0.0, - -xFill+2*xAdj+x, -yFill+y, 0.0 - ]; - } - } - - var z = 0; + this._materialNodeArray = []; + + this._scaleX = (world._viewportWidth)/(world._viewportHeight); + + var innerX = xFill-xStroke; + var innerY = yFill-yStroke; + + if(this._slope === "vertical") + { + strokeVertices = [ + -xFill+x, yFill+y, 0.0, + xFill+x, yFill+y, 0.0, + -xFill+x, -yFill+y, 0.0, + + xFill+x, -yFill+y, 0.0, + -xFill+x, -yFill+y, 0.0, + xFill+x, yFill+y, 0.0 + ]; + + strokeTextures = [ + 0, 1, + 1, 1, + 0, 0, + + 1, 0, + 0, 0, + 1, 1 + ]; + } + else if(this._slope === "horizontal") + { + // right now, this is the same as vertical line because, + // our canvas is the same size as us. + // But, we will need to use this when drawing in an existing GLWorld with other shapes + strokeVertices = [ + -xFill+x, yFill+y, 0.0, + xFill+x, yFill+y, 0.0, + -xFill+x, -yFill+y, 0.0, + + xFill+x, -yFill+y, 0.0, + -xFill+x, -yFill+y, 0.0, + xFill+x, yFill+y, 0.0 + ]; + + strokeTextures = [ + 0, 1, + 1, 1, + 0, 0, + + 1, 0, + 0, 0, + 1, 1 + ]; + } + else if(this._slope > 0) + { + // if slope is positive, draw a line from top-left to bottom-right + strokeVertices = [ + -xFill+x, yFill-2*yAdj+y, 0.0, + -xFill+2*xAdj+x, yFill+y, 0.0, + xFill-2*xAdj+x, -yFill+y, 0.0, + + xFill+x, -yFill+2*yAdj+y, 0.0, + xFill-2*xAdj+x, -yFill+y, 0.0, + -xFill+2*xAdj+x, yFill+y, 0.0 + ]; + + strokeTextures = [ + 0, 0, + 0, 1, + 1, 0, + + 1, 1, + 1, 0, + 0, 1 + ]; + } + else + { + // else slope is negative, draw a line from bottom-left to top-right + strokeVertices = [ + xFill-2*xAdj+x, yFill+y, 0.0, + -xFill+2*xAdj+x, -yFill+y, 0.0, + -xFill+x, -yFill+2*yAdj+y, 0.0, + + -xFill+2*xAdj+x, -yFill+y, 0.0, + xFill-2*xAdj+x, yFill+y, 0.0, + xFill+x, yFill-2*yAdj+y, 0.0 + ]; + + strokeTextures = [ + 1, 1, + 0, 0, + 0, 1, + + 0, 0, + 1, 1, + 1, 0 + ]; + } + + var z = 0; var indices = []; - var nVerts = strokeVertices.length/3; -// for(var i=0; i 0) - { + } + else if(this._slope > 0) + { p0 = [this._xAdj, this._yAdj]; p1 = [w - this._xAdj, h - this._yAdj]; - } - else - { - p0 = [this._xAdj, h - this._yAdj]; + } + else + { + p0 = [this._xAdj, h - this._yAdj]; p1 = [w - this._xAdj, this._yAdj]; } @@ -383,105 +403,105 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro /* - // type is Dotted or Dashed - this.createStippledStrokes = function(strokeVertices, strokeSize, slope, type, innerX, innerY) - { - var stippleLength = strokeSize; - - if (type === "Dotted") - { - stippleLength = this.DOT_LENGTH; - } - else if(type === "Dashed") - { - stippleLength = this.DASH_LENGTH; - } - - var numStrokes = 0; - var startPos = -innerX; - var endPos = innerX; - - var gap = this.GAP_LENGTH; - if(slope === "horizontal") - { - gap *= this._scaleX; - stippleLength *= this._scaleX; - } - else if(slope === "vertical") - { - startPos = -innerY; - endPos = innerY; - } - else - { - if(this._scaleX < 1) - { - startPos = -innerY; - endPos = innerY; - strokeSize = (strokeSize*this._scaleX)/2; + // type is Dotted or Dashed + this.createStippledStrokes = function(strokeVertices, strokeSize, slope, type, innerX, innerY) + { + var stippleLength = strokeSize; + + if (type === "Dotted") + { + stippleLength = this.DOT_LENGTH; + } + else if(type === "Dashed") + { + stippleLength = this.DASH_LENGTH; + } + + var numStrokes = 0; + var startPos = -innerX; + var endPos = innerX; + + var gap = this.GAP_LENGTH; + if(slope === "horizontal") + { + gap *= this._scaleX; + stippleLength *= this._scaleX; + } + else if(slope === "vertical") + { + startPos = -innerY; + endPos = innerY; + } + else + { + if(this._scaleX < 1) + { + startPos = -innerY; + endPos = innerY; + strokeSize = (strokeSize*this._scaleX)/2; // strokeSize *= this._scaleX; - stippleLength *= this._scaleX; - } - else - { - strokeSize = strokeSize/2; - gap *= this._scaleX; - stippleLength *= this._scaleX; - } - - } - - while(startPos + stippleLength < endPos) - { - if(slope === "horizontal") - { - strokeVertices.push(startPos); strokeVertices.push(-strokeSize); strokeVertices.push(0); - strokeVertices.push(startPos); strokeVertices.push(strokeSize); strokeVertices.push(0); - strokeVertices.push(startPos+stippleLength); strokeVertices.push(-strokeSize); strokeVertices.push(0); - - strokeVertices.push(startPos); strokeVertices.push(strokeSize); strokeVertices.push(0); - strokeVertices.push(startPos+stippleLength); strokeVertices.push(-strokeSize); strokeVertices.push(0); - strokeVertices.push(startPos+stippleLength); strokeVertices.push(strokeSize); strokeVertices.push(0); - } - else if(slope === "vertical") - { - strokeVertices.push(-strokeSize); strokeVertices.push(startPos); strokeVertices.push(0); - strokeVertices.push(strokeSize); strokeVertices.push(startPos); strokeVertices.push(0); - strokeVertices.push(-strokeSize); strokeVertices.push(startPos+stippleLength); strokeVertices.push(0); - - strokeVertices.push(strokeSize); strokeVertices.push(startPos); strokeVertices.push(0); - strokeVertices.push(-strokeSize); strokeVertices.push(startPos+stippleLength); strokeVertices.push(0); - strokeVertices.push(strokeSize); strokeVertices.push(startPos+stippleLength); strokeVertices.push(0); - } - else - { - strokeVertices.push(startPos); strokeVertices.push(startPos*-slope-strokeSize); strokeVertices.push(0); - strokeVertices.push(startPos); strokeVertices.push(startPos*-slope+strokeSize); strokeVertices.push(0); - strokeVertices.push(startPos+stippleLength); strokeVertices.push((startPos+stippleLength)*-slope-strokeSize); strokeVertices.push(0); - - strokeVertices.push(startPos); strokeVertices.push(startPos*-slope+strokeSize); strokeVertices.push(0); - strokeVertices.push(startPos+stippleLength); strokeVertices.push((startPos+stippleLength)*-slope-strokeSize); strokeVertices.push(0); - strokeVertices.push(startPos+stippleLength); strokeVertices.push((startPos+stippleLength)*-slope+strokeSize); strokeVertices.push(0); - } - - numStrokes += 6; - - startPos += (stippleLength+gap); - } + stippleLength *= this._scaleX; + } + else + { + strokeSize = strokeSize/2; + gap *= this._scaleX; + stippleLength *= this._scaleX; + } + + } + + while(startPos + stippleLength < endPos) + { + if(slope === "horizontal") + { + strokeVertices.push(startPos); strokeVertices.push(-strokeSize); strokeVertices.push(0); + strokeVertices.push(startPos); strokeVertices.push(strokeSize); strokeVertices.push(0); + strokeVertices.push(startPos+stippleLength); strokeVertices.push(-strokeSize); strokeVertices.push(0); + + strokeVertices.push(startPos); strokeVertices.push(strokeSize); strokeVertices.push(0); + strokeVertices.push(startPos+stippleLength); strokeVertices.push(-strokeSize); strokeVertices.push(0); + strokeVertices.push(startPos+stippleLength); strokeVertices.push(strokeSize); strokeVertices.push(0); + } + else if(slope === "vertical") + { + strokeVertices.push(-strokeSize); strokeVertices.push(startPos); strokeVertices.push(0); + strokeVertices.push(strokeSize); strokeVertices.push(startPos); strokeVertices.push(0); + strokeVertices.push(-strokeSize); strokeVertices.push(startPos+stippleLength); strokeVertices.push(0); + + strokeVertices.push(strokeSize); strokeVertices.push(startPos); strokeVertices.push(0); + strokeVertices.push(-strokeSize); strokeVertices.push(startPos+stippleLength); strokeVertices.push(0); + strokeVertices.push(strokeSize); strokeVertices.push(startPos+stippleLength); strokeVertices.push(0); + } + else + { + strokeVertices.push(startPos); strokeVertices.push(startPos*-slope-strokeSize); strokeVertices.push(0); + strokeVertices.push(startPos); strokeVertices.push(startPos*-slope+strokeSize); strokeVertices.push(0); + strokeVertices.push(startPos+stippleLength); strokeVertices.push((startPos+stippleLength)*-slope-strokeSize); strokeVertices.push(0); + + strokeVertices.push(startPos); strokeVertices.push(startPos*-slope+strokeSize); strokeVertices.push(0); + strokeVertices.push(startPos+stippleLength); strokeVertices.push((startPos+stippleLength)*-slope-strokeSize); strokeVertices.push(0); + strokeVertices.push(startPos+stippleLength); strokeVertices.push((startPos+stippleLength)*-slope+strokeSize); strokeVertices.push(0); + } + + numStrokes += 6; + + startPos += (stippleLength+gap); + } // - return numStrokes; - } + return numStrokes; + } */ - this.collidesWithPoint = function( x, y ) - { - if(x < this._xOffset) return false; - if(x > (this._xOffset + this._width)) return false; - if(y < this._yOffset) return false; - if(y > (this._yOffset + this._height)) return false; + this.collidesWithPoint = function( x, y ) + { + if(x < this._xOffset) return false; + if(x > (this._xOffset + this._width)) return false; + if(y < this._yOffset) return false; + if(y > (this._yOffset + this._height)) return false; - return true; - } + return true; + } } diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js index 4216fe53..5b6ff94f 100755 --- a/js/helper-classes/RDGE/GLRectangle.js +++ b/js/helper-classes/RDGE/GLRectangle.js @@ -404,12 +404,18 @@ function GLRectangle() ctx.beginPath(); ctx.fillStyle = "#990000"; if (this._fillColor) - ctx.fillStyle = MathUtils.colorToHex( this._fillColor ); + { + var c = "rgba(" + 255*this._fillColor[0] + "," + 255*this._fillColor[1] + "," + 255*this._fillColor[2] + "," + this._fillColor[3] + ")"; + ctx.fillStyle = c; + } // set the stroke ctx.strokeStyle = "#0000ff"; if (this._strokeColor) - ctx.strokeStyle = MathUtils.colorToHex( this._strokeColor ); + { + var c = "rgba(" + 255*this._strokeColor[0] + "," + 255*this._strokeColor[1] + "," + 255*this._strokeColor[2] + "," + this._strokeColor[3] + ")"; + ctx.strokeStyle = c; + } ctx.lineWidth = lw; var inset = Math.ceil( 0.5*lw ) + 0.5; @@ -1051,13 +1057,12 @@ RectangleStroke.create = function( rectCtr, width, height, strokeWidth, tlRad, { var paramRange = material.getVertexDeformationRange(); var tolerance = material.getVertexDeformationTolerance(); - nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); + //nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); } } // create the RDGE primitive var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.TRIANGLES, nVertices); - //var prim = ShapePrimitive.create(this.vertices, this.normals, this.uvs, this.indices, g_Engine.getContext().renderer.LINES, nVertices); return prim; } @@ -1145,7 +1150,7 @@ RectangleGeometry.create = function( ctr, width, height, material ) { var paramRange = material.getVertexDeformationRange(); var tolerance = material.getVertexDeformationTolerance(); - nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); + //nVertices = ShapePrimitive.refineMesh( this.vertices, this.normals, this.uvs, this.indices, nVertices, paramRange, tolerance ); } } @@ -1223,108 +1228,6 @@ ShapePrimitive.create = function(coords, normals, uvs, indices, primType, ver } -ShapePrimitive.refineMesh = function( verts, norms, uvs, indices, nVertices, paramRange, tolerance ) -{ - // get the param range - var pUMin = paramRange[0], pVMin = paramRange[1], - pUMax = paramRange[2], pVMax = paramRange[3]; - var iTriangle = 0; - var nTriangles = indices.length/3; - var index = 0; - while (iTriangle < nTriangles) - { - // get the indices of the 3 vertices - var i0 = indices[index], - i1 = indices[index+1], - i2 = indices[index+2]; - - // get the uv values - //var vrtIndex = 3*iTriangle; - var iuv0 = 2 * i0, - iuv1 = 2 * i1, - iuv2 = 2 * i2; - var u0 = uvs[iuv0], v0 = uvs[iuv0+1], - u1 = uvs[iuv1], v1 = uvs[iuv1+1], - u2 = uvs[iuv2], v2 = uvs[iuv2+1]; - - // find the u and v range - var uMin = u0, vMin = v0; - if (u1 < uMin) uMin = u1; if (v1 < vMin) vMin = v1; - if (u2 < uMin) uMin = u2; if (v2 < vMin) vMin = v2; - var uMax = u0, vMax = v0; - if (u1 > uMax) uMax = u1; if (v1 > vMax) vMax = v1; - if (u2 > uMax) uMax = u2; if (v2 > vMax) vMax = v2; - - // if the parameter range of the triangle is outside the - // desired parameter range, advance to the next polygon and continue - if ((uMin > pUMax) || (uMax < pUMin) || (vMin > pVMax) || (vMax < pVMin)) - { - // go to the next triangle - iTriangle++; - index += 3; - } - else - { - // check thesize of the triangle in uv space. If small enough, advance - // to the next triangle. If not small enough, split the triangle into 3; - var du = uMax - uMin, dv = vMax - vMin; - if ((du < tolerance) && (dv < tolerance)) - { - iTriangle++; - index += 3; - } - else // split the triangle into 4 parts - { - //calculate the position of the new vertex - var iPt0 = 3 * i0, - iPt1 = 3 * i1, - iPt2 = 3 * i2; - var x0 = verts[iPt0], y0 = verts[iPt0+1], z0 = verts[iPt0+2], - x1 = verts[iPt1], y1 = verts[iPt1+1], z1 = verts[iPt1+2], - x2 = verts[iPt2], y2 = verts[iPt2+1], z2 = verts[iPt2+2]; - - // calculate the midpoints of the edges - var xA = (x0 + x1)/2.0, yA = (y0 + y1)/2.0, zA = (z0 + z1)/2.0, - xB = (x1 + x2)/2.0, yB = (y1 + y2)/2.0, zB = (z1 + z2)/2.0, - xC = (x2 + x0)/2.0, yC = (y2 + y0)/2.0, zC = (z2 + z0)/2.0; - - // calculate the uv values of the new coordinates - var uA = (u0 + u1)/2.0, vA = (v0 + v1)/2.0, - uB = (u1 + u2)/2.0, vB = (v1 + v2)/2.0, - uC = (u2 + u0)/2.0, vC = (v2 + v0)/2.0; - - // calculate the normals for the new points - var nx0 = norms[iPt0], ny0 = norms[iPt0+1], nz0 = norms[iPt0+2], - nx1 = norms[iPt1], ny1 = norms[iPt1+1], nz1 = norms[iPt1+2], - nx2 = norms[iPt2], ny2 = norms[iPt2+1], nz2 = norms[iPt2+2]; - var nxA = (nx0 + nx1), nyA = (ny0 + ny1), nzA = (nz0 + nz1); var nrmA = VecUtils.vecNormalize(3, [nxA, nyA, nzA], 1.0 ), - nxB = (nx1 + nx2), nyB = (ny1 + ny2), nzB = (nz1 + nz2); var nrmB = VecUtils.vecNormalize(3, [nxB, nyB, nzB], 1.0 ), - nxC = (nx2 + nx0), nyC = (ny2 + ny0), nzC = (nz2 + nz0); var nrmC = VecUtils.vecNormalize(3, [nxC, nyC, nzC], 1.0 ); - - // push everything - verts.push(xA); verts.push(yA); verts.push(zA); - verts.push(xB); verts.push(yB); verts.push(zB); - verts.push(xC); verts.push(yC); verts.push(zC); - uvs.push(uA), uvs.push(vA); - uvs.push(uB), uvs.push(vB); - uvs.push(uC), uvs.push(vC); - norms.push(nrmA[0]); norms.push(nrmA[1]); norms.push(nrmA[2]); - norms.push(nrmB[0]); norms.push(nrmB[1]); norms.push(nrmB[2]); - norms.push(nrmC[0]); norms.push(nrmC[1]); norms.push(nrmC[2]); - - // split the current triangle into 4 - indices[index+1] = nVertices; indices[index+2] = nVertices+2; - indices.push(nVertices); indices.push(i1); indices.push(nVertices+1); nTriangles++; - indices.push(nVertices+1); indices.push(i2); indices.push(nVertices+2); nTriangles++; - indices.push(nVertices); indices.push(nVertices+1); indices.push(nVertices+2); nTriangles++; - nVertices += 3; - - // by not advancing 'index', we examine the first of the 3 triangles generated above - } - } - } - return nVertices; -} diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js index c8327064..1edd5cff 100755 --- a/js/helper-classes/RDGE/GLWorld.js +++ b/js/helper-classes/RDGE/GLWorld.js @@ -163,7 +163,7 @@ function GLWorld( canvas, use3D ) this.renderer.cameraManager().setActiveCamera(cam); // change clear color - this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); + //this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); this.renderer.setClearColor([1.0, 1.0, 1.0, 0.0]); //this.renderer.NinjaWorld = this; @@ -206,6 +206,7 @@ function GLWorld( canvas, use3D ) { if (!dt) dt = 0.2; + dt = 0.01; // use our own internal throttle this.elapsed += dt; if (this._useWebGL) @@ -232,39 +233,35 @@ function GLWorld( canvas, use3D ) { g_Engine.setContext( this._canvas.uuid ); var ctx = g_Engine.getContext(); - var ctx1 = g_Engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle); - if (ctx1 != ctx) - console.log( "***** different contexts (2) *****" ); - var aRenderer = ctx1.renderer; var renderer = ctx.renderer; - if (renderer != aRenderer) - { - console.log( "***** DIFFERENT RENDERERS *****" ); - renderer = aRenderer; - } - if (renderer.unloadedTextureCount <= 0) { renderer.disableCulling(); //console.log( "GLWorld.draw " + renderer._world._worldCount ); + renderer._clear(); this.myScene.render(); if (this._firstRender) { - this._firstRender = false; - - if (!this.hasAnimatedMaterials()) + if (this._canvas.task) { - //this.myScene.render(); - this._canvas.task.stop(); - //this._renderCount = 10; + this._firstRender = false; + + if (!this.hasAnimatedMaterials()) + { + this._canvas.task.stop(); + //this._renderCount = 10; + } } } else if (this._renderCount >= 0) { - this._renderCount--; - if (this._renderCount <= 0) - this._canvas.task.stop(); + if (this._canvas.task) + { + this._renderCount--; + if (this._renderCount <= 0) + this._canvas.task.stop(); + } } } } @@ -394,11 +391,9 @@ function GLWorld( canvas, use3D ) if (this._useWebGL) { rdgeStarted = true; - - this._canvas.rdgeid = this._canvas.uuid; - - g_Engine.registerCanvas(this._canvas, this); - RDGEStart( this._canvas ); + this._canvas.rdgeid = this._canvas.uuid; + g_Engine.registerCanvas(this._canvas, this); + RDGEStart( this._canvas ); //this._canvas.fpsTracker = new fpsTracker( '0' ); //this._canvas.task = new RDGETask(this._canvas, false); diff --git a/js/helper-classes/RDGE/Materials/DeformMaterial.js b/js/helper-classes/RDGE/Materials/DeformMaterial.js new file mode 100644 index 00000000..ddc97383 --- /dev/null +++ b/js/helper-classes/RDGE/Materials/DeformMaterial.js @@ -0,0 +1,133 @@ +/* + 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. +
*/ + + + +/////////////////////////////////////////////////////////////////////// +// Class GLMaterial +// RDGE representation of a material. +/////////////////////////////////////////////////////////////////////// +function DeformMaterial() +{ + // initialize the inherited members + this.inheritedFrom = PulseMaterial; + this.inheritedFrom(); + + /////////////////////////////////////////////////////////////////////// + // Instance variables + /////////////////////////////////////////////////////////////////////// + this._name = "DeformMaterial"; + this._shaderName = "deform"; + + this._texMap = 'assets/images/rocky-normal.jpg'; + + this._time = 0.0; + this._dTime = 0.01; + + /////////////////////////////////////////////////////////////////////// + // Properties + /////////////////////////////////////////////////////////////////////// + // all defined in parent PulseMaterial.js + // load the local default value + this._propValues[ this._propNames[0] ] = this._texMap.slice(0); + + /////////////////////////////////////////////////////////////////////// + // Material Property Accessors + /////////////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////// + // Methods + /////////////////////////////////////////////////////////////////////// + // duplcate method requirde + this.dup = function( world ) + { + // allocate a new uber material + var newMat = new DeformMaterial(); + + // copy over the current values; + var propNames = [], propValues = [], propTypes = [], propLabels = []; + this.getAllProperties( propNames, propValues, propTypes, propLabels); + var n = propNames.length; + for (var i=0; i + 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. + */ + + + +/////////////////////////////////////////////////////////////////////// +// Class GLMaterial +// RDGE representation of a material. +/////////////////////////////////////////////////////////////////////// +function FlyMaterial() +{ + // initialize the inherited members + this.inheritedFrom = PulseMaterial; + this.inheritedFrom(); + + /////////////////////////////////////////////////////////////////////// + // Instance variables + /////////////////////////////////////////////////////////////////////// + this._name = "FlyMaterial"; + this._shaderName = "fly"; + + this._texMap = 'assets/images/rocky-normal.jpg'; + + this._time = 0.0; + this._dTime = 0.01; + + /////////////////////////////////////////////////////////////////////// + // Properties + /////////////////////////////////////////////////////////////////////// + // all defined in parent PulseMaterial.js + // load the local default value + this._propValues[ this._propNames[0] ] = this._texMap.slice(0); + + /////////////////////////////////////////////////////////////////////// + // Material Property Accessors + /////////////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////// + // Methods + /////////////////////////////////////////////////////////////////////// + // duplcate method requirde + this.dup = function( world ) + { + // allocate a new uber material + var newMat = new FlyMaterial(); + + // copy over the current values; + var propNames = [], propValues = [], propTypes = [], propLabels = []; + this.getAllProperties( propNames, propValues, propTypes, propLabels); + var n = propNames.length; + for (var i=0; i + 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. + */ + + + +/////////////////////////////////////////////////////////////////////// +// Class GLMaterial +// RDGE representation of a material. +/////////////////////////////////////////////////////////////////////// +function JuliaMaterial() +{ + // initialize the inherited members + this.inheritedFrom = PulseMaterial; + this.inheritedFrom(); + + /////////////////////////////////////////////////////////////////////// + // Instance variables + /////////////////////////////////////////////////////////////////////// + this._name = "JuliaMaterial"; + this._shaderName = "julia"; + + this._texMap = 'assets/images/rocky-normal.jpg'; + + this._time = 0.0; + this._dTime = 0.01; + + /////////////////////////////////////////////////////////////////////// + // Properties + /////////////////////////////////////////////////////////////////////// + // no properties + this._propNames