sunrize 1.7.43 → 1.7.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/Application/Application.js +17 -5
- package/src/Application/Dashboard.js +5 -2
- package/src/Application/Document.js +1 -9
- package/src/Application/Tabs.js +2 -1
- package/src/Components/Geometry2D/Arc2D.js +16 -0
- package/src/Components/Geometry2D/ArcClose2D.js +14 -0
- package/src/Components/Geometry2D/Circle2D.js +23 -0
- package/src/Components/Geometry2D/Disk2D.js +53 -0
- package/src/Components/Geometry2D/Polyline2D.js +16 -0
- package/src/Components/Geometry2D/Polypoint2D.js +20 -0
- package/src/Components/Geometry2D/Rectangle2D.js +27 -0
- package/src/Components/Geometry2D/TriangleSet2D.js +33 -0
- package/src/Components/Geometry3D/Box.js +27 -0
- package/src/Components/Geometry3D/Cone.js +79 -0
- package/src/Components/Geometry3D/Cylinder.js +81 -0
- package/src/Components/Geometry3D/ElevationGrid.js +23 -0
- package/src/Components/Geometry3D/Extrusion.js +194 -0
- package/src/Components/Geometry3D/IndexedFaceSet.js +112 -0
- package/src/Components/Geometry3D/Sphere.js +27 -0
- package/src/Components/NURBS/NurbsCurve.js +17 -0
- package/src/Components/NURBS/NurbsSweptSurface.js +24 -0
- package/src/Components/NURBS/NurbsSwungSurface.js +24 -0
- package/src/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +19 -0
- package/src/Components/Rendering/IndexedLineSet.js +24 -0
- package/src/Components/Rendering/LineSet.js +34 -0
- package/src/Components/Rendering/X3DComposedGeometryNode.js +44 -0
- package/src/Components/Rendering/X3DGeometryNode.js +183 -0
- package/src/Components/Text/Text.js +17 -0
- package/src/Components.js +33 -0
- package/src/Editors/Library.js +2 -0
- package/src/Editors/LibraryPane.js +6 -1
- package/src/Editors/NodesLibrary.js +41 -1
- package/src/Editors/OutlineEditor.js +118 -25
- package/src/Editors/OutlineView.js +53 -22
- package/src/Editors/PrimitivesLibrary.js +58 -2
- package/src/Tools/Geometry2D/Disk2DTool.js +16 -18
- package/src/Undo/Editor.js +207 -153
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sunrize",
|
|
3
3
|
"productName": "Sunrize X3D Editor",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.45",
|
|
5
5
|
"description": "A Multi-Platform X3D Editor",
|
|
6
6
|
"main": "src/main.js",
|
|
7
7
|
"bin": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"capitalize": "^2.0.4",
|
|
92
92
|
"console": "^0.7.2",
|
|
93
|
-
"electron": "^
|
|
93
|
+
"electron": "^34.0.0",
|
|
94
94
|
"electron-prompt": "^1.7.0",
|
|
95
95
|
"electron-squirrel-startup": "^1.0.1",
|
|
96
96
|
"electron-tabs": "^1.0.4",
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"string-similarity": "^4.0.4",
|
|
110
110
|
"tweakpane": "^3.1.10",
|
|
111
111
|
"update-electron-app": "^3.1.0",
|
|
112
|
-
"x_ite": "^11.0.
|
|
112
|
+
"x_ite": "^11.0.5",
|
|
113
113
|
"x3d-traverse": "^1.0.9"
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -58,16 +58,17 @@ module .exports = class Application
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
this .config .setDefaultValues ({
|
|
61
|
-
position: [undefined, undefined],
|
|
62
|
-
size: [1100, 680],
|
|
63
|
-
maximized: false,
|
|
64
|
-
fullscreen: false,
|
|
65
61
|
autoSave: true,
|
|
62
|
+
browserUpdate: false,
|
|
66
63
|
expandExternProtoDeclarations: true,
|
|
67
|
-
expandPrototypeInstances: true,
|
|
68
64
|
expandInlineNodes: true,
|
|
65
|
+
expandPrototypeInstances: true,
|
|
66
|
+
fullscreen: false,
|
|
67
|
+
maximized: false,
|
|
68
|
+
position: [undefined, undefined],
|
|
69
69
|
recentDocuments: [ ],
|
|
70
70
|
recentLocations: [ ],
|
|
71
|
+
size: [1100, 680],
|
|
71
72
|
});
|
|
72
73
|
|
|
73
74
|
Template .create (path .join (__dirname, "../assets/html/application-template.html"));
|
|
@@ -286,6 +287,17 @@ module .exports = class Application
|
|
|
286
287
|
click: () => this .mainWindow .webContents .send ("reload"),
|
|
287
288
|
},
|
|
288
289
|
{ type: "separator" },
|
|
290
|
+
{
|
|
291
|
+
label: _("Default Play Button State"),
|
|
292
|
+
type: "checkbox",
|
|
293
|
+
checked: this .config .browserUpdate,
|
|
294
|
+
click: () =>
|
|
295
|
+
{
|
|
296
|
+
this .config .browserUpdate = !this .config .browserUpdate;
|
|
297
|
+
this .mainWindow .webContents .send ("browser-update", this .config .browserUpdate);
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
{ type: "separator" },
|
|
289
301
|
{
|
|
290
302
|
label: _("Save"),
|
|
291
303
|
accelerator: "CmdOrCtrl+S",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const
|
|
4
4
|
$ = require ("jquery"),
|
|
5
|
+
electron = require ("electron"),
|
|
5
6
|
Interface = require ("./Interface"),
|
|
6
7
|
Editor = require("../Undo/Editor"),
|
|
7
8
|
_ = require ("./GetText");
|
|
@@ -65,18 +66,20 @@ module .exports = class Dashboard extends Interface
|
|
|
65
66
|
.text ("edit_note")
|
|
66
67
|
.appendTo (this .toolbar)
|
|
67
68
|
.on ("click", () => this .togglePanel (!this .config .file .panel));
|
|
69
|
+
|
|
70
|
+
electron .ipcRenderer .on ("browser-update", (event, value) => this .config .global .play = value);
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
configure ()
|
|
71
74
|
{
|
|
72
75
|
this .config .file .setDefaultValues ({
|
|
73
76
|
pointer: "arrow",
|
|
74
|
-
play:
|
|
77
|
+
play: this .config .global .play,
|
|
75
78
|
panel: false,
|
|
76
79
|
});
|
|
77
80
|
|
|
78
81
|
this [this .config .file .pointer] ();
|
|
79
|
-
this .play (this .config .file .play && !this .isInitialScene);
|
|
82
|
+
this .play ((this .config .file .play) && !this .isInitialScene);
|
|
80
83
|
this .straighten (this .browser .getBrowserOption ("StraightenHorizon"));
|
|
81
84
|
|
|
82
85
|
if (this .config .file .panel)
|
|
@@ -177,15 +177,7 @@ module .exports = class Document extends Interface
|
|
|
177
177
|
|
|
178
178
|
this .browser .updateConcreteNode (require ("../Components/Grouping/StaticGroup"));
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
this .getTrajectoryCurve () ?.traverse (type, renderObject);
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
X3D .NurbsSwungSurface .prototype .traverse = function (type, renderObject)
|
|
186
|
-
{
|
|
187
|
-
this .getTrajectoryCurve () ?.traverse (type, renderObject);
|
|
188
|
-
};
|
|
180
|
+
require ("../Components");
|
|
189
181
|
|
|
190
182
|
// Restore
|
|
191
183
|
|
package/src/Application/Tabs.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .Arc2D .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const geometry = this .toIndexedLineSet (executionContext,
|
|
8
|
+
{
|
|
9
|
+
polyline: true,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
geometry ._metadata = this ._metadata;
|
|
13
|
+
|
|
14
|
+
return geometry;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .ArcClose2D .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const geometry = this .toIndexedFaceSet (executionContext, { texCoord: true });
|
|
8
|
+
|
|
9
|
+
geometry ._metadata = this ._metadata;
|
|
10
|
+
geometry ._solid = this ._solid;
|
|
11
|
+
|
|
12
|
+
return geometry;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .Circle2D .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const
|
|
8
|
+
browser = this .getBrowser (),
|
|
9
|
+
geometry = browser .getCircle2DOptions () .getGeometry () .copy (executionContext),
|
|
10
|
+
radius = this ._radius .getValue ();
|
|
11
|
+
|
|
12
|
+
geometry ._metadata = this ._metadata;
|
|
13
|
+
geometry ._coord = geometry ._coord .getValue () .copy (executionContext);
|
|
14
|
+
|
|
15
|
+
for (const [i, point] of geometry ._coord .point .entries ())
|
|
16
|
+
geometry ._coord .point [i] = point .multiply (radius);
|
|
17
|
+
|
|
18
|
+
geometry ._coord .getValue () .setup ();
|
|
19
|
+
geometry .setup ();
|
|
20
|
+
|
|
21
|
+
return geometry;
|
|
22
|
+
},
|
|
23
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .Disk2D .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const
|
|
8
|
+
innerRadius = Math .min (Math .abs (this ._innerRadius .getValue ()), Math .abs (this ._outerRadius .getValue ())),
|
|
9
|
+
outerRadius = Math .max (Math .abs (this ._innerRadius .getValue ()), Math .abs (this ._outerRadius .getValue ()));
|
|
10
|
+
|
|
11
|
+
if (innerRadius === outerRadius)
|
|
12
|
+
{
|
|
13
|
+
// Point
|
|
14
|
+
|
|
15
|
+
if (outerRadius === 0)
|
|
16
|
+
{
|
|
17
|
+
const geometry = executionContext .createNode ("PointSet", false);
|
|
18
|
+
|
|
19
|
+
geometry ._coord = executionContext .createNode ("Coordinate", false);
|
|
20
|
+
|
|
21
|
+
geometry ._coord .point .push (new X3D .SFVec3f ());
|
|
22
|
+
|
|
23
|
+
geometry ._coord .getValue () .setup ();
|
|
24
|
+
geometry .setup ();
|
|
25
|
+
|
|
26
|
+
return geometry;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Circle
|
|
30
|
+
|
|
31
|
+
const
|
|
32
|
+
browser = this .getBrowser (),
|
|
33
|
+
geometry = browser .getCircle2DOptions () .getGeometry () .copy (executionContext);
|
|
34
|
+
|
|
35
|
+
geometry ._coord = geometry ._coord .getValue () .copy (executionContext);
|
|
36
|
+
|
|
37
|
+
for (const [i, point] of geometry ._coord .point .entries ())
|
|
38
|
+
geometry ._coord .point [i] = point .multiply (outerRadius);
|
|
39
|
+
|
|
40
|
+
geometry ._coord .getValue () .setup ();
|
|
41
|
+
geometry .setup ();
|
|
42
|
+
|
|
43
|
+
return geometry;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const geometry = this .toIndexedFaceSet (executionContext, { texCoord: true });
|
|
47
|
+
|
|
48
|
+
geometry ._metadata = this ._metadata;
|
|
49
|
+
geometry ._solid = this ._solid;
|
|
50
|
+
|
|
51
|
+
return geometry;
|
|
52
|
+
},
|
|
53
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .Polyline2D .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const geometry = this .toIndexedLineSet (executionContext,
|
|
8
|
+
{
|
|
9
|
+
polyline: true,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
geometry ._metadata = this ._metadata;
|
|
13
|
+
|
|
14
|
+
return geometry;
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .Polypoint2D .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const geometry = executionContext .createNode ("PointSet", false);
|
|
8
|
+
|
|
9
|
+
geometry ._metadata = this ._metadata;
|
|
10
|
+
geometry ._coord = executionContext .createNode ("Coordinate", false);
|
|
11
|
+
|
|
12
|
+
for (const point of this ._point)
|
|
13
|
+
geometry ._coord .point .push (new X3D .SFVec3f (... point, 0));
|
|
14
|
+
|
|
15
|
+
geometry ._coord .getValue () .setup ();
|
|
16
|
+
geometry .setup ();
|
|
17
|
+
|
|
18
|
+
return geometry;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .Rectangle2D .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const
|
|
8
|
+
browser = this .getBrowser (),
|
|
9
|
+
geometry = browser .getRectangle2DOptions () .getGeometry () .copy (executionContext),
|
|
10
|
+
size1_2 = new X3D .SFVec3f (... this ._size .divide (2), 1);
|
|
11
|
+
|
|
12
|
+
geometry ._metadata = this ._metadata;
|
|
13
|
+
geometry ._solid = this ._solid;
|
|
14
|
+
|
|
15
|
+
geometry ._texCoord = geometry ._texCoord .getValue () .copy (executionContext);
|
|
16
|
+
geometry ._coord = geometry ._coord .getValue () .copy (executionContext);
|
|
17
|
+
|
|
18
|
+
for (const [i, point] of geometry ._coord .point .entries ())
|
|
19
|
+
geometry ._coord .point [i] = point .multVec (size1_2);
|
|
20
|
+
|
|
21
|
+
geometry ._texCoord .getValue () .setup ();
|
|
22
|
+
geometry ._coord .getValue () .setup ();
|
|
23
|
+
geometry .setup ();
|
|
24
|
+
|
|
25
|
+
return geometry;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .TriangleSet2D .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const
|
|
8
|
+
texCoords = this .getTexCoords (),
|
|
9
|
+
vertices = this .getVertices (),
|
|
10
|
+
geometry = executionContext .createNode ("IndexedFaceSet", false);
|
|
11
|
+
|
|
12
|
+
geometry ._metadata = this ._metadata;
|
|
13
|
+
geometry ._solid = this ._solid;
|
|
14
|
+
|
|
15
|
+
geometry ._texCoord = executionContext .createNode ("TextureCoordinate", false);
|
|
16
|
+
geometry ._coord = executionContext .createNode ("Coordinate", false);
|
|
17
|
+
|
|
18
|
+
for (let i = 0, length = vertices .length / 12; i < length; ++ i)
|
|
19
|
+
geometry ._coordIndex .push (i * 3, i * 3 + 1, i * 3 + 2, -1);
|
|
20
|
+
|
|
21
|
+
for (let i = 0, length = vertices .length; i < length; i += 4)
|
|
22
|
+
{
|
|
23
|
+
geometry ._texCoord .point .push (new X3D .SFVec2f (texCoords [i], texCoords [i + 1]));
|
|
24
|
+
geometry ._coord .point .push (new X3D .SFVec3f (vertices [i], vertices [i + 1], 0));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
geometry ._texCoord .getValue () .setup ();
|
|
28
|
+
geometry ._coord .getValue () .setup ();
|
|
29
|
+
geometry .setup ();
|
|
30
|
+
|
|
31
|
+
return geometry;
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .Box .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const
|
|
8
|
+
browser = this .getBrowser (),
|
|
9
|
+
geometry = browser .getBoxOptions () .getGeometry () .copy (executionContext),
|
|
10
|
+
size1_2 = this ._size .divide (2);
|
|
11
|
+
|
|
12
|
+
geometry ._metadata = this ._metadata;
|
|
13
|
+
geometry ._solid = this ._solid;
|
|
14
|
+
|
|
15
|
+
geometry ._texCoord = geometry ._texCoord .getValue () .copy (executionContext);
|
|
16
|
+
geometry ._coord = geometry ._coord .getValue () .copy (executionContext);
|
|
17
|
+
|
|
18
|
+
for (const [i, point] of geometry ._coord .point .entries ())
|
|
19
|
+
geometry ._coord .point [i] = point .multVec (size1_2);
|
|
20
|
+
|
|
21
|
+
geometry ._texCoord .getValue () .setup ();
|
|
22
|
+
geometry ._coord .getValue () .setup ();
|
|
23
|
+
geometry .setup ();
|
|
24
|
+
|
|
25
|
+
return geometry;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .Cone .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const
|
|
8
|
+
browser = this .getBrowser (),
|
|
9
|
+
geometry = browser .getConeOptions () .getSideGeometry () .copy (executionContext),
|
|
10
|
+
radius = this ._bottomRadius .getValue (),
|
|
11
|
+
height1_2 = this ._height .getValue () / 2;
|
|
12
|
+
|
|
13
|
+
geometry ._metadata = this ._metadata;
|
|
14
|
+
geometry ._coordIndex = [ ];
|
|
15
|
+
geometry ._normalIndex = [ ];
|
|
16
|
+
geometry ._solid = this ._solid;
|
|
17
|
+
geometry ._creaseAngle = Math .PI;
|
|
18
|
+
|
|
19
|
+
geometry ._texCoord = geometry ._texCoord .getValue () .copy (executionContext);
|
|
20
|
+
geometry ._normal = null;
|
|
21
|
+
geometry ._coord = geometry ._coord .getValue () .copy (executionContext);
|
|
22
|
+
|
|
23
|
+
for (const point of geometry ._coord .point)
|
|
24
|
+
{
|
|
25
|
+
point .x *= radius;
|
|
26
|
+
point .y *= height1_2;
|
|
27
|
+
point .z *= radius;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (this ._side .getValue ())
|
|
31
|
+
{
|
|
32
|
+
const last = geometry ._coord .point .length - 1;
|
|
33
|
+
|
|
34
|
+
for (const index of browser .getConeOptions () .getSideGeometry () ._coordIndex)
|
|
35
|
+
{
|
|
36
|
+
if (index < 0 || index !== last)
|
|
37
|
+
{
|
|
38
|
+
geometry ._coordIndex .push (index);
|
|
39
|
+
}
|
|
40
|
+
else
|
|
41
|
+
{
|
|
42
|
+
geometry ._coordIndex .push (geometry ._coord .point .length);
|
|
43
|
+
geometry ._coord .point .push (geometry ._coord .point [index]);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else
|
|
48
|
+
{
|
|
49
|
+
geometry ._texCoordIndex .length = 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (this ._bottom .getValue ())
|
|
53
|
+
{
|
|
54
|
+
for (const index of browser .getConeOptions () .getBottomGeometry () ._texCoordIndex)
|
|
55
|
+
geometry ._texCoordIndex .push (index);
|
|
56
|
+
|
|
57
|
+
for (const index of browser .getConeOptions () .getBottomGeometry () ._coordIndex)
|
|
58
|
+
{
|
|
59
|
+
if (index < 0)
|
|
60
|
+
{
|
|
61
|
+
geometry ._coordIndex .push (-1);
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
{
|
|
65
|
+
geometry ._coordIndex .push (geometry ._coord .point .length);
|
|
66
|
+
geometry ._coord .point .push (geometry ._coord .point [index]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// geometry .optimize ();
|
|
72
|
+
|
|
73
|
+
geometry ._texCoord .getValue () .setup ();
|
|
74
|
+
geometry ._coord .getValue () .setup ();
|
|
75
|
+
geometry .setup ();
|
|
76
|
+
|
|
77
|
+
return geometry;
|
|
78
|
+
},
|
|
79
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .Cylinder .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const
|
|
8
|
+
browser = this .getBrowser (),
|
|
9
|
+
geometry = browser .getCylinderOptions () .getSideGeometry () .copy (executionContext),
|
|
10
|
+
radius = this ._radius .getValue (),
|
|
11
|
+
height1_2 = this ._height .getValue () / 2;
|
|
12
|
+
|
|
13
|
+
geometry ._metadata = this ._metadata;
|
|
14
|
+
geometry ._normalIndex = [ ];
|
|
15
|
+
geometry ._solid = this ._solid;
|
|
16
|
+
geometry ._creaseAngle = Math .PI;
|
|
17
|
+
|
|
18
|
+
geometry ._texCoord = geometry ._texCoord .getValue () .copy (executionContext);
|
|
19
|
+
geometry ._normal = null;
|
|
20
|
+
geometry ._coord = geometry ._coord .getValue () .copy (executionContext);
|
|
21
|
+
|
|
22
|
+
for (const point of geometry ._coord .point)
|
|
23
|
+
{
|
|
24
|
+
point .x *= radius;
|
|
25
|
+
point .y *= height1_2;
|
|
26
|
+
point .z *= radius;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!this ._side .getValue ())
|
|
30
|
+
{
|
|
31
|
+
geometry ._texCoordIndex .length = 0;
|
|
32
|
+
geometry ._coordIndex .length = 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (this ._top .getValue ())
|
|
36
|
+
{
|
|
37
|
+
for (const index of browser .getCylinderOptions () .getTopGeometry () ._texCoordIndex)
|
|
38
|
+
geometry ._texCoordIndex .push (index);
|
|
39
|
+
|
|
40
|
+
for (const index of browser .getCylinderOptions () .getTopGeometry () ._coordIndex)
|
|
41
|
+
{
|
|
42
|
+
if (index < 0)
|
|
43
|
+
{
|
|
44
|
+
geometry ._coordIndex .push (-1);
|
|
45
|
+
}
|
|
46
|
+
else
|
|
47
|
+
{
|
|
48
|
+
geometry ._coordIndex .push (geometry ._coord .point .length);
|
|
49
|
+
geometry ._coord .point .push (geometry ._coord .point [index]);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (this ._bottom .getValue ())
|
|
55
|
+
{
|
|
56
|
+
for (const index of browser .getCylinderOptions () .getBottomGeometry () ._texCoordIndex)
|
|
57
|
+
geometry ._texCoordIndex .push (index);
|
|
58
|
+
|
|
59
|
+
for (const index of browser .getCylinderOptions () .getBottomGeometry () ._coordIndex)
|
|
60
|
+
{
|
|
61
|
+
if (index < 0)
|
|
62
|
+
{
|
|
63
|
+
geometry ._coordIndex .push (-1);
|
|
64
|
+
}
|
|
65
|
+
else
|
|
66
|
+
{
|
|
67
|
+
geometry ._coordIndex .push (geometry ._coord .point .length);
|
|
68
|
+
geometry ._coord .point .push (geometry ._coord .point [index]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// geometry .optimize ();
|
|
74
|
+
|
|
75
|
+
geometry ._texCoord .getValue () .setup ();
|
|
76
|
+
geometry ._coord .getValue () .setup ();
|
|
77
|
+
geometry .setup ();
|
|
78
|
+
|
|
79
|
+
return geometry;
|
|
80
|
+
},
|
|
81
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const X3D = require ("../../X3D");
|
|
2
|
+
|
|
3
|
+
Object .assign (X3D .ElevationGrid .prototype,
|
|
4
|
+
{
|
|
5
|
+
toPrimitive (executionContext = this .getExecutionContext ())
|
|
6
|
+
{
|
|
7
|
+
const geometry = this .toIndexedFaceSet (executionContext,
|
|
8
|
+
{
|
|
9
|
+
fogCoord: !!this ._fogCoord .getValue (),
|
|
10
|
+
color: !!this ._color .getValue (),
|
|
11
|
+
texCoord: true,
|
|
12
|
+
tangent: !!this ._tangent .getValue (),
|
|
13
|
+
normal: !!this ._normal .getValue (),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
geometry ._metadata = this ._metadata;
|
|
17
|
+
geometry ._solid = this ._solid;
|
|
18
|
+
geometry ._ccw = this ._ccw;
|
|
19
|
+
geometry ._creaseAngle = this ._creaseAngle;
|
|
20
|
+
|
|
21
|
+
return geometry;
|
|
22
|
+
},
|
|
23
|
+
});
|