x_ite 8.11.5 → 8.11.6
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/README.md +6 -0
- package/dist/assets/components/Annotation.js +13 -13
- package/dist/assets/components/Annotation.min.js +1 -1
- package/dist/assets/components/CADGeometry.js +13 -13
- package/dist/assets/components/CADGeometry.min.js +1 -1
- package/dist/assets/components/CubeMapTexturing.js +25 -25
- package/dist/assets/components/CubeMapTexturing.min.js +1 -1
- package/dist/assets/components/DIS.js +13 -13
- package/dist/assets/components/DIS.min.js +1 -1
- package/dist/assets/components/EventUtilities.js +9 -9
- package/dist/assets/components/EventUtilities.min.js +1 -1
- package/dist/assets/components/Geometry2D.js +19 -19
- package/dist/assets/components/Geometry2D.min.js +1 -1
- package/dist/assets/components/Geospatial.js +33 -33
- package/dist/assets/components/Geospatial.min.js +1 -1
- package/dist/assets/components/HAnim.js +23 -23
- package/dist/assets/components/HAnim.min.js +1 -1
- package/dist/assets/components/KeyDeviceSensor.js +8 -8
- package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
- package/dist/assets/components/Layout.js +26 -26
- package/dist/assets/components/Layout.min.js +1 -1
- package/dist/assets/components/NURBS.js +24 -24
- package/dist/assets/components/NURBS.min.js +1 -1
- package/dist/assets/components/ParticleSystems.js +50 -1061
- package/dist/assets/components/ParticleSystems.min.js +1 -1
- package/dist/assets/components/Picking.js +18 -18
- package/dist/assets/components/Picking.min.js +1 -1
- package/dist/assets/components/RigidBodyPhysics.js +17 -17
- package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
- package/dist/assets/components/Scripting.js +37 -37
- package/dist/assets/components/Scripting.min.js +1 -1
- package/dist/assets/components/Text.js +47 -31
- package/dist/assets/components/Text.min.js +1 -1
- package/dist/assets/components/TextureProjector.js +25 -21
- package/dist/assets/components/TextureProjector.min.js +1 -1
- package/dist/assets/components/Texturing3D.js +30 -30
- package/dist/assets/components/Texturing3D.min.js +1 -1
- package/dist/assets/components/VolumeRendering.js +40 -106
- package/dist/assets/components/VolumeRendering.min.js +1 -1
- package/dist/assets/components/X_ITE.js +9 -9
- package/dist/assets/components/X_ITE.min.js +1 -1
- package/dist/x_ite.css +1 -1
- package/dist/x_ite.js +1939 -5479
- package/dist/x_ite.min.js +1 -1
- package/dist/x_ite.zip +0 -0
- package/docs/_config.yml +2 -2
- package/docs/_posts/dom-integration.md +1 -1
- package/docs/_posts/features.md +12 -10
- package/package.json +6 -1
- package/src/x_ite/Browser/Text/X3DTextContext.js +24 -8
- package/src/x_ite/Browser/VERSION.js +1 -1
- package/src/x_ite/Browser/VolumeRendering/VolumeStyle.fs.js +2 -2
- package/src/x_ite/Components/Core/X3DBindableNode.js +26 -0
- package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +6 -0
- package/src/x_ite/Components/Shaders/ShaderPart.js +1 -1
- package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +2 -2
- package/src/x_ite/Components/Shape/PhysicalMaterial.js +1 -1
- package/src/x_ite/Components/TextureProjector/TextureProjector.js +5 -5
- package/src/x_ite/Components/TextureProjector/X3DTextureProjectorNode.js +6 -2
- package/src/x_ite/Components/VolumeRendering/IsoSurfaceVolumeData.js +3 -2
- package/src/x_ite/Components/VolumeRendering/SegmentedVolumeData.js +3 -2
- package/src/x_ite/Components/VolumeRendering/VolumeData.js +3 -2
- package/src/x_ite/Execution/BindableList.js +10 -9
- package/src/x_ite/Rendering/X3DRenderObject.js +6 -3
- package/webpack.config.js +39 -3
package/dist/x_ite.zip
CHANGED
|
Binary file
|
package/docs/_config.yml
CHANGED
|
@@ -20,8 +20,8 @@ timezone:
|
|
|
20
20
|
# ↓ --------------------------
|
|
21
21
|
|
|
22
22
|
title: X_ITE X3D Browser # the main title
|
|
23
|
-
version: 8.11.
|
|
24
|
-
size:
|
|
23
|
+
version: 8.11.6 # x_ite latest version
|
|
24
|
+
size: 279 # size in kb
|
|
25
25
|
x3d_latest_version: 4.0 # x3d latest version
|
|
26
26
|
|
|
27
27
|
tagline: Step Into The Future # it will display as the sub-title
|
|
@@ -7,7 +7,7 @@ tags: [DOM, Integration, XHTML, HTML]
|
|
|
7
7
|
---
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
DOM integration allows you to integrate 3D content seamlessly into your web page, with just a JavaScript file included, the scene can be written directly into the XHTML or HTML markup.
|
|
10
|
+
DOM integration allows you to integrate 3D content seamlessly into your web page, with just a JavaScript file included, the scene can be written directly into the XHTML or HTML markup and manipulated using common JavaScript DOM manipulation methods.
|
|
11
11
|
|
|
12
12
|
Andreas Plesch has written a nice plugin for X3D DOM integration. It allows JavaScript authors to use X3D content as if it were HTML. It links the X3D DOM nodes to the X3D scene graph, allowing control of the X3D scene using regular DOM manipulation methods.
|
|
13
13
|
|
package/docs/_posts/features.md
CHANGED
|
@@ -7,19 +7,19 @@ tags: [Features]
|
|
|
7
7
|
---
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
X_ITE is a fast, small, and feature-rich JavaScript library for displaying and executing X3D files. It makes things like WebGL programming, document access and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
|
|
10
|
+
X_ITE is a fast, small, and feature-rich JavaScript library for displaying and executing X3D files, and other formats like VRML, glTF and [more](./#supported-file-formats). It makes things like WebGL programming, document access and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
|
|
11
11
|
|
|
12
12
|
X_ITE is freely downloadable for any usage and licensed under the GPL3. You can use them for commercial and noncommercial purposes.
|
|
13
13
|
|
|
14
|
-
Runs completely standalone, ie. there are no other library dependencies. You just need to include x_ite.js into your HTML page.
|
|
14
|
+
Runs completely standalone, ie. there are no other library dependencies. You just need to include *x_ite.js* into your HTML page.
|
|
15
15
|
|
|
16
16
|
Competitive performance for most frequently used functions and nodes. All function within X_ITE are optimized to give your the best performance that JavaScript can offer.
|
|
17
17
|
|
|
18
|
-
The X_ITE package is optimized in size with Terser to achieve the smallest size we can reach. **X_ITE has only {{ site.size }}kB in size minified and compressed.**
|
|
18
|
+
The X_ITE package is optimized in size with Terser to achieve the smallest size we can reach. **X_ITE core component has only {{ site.size }}kB in size minified and compressed.**
|
|
19
19
|
|
|
20
20
|
X_ITE is designed for optimal performance with event driven programming. The flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other scripts.
|
|
21
21
|
|
|
22
|
-
All code is held by CREATE3000 and all contributors are selected and all contributions become verified.
|
|
22
|
+
All code is held by [CREATE3000](https://github.com/create3000) and all contributors are selected and all contributions become verified.
|
|
23
23
|
|
|
24
24
|
## Core Features
|
|
25
25
|
|
|
@@ -29,19 +29,21 @@ X_ITE comes with a high performance JavaScript rendering engine, ie. developers
|
|
|
29
29
|
|
|
30
30
|
We offer full [X3D ECMAScript](reference/ecmascript-object-and-function-definitions) support to give you the best scripting tools you can get.
|
|
31
31
|
|
|
32
|
-
X3D comes with a fixed set of objects
|
|
32
|
+
X3D comes with a fixed set of objects called *nodes* that will cover most of your needs. But its creators also planned ahead, knowing that sometimes you'll need to create your own objects. The prototyping feature lets you create complex objects that you can reuse, changing certain properties of the objects as you go.
|
|
33
33
|
|
|
34
|
-
X_ITE works seamlessly
|
|
34
|
+
X_ITE works seamlessly with [Sunrize](https://create3000.github.io/sunrize/) because Sunrize is based on X_ITE. This means that everything you create in Sunrize will look exactly the same in X_ITE, including scripts and shaders.
|
|
35
35
|
|
|
36
|
-
There is excellent
|
|
36
|
+
There is excellent built-in support for Gouraud and Phong shading. Gouraud and Phong shading is the most popular shading algorithm in use today. These methods were developed by Henri Gouraud and Phong Bui-Toung. If the built-in shading methods are not enough for you, there is support for [Custom Shaders](custom-shaders). Don't worry about *uniform variables, shader compilation and texture loading* The Composed Shader node makes it easy to write your own shader even if you are a beginner, but there is also everything for professionals. There is a standardized shader API similar to GLSL that makes it easy to convert your existing shaders. The built-in shaders support eight simultaneous local lights for each shape node, color nodes attached to a geometry are supported. There is smooth texture mapping adjustable with TextureProperties node and normals can be automatically generated depending on *creaseAngle* if you want smooth shading.
|
|
37
37
|
|
|
38
|
-
Complex routing graphs can be created.
|
|
38
|
+
Complex routing graphs can be created. X3D's event model allows the creation of connections between fields (routes), and events are propagated along these connections. The behavior graph collects all these field connections. It can be changed dynamically by rerouting, adding, or disconnecting connections. Events are injected into the system and propagated through the behavior graph in a well-defined order.
|
|
39
39
|
|
|
40
|
-
Collision detection is also considered, it is unbreakable. In virtual reality environments, collision detection is
|
|
40
|
+
Collision detection is also considered, it is unbreakable. In virtual reality environments, collision detection is an algorithm that determines how close a user is to a real physical object and will stop their movement before colliding with the object. If you want, there is terrain following support. Terrain following works by determining the ground beneath the avatar and letting him walk over plains and mountains. Use the NavigationInfo node to enable it.
|
|
41
41
|
|
|
42
42
|
To add special effects and environment sound to your scenes there is support for MovieTexture and Sound node with a standardized set of functions. These are easy to use. They use HTML5 \<video\> and \<audio\> elements internally, you don't need to worry about it.
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
Create text quickly and easily. Use the Text node, which can load remote font files in TrueType and OpenType format, but there are also built-in fonts.
|
|
45
|
+
|
|
46
|
+
With [DOM integration](dom-integration), X3D content can be used as if it were HTML and manipulated using common JavaScript DOM manipulation methods as used to do from X3DOM.
|
|
45
47
|
|
|
46
48
|
If this is not enough for you have a look at [Supported Nodes](supported-nodes) there's sure to be something there for you.
|
|
47
49
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x_ite",
|
|
3
|
-
"version": "8.11.
|
|
3
|
+
"version": "8.11.6",
|
|
4
4
|
"description": "X_ITE X3D Browser, view and manipulate X3D and VRML scenes in HTML.",
|
|
5
5
|
"homepage": "https://create3000.github.io/x_ite/",
|
|
6
6
|
"author": "Holger Seelig <holger.seelig@gmail.com>",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"Wavefront-OBJ",
|
|
31
31
|
"WebGL",
|
|
32
32
|
"wrl",
|
|
33
|
+
"x_ite",
|
|
33
34
|
"X3D",
|
|
34
35
|
"XML"
|
|
35
36
|
],
|
|
@@ -54,6 +55,10 @@
|
|
|
54
55
|
"url": "https://github.com/splace"
|
|
55
56
|
}
|
|
56
57
|
],
|
|
58
|
+
"funding": {
|
|
59
|
+
"type": "patreon",
|
|
60
|
+
"url": "https://patreon.com/X_ITE"
|
|
61
|
+
},
|
|
57
62
|
"devDependencies": {
|
|
58
63
|
"ammojs": "^0.0.2",
|
|
59
64
|
"CharLS.js": "^2.0.1",
|
|
@@ -74,7 +74,7 @@ Object .assign (X3DTextContext .prototype,
|
|
|
74
74
|
},
|
|
75
75
|
getFont (url, cache = true)
|
|
76
76
|
{
|
|
77
|
-
return new Promise ((resolve, reject) =>
|
|
77
|
+
return new Promise (async (resolve, reject) =>
|
|
78
78
|
{
|
|
79
79
|
url = url .toString ();
|
|
80
80
|
|
|
@@ -82,13 +82,29 @@ Object .assign (X3DTextContext .prototype,
|
|
|
82
82
|
|
|
83
83
|
if (!deferred)
|
|
84
84
|
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
try
|
|
86
|
+
{
|
|
87
|
+
this [_fontCache] .set (url, deferred = $.Deferred ());
|
|
88
|
+
|
|
89
|
+
const response = await fetch (url, { cache: cache ? "default" : "reload"});
|
|
90
|
+
|
|
91
|
+
if (response .ok)
|
|
92
|
+
{
|
|
93
|
+
const
|
|
94
|
+
buffer = await response .arrayBuffer (),
|
|
95
|
+
font = opentype .parse (buffer);
|
|
96
|
+
|
|
97
|
+
deferred .resolve (font);
|
|
98
|
+
}
|
|
99
|
+
else
|
|
100
|
+
{
|
|
101
|
+
throw new Error (response .statusText || response .status);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (error)
|
|
105
|
+
{
|
|
106
|
+
deferred .reject (error);
|
|
107
|
+
}
|
|
92
108
|
}
|
|
93
109
|
|
|
94
110
|
deferred .done (resolve) .fail (reject);
|
|
@@ -17,7 +17,7 @@ const float M_PI = 3.14159265359;
|
|
|
17
17
|
#pragma X3D include "includes/ClipPlanes.glsl"
|
|
18
18
|
#pragma X3D include "includes/Fog.glsl"
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
__VOLUME_STYLES_UNIFORMS__
|
|
21
21
|
|
|
22
22
|
out vec4 x3d_FragColor;
|
|
23
23
|
|
|
@@ -37,7 +37,7 @@ getTextureColor (in vec3 texCoord)
|
|
|
37
37
|
|
|
38
38
|
// Apply volume styles.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
__VOLUME_STYLES_FUNCTIONS__
|
|
41
41
|
|
|
42
42
|
return textureColor;
|
|
43
43
|
}
|
|
@@ -48,21 +48,39 @@
|
|
|
48
48
|
import X3DChildNode from "./X3DChildNode.js";
|
|
49
49
|
import X3DConstants from "../../Base/X3DConstants.js";
|
|
50
50
|
|
|
51
|
+
let modificationCount = 0;
|
|
52
|
+
|
|
51
53
|
function X3DBindableNode (executionContext)
|
|
52
54
|
{
|
|
53
55
|
X3DChildNode .call (this, executionContext);
|
|
54
56
|
|
|
55
57
|
this .addType (X3DConstants .X3DBindableNode);
|
|
58
|
+
|
|
59
|
+
this .modificationCount = 0;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
Object .assign (Object .setPrototypeOf (X3DBindableNode .prototype, X3DChildNode .prototype),
|
|
59
63
|
{
|
|
64
|
+
initialize ()
|
|
65
|
+
{
|
|
66
|
+
X3DChildNode .prototype .initialize .call (this);
|
|
67
|
+
|
|
68
|
+
this ._set_bind .addInterest ("set_bind__", this);
|
|
69
|
+
},
|
|
60
70
|
isCameraObject ()
|
|
61
71
|
{
|
|
62
72
|
return true;
|
|
63
73
|
},
|
|
74
|
+
getModificationCount ()
|
|
75
|
+
{
|
|
76
|
+
return this .modificationCount;
|
|
77
|
+
},
|
|
64
78
|
transitionStart ()
|
|
65
79
|
{ },
|
|
80
|
+
set_bind__ ()
|
|
81
|
+
{
|
|
82
|
+
this .modificationCount = ++ modificationCount;
|
|
83
|
+
}
|
|
66
84
|
});
|
|
67
85
|
|
|
68
86
|
Object .defineProperties (X3DBindableNode,
|
|
@@ -77,6 +95,14 @@ Object .defineProperties (X3DBindableNode,
|
|
|
77
95
|
value: "Core",
|
|
78
96
|
enumerable: true,
|
|
79
97
|
},
|
|
98
|
+
getModificationCount:
|
|
99
|
+
{
|
|
100
|
+
value: function ()
|
|
101
|
+
{
|
|
102
|
+
return modificationCount;
|
|
103
|
+
},
|
|
104
|
+
enumerable: false,
|
|
105
|
+
},
|
|
80
106
|
});
|
|
81
107
|
|
|
82
108
|
export default X3DBindableNode;
|
|
@@ -882,6 +882,9 @@ Object .assign (Object .setPrototypeOf (X3DParticleEmitterNode .prototype, X3DNo
|
|
|
882
882
|
gl .shaderSource (vertexShader, vertexShaderSource);
|
|
883
883
|
gl .compileShader (vertexShader);
|
|
884
884
|
|
|
885
|
+
if (!gl .getShaderParameter (vertexShader, gl .COMPILE_STATUS))
|
|
886
|
+
console .error (gl .getShaderInfoLog (vertexShader));
|
|
887
|
+
|
|
885
888
|
// Fragment shader
|
|
886
889
|
|
|
887
890
|
const fragmentShader = gl .createShader (gl .FRAGMENT_SHADER);
|
|
@@ -889,6 +892,9 @@ Object .assign (Object .setPrototypeOf (X3DParticleEmitterNode .prototype, X3DNo
|
|
|
889
892
|
gl .shaderSource (fragmentShader, fragmentShaderSource);
|
|
890
893
|
gl .compileShader (fragmentShader);
|
|
891
894
|
|
|
895
|
+
if (!gl .getShaderParameter (fragmentShader, gl .COMPILE_STATUS))
|
|
896
|
+
console .error (gl .getShaderInfoLog (fragmentShader));
|
|
897
|
+
|
|
892
898
|
// Program
|
|
893
899
|
|
|
894
900
|
const program = gl .createProgram ();
|
|
@@ -164,7 +164,7 @@ Object .assign (Object .setPrototypeOf (ShaderPart .prototype, X3DNode .prototyp
|
|
|
164
164
|
gl .shaderSource (shader, source);
|
|
165
165
|
gl .compileShader (shader);
|
|
166
166
|
|
|
167
|
-
if (!
|
|
167
|
+
if (!gl .getShaderParameter (shader, gl .COMPILE_STATUS))
|
|
168
168
|
{
|
|
169
169
|
const
|
|
170
170
|
typeName = this .getTypeName (),
|
|
@@ -988,9 +988,9 @@ Object .assign (X3DProgrammableShaderObject .prototype,
|
|
|
988
988
|
|
|
989
989
|
// Set global uniforms.
|
|
990
990
|
|
|
991
|
-
if (this .
|
|
991
|
+
if (this .renderCount !== renderObject .getRenderCount ())
|
|
992
992
|
{
|
|
993
|
-
this .
|
|
993
|
+
this .renderCount = renderObject .getRenderCount ();
|
|
994
994
|
|
|
995
995
|
// Set viewport.
|
|
996
996
|
|
|
@@ -185,7 +185,7 @@ Object .assign (Object .setPrototypeOf (PhysicalMaterial .prototype, X3DOneSided
|
|
|
185
185
|
options .push ("X3D_OCCLUSION_TEXTURE", `X3D_OCCLUSION_TEXTURE_${this .occlusionTextureNode .getTextureTypeString ()}`);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
var shaderNode = browser .createShader ("
|
|
188
|
+
var shaderNode = browser .createShader ("PBRShader", "Default", "PBR", options);
|
|
189
189
|
}
|
|
190
190
|
else
|
|
191
191
|
{
|
|
@@ -98,11 +98,11 @@ Object .assign (TextureProjectorContainer .prototype,
|
|
|
98
98
|
invTextureSpaceMatrix .inverse ();
|
|
99
99
|
|
|
100
100
|
const
|
|
101
|
-
width
|
|
102
|
-
height
|
|
103
|
-
nearDistance
|
|
104
|
-
farDistance
|
|
105
|
-
fieldOfView
|
|
101
|
+
width = textureProjectorNode .getTexture () .getWidth (),
|
|
102
|
+
height = textureProjectorNode .getTexture () .getHeight (),
|
|
103
|
+
nearDistance = textureProjectorNode .getNearDistance (),
|
|
104
|
+
farDistance = textureProjectorNode .getFarDistance (),
|
|
105
|
+
fieldOfView = textureProjectorNode .getFieldOfView ();
|
|
106
106
|
|
|
107
107
|
Camera .perspective (fieldOfView, nearDistance, farDistance, width, height, this .projectionMatrix);
|
|
108
108
|
|
|
@@ -88,11 +88,15 @@ Object .assign (Object .setPrototypeOf (X3DTextureProjectorNode .prototype, X3DC
|
|
|
88
88
|
},
|
|
89
89
|
getNearDistance ()
|
|
90
90
|
{
|
|
91
|
-
|
|
91
|
+
const nearDistance = this ._nearDistance .getValue ();
|
|
92
|
+
|
|
93
|
+
return nearDistance === -1 ? 0.125 : nearDistance;
|
|
92
94
|
},
|
|
93
95
|
getFarDistance ()
|
|
94
96
|
{
|
|
95
|
-
|
|
97
|
+
const farDistance = this ._farDistance .getValue ();
|
|
98
|
+
|
|
99
|
+
return farDistance === -1 ? 100_000 : farDistance;
|
|
96
100
|
},
|
|
97
101
|
getTexture ()
|
|
98
102
|
{
|
|
@@ -271,8 +271,9 @@ Object .assign (Object .setPrototypeOf (IsoSurfaceVolumeData .prototype, X3DVolu
|
|
|
271
271
|
styleFunctions += "\n";
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
fs = fs
|
|
275
|
-
|
|
274
|
+
fs = fs
|
|
275
|
+
.replace (/__VOLUME_STYLES_UNIFORMS__/, styleUniforms)
|
|
276
|
+
.replace (/__VOLUME_STYLES_FUNCTIONS__/, styleFunctions);
|
|
276
277
|
|
|
277
278
|
// if (DEVELOPMENT)
|
|
278
279
|
// this .getBrowser () .print (fs);
|
|
@@ -186,8 +186,9 @@ Object .assign (Object .setPrototypeOf (SegmentedVolumeData .prototype, X3DVolum
|
|
|
186
186
|
styleFunctions += " }\n";
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
fs = fs
|
|
190
|
-
|
|
189
|
+
fs = fs
|
|
190
|
+
.replace (/__VOLUME_STYLES_UNIFORMS__/, styleUniforms)
|
|
191
|
+
.replace (/__VOLUME_STYLES_FUNCTIONS__/, styleFunctions);
|
|
191
192
|
|
|
192
193
|
// if (DEVELOPMENT)
|
|
193
194
|
// this .getBrowser () .print (fs);
|
|
@@ -128,8 +128,9 @@ Object .assign (Object .setPrototypeOf (VolumeData .prototype, X3DVolumeDataNode
|
|
|
128
128
|
styleFunctions += this .renderStyleNode .getFunctionsText ();
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
fs = fs
|
|
132
|
-
|
|
131
|
+
fs = fs
|
|
132
|
+
.replace (/__VOLUME_STYLES_UNIFORMS__/, styleUniforms)
|
|
133
|
+
.replace (/__VOLUME_STYLES_FUNCTIONS__/, styleFunctions);
|
|
133
134
|
|
|
134
135
|
// if (DEVELOPMENT)
|
|
135
136
|
// this .getBrowser () .print (fs);
|
|
@@ -45,17 +45,18 @@
|
|
|
45
45
|
*
|
|
46
46
|
******************************************************************************/
|
|
47
47
|
|
|
48
|
-
import X3DBaseNode
|
|
48
|
+
import X3DBaseNode from "../Base/X3DBaseNode.js";
|
|
49
|
+
import X3DBindableNode from "../Components/Core/X3DBindableNode.js";
|
|
49
50
|
|
|
50
51
|
function BindableList (executionContext, defaultNode)
|
|
51
52
|
{
|
|
52
53
|
X3DBaseNode .call (this, executionContext);
|
|
53
54
|
|
|
54
|
-
this .
|
|
55
|
-
this .nodes
|
|
56
|
-
this .collectedNodes
|
|
57
|
-
this .changedNodes
|
|
58
|
-
this .removedNodes
|
|
55
|
+
this .modificationCount = 0;
|
|
56
|
+
this .nodes = [ defaultNode ];
|
|
57
|
+
this .collectedNodes = [ defaultNode ];
|
|
58
|
+
this .changedNodes = [ ];
|
|
59
|
+
this .removedNodes = [ ];
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
Object .assign (Object .setPrototypeOf (BindableList .prototype, X3DBaseNode .prototype),
|
|
@@ -132,7 +133,7 @@ Object .assign (Object .setPrototypeOf (BindableList .prototype, X3DBaseNode .pr
|
|
|
132
133
|
|
|
133
134
|
for (const node of collectedNodes)
|
|
134
135
|
{
|
|
135
|
-
if (node .
|
|
136
|
+
if (node .getModificationCount () > this .modificationCount)
|
|
136
137
|
changedNodes .push (node);
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -165,9 +166,9 @@ Object .assign (Object .setPrototypeOf (BindableList .prototype, X3DBaseNode .pr
|
|
|
165
166
|
changedNodes .length = 0;
|
|
166
167
|
removedNodes .length = 0;
|
|
167
168
|
|
|
168
|
-
// Advance
|
|
169
|
+
// Advance modificationCount time.
|
|
169
170
|
|
|
170
|
-
this .
|
|
171
|
+
this .modificationCount = X3DBindableNode .getModificationCount ();
|
|
171
172
|
},
|
|
172
173
|
});
|
|
173
174
|
|
|
@@ -61,10 +61,13 @@ import StopWatch from "../../standard/Time/StopWatch.js";
|
|
|
61
61
|
|
|
62
62
|
const DEPTH_BUFFER_SIZE = 16;
|
|
63
63
|
|
|
64
|
+
let renderCount = 0;
|
|
65
|
+
|
|
64
66
|
function X3DRenderObject (executionContext)
|
|
65
67
|
{
|
|
66
68
|
const browser = executionContext .getBrowser ();
|
|
67
69
|
|
|
70
|
+
this .renderCount = 0;
|
|
68
71
|
this .viewVolumes = [ ];
|
|
69
72
|
this .cameraSpaceMatrix = new MatrixStack (Matrix4);
|
|
70
73
|
this .viewMatrix = new MatrixStack (Matrix4);
|
|
@@ -112,9 +115,9 @@ Object .assign (X3DRenderObject .prototype,
|
|
|
112
115
|
{
|
|
113
116
|
return true;
|
|
114
117
|
},
|
|
115
|
-
|
|
118
|
+
getRenderCount ()
|
|
116
119
|
{
|
|
117
|
-
return this .
|
|
120
|
+
return this .renderCount;
|
|
118
121
|
},
|
|
119
122
|
getViewVolumes ()
|
|
120
123
|
{
|
|
@@ -991,7 +994,7 @@ Object .assign (X3DRenderObject .prototype,
|
|
|
991
994
|
oit = browser .getFrameBuffer () .getOrderIndependentTransparency ();
|
|
992
995
|
|
|
993
996
|
|
|
994
|
-
this .
|
|
997
|
+
this .renderCount = ++ renderCount;
|
|
995
998
|
|
|
996
999
|
this .logarithmicDepthBuffer = browser .getBrowserOption ("LogarithmicDepthBuffer")
|
|
997
1000
|
|| this .getViewpoint () .getLogarithmicDepthBuffer ();
|
package/webpack.config.js
CHANGED
|
@@ -61,6 +61,42 @@ export default __default__;`;
|
|
|
61
61
|
],
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
const compress_glsl = {
|
|
65
|
+
test: /\.js$/,
|
|
66
|
+
use: [
|
|
67
|
+
{
|
|
68
|
+
loader: StringReplacePlugin .replace ({
|
|
69
|
+
replacements: [
|
|
70
|
+
{
|
|
71
|
+
pattern: /\/\*\s*glsl\s*\*\/\s*`(.*?)`;/sg,
|
|
72
|
+
replacement: function (match, m, offset, string)
|
|
73
|
+
{
|
|
74
|
+
const e = [ ];
|
|
75
|
+
|
|
76
|
+
return "/* glsl */ `" + m
|
|
77
|
+
.replace (/\$\{(?:[^}{]|\{(?:[^}{]|\{(?:[^}{]|\{[^}{]*\})*\})*\})*\}/sg, s =>
|
|
78
|
+
{
|
|
79
|
+
return `__EXPRESSION${e .push (s) - 1}__`
|
|
80
|
+
})
|
|
81
|
+
.replace (/\/\*.*?\*\//sg, "")
|
|
82
|
+
.replace (/\/\/.*?\n/sg, "\n")
|
|
83
|
+
.replace (/(#.*?)\n/sg, "$1__PREPROCESSOR__")
|
|
84
|
+
.replace (/\s+/sg, " ")
|
|
85
|
+
.replace (/\s*([(){}\[\],;=<>!+\-*\/&|?:\.])\s*/sg, "$1")
|
|
86
|
+
.replace (/(#.*?)__PREPROCESSOR__\s*/sg, "$1\n")
|
|
87
|
+
.replace (/(.)#/sg, "$1\n#")
|
|
88
|
+
.replace (/^\s+/, "")
|
|
89
|
+
.replace (/$/, "\n")
|
|
90
|
+
.replace (/\n+/sg, "\n")
|
|
91
|
+
.replace (/__EXPRESSION(\d+)__/sg, (_, i) => `\n${e [i]}\n`) + "`"
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
}),
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
}
|
|
99
|
+
|
|
64
100
|
targets .push ({
|
|
65
101
|
entry: {
|
|
66
102
|
"x_ite": "./src/x_ite.js",
|
|
@@ -77,7 +113,7 @@ export default __default__;`;
|
|
|
77
113
|
},
|
|
78
114
|
mode: "production",
|
|
79
115
|
module: {
|
|
80
|
-
rules: [namespace],
|
|
116
|
+
rules: [namespace, compress_glsl],
|
|
81
117
|
},
|
|
82
118
|
optimization: {
|
|
83
119
|
minimize: true,
|
|
@@ -196,7 +232,7 @@ export default __default__;`;
|
|
|
196
232
|
},
|
|
197
233
|
mode: "production",
|
|
198
234
|
module: {
|
|
199
|
-
rules: [namespace],
|
|
235
|
+
rules: [namespace, compress_glsl],
|
|
200
236
|
},
|
|
201
237
|
optimization: {
|
|
202
238
|
minimize: true,
|
|
@@ -272,7 +308,7 @@ export default __default__;`;
|
|
|
272
308
|
|
|
273
309
|
for (const deps of component_deps)
|
|
274
310
|
{
|
|
275
|
-
if (!
|
|
311
|
+
if (!deps .has (filename))
|
|
276
312
|
continue
|
|
277
313
|
|
|
278
314
|
const module = path .relative (path .resolve (__dirname, "src"), filename) .replace (/\.js$/, "")
|