diff options
Diffstat (limited to 'js')
38 files changed, 1754 insertions, 260 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 8819f637..7e1260bf 100644 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -977,7 +977,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
977 | viewUtils.setViewportObj( stage ); | 977 | viewUtils.setViewportObj( stage ); |
978 | 978 | ||
979 | MathUtils.makeDimension3( screenPt ); | 979 | MathUtils.makeDimension3( screenPt ); |
980 | this.hSnapToElements( stage, screenPt, hitRecs, 0, screenPt ); | 980 | this.hSnapToElements( stage, hitRecs, 0, screenPt ); |
981 | 981 | ||
982 | return; | 982 | return; |
983 | } | 983 | } |
@@ -985,7 +985,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
985 | 985 | ||
986 | hSnapToElements : | 986 | hSnapToElements : |
987 | { | 987 | { |
988 | value: function( elt, parentPt, hitRecs, depth, globalScrPt ) | 988 | value: function( elt, hitRecs, depth, globalScrPt ) |
989 | { | 989 | { |
990 | // hit test the current object | 990 | // hit test the current object |
991 | var hit; | 991 | var hit; |
@@ -994,8 +994,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
994 | // if the element is in the 2D cache snapping is done there | 994 | // if the element is in the 2D cache snapping is done there |
995 | if (elt.elementModel && !elt.elementModel.isIn2DSnapCache) | 995 | if (elt.elementModel && !elt.elementModel.isIn2DSnapCache) |
996 | { | 996 | { |
997 | var scrPt = viewUtils.parentToChild( parentPt, elt, false ); | 997 | hit = this.snapToElement( elt, globalScrPt ); |
998 | hit = this.snapToElement( elt, scrPt, globalScrPt ); | ||
999 | if (hit) | 998 | if (hit) |
1000 | { | 999 | { |
1001 | //hitRecs.push( hit ); | 1000 | //hitRecs.push( hit ); |
@@ -1017,14 +1016,14 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1017 | } | 1016 | } |
1018 | // test the rest of the tree | 1017 | // test the rest of the tree |
1019 | var n = elt.childElementCount; | 1018 | var n = elt.childElementCount; |
1020 | var eltPt = viewUtils.parentToChild( parentPt, elt, true ); | 1019 | //var eltPt = viewUtils.parentToChild( parentPt, elt, true ); |
1021 | if (n > 0) | 1020 | if (n > 0) |
1022 | { | 1021 | { |
1023 | for (var i=0; i<n; i++) | 1022 | for (var i=0; i<n; i++) |
1024 | { | 1023 | { |
1025 | var child = elt.children[i]; | 1024 | var child = elt.children[i]; |
1026 | //var childPt = viewUtils.parentToChild( scrPt, child ); | 1025 | //var childPt = viewUtils.parentToChild( scrPt, child ); |
1027 | hit = this.hSnapToElements( child, eltPt, hitRecs, (depth+1), globalScrPt ); | 1026 | hit = this.hSnapToElements( child, hitRecs, (depth+1), globalScrPt ); |
1028 | if (hit) | 1027 | if (hit) |
1029 | { | 1028 | { |
1030 | //hitRecs.push( hit ); | 1029 | //hitRecs.push( hit ); |
@@ -1044,7 +1043,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1044 | 1043 | ||
1045 | snapToElement : | 1044 | snapToElement : |
1046 | { | 1045 | { |
1047 | value: function( elt, scrPt, globalScrPt ) | 1046 | value: function( elt, globalScrPt ) |
1048 | { | 1047 | { |
1049 | if (this.isAvoidedElement(elt) ) return null; | 1048 | if (this.isAvoidedElement(elt) ) return null; |
1050 | 1049 | ||
diff --git a/js/helper-classes/RDGE/GLCircle.js b/js/helper-classes/RDGE/GLCircle.js index fc2e6460..8f7a5d30 100644 --- a/js/helper-classes/RDGE/GLCircle.js +++ b/js/helper-classes/RDGE/GLCircle.js | |||
@@ -63,14 +63,16 @@ function GLCircle() | |||
63 | 63 | ||
64 | this.m_world = world; | 64 | this.m_world = world; |
65 | 65 | ||
66 | |||
66 | if(strokeMaterial) | 67 | if(strokeMaterial) |
67 | { | ||
68 | this._strokeMaterial = strokeMaterial; | 68 | this._strokeMaterial = strokeMaterial; |
69 | } | 69 | else |
70 | this._strokeMaterial = new FlatMaterial(); | ||
71 | |||
70 | if(fillMaterial) | 72 | if(fillMaterial) |
71 | { | ||
72 | this._fillMaterial = fillMaterial; | 73 | this._fillMaterial = fillMaterial; |
73 | } | 74 | else |
75 | this._fillMaterial = new FlatMaterial(); | ||
74 | } | 76 | } |
75 | 77 | ||
76 | /////////////////////////////////////////////////////////////////////// | 78 | /////////////////////////////////////////////////////////////////////// |
diff --git a/js/helper-classes/RDGE/GLGeomObj.js b/js/helper-classes/RDGE/GLGeomObj.js index 72019703..e04b3283 100644 --- a/js/helper-classes/RDGE/GLGeomObj.js +++ b/js/helper-classes/RDGE/GLGeomObj.js | |||
@@ -99,6 +99,9 @@ function GLGeomObj() | |||
99 | } | 99 | } |
100 | } | 100 | } |
101 | } | 101 | } |
102 | |||
103 | var world = this.getWorld(); | ||
104 | if (world) world.restartRenderLoop(); | ||
102 | } | 105 | } |
103 | 106 | ||
104 | this.setFillColor = function(c) { this.setMaterialColor(c, "fill"); } | 107 | this.setFillColor = function(c) { this.setMaterialColor(c, "fill"); } |
diff --git a/js/helper-classes/RDGE/GLMaterial.js b/js/helper-classes/RDGE/GLMaterial.js index 51c27ace..07a98ab5 100644 --- a/js/helper-classes/RDGE/GLMaterial.js +++ b/js/helper-classes/RDGE/GLMaterial.js | |||
@@ -31,6 +31,11 @@ function GLMaterial( world ) | |||
31 | 31 | ||
32 | this._texture; | 32 | this._texture; |
33 | 33 | ||
34 | // vertex deformation variables | ||
35 | this._hasVertexDeformation = false; | ||
36 | this._vertexDeformationRange = [0, 0, 1, 1]; // (xMin, yMin, xMax, yMax) | ||
37 | this._vertexDeformationTolerance = 0.05; | ||
38 | |||
34 | // RDGE variables | 39 | // RDGE variables |
35 | this._shader; | 40 | this._shader; |
36 | this._materialNode; | 41 | this._materialNode; |
@@ -62,6 +67,16 @@ function GLMaterial( world ) | |||
62 | this.getShader = function() { return this._shader; } | 67 | this.getShader = function() { return this._shader; } |
63 | this.getMaterialNode = function() { return this._materialNode; } | 68 | this.getMaterialNode = function() { return this._materialNode; } |
64 | 69 | ||
70 | // a material can be animated or not. default is not. | ||
71 | // Any material needing continuous rendering should override this method | ||
72 | this.isAnimated = function() { return false; } | ||
73 | |||
74 | // the vertex shader can apply deformations requiring refinement in | ||
75 | // certain areas. | ||
76 | this.hasVertexDeformation = function() { return this._hasVertexDeformation; } | ||
77 | this.getVertexDeformationRange = function() { return this._vertexDeformationRange.slice(); } | ||
78 | this.getVertexDeformationTolerance = function() { return this._vertexDeformationTolerance; } | ||
79 | |||
65 | 80 | ||
66 | /////////////////////////////////////////////////////////////////////// | 81 | /////////////////////////////////////////////////////////////////////// |
67 | // Common Material Methods | 82 | // Common Material Methods |
@@ -174,6 +189,31 @@ function GLMaterial( world ) | |||
174 | // animated materials should implement the update method | 189 | // animated materials should implement the update method |
175 | } | 190 | } |
176 | 191 | ||
192 | this.registerTexture = function( texture ) | ||
193 | { | ||
194 |