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. --- js/lib/drawing/world.js | 30 ++++++++++++++++++++++++++++-- js/lib/geom/brush-stroke.js | 14 +++++++++++++- js/lib/rdge/materials/material.js | 4 ++++ 3 files changed, 45 insertions(+), 3 deletions(-) (limited to 'js/lib') diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index ca2f07cc..b9f9863f 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js @@ -439,6 +439,11 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) { // in the case of a procedurally built scene an init state is not needed for loading data this._canvas.rdgeid = this._canvas.getAttribute( "data-RDGE-id" ); if (this._useWebGL) { + // make sure the id is unique + var id = this.uniqueifyID( this._canvas.rdgeid ); + this._canvas.rdgeid = id; + this._canvas.setAttribute( "data-rdge-id", id ); + rdgeStarted = true; RDGE.globals.engine.unregisterCanvas( this._canvas ); RDGE.globals.engine.registerCanvas(this._canvas, this); @@ -673,13 +678,35 @@ World.prototype.updateMaterials = function( obj, time ) { var n = matArray.length; for (var i=0; i= 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 { -- 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(+) (limited to 'js/lib') 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