x_ite 8.6.7 → 8.6.8

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.
Files changed (62) hide show
  1. package/dist/assets/components/Annotation.js +13 -13
  2. package/dist/assets/components/Annotation.min.js +1 -1
  3. package/dist/assets/components/CADGeometry.js +13 -13
  4. package/dist/assets/components/CADGeometry.min.js +1 -1
  5. package/dist/assets/components/CubeMapTexturing.js +26 -26
  6. package/dist/assets/components/CubeMapTexturing.min.js +1 -1
  7. package/dist/assets/components/DIS.js +13 -13
  8. package/dist/assets/components/DIS.min.js +1 -1
  9. package/dist/assets/components/EventUtilities.js +9 -9
  10. package/dist/assets/components/EventUtilities.min.js +1 -1
  11. package/dist/assets/components/Geometry2D.js +19 -19
  12. package/dist/assets/components/Geometry2D.min.js +1 -1
  13. package/dist/assets/components/Geospatial.js +33 -33
  14. package/dist/assets/components/Geospatial.min.js +1 -1
  15. package/dist/assets/components/HAnim.js +18 -18
  16. package/dist/assets/components/HAnim.min.js +1 -1
  17. package/dist/assets/components/KeyDeviceSensor.js +8 -8
  18. package/dist/assets/components/KeyDeviceSensor.min.js +1 -1
  19. package/dist/assets/components/Layout.js +27 -27
  20. package/dist/assets/components/Layout.min.js +1 -1
  21. package/dist/assets/components/NURBS.js +24 -24
  22. package/dist/assets/components/NURBS.min.js +1 -1
  23. package/dist/assets/components/ParticleSystems.js +23 -23
  24. package/dist/assets/components/ParticleSystems.min.js +1 -1
  25. package/dist/assets/components/Picking.js +19 -19
  26. package/dist/assets/components/Picking.min.js +1 -1
  27. package/dist/assets/components/RigidBodyPhysics.js +18 -18
  28. package/dist/assets/components/RigidBodyPhysics.min.js +1 -1
  29. package/dist/assets/components/Scripting.js +28 -28
  30. package/dist/assets/components/Scripting.min.js +1 -1
  31. package/dist/assets/components/Text.js +24 -24
  32. package/dist/assets/components/Text.min.js +1 -1
  33. package/dist/assets/components/TextureProjector.js +14 -14
  34. package/dist/assets/components/TextureProjector.min.js +1 -1
  35. package/dist/assets/components/Texturing3D.js +33 -33
  36. package/dist/assets/components/Texturing3D.min.js +1 -1
  37. package/dist/assets/components/VolumeRendering.js +19 -19
  38. package/dist/assets/components/VolumeRendering.min.js +1 -1
  39. package/dist/assets/components/X_ITE.js +9 -9
  40. package/dist/assets/components/X_ITE.min.js +1 -1
  41. package/dist/x_ite.css +1 -1
  42. package/dist/x_ite.js +144 -163
  43. package/dist/x_ite.min.js +1 -1
  44. package/dist/x_ite.zip +0 -0
  45. package/docs/_config.yml +1 -1
  46. package/package.json +1 -1
  47. package/src/assets/shaders/webgl1/include/Vertex.glsl.js +2 -3
  48. package/src/assets/shaders/webgl2/include/Particle.glsl.js +9 -23
  49. package/src/standard/Math/Numbers/Color3.js +2 -2
  50. package/src/standard/Math/Numbers/Color4.js +1 -1
  51. package/src/x_ite/Browser/Shaders/Shaders.js +0 -2
  52. package/src/x_ite/Browser/VERSION.js +1 -1
  53. package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +1 -1
  54. package/src/x_ite/Components/Shape/Material.js +24 -23
  55. package/src/x_ite/Components/Shape/PhysicalMaterial.js +1 -0
  56. package/src/x_ite/Components/Shape/UnlitMaterial.js +1 -0
  57. package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +12 -10
  58. package/src/x_ite/Components/Texturing/ImageTexture.js +17 -4
  59. package/src/x_ite/Components/Texturing/MovieTexture.js +5 -4
  60. package/src/x_ite/Parser/GLTF2Parser.js +3 -9
  61. package/src/x_ite/Parser/OBJParser.js +6 -9
  62. package/src/assets/shaders/webgl1/include/Particle.glsl.js +0 -7
package/dist/x_ite.zip CHANGED
Binary file
package/docs/_config.yml CHANGED
@@ -20,7 +20,7 @@ timezone:
20
20
  # ↓ --------------------------
21
21
 
22
22
  title: X_ITE X3D Browser # the main title
23
- version: 8.6.7 # x_ite latest version
23
+ version: 8.6.8 # x_ite latest version
24
24
  size: 288 # size in kb
25
25
  x3d_latest_version: 4.0 # x3d latest version
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x_ite",
3
- "version": "8.6.7",
3
+ "version": "8.6.8",
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>",
@@ -72,7 +72,6 @@ varying vec3 vertex;
72
72
 
73
73
  // Main
74
74
 
75
- #pragma X3D include "Particle.glsl"
76
75
  #pragma X3D include "PointSize.glsl"
77
76
 
78
77
  void
@@ -101,11 +100,11 @@ vertex_main ()
101
100
  #if ! defined (X3D_GEOMETRY_0D) && ! defined (X3D_GEOMETRY_1D)
102
101
  #if defined (X3D_TEXTURE) || defined (X3D_MATERIAL_TEXTURES)
103
102
  #if X3D_NUM_TEXTURE_COORDINATES > 0
104
- texCoord0 = getTexCoord (x3d_TexCoord0);
103
+ texCoord0 = x3d_TexCoord0;
105
104
  #endif
106
105
 
107
106
  #if X3D_NUM_TEXTURE_COORDINATES > 1
108
- texCoord1 = getTexCoord (x3d_TexCoord1);
107
+ texCoord1 = x3d_TexCoord1;
109
108
  #endif
110
109
  #endif
111
110
  #endif
@@ -1,8 +1,10 @@
1
1
  export default /* glsl */ `
2
2
  #if defined (X3D_PARTICLE_SYSTEM)
3
+ #if defined (X3D_TEX_COORD_RAMP)
4
+
5
+ uniform sampler2D x3d_TexCoordRamp;
3
6
 
4
7
  in vec4 x3d_Particle;
5
- in mat4 x3d_ParticleMatrix;
6
8
 
7
9
  vec4
8
10
  texelFetch (const in sampler2D sampler, const in int index, const in int lod)
@@ -14,12 +16,8 @@ texelFetch (const in sampler2D sampler, const in int index, const in int lod)
14
16
  return t;
15
17
  }
16
18
 
17
- #if defined (X3D_TEX_COORD_RAMP)
18
-
19
- uniform sampler2D x3d_TexCoordRamp;
20
-
21
19
  vec4
22
- getParticleTexCoord (const in vec4 texCoord)
20
+ getTexCoord (const in vec4 texCoord)
23
21
  {
24
22
  const int map [6] = int [6] (0, 1, 2, 0, 2, 3);
25
23
 
@@ -28,9 +26,11 @@ getParticleTexCoord (const in vec4 texCoord)
28
26
  return texelFetch (x3d_TexCoordRamp, index0 + map [gl_VertexID % 6], 0);
29
27
  }
30
28
  #else
31
- #define getParticleTexCoord(texCoord) (texCoord)
29
+ #define getTexCoord(texCoord) (texCoord)
32
30
  #endif
33
31
 
32
+ in mat4 x3d_ParticleMatrix;
33
+
34
34
  vec4
35
35
  getVertex (const in vec4 vertex)
36
36
  {
@@ -38,21 +38,7 @@ getVertex (const in vec4 vertex)
38
38
  }
39
39
 
40
40
  #else
41
-
42
- #define getVertex(vertex) (vertex)
43
- #define getParticleTexCoord(texCoord) (texCoord)
44
-
45
- #endif
46
-
47
- #if defined (X3D_PHYSICAL_MATERIAL)
48
- vec4
49
- getTexCoord (const in vec4 texCoord)
50
- {
51
- vec4 t = getParticleTexCoord (texCoord);
52
-
53
- return vec4 (t .x, 1.0 - t .y, t .z, t .w);
54
- }
55
- #else
56
- #define getTexCoord(texCoord) getParticleTexCoord(texCoord)
41
+ #define getVertex(vertex) (vertex)
42
+ #define getTexCoord(texCoord) (texCoord)
57
43
  #endif
58
44
  `;
@@ -47,7 +47,7 @@
47
47
 
48
48
  import Algorithm from "../Algorithm.js";
49
49
 
50
- const clamp = Algorithm .clamp;
50
+ const { clamp, interval, degrees } = Algorithm;
51
51
 
52
52
  const
53
53
  _r = Symbol .for ("X_ITE.Color3.r"),
@@ -157,7 +157,7 @@ Color3 .prototype =
157
157
  }
158
158
  else
159
159
  {
160
- const w = Algorithm .degrees (Algorithm .interval (h, 0, Math .PI * 2)) / 60; // sector 0 to 5
160
+ const w = degrees (interval (h, 0, Math .PI * 2)) / 60; // sector 0 to 5
161
161
 
162
162
  const i = Math .floor (w);
163
163
  const f = w - i; // factorial part of h
@@ -48,7 +48,7 @@
48
48
  import Color3 from "./Color3.js";
49
49
  import Algorithm from "../Algorithm.js";
50
50
 
51
- const clamp = Algorithm .clamp;
51
+ const { clamp } = Algorithm;
52
52
 
53
53
  const
54
54
  _r = Symbol .for ("X_ITE.Color3.r"),
@@ -53,7 +53,6 @@ import Fragment1 from "../../../assets/shaders/webgl1/include/Fragm
53
53
  import Hatch1 from "../../../assets/shaders/webgl1/include/Hatch.glsl.js";
54
54
  import Material1 from "../../../assets/shaders/webgl1/include/Material.glsl.js";
55
55
  import Normal1 from "../../../assets/shaders/webgl1/include/Normal.glsl.js";
56
- import Particle1 from "../../../assets/shaders/webgl1/include/Particle.glsl.js";
57
56
  import Perlin1 from "../../../assets/shaders/webgl1/include/Perlin.glsl.js";
58
57
  import Point1 from "../../../assets/shaders/webgl1/include/Point.glsl.js";
59
58
  import PointSize1 from "../../../assets/shaders/webgl1/include/PointSize.glsl.js";
@@ -117,7 +116,6 @@ const Shaders = {
117
116
  Hatch: Hatch1,
118
117
  Material: Material1,
119
118
  Normal: Normal1,
120
- Particle: Particle1,
121
119
  Perlin: Perlin1,
122
120
  Point: Point1,
123
121
  PointSize: PointSize1,
@@ -45,4 +45,4 @@
45
45
  *
46
46
  ******************************************************************************/
47
47
 
48
- export default "8.6.7";
48
+ export default "8.6.8";
@@ -203,7 +203,7 @@ ComposedCubeMapTexture .prototype = Object .assign (Object .create (X3DEnvironme
203
203
  case X3DConstants .MovieTexture:
204
204
  {
205
205
  gl .bindTexture (this .getTarget (), this .getTexture ());
206
- gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, false);
206
+ gl .pixelStorei (gl .UNPACK_FLIP_Y_WEBGL, textureNode ._flipVertically .getValue ());
207
207
  gl .texImage2D (this .getTargets () [i], 0, gl .RGBA, width, height, 0, gl .RGBA, gl .UNSIGNED_BYTE, textureNode .getElement ());
208
208
  break;
209
209
  }
@@ -71,29 +71,30 @@ Material .prototype = Object .assign (Object .create (X3DOneSidedMaterialNode .p
71
71
  {
72
72
  constructor: Material,
73
73
  [Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
74
- new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
75
- new X3DFieldDefinition (X3DConstants .inputOutput, "ambientIntensity", new Fields .SFFloat (0.2)),
76
- new X3DFieldDefinition (X3DConstants .inputOutput, "ambientTextureMapping", new Fields .SFString ()),
77
- new X3DFieldDefinition (X3DConstants .inputOutput, "ambientTexture", new Fields .SFNode ()),
78
- new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseColor", new Fields .SFColor (0.8, 0.8, 0.8)),
79
- new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseTextureMapping", new Fields .SFString ()),
80
- new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseTexture", new Fields .SFNode ()),
81
- new X3DFieldDefinition (X3DConstants .inputOutput, "specularColor", new Fields .SFColor ()),
82
- new X3DFieldDefinition (X3DConstants .inputOutput, "specularTextureMapping", new Fields .SFString ()),
83
- new X3DFieldDefinition (X3DConstants .inputOutput, "specularTexture", new Fields .SFNode ()),
84
- new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveColor", new Fields .SFColor ()),
85
- new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTextureMapping", new Fields .SFString ()),
86
- new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTexture", new Fields .SFNode ()),
87
- new X3DFieldDefinition (X3DConstants .inputOutput, "shininess", new Fields .SFFloat (0.2)),
88
- new X3DFieldDefinition (X3DConstants .inputOutput, "shininessTextureMapping", new Fields .SFString ()),
89
- new X3DFieldDefinition (X3DConstants .inputOutput, "shininessTexture", new Fields .SFNode ()),
90
- new X3DFieldDefinition (X3DConstants .inputOutput, "occlusionStrength", new Fields .SFFloat (1)),
91
- new X3DFieldDefinition (X3DConstants .inputOutput, "occlusionTextureMapping", new Fields .SFString ()),
92
- new X3DFieldDefinition (X3DConstants .inputOutput, "occlusionTexture", new Fields .SFNode ()),
93
- new X3DFieldDefinition (X3DConstants .inputOutput, "normalScale", new Fields .SFFloat (1)),
94
- new X3DFieldDefinition (X3DConstants .inputOutput, "normalTextureMapping", new Fields .SFString ()),
95
- new X3DFieldDefinition (X3DConstants .inputOutput, "normalTexture", new Fields .SFNode ()),
96
- new X3DFieldDefinition (X3DConstants .inputOutput, "transparency", new Fields .SFFloat ()),
74
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
75
+ new X3DFieldDefinition (X3DConstants .inputOutput, "ambientIntensity", new Fields .SFFloat (0.2)),
76
+ new X3DFieldDefinition (X3DConstants .inputOutput, "ambientTextureMapping", new Fields .SFString ()),
77
+ new X3DFieldDefinition (X3DConstants .inputOutput, "ambientTexture", new Fields .SFNode ()),
78
+ new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseColor", new Fields .SFColor (0.8, 0.8, 0.8)),
79
+ new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseTextureMapping", new Fields .SFString ()),
80
+ new X3DFieldDefinition (X3DConstants .inputOutput, "diffuseTexture", new Fields .SFNode ()),
81
+ new X3DFieldDefinition (X3DConstants .inputOutput, "specularColor", new Fields .SFColor ()),
82
+ new X3DFieldDefinition (X3DConstants .inputOutput, "specularTextureMapping", new Fields .SFString ()),
83
+ new X3DFieldDefinition (X3DConstants .inputOutput, "specularTexture", new Fields .SFNode ()),
84
+ new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveColor", new Fields .SFColor ()),
85
+ new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveStrength", new Fields .SFFloat (1)),
86
+ new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTextureMapping", new Fields .SFString ()),
87
+ new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTexture", new Fields .SFNode ()),
88
+ new X3DFieldDefinition (X3DConstants .inputOutput, "shininess", new Fields .SFFloat (0.2)),
89
+ new X3DFieldDefinition (X3DConstants .inputOutput, "shininessTextureMapping", new Fields .SFString ()),
90
+ new X3DFieldDefinition (X3DConstants .inputOutput, "shininessTexture", new Fields .SFNode ()),
91
+ new X3DFieldDefinition (X3DConstants .inputOutput, "occlusionStrength", new Fields .SFFloat (1)),
92
+ new X3DFieldDefinition (X3DConstants .inputOutput, "occlusionTextureMapping", new Fields .SFString ()),
93
+ new X3DFieldDefinition (X3DConstants .inputOutput, "occlusionTexture", new Fields .SFNode ()),
94
+ new X3DFieldDefinition (X3DConstants .inputOutput, "normalScale", new Fields .SFFloat (1)),
95
+ new X3DFieldDefinition (X3DConstants .inputOutput, "normalTextureMapping", new Fields .SFString ()),
96
+ new X3DFieldDefinition (X3DConstants .inputOutput, "normalTexture", new Fields .SFNode ()),
97
+ new X3DFieldDefinition (X3DConstants .inputOutput, "transparency", new Fields .SFFloat ()),
97
98
  ]),
98
99
  getTypeName: function ()
99
100
  {
@@ -71,6 +71,7 @@ PhysicalMaterial .prototype = Object .assign (Object .create (X3DOneSidedMateria
71
71
  new X3DFieldDefinition (X3DConstants .inputOutput, "baseTextureMapping", new Fields .SFString ()),
72
72
  new X3DFieldDefinition (X3DConstants .inputOutput, "baseTexture", new Fields .SFNode ()),
73
73
  new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveColor", new Fields .SFColor (0, 0, 0)),
74
+ new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveStrength", new Fields .SFFloat (1)),
74
75
  new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTextureMapping", new Fields .SFString ()),
75
76
  new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTexture", new Fields .SFNode ()),
76
77
  new X3DFieldDefinition (X3DConstants .inputOutput, "metallic", new Fields .SFFloat (1)),
@@ -64,6 +64,7 @@ UnlitMaterial .prototype = Object .assign (Object .create (X3DOneSidedMaterialNo
64
64
  [Symbol .for ("X_ITE.X3DBaseNode.fieldDefinitions")]: new FieldDefinitionArray ([
65
65
  new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
66
66
  new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveColor", new Fields .SFColor (1, 1, 1)),
67
+ new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveStrength", new Fields .SFFloat (1)),
67
68
  new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTextureMapping", new Fields .SFString ()),
68
69
  new X3DFieldDefinition (X3DConstants .inputOutput, "emissiveTexture", new Fields .SFNode ()),
69
70
  new X3DFieldDefinition (X3DConstants .inputOutput, "normalScale", new Fields .SFFloat (1)),
@@ -69,11 +69,12 @@ X3DOneSidedMaterialNode .prototype = Object .assign (Object .create (X3DMaterial
69
69
  {
70
70
  X3DMaterialNode .prototype .initialize .call (this);
71
71
 
72
- this ._emissiveColor .addInterest ("set_emissiveColor__", this);
73
- this ._emissiveTexture .addInterest ("set_emissiveTexture__", this);
74
- this ._normalTexture .addInterest ("set_normalTexture__", this);
75
- this ._transparency .addInterest ("set_transparency__", this);
76
- this ._transparency .addInterest ("set_transparent__", this);
72
+ this ._emissiveColor .addInterest ("set_emissiveColor__", this);
73
+ this ._emissiveStrength .addInterest ("set_emissiveColor__", this);
74
+ this ._emissiveTexture .addInterest ("set_emissiveTexture__", this);
75
+ this ._normalTexture .addInterest ("set_normalTexture__", this);
76
+ this ._transparency .addInterest ("set_transparency__", this);
77
+ this ._transparency .addInterest ("set_transparent__", this);
77
78
 
78
79
  this .set_emissiveColor__ ();
79
80
  this .set_emissiveTexture__ ();
@@ -86,12 +87,13 @@ X3DOneSidedMaterialNode .prototype = Object .assign (Object .create (X3DMaterial
86
87
  //this .emissiveColor .set (this ._emissiveColor .getValue ());
87
88
 
88
89
  const
89
- emissiveColor = this .emissiveColor,
90
- emissiveColor_ = this ._emissiveColor .getValue ();
90
+ emissiveColor = this .emissiveColor,
91
+ emissiveColor_ = this ._emissiveColor .getValue (),
92
+ emissiveStrength = this ._emissiveStrength .getValue ();
91
93
 
92
- emissiveColor [0] = emissiveColor_ .r;
93
- emissiveColor [1] = emissiveColor_ .g;
94
- emissiveColor [2] = emissiveColor_ .b;
94
+ emissiveColor [0] = emissiveColor_ .r * emissiveStrength;
95
+ emissiveColor [1] = emissiveColor_ .g * emissiveStrength;
96
+ emissiveColor [2] = emissiveColor_ .b * emissiveStrength;
95
97
  },
96
98
  set_emissiveTexture__: function ()
97
99
  {
@@ -77,6 +77,7 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
77
77
  new X3DFieldDefinition (X3DConstants .inputOutput, "url", new Fields .MFString ()),
78
78
  new X3DFieldDefinition (X3DConstants .inputOutput, "autoRefresh", new Fields .SFTime ()),
79
79
  new X3DFieldDefinition (X3DConstants .inputOutput, "autoRefreshTimeLimit", new Fields .SFTime (3600)),
80
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "flipVertically", new Fields .SFBool ()),
80
81
  new X3DFieldDefinition (X3DConstants .initializeOnly, "repeatS", new Fields .SFBool (true)),
81
82
  new X3DFieldDefinition (X3DConstants .initializeOnly, "repeatT", new Fields .SFBool (true)),
82
83
  new X3DFieldDefinition (X3DConstants .initializeOnly, "textureProperties", new Fields .SFNode ()),
@@ -98,6 +99,8 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
98
99
  X3DTexture2DNode .prototype .initialize .call (this);
99
100
  X3DUrlObject .prototype .initialize .call (this);
100
101
 
102
+ this ._flipVertically .addInterest ("set_url__", this);
103
+
101
104
  this .image .on ("load", this .setImage .bind (this));
102
105
  this .image .on ("abort error", this .setError .bind (this));
103
106
  this .image .prop ("crossOrigin", "Anonymous");
@@ -179,8 +182,13 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
179
182
 
180
183
  cx .clearRect (0, 0, width, height);
181
184
  cx .save ();
182
- cx .translate (0, height);
183
- cx .scale (1, -1);
185
+
186
+ if (!this ._flipVertically .getValue ())
187
+ {
188
+ cx .translate (0, height);
189
+ cx .scale (1, -1);
190
+ }
191
+
184
192
  cx .drawImage (image, 0, 0);
185
193
  cx .restore ();
186
194
  }
@@ -196,8 +204,13 @@ ImageTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
196
204
 
197
205
  cx .clearRect (0, 0, width, height);
198
206
  cx .save ();
199
- cx .translate (0, height);
200
- cx .scale (1, -1);
207
+
208
+ if (!this ._flipVertically .getValue ())
209
+ {
210
+ cx .translate (0, height);
211
+ cx .scale (1, -1);
212
+ }
213
+
201
214
  cx .drawImage (image, 0, 0, image .width, image .height, 0, 0, width, height);
202
215
  cx .restore ();
203
216
  }
@@ -93,6 +93,7 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
93
93
  new X3DFieldDefinition (X3DConstants .outputOnly, "isActive", new Fields .SFBool ()),
94
94
  new X3DFieldDefinition (X3DConstants .outputOnly, "elapsedTime", new Fields .SFTime ()),
95
95
  new X3DFieldDefinition (X3DConstants .outputOnly, "duration_changed", new Fields .SFTime (-1)),
96
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "flipVertically", new Fields .SFBool ()),
96
97
  new X3DFieldDefinition (X3DConstants .initializeOnly, "repeatS", new Fields .SFBool (true)),
97
98
  new X3DFieldDefinition (X3DConstants .initializeOnly, "repeatT", new Fields .SFBool (true)),
98
99
  new X3DFieldDefinition (X3DConstants .initializeOnly, "textureProperties", new Fields .SFNode ()),
@@ -219,7 +220,7 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
219
220
  throw new Error ("The movie texture is a non power-of-two texture.");
220
221
 
221
222
  this .setMedia (this .video [0]);
222
- this .setTexture (width, height, false, video, true);
223
+ this .setTexture (width, height, false, video, !this ._flipVertically .getValue ());
223
224
  this .setLoadState (X3DConstants .COMPLETE_STATE);
224
225
  }
225
226
  catch (error)
@@ -239,7 +240,7 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
239
240
  gif .pause ();
240
241
 
241
242
  this .setMedia (gif);
242
- this .setTexture (gif .get_canvas () .width, gif .get_canvas () .height, false, gif .get_frames () [0] .data, true);
243
+ this .setTexture (gif .get_canvas () .width, gif .get_canvas () .height, false, gif .get_frames () [0] .data, !this ._flipVertically .getValue ());
243
244
  this .setLoadState (X3DConstants .COMPLETE_STATE);
244
245
  }
245
246
  catch (error)
@@ -256,9 +257,9 @@ MovieTexture .prototype = Object .assign (Object .create (X3DTexture2DNode .prot
256
257
  return;
257
258
 
258
259
  if (this .gif)
259
- this .updateTexture (this .gif .currentFrame .data, true);
260
+ this .updateTexture (this .gif .currentFrame .data, !this ._flipVertically .getValue ());
260
261
  else
261
- this .updateTexture (this .video [0], true);
262
+ this .updateTexture (this .video [0], !this ._flipVertically .getValue ());
262
263
  },
263
264
  traverse: X3DTexture2DNode .prototype .traverse,
264
265
  dispose: function ()
@@ -696,7 +696,8 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
696
696
  if (name)
697
697
  scene .addNamedNode (scene .getUniqueName (name), textureNode);
698
698
 
699
- textureNode ._url = [image .uri];
699
+ textureNode ._url = [image .uri];
700
+ textureNode ._flipVertically = true;
700
701
 
701
702
  const sampler = this .samplers [texture .sampler];
702
703
 
@@ -926,14 +927,7 @@ GLTF2Parser .prototype = Object .assign (Object .create (X3DParser .prototype),
926
927
  if (!(KHR_materials_emissive_strength instanceof Object))
927
928
  return;
928
929
 
929
- const emissiveStrength = this .numberValue (KHR_materials_emissive_strength .emissiveStrength, 1);
930
-
931
- // Will not always get the desired result, because colors are clamped values,
932
- // especially if there is an emissiveTexture.
933
-
934
- materialNode ._emissiveColor .r *= emissiveStrength;
935
- materialNode ._emissiveColor .g *= emissiveStrength;
936
- materialNode ._emissiveColor .b *= emissiveStrength;
930
+ materialNode ._emissiveStrength = this .numberValue (KHR_materials_emissive_strength .emissiveStrength, 1);
937
931
  },
938
932
  textureTransformObject: function (KHR_texture_transform, mapping)
939
933
  {
@@ -275,15 +275,12 @@ OBJParser .prototype = Object .assign (Object .create (X3DParser .prototype),
275
275
  try
276
276
  {
277
277
  const
278
- scene = this .getExecutionContext (),
279
- url = new URL (path, scene .getWorldURL ());
280
-
281
- const input = await fetch (url)
282
- .then (response => response .arrayBuffer ())
283
- .then (arrayBuffer => $.decodeText ($.ungzip (arrayBuffer)))
284
- .catch (Function .prototype);
285
-
286
- const parser = new MaterialParser (scene, input);
278
+ scene = this .getExecutionContext (),
279
+ url = new URL (path, scene .getWorldURL ()),
280
+ response = await fetch (url),
281
+ arrayBuffer = await response .arrayBuffer (),
282
+ input = $.decodeText ($.ungzip (arrayBuffer)),
283
+ parser = new MaterialParser (scene, input);
287
284
 
288
285
  parser .parse ();
289
286
 
@@ -1,7 +0,0 @@
1
- export default /* glsl */ `
2
- #if defined (X3D_PHYSICAL_MATERIAL)
3
- #define getTexCoord(texCoord) vec4(texCoord .x, 1.0 - texCoord .y, texCoord .z, texCoord .w);
4
- #else
5
- #define getTexCoord(texCoord) (texCoord)
6
- #endif
7
- `;