From e9d08c7af751d75af16371fcac06fd1af8a60fac Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 23 Jul 2012 14:37:51 -0700 Subject: Bugs fixed: 1915 - Data.JSON too large. Reduced mesh size and limited precision of fp numbers 1381 - Background transparency in preview. 1740 - File Save As caused WebGL to stop animating. Crossed RDGE IDs 1954 - Texture change from material popup broke screen rendering. Set correct context on property change. --- assets/canvas-runtime.js | 2 +- .../RDGE/src/core/script/MeshManager.js | 22 +++++++++++++++- js/helper-classes/RDGE/src/core/script/renderer.js | 4 ++- js/lib/drawing/world.js | 30 ++++++++++++++++++++-- js/lib/geom/brush-stroke.js | 14 +++++++++- js/lib/rdge/materials/material.js | 4 +++ js/tools/modifier-tool-base.js | 4 +++ 7 files changed, 74 insertions(+), 6 deletions(-) diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js index 4181dd89..7c2554df 100644 --- a/assets/canvas-runtime.js +++ b/assets/canvas-runtime.js @@ -289,7 +289,7 @@ NinjaCvsRt.GLRuntime = Object.create(Object.prototype, { this.renderer.cameraManager().setActiveCamera(cam); // change clear color - this.renderer.setClearColor([1.0, 1.0, 1.0, 0.0]); + this.renderer.setClearColor([0.0, 0.0, 0.0, 0.0]); // create an empty scene graph this.myScene = new RDGE.SceneGraph(); diff --git a/js/helper-classes/RDGE/src/core/script/MeshManager.js b/js/helper-classes/RDGE/src/core/script/MeshManager.js index 4ff95cc4..f0600793 100755 --- a/js/helper-classes/RDGE/src/core/script/MeshManager.js +++ b/js/helper-classes/RDGE/src/core/script/MeshManager.js @@ -201,11 +201,31 @@ RDGE.MeshManager.prototype.onLoaded = function (meshName) { }; RDGE.MeshManager.prototype.exportJSON = function () { + for (var m in this.modelMap) { this.modelMap[m].primitive.built = false; } - return JSON.stringify(this.modelMap); + function replacer(key, value) { + if (key === "bufferStreams") + { + var nStreams = value.length; + for (iStream=0; iStream= 0) + { + var subStr = id.substr( index+1); + num = Number( subStr ) + 1; + id = id.substr( 0, index ); + } + + id = id + "_" + num; + ctx = RDGE.globals.engine.getContext( id ); + } + + return id; +} + // return the origin of the world in NDC World.prototype.getNDCOrigin = function() { var pt = MathUtils.transformPoint( [0,0,0], this.getCameraMatInverse() ); @@ -973,7 +1000,6 @@ World.prototype.importJSON = function (jObj) // start RDGE rdgeStarted = true; var id = this._canvas.getAttribute( "data-RDGE-id" ); - this._canvas.rdgeid = id; RDGE.globals.engine.registerCanvas(this._canvas, this); RDGE.RDGEStart(this._canvas); this._canvas.task.stop() diff --git a/js/lib/geom/brush-stroke.js b/js/lib/geom/brush-stroke.js index 12f5c5a1..164d31ee 100755 --- a/js/lib/geom/brush-stroke.js +++ b/js/lib/geom/brush-stroke.js @@ -864,6 +864,17 @@ BrushStroke.prototype.drawToContext = function(ctx, drawStageWorldPts, stageWorl }; //this.drawToCanvas() + +BrushStroke.prototype._fixCoordPrecision = function(coord, precision){ + var i=0; + var numPoints = coord.length; + for (i=0;i - + this._fixCoordPrecision(retObject.origLocalPoints, 4); retObject.stageWorldCenter = [this._stageWorldCenter[0],this._stageWorldCenter[1],this._stageWorldCenter[2]]; retObject.planeMat = this._planeMat; retObject.planeMatInv = this._planeMatInv; diff --git a/js/lib/rdge/materials/material.js b/js/lib/rdge/materials/material.js index e8571e9d..227a772a 100755 --- a/js/lib/rdge/materials/material.js +++ b/js/lib/rdge/materials/material.js @@ -263,6 +263,10 @@ var Material = function GLMaterial( world ) { var material = this._materialNode; if (material) technique = material.shaderProgram[this.getTechniqueName()]; + // make sure RDGE has the correct context + if (this.getWorld()) + RDGE.globals.engine.setContext( this.getWorld().getCanvas().rdgeid ); + if(prop === "gradient") { this.setGradientData(value); } else { diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js index c772e36c..d12ba7d2 100755 --- a/js/tools/modifier-tool-base.js +++ b/js/tools/modifier-tool-base.js @@ -569,7 +569,11 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { var alignArray = new Array(); snapManager.snapAlignToElementBounds( this._clickedObject, delta, alignArray ); if (alignArray.length > 0) + { + alignArray.push( hitRec ); + snapManager.sortHitRecords( alignArray ); hitRec = alignArray[0]; + } } } -- cgit v1.2.3 From fb6b9cb1f7ee29bb2e8d7178479717f650d0b7b5 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 23 Jul 2012 16:59:28 -0700 Subject: Fix: Adding a check for element w/h/t/l This fixes an issue with elements with no set width, height, top, left values from being handling through the PI. Currently those values will default to zero, a secondary fix will address this to show no value in PI and other panels. --- js/lib/NJUtils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js index cfb7ef07..bca9b05b 100755 --- a/js/lib/NJUtils.js +++ b/js/lib/NJUtils.js @@ -241,6 +241,7 @@ exports.NJUtils = Montage.create(Component, { // 100px will return the following array: [100, px] getValueAndUnits: { value: function(input) { + if (!input) return [null, null]; var numberValue = parseFloat(input); // Ignore all whitespace, digits, negative sign and "." when looking for units label -- cgit v1.2.3