diff options
Diffstat (limited to 'js/helper-classes')
27 files changed, 609 insertions, 246 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 3ed96082..8819f637 100644 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -1780,7 +1780,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1780 | var mergedSnap = this.mergeHitRecords( hitRecs ); | 1780 | var mergedSnap = this.mergeHitRecords( hitRecs ); |
1781 | if (mergedSnap) | 1781 | if (mergedSnap) |
1782 | { | 1782 | { |
1783 | while (hitRecs.length > 0) hitRecs.pop(); | 1783 | while (hitRecs.length > 0) hitRecs.pop(); |
1784 | hitRecs.push( mergedSnap ); | 1784 | hitRecs.push( mergedSnap ); |
1785 | //console.log( "merged snaps" ); | 1785 | //console.log( "merged snaps" ); |
1786 | } | 1786 | } |
@@ -1836,6 +1836,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1836 | hSnap.setLocalPoint( localPt ); | 1836 | hSnap.setLocalPoint( localPt ); |
1837 | hSnap.setScreenPoint( scrPt ); | 1837 | hSnap.setScreenPoint( scrPt ); |
1838 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); | 1838 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); |
1839 | hSnap.setElement( stage ); | ||
1840 | hSnap.setPlane( [0,0,1,0] ); | ||
1841 | hSnap.setPlaneMatrix( Matrix.I(4) ); | ||
1839 | if (vSnap.hasAssociatedScreenPoint() ) | 1842 | if (vSnap.hasAssociatedScreenPoint() ) |
1840 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); | 1843 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); |
1841 | if (vSnap.hasAssociatedScreenPoint2() ) | 1844 | if (vSnap.hasAssociatedScreenPoint2() ) |
@@ -1882,6 +1885,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1882 | hSnap.setLocalPoint( localPt ); | 1885 | hSnap.setLocalPoint( localPt ); |
1883 | hSnap.setScreenPoint( scrPt ); | 1886 | hSnap.setScreenPoint( scrPt ); |
1884 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); | 1887 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); |
1888 | hSnap.setElement( stage ); | ||
1889 | hSnap.setPlane( [0,0,1,0] ); | ||
1890 | hSnap.setPlaneMatrix( Matrix.I(4) ); | ||
1885 | if (vSnap.hasAssociatedScreenPoint() ) | 1891 | if (vSnap.hasAssociatedScreenPoint() ) |
1886 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); | 1892 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); |
1887 | if (vSnap.hasAssociatedScreenPoint2() ) | 1893 | if (vSnap.hasAssociatedScreenPoint2() ) |
@@ -1934,6 +1940,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1934 | hSnap.setLocalPoint( localPt ); | 1940 | hSnap.setLocalPoint( localPt ); |
1935 | hSnap.setScreenPoint( scrPt ); | 1941 | hSnap.setScreenPoint( scrPt ); |
1936 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); | 1942 | hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); |
1943 | hSnap.setElement( stage ); | ||
1944 | hSnap.setPlane( [0,0,1,0] ); | ||
1945 | hSnap.setPlaneMatrix( Matrix.I(4) ); | ||
1937 | if (vSnap.hasAssociatedScreenPoint() ) | 1946 | if (vSnap.hasAssociatedScreenPoint() ) |
1938 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); | 1947 | hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); |
1939 | if (vSnap.hasAssociatedScreenPoint2() ) | 1948 | if (vSnap.hasAssociatedScreenPoint2() ) |
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..c633f679 100644 --- a/js/helper-classes/RDGE/GLMaterial.js +++ b/js/helper-classes/RDGE/GLMaterial.js | |||
@@ -62,6 +62,10 @@ function GLMaterial( world ) | |||
62 | this.getShader = function() { return this._shader; } | 62 | this.getShader = function() { return this._shader; } |
63 | this.getMaterialNode = function() { return this._materialNode; } | 63 | this.getMaterialNode = function() { return this._materialNode; } |
64 | 64 | ||
65 | // a material can be animated or not. default is not. | ||
66 | // Any material needing continuous rendering should override this method | ||
67 | this.isAnimated = function() { return false; } | ||
68 | |||
65 | 69 | ||
66 | /////////////////////////////////////////////////////////////////////// | 70 | /////////////////////////////////////////////////////////////////////// |
67 | // Common Material Methods | 71 | // Common Material Methods |
@@ -174,6 +178,31 @@ function GLMaterial( world ) | |||
174 | // animated materials should implement the update method | 178 | // animated materials should implement the update method |
175 | } | 179 | } |
176 | 180 | ||
181 | this.registerTexture = function( texture ) | ||
182 | { | ||
183 | // the world needs to know about the texture map | ||
184 | var world = this.getWorld(); | ||
185 | if (!world) | ||
186 | console.log( "**** world not defined for registering texture map: " + texture.lookUpName ); | ||
187 | else | ||
188 | world.textureToLoad( texture ); | ||
189 | } | ||
190 | |||
191 | this.loadTexture = function( texMapName, wrap, mips ) | ||
192 | { | ||
193 | var tex; | ||
194 | var world = this.getWorld(); | ||
195 | if (!world) | ||
196 | console.log( "world not defined for material with texture map" ); | ||
197 | else | ||
198 | { | ||
199 | var renderer = world.getRenderer(); | ||
200 | tex = renderer.getTextureByName(texMapName, wrap, mips ); | ||
201 | this.registerTexture( tex ); | ||
202 | } | ||
203 | return tex; | ||
204 | } | ||
205 | |||
177 | this.export = function() | 206 | this.export = function() |
178 | { | 207 | { |
179 | // this function should be overridden by subclasses | 208 | // this function should be overridden by subclasses |
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js index 1334d7e6..1bb4bcac 100644 --- a/js/helper-classes/RDGE/GLRectangle.js +++ b/js/helper-classes/RDGE/GLRectangle.js | |||
@@ -80,13 +80,14 @@ function GLRectangle() | |||
80 | this._materialSpecular = [0.4, 0.4, 0.4, 1.0]; | 80 | this._materialSpecular = [0.4, 0.4, 0.4, 1.0]; |
81 | 81 | ||
82 | if(strokeMaterial) | 82 | if(strokeMaterial) |
83 | { | ||
84 | this._strokeMaterial = strokeMaterial; | 83 | this._strokeMaterial = strokeMaterial; |
85 | } | 84 | else |
85 | this._strokeMaterial = new FlatMaterial(); | ||
86 | |||
86 | if(fillMaterial) | 87 | if(fillMaterial) |
87 | { | ||
88 | this._fillMaterial = fillMaterial; | 88 | this._fillMaterial = fillMaterial; |
89 | } | 89 | else |
90 | this._fillMaterial = new FlatMaterial(); | ||
90 | } | 91 | } |
91 | 92 | ||
92 | /////////////////////////////////////////////////////////////////////// |