diff options
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-x | js/helper-classes/3D/LinePlaneIntersectRec.js | 3 | ||||
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 20 | ||||
-rwxr-xr-x | js/helper-classes/3D/hit-record.js | 6 | ||||
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 4 | ||||
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 8 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/GLCircle.js | 2 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/GLLine.js | 2 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/GLRectangle.js | 2 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/GLWorld.js | 27 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/rdge-compiled.js | 28 | ||||
-rw-r--r-- | js/helper-classes/RDGE/runtime/CanvasDataManager.js | 98 | ||||
-rw-r--r-- | js/helper-classes/RDGE/runtime/GLRuntime.js | 159 | ||||
-rw-r--r-- | js/helper-classes/RDGE/src/tools/rdge-compiled.js | 28 |
13 files changed, 329 insertions, 58 deletions
diff --git a/js/helper-classes/3D/LinePlaneIntersectRec.js b/js/helper-classes/3D/LinePlaneIntersectRec.js index e075dd3d..cb172bf7 100755 --- a/js/helper-classes/3D/LinePlaneIntersectRec.js +++ b/js/helper-classes/3D/LinePlaneIntersectRec.js | |||
@@ -42,9 +42,6 @@ var LinePlaneIntersectRec = exports.LinePlaneIntersectRec = Object.create(Object | |||
42 | setDeltaVis: { value: function(d) { this._deltaVis = d; } }, | 42 | setDeltaVis: { value: function(d) { this._deltaVis = d; } }, |
43 | getDeltaVis: { value: function() { return this._deltaVis; } }, | 43 | getDeltaVis: { value: function() { return this._deltaVis; } }, |
44 | 44 | ||
45 | getElementPlanes: { value: function() { return this._deltaVis; } }, | ||
46 | setElementPlanes: { value: function(p) { this._elementPlanes = p; } }, | ||
47 | |||
48 | setNext: { value: function(n) { this._next = n; } }, | 45 | setNext: { value: function(n) { this._next = n; } }, |
49 | getNext: { value: function() { return this._next; } }, | 46 | getNext: { value: function() { return this._next; } }, |
50 | 47 | ||
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index c07391db..85870097 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -115,6 +115,26 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
115 | } | 115 | } |
116 | }, | 116 | }, |
117 | 117 | ||
118 | initializeFromDocument:{ | ||
119 | value:function(){ | ||
120 | var documentRootChildren = null, i; | ||
121 | //initialize with current document | ||
122 | this._eltArray = []; | ||
123 | this._planesArray = []; | ||
124 | this.setDrawingSurfaceElement(this.application.ninja.stage.canvas); | ||
125 | this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage ); | ||
126 | this.setWorkingPlane( Vector.create( [0,0,1,0] ) ); | ||
127 | |||
128 | //Loop through all the top-level children of the current document and call drawUtils.addElement on them | ||
129 | if(this.application.ninja.currentDocument._liveNodeList.length > 0){ | ||
130 | documentRootChildren = this.application.ninja.currentDocument._liveNodeList; | ||
131 | for(i=0;i<documentRootChildren.length;i++){ | ||
132 | this.addElement(documentRootChildren[i]); | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | }, | ||
137 | |||
118 | handleElementAdded: { | 138 | handleElementAdded: { |
119 | value: function(event) { | 139 | value: function(event) { |
120 | this.addElement(event.detail); | 140 | this.addElement(event.detail); |
diff --git a/js/helper-classes/3D/hit-record.js b/js/helper-classes/3D/hit-record.js index 5546cc5a..2c60adc6 100755 --- a/js/helper-classes/3D/hit-record.js +++ b/js/helper-classes/3D/hit-record.js | |||
@@ -139,12 +139,10 @@ var HitRecord = exports.HitRecord = Object.create(Object.prototype, | |||
139 | 139 | ||
140 | isSomeGridTypeSnap : { | 140 | isSomeGridTypeSnap : { |
141 | value: function() { | 141 | value: function() { |
142 | return | 142 | return ((this._type == this.SNAP_TYPE_GRID_VERTEX) || |
143 | ( | ||
144 | (this._type == this.SNAP_TYPE_GRID_VERTEX) || | ||
145 | (this._type == this.SNAP_TYPE_GRID_HORIZONTAL) || | 143 | (this._type == this.SNAP_TYPE_GRID_HORIZONTAL) || |
146 | (this._type == this.SNAP_TYPE_GRID_VERTICAL) | 144 | (this._type == this.SNAP_TYPE_GRID_VERTICAL) |
147 | ) | 145 | ); |
148 | } | 146 | } |
149 | }, | 147 | }, |
150 | 148 | ||
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index ada6960b..94202dc5 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -521,7 +521,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
521 | 521 | ||
522 | if (!elt.elementModel) | 522 | if (!elt.elementModel) |
523 | { | 523 | { |
524 | NJUtils.makeElementModel2(elt); | 524 | NJUtils.makeModelFromElement(elt); |
525 | } | 525 | } |
526 | elt.elementModel.isIn2DSnapCache = true; | 526 | elt.elementModel.isIn2DSnapCache = true; |
527 | } | 527 | } |
@@ -588,7 +588,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
588 | 588 | ||
589 | if (!elt.elementModel) | 589 | if (!elt.elementModel) |
590 | { | 590 | { |
591 | NJUtils.makeElementModel2(elt); | 591 | NJUtils.makeModelFromElement(elt); |
592 | } | 592 | } |
593 | elt.elementModel.isIn2DSnapCache = true; | 593 | elt.elementModel.isIn2DSnapCache = true; |
594 | } | 594 | } |
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index a2fac34f..bedda8bf 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js | |||
@@ -1226,6 +1226,14 @@ exports.ViewUtils = Montage.create(Component, { | |||
1226 | } | 1226 | } |
1227 | }, | 1227 | }, |
1228 | 1228 | ||
1229 | getCurrentDocument: | ||
1230 | { | ||
1231 | value: function() | ||
1232 | { | ||
1233 | return snapManagerModule.SnapManager.application.ninja.currentDocument; | ||
1234 | } | ||
1235 | }, | ||
1236 | |||
1229 | setStageZoom: { | 1237 | setStageZoom: { |
1230 | value:function( globalPt, zoomFactor ) { | 1238 | value:function( globalPt, zoomFactor ) { |
1231 | var localPt; | 1239 | var localPt; |
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js index 5b32547e..712544c0 100755 --- a/js/helper-classes/RDGE/GLCircle.js +++ b/js/helper-classes/RDGE/GLCircle.js | |||
@@ -135,7 +135,7 @@ function GLCircle() | |||
135 | if (!world._useWebGL) return; | 135 | if (!world._useWebGL) return; |
136 | 136 | ||
137 | // make sure RDGE has the correct context | 137 | // make sure RDGE has the correct context |
138 | g_Engine.setContext( world.getCanvas().uuid ); | 138 | g_Engine.setContext( world.getCanvas().rdgeid ); |
139 | 139 | ||
140 | // create the gl buffer | 140 | // create the gl buffer |
141 | var gl = world.getGLContext(); | 141 | var gl = world.getGLContext(); |
diff --git a/js/helper-classes/RDGE/GLLine.js b/js/helper-classes/RDGE/GLLine.js index 0d815145..f715a43c 100755 --- a/js/helper-classes/RDGE/GLLine.js +++ b/js/helper-classes/RDGE/GLLine.js | |||
@@ -171,7 +171,7 @@ function GLLine( world, xOffset, yOffset, width, height, slope, strokeSize, stro | |||
171 | if (!world._useWebGL) return; | 171 | if (!world._useWebGL) return; |
172 | 172 | ||
173 | // make sure RDGE has the correct context | 173 | // make sure RDGE has the correct context |
174 | g_Engine.setContext( world.getCanvas().uuid ); | 174 | g_Engine.setContext( world.getCanvas().rdgeid ); |
175 | 175 | ||
176 | // create the gl buffer | 176 | // create the gl buffer |
177 | var gl = world.getGLContext(); | 177 | var gl = world.getGLContext(); |
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js index 5b6ff94f..3c1cb7dc 100755 --- a/js/helper-classes/RDGE/GLRectangle.js +++ b/js/helper-classes/RDGE/GLRectangle.js | |||
@@ -214,7 +214,7 @@ function GLRectangle() | |||
214 | if (!world._useWebGL) return; | 214 | if (!world._useWebGL) return; |
215 | 215 | ||
216 | // make sure RDGE has the correct context | 216 | // make sure RDGE has the correct context |
217 | g_Engine.setContext( world.getCanvas().uuid ); | 217 | g_Engine.setContext( world.getCanvas().rdgeid ); |
218 | 218 | ||
219 | // create the gl buffer | 219 | // create the gl buffer |
220 | var gl = world.getGLContext(); | 220 | var gl = world.getGLContext(); |
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js index 1edd5cff..64086bee 100755 --- a/js/helper-classes/RDGE/GLWorld.js +++ b/js/helper-classes/RDGE/GLWorld.js | |||
@@ -136,13 +136,6 @@ function GLWorld( canvas, use3D ) | |||
136 | var camMat = Matrix.I(4); | 136 | var camMat = Matrix.I(4); |
137 | camMat[14] = this.getViewDistance(); | 137 | camMat[14] = this.getViewDistance(); |
138 | this.setCameraMat( camMat ); | 138 | this.setCameraMat( camMat ); |
139 | |||
140 | ////////////////////////////////////////// | ||
141 | // test call to SVG importer | ||
142 | // console.log( "***** SVG TEST *****" ); | ||
143 | // var svgImporter = new SVGParse( this ); | ||
144 | // svgImporter.importSVG(); | ||
145 | ////////////////////////////////////////// | ||
146 | 139 | ||
147 | // post-load processing of the scene | 140 | // post-load processing of the scene |
148 | this.init = function() | 141 | this.init = function() |
@@ -198,7 +191,9 @@ function GLWorld( canvas, use3D ) | |||
198 | this.myScene.addNode(lightTr); | 191 | this.myScene.addNode(lightTr); |
199 | 192 | ||
200 | // Add the scene to the engine - necessary if you want the engine to draw for you | 193 | // Add the scene to the engine - necessary if you want the engine to draw for you |
201 | g_Engine.AddScene("myScene" + this._canvas.id, this.myScene); | 194 | //g_Engine.AddScene("myScene" + this._canvas.id, this.myScene); |
195 | var name = this._canvas.getAttribute( "data-RDGE-id" ); | ||
196 | g_Engine.AddScene("myScene" + name, this.myScene); | ||
202 | } | 197 | } |
203 | 198 | ||
204 | // main code for handling user interaction and updating the scene | 199 | // main code for handling user interaction and updating the scene |
@@ -227,11 +222,11 @@ function GLWorld( canvas, use3D ) | |||
227 | } | 222 | } |
228 | 223 | ||
229 | // defining the draw function to control how the scene is rendered | 224 | // defining the draw function to control how the scene is rendered |
230 | this.draw = function() | 225 | this.draw = function() |
231 | { | 226 | { |
232 | if (this._useWebGL) | 227 | if (this._useWebGL) |
233 | { | 228 | { |
234 | g_Engine.setContext( this._canvas.uuid ); | 229 | g_Engine.setContext( this._canvas.rdgeid ); |
235 | var ctx = g_Engine.getContext(); | 230 | var ctx = g_Engine.getContext(); |
236 | var renderer = ctx.renderer; | 231 | var renderer = ctx.renderer; |
237 | if (renderer.unloadedTextureCount <= 0) | 232 | if (renderer.unloadedTextureCount <= 0) |
@@ -391,12 +386,10 @@ function GLWorld( canvas, use3D ) | |||
391 | if (this._useWebGL) | 386 | if (this._useWebGL) |
392 | { | 387 | { |
393 | rdgeStarted = true; | 388 | rdgeStarted = true; |
394 | this._canvas.rdgeid = this._canvas.uuid; |