ohzi-core 6.2.3 → 6.3.2

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 (100) hide show
  1. package/build/index.module.js +1 -1
  2. package/build/index.module.js.map +1 -1
  3. package/package.json +1 -1
  4. package/src/CustomBezierCurve.js +2 -2
  5. package/src/Debug.js +28 -28
  6. package/src/EventManager.js +1 -1
  7. package/src/Graphics.js +12 -12
  8. package/src/KeyboardInput.js +1 -1
  9. package/src/OS.js +5 -5
  10. package/src/UI.js +1 -1
  11. package/src/action_sequencer/ActionSequencer.js +17 -12
  12. package/src/action_sequencer/VectorInterpolator.js +1 -1
  13. package/src/canvas_drawer/CanvasDrawer.js +8 -8
  14. package/src/canvas_drawer/MultiLineTextDrawer.js +3 -3
  15. package/src/canvas_drawer/SimpleTextDrawer.js +1 -1
  16. package/src/components/EdgeMesh.js +17 -17
  17. package/src/components/GeometryEdgeVisualizer.js +1 -1
  18. package/src/components/Grid.js +3 -3
  19. package/src/components/Line.js +16 -16
  20. package/src/components/MultiLinePath.js +1 -1
  21. package/src/components/MultiLineText2D.js +1 -1
  22. package/src/components/ObjectAxis.js +3 -3
  23. package/src/components/ObjectOrientedBoundingBox.js +19 -19
  24. package/src/components/Shape2D.js +7 -7
  25. package/src/components/Shape3D.js +5 -5
  26. package/src/components/Text2D.js +3 -3
  27. package/src/components/UIElement.js +2 -2
  28. package/src/components/UpdatableMaterialMesh.js +1 -1
  29. package/src/components/WorldImage.js +4 -4
  30. package/src/components/mouse_interactors/ObjectRotator.js +2 -2
  31. package/src/components/sdf_text/SDFText.js +10 -10
  32. package/src/components/sdf_text/SDFTextBatch.js +24 -24
  33. package/src/components/sdf_text/TextGlyph.js +2 -2
  34. package/src/data_textures/RGBADataTexture.js +1 -1
  35. package/src/data_textures/RGBAFloatDataTexture.js +1 -1
  36. package/src/data_textures/RGBDataTexture.js +1 -1
  37. package/src/data_textures/RGBFloatDataTexture.js +1 -1
  38. package/src/editor/ManipulatorHandle.js +4 -4
  39. package/src/editor/ObjectEditor.js +2 -2
  40. package/src/editor/ObjectManipulator.js +3 -3
  41. package/src/gpu_particles/GPUParticleSystem.js +4 -4
  42. package/src/gpu_particles/ParticleAttribute.js +4 -4
  43. package/src/gpu_particles/ParticlePositionAttribute.js +2 -2
  44. package/src/materials/MedianFilterMaterial.js +1 -1
  45. package/src/materials/SSAOMaterial.js +5 -5
  46. package/src/materials/ScreenSpaceTextureMaterial.js +2 -2
  47. package/src/materials/UnrealBloomComposeMaterial.js +1 -1
  48. package/src/materials/UnrealBlurMaterial.js +1 -1
  49. package/src/materials/UnrealComposeMaterial.js +1 -1
  50. package/src/object_pool/Pool.js +3 -3
  51. package/src/primitives/Arrow.js +6 -6
  52. package/src/primitives/Cube.js +2 -2
  53. package/src/primitives/HorizontalPlane.js +1 -1
  54. package/src/primitives/Sphere.js +2 -2
  55. package/src/primitives/VerticalPlane.js +1 -1
  56. package/src/render_mode/DeferredRender.js +10 -10
  57. package/src/render_mode/PlanarReflectionsRender.js +3 -3
  58. package/src/render_mode/TransparencyMixRender.js +1 -1
  59. package/src/render_utilities/Blitter.js +7 -7
  60. package/src/render_utilities/GaussianBlurrer.js +3 -3
  61. package/src/render_utilities/MedianFilter.js +1 -1
  62. package/src/resource_loader/AbstractLoader.js +1 -1
  63. package/src/resource_loader/BasisLoader.js +1 -1
  64. package/src/resource_loader/CubemapLoader.js +1 -1
  65. package/src/resource_loader/DAELoader.js +1 -1
  66. package/src/resource_loader/DDSLoader.js +1 -1
  67. package/src/resource_loader/FileLoader.js +1 -1
  68. package/src/resource_loader/FontLoader.js +1 -1
  69. package/src/resource_loader/GLTFDRACOLoader.js +1 -1
  70. package/src/resource_loader/GLTFLoader.js +1 -1
  71. package/src/resource_loader/HDRCubeTextureLoader.js +1 -1
  72. package/src/resource_loader/JSONLoader.js +1 -1
  73. package/src/resource_loader/OBJLoader.js +1 -1
  74. package/src/resource_loader/PointArrayLoader.js +6 -6
  75. package/src/resource_loader/RGBETextureLoader.js +1 -1
  76. package/src/resource_loader/SVGLoader.js +1 -1
  77. package/src/resource_loader/TextLoader.js +1 -1
  78. package/src/static_batcher/GeometryBatch.js +20 -20
  79. package/src/static_batcher/GeometryBatcher.js +7 -7
  80. package/src/static_batcher/MeshBatcher.js +8 -8
  81. package/src/utilities/ArrayUtilities.js +4 -4
  82. package/src/utilities/CameraUtilities.js +24 -24
  83. package/src/utilities/EasingFunctions.js +19 -8
  84. package/src/utilities/FrustumPointFitter.js +55 -55
  85. package/src/utilities/GeometryUtilities.js +7 -7
  86. package/src/utilities/ImageUtilities.js +4 -4
  87. package/src/utilities/MeshSampler.js +33 -33
  88. package/src/utilities/ModelUtilities.js +2 -2
  89. package/src/utilities/OMath.js +4 -4
  90. package/src/utilities/ObjectUtilities.js +4 -4
  91. package/src/utilities/OrthographicFrustumPointFitter.js +10 -10
  92. package/src/utilities/PerspectiveFrustumPointFitter.js +55 -55
  93. package/src/view_components/ApplicationView.js +2 -2
  94. package/src/view_components/ViewComponent.js +26 -2
  95. package/src/view_components/ViewComponentManager.js +11 -1
  96. package/src/view_components/ViewManager.js +20 -2
  97. package/src/view_components/transition/ActionSequencerBuilder.js +18 -18
  98. package/src/view_components/transition/DrawIOAnimationSheet.js +20 -20
  99. package/src/view_components/transition/TransitionTable.js +1 -1
  100. package/src/view_components/transition/ViewStateTransitionHandler.js +2 -1
@@ -11,7 +11,7 @@ export default class MultiLinePath extends Object3D
11
11
  this.paths = [];
12
12
  for (let i = 0; i < paths.length; i++)
13
13
  {
14
- let line = new Line(paths[i], webgl);
14
+ const line = new Line(paths[i], webgl);
15
15
  this.paths.push = line;
16
16
  this.add(line);
17
17
  }
@@ -17,7 +17,7 @@ export default class MultiLineText2D extends Object3D
17
17
 
18
18
  for (let i = 0; i < text_array.length; i++)
19
19
  {
20
- let text2D = new Text2D(text_array[i], font, color, pivot);
20
+ const text2D = new Text2D(text_array[i], font, color, pivot);
21
21
  this.text_array.push(text2D);
22
22
  this.add(text2D);
23
23
  }
@@ -9,9 +9,9 @@ export default class ObjectAxis extends Object3D
9
9
  {
10
10
  super();
11
11
  size = size || 1.5;
12
- let right = new Vector3(1, 0, 0).applyQuaternion(obj.quaternion);
13
- let up = new Vector3(0, 1, 0).applyQuaternion(obj.quaternion);
14
- let forward = new Vector3(0, 0, 1).applyQuaternion(obj.quaternion);
12
+ const right = new Vector3(1, 0, 0).applyQuaternion(obj.quaternion);
13
+ const up = new Vector3(0, 1, 0).applyQuaternion(obj.quaternion);
14
+ const forward = new Vector3(0, 0, 1).applyQuaternion(obj.quaternion);
15
15
  console.log(right, up, forward);
16
16
  this.add(new Arrow('#FF0000', size, right));
17
17
  this.add(new Arrow('#00FF00', size, up));
@@ -7,7 +7,7 @@ export default class ObjectOrientedBoundingBox
7
7
  constructor(points)
8
8
  {
9
9
  let degrees = 0;
10
- let center = this.get_center(points);
10
+ const center = this.get_center(points);
11
11
  // console.log(points);
12
12
 
13
13
  let min = new Vector3(90000, 90000, 90000);
@@ -15,17 +15,17 @@ export default class ObjectOrientedBoundingBox
15
15
 
16
16
  for (let deg = 0; deg < 359; deg++)
17
17
  {
18
- let local_min = new Vector3(100000, 100000, 100000);
19
- let local_max = new Vector3(-100000, -100000, -100000);
18
+ const local_min = new Vector3(100000, 100000, 100000);
19
+ const local_max = new Vector3(-100000, -100000, -100000);
20
20
 
21
21
  for (let i = 0; i < points.length; i++)
22
22
  {
23
- let store_pos = points[i].clone();
23
+ const store_pos = points[i].clone();
24
24
  // store_pos.set(points[i].x, points[i].z, points[i].y);
25
25
 
26
26
  store_pos.sub(center);
27
27
 
28
- let quaternion = new Quaternion();
28
+ const quaternion = new Quaternion();
29
29
 
30
30
  quaternion.setFromAxisAngle(new Vector3(0, 1, 0), (deg / 359) * Math.PI * 2);
31
31
 
@@ -72,13 +72,13 @@ export default class ObjectOrientedBoundingBox
72
72
  this.max = max.clone();
73
73
  this.center = center;
74
74
 
75
- let left_down = min;
75
+ const left_down = min;
76
76
  // let left_up = min.clone().add(new Vector3(0, max.y - min.y, 0));
77
77
  // let right_up = max;
78
- let right_down = min.clone().add(new Vector3(max.x - min.x, 0, 0));
78
+ const right_down = min.clone().add(new Vector3(max.x - min.x, 0, 0));
79
79
 
80
- let deep_left = min.clone().add(new Vector3(0, 0, max.z - min.z));
81
- let deep_right = min.clone().add(new Vector3(max.x - min.x, 0, max.z - min.z));
80
+ const deep_left = min.clone().add(new Vector3(0, 0, max.z - min.z));
81
+ const deep_right = min.clone().add(new Vector3(max.x - min.x, 0, max.z - min.z));
82
82
 
83
83
  this.bounds = [];
84
84
  this.bounds[0] = left_down.clone();
@@ -106,7 +106,7 @@ export default class ObjectOrientedBoundingBox
106
106
 
107
107
  get_center(points)
108
108
  {
109
- let v = new Vector3();
109
+ const v = new Vector3();
110
110
  for (let i = 0; i < points.length; i++)
111
111
  {
112
112
  v.add(points[i]);
@@ -117,7 +117,7 @@ export default class ObjectOrientedBoundingBox
117
117
 
118
118
  box_volume(min, max)
119
119
  {
120
- let difference = max.clone().sub(min);
120
+ const difference = max.clone().sub(min);
121
121
  return Math.abs(difference.x * difference.y * difference.x);
122
122
  }
123
123
 
@@ -128,7 +128,7 @@ export default class ObjectOrientedBoundingBox
128
128
 
129
129
  is_inside_XZ(point)
130
130
  {
131
- let pos = point.clone();
131
+ const pos = point.clone();
132
132
  pos.sub(this.center);
133
133
  pos.applyQuaternion(this.world_to_axis);
134
134
  if (pos.x > this.min.x &&
@@ -146,7 +146,7 @@ export default class ObjectOrientedBoundingBox
146
146
 
147
147
  closest_point_on_bounds(reference_point)
148
148
  {
149
- let force = new Vector3();
149
+ const force = new Vector3();
150
150
  for (let i = 0; i < this.bounds.length - 1; i++)
151
151
  {
152
152
  let dir = this.bounds[i + 1].clone().sub(this.bounds[i]);
@@ -154,13 +154,13 @@ export default class ObjectOrientedBoundingBox
154
154
  dir.normalize();
155
155
  dir = new Vector3(dir.z, 0, -dir.x);
156
156
 
157
- let dir_to_point = this.world_to_local(reference_point);
157
+ const dir_to_point = this.world_to_local(reference_point);
158
158
  dir_to_point.sub(this.bounds[i]);
159
159
  dir_to_point.y = 0;
160
160
 
161
161
  if (dir_to_point.clone().normalize().dot(dir) > 0)
162
162
  {
163
- let dot = dir_to_point.clone().dot(dir);
163
+ const dot = dir_to_point.clone().dot(dir);
164
164
  force.add(dir.multiplyScalar(dot));
165
165
  }
166
166
  }
@@ -169,14 +169,14 @@ export default class ObjectOrientedBoundingBox
169
169
 
170
170
  world_to_local(point)
171
171
  {
172
- let pos = point.clone().sub(this.center);
172
+ const pos = point.clone().sub(this.center);
173
173
  pos.applyQuaternion(this.world_to_axis);
174
174
  return pos;
175
175
  }
176
176
 
177
177
  local_to_world(point)
178
178
  {
179
- let pos = point.clone();
179
+ const pos = point.clone();
180
180
  pos.applyQuaternion(this.axis_to_world);
181
181
  pos.add(this.center);
182
182
  return pos;
@@ -184,14 +184,14 @@ export default class ObjectOrientedBoundingBox
184
184
 
185
185
  local_to_world_dir(direction)
186
186
  {
187
- let dir = direction.clone();
187
+ const dir = direction.clone();
188
188
  dir.applyQuaternion(this.axis_to_world);
189
189
  return dir;
190
190
  }
191
191
 
192
192
  get_corners()
193
193
  {
194
- let corners = [];
194
+ const corners = [];
195
195
  for (let i = 0; i < this.bounds.length; i++)
196
196
  {
197
197
  corners.push(this.local_to_world(this.bounds[i]));
@@ -9,17 +9,17 @@ export default class Shape2D extends Mesh
9
9
  {
10
10
  constructor(points_2D, show_edges)
11
11
  {
12
- let shape = new Shape(points_2D);
13
- let geometry = new ShapeBufferGeometry(shape);
12
+ const shape = new Shape(points_2D);
13
+ const geometry = new ShapeBufferGeometry(shape);
14
14
  geometry.rotateX(3.14 / 2);
15
15
 
16
- let material = new MeshBasicMaterial({ color: 0xff0000 });
16
+ const material = new MeshBasicMaterial({ color: 0xff0000 });
17
17
  super(geometry, material);
18
18
  this.invert_normals(geometry);
19
19
 
20
20
  if (show_edges)
21
21
  {
22
- let edge_mesh = new GeometryEdgeVisualizer(geometry);
22
+ const edge_mesh = new GeometryEdgeVisualizer(geometry);
23
23
  edge_mesh.hide_faces();
24
24
  edge_mesh.material.depthTest = false;
25
25
  this.add(edge_mesh);
@@ -28,11 +28,11 @@ export default class Shape2D extends Mesh
28
28
 
29
29
  invert_normals(geometry)
30
30
  {
31
- let indices = geometry.index.array;
31
+ const indices = geometry.index.array;
32
32
  for (let i = 0; i < indices.length; i += 3)
33
33
  {
34
- let x = indices[i + 0];
35
- let z = indices[i + 2];
34
+ const x = indices[i + 0];
35
+ const z = indices[i + 2];
36
36
 
37
37
  indices[i + 0] = z;
38
38
  indices[i + 2] = x;
@@ -9,10 +9,10 @@ export default class Shape3D extends Mesh
9
9
  {
10
10
  constructor(points_2D, show_edges, height)
11
11
  {
12
- let shape = new Shape(points_2D);
12
+ const shape = new Shape(points_2D);
13
13
  height = height || 1;
14
14
 
15
- let extrudeSettings = {
15
+ const extrudeSettings = {
16
16
  steps: 2,
17
17
  depth: height,
18
18
  bevelEnabled: false,
@@ -21,16 +21,16 @@ export default class Shape3D extends Mesh
21
21
  bevelSegments: 1
22
22
  };
23
23
 
24
- let geometry = new ExtrudeBufferGeometry(shape, extrudeSettings);
24
+ const geometry = new ExtrudeBufferGeometry(shape, extrudeSettings);
25
25
  geometry.rotateX(3.14 / 2);
26
26
  geometry.translate(0, height, 0);
27
27
 
28
- let material = new MeshNormalMaterial({ color: 0xff0000 });
28
+ const material = new MeshNormalMaterial({ color: 0xff0000 });
29
29
  super(geometry, material);
30
30
 
31
31
  if (show_edges)
32
32
  {
33
- let edge_mesh = new GeometryEdgeVisualizer(geometry, '#FF0000');
33
+ const edge_mesh = new GeometryEdgeVisualizer(geometry, '#FF0000');
34
34
  edge_mesh.hide_faces();
35
35
  this.add(edge_mesh);
36
36
  }
@@ -8,13 +8,13 @@ export default class Text2D extends WorldImage
8
8
  {
9
9
  constructor(text, font, color, pivot, is_static)
10
10
  {
11
- let simple_text_drawer = new SimpleTextDrawer(is_static);
11
+ const simple_text_drawer = new SimpleTextDrawer(is_static);
12
12
 
13
- let draw_settings = {
13
+ const draw_settings = {
14
14
  font: font,
15
15
  font_color: color || '#000000'
16
16
  };
17
- let canvas_texture = simple_text_drawer.draw_on_texture(text, draw_settings);
17
+ const canvas_texture = simple_text_drawer.draw_on_texture(text, draw_settings);
18
18
 
19
19
  canvas_texture.minFilter = LinearMipMapLinearFilter;
20
20
  canvas_texture.minFilter = LinearFilter;
@@ -147,7 +147,7 @@ export default class UIElement extends Mesh
147
147
  this.screen_pos_tmp.x += this.pixel_offset.x;
148
148
  this.screen_pos_tmp.y += this.pixel_offset.y;
149
149
 
150
- let rect = new Box2().setFromCenterAndSize(this.screen_pos_tmp, this.get_size());
150
+ const rect = new Box2().setFromCenterAndSize(this.screen_pos_tmp, this.get_size());
151
151
 
152
152
  this.mouse_pos_tmp.copy(normalized_mouse_pos);
153
153
  this.to_screen_position(this.mouse_pos_tmp);
@@ -163,7 +163,7 @@ export default class UIElement extends Mesh
163
163
 
164
164
  get_screen_space_position()
165
165
  {
166
- let pos = this.cached_NDC_position.clone();
166
+ const pos = this.cached_NDC_position.clone();
167
167
  this.to_screen_position(pos);
168
168
  return pos;
169
169
  }
@@ -6,7 +6,7 @@ export default class UpdatableMaterialMesh extends Mesh
6
6
  {
7
7
  super(geometry, material);
8
8
 
9
- let self = this;
9
+ const self = this;
10
10
 
11
11
  this.onBeforeRender = () =>
12
12
  {
@@ -13,7 +13,7 @@ export default class WorldImage extends Mesh
13
13
  constructor(texture, pivot)
14
14
  {
15
15
  pivot = pivot || new Vector2(0, 0);
16
- let material = new ShaderMaterial({
16
+ const material = new ShaderMaterial({
17
17
  uniforms: {
18
18
  _MainTex: { value: texture },
19
19
  _ScreenAligned: { value: 0 },
@@ -26,9 +26,9 @@ export default class WorldImage extends Mesh
26
26
  depthWrite: false,
27
27
  side: DoubleSide
28
28
  });
29
- let geometry = new PlaneGeometry(1, 1, 1);
29
+ const geometry = new PlaneGeometry(1, 1, 1);
30
30
  geometry.translate(-pivot.x / 2, -pivot.y / 2, 0);
31
- let current_scale = texture.image.width / texture.image.height;
31
+ const current_scale = texture.image.width / texture.image.height;
32
32
  geometry.scale(current_scale, 1, 1);
33
33
  super(geometry, material);
34
34
  this.current_scale = current_scale;
@@ -41,7 +41,7 @@ export default class WorldImage extends Mesh
41
41
  update_texture()
42
42
  {
43
43
  this.material.uniforms._MainTex.value.needsUpdate = true;
44
- let img = this.material.uniforms._MainTex.value.image;
44
+ const img = this.material.uniforms._MainTex.value.image;
45
45
 
46
46
  this.geometry.scale(1 / this.current_scale, 1, 1);
47
47
  this.current_scale = img.width / img.height;
@@ -50,8 +50,8 @@ export default class ObjectRotator extends RaycastResolver
50
50
 
51
51
  if (this.rotation_active)
52
52
  {
53
- let rot_x = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), Input.NDC_delta.x);
54
- let rot_y = new Quaternion().setFromAxisAngle(new Vector3(1, 0, 0), Input.NDC_delta.y);
53
+ const rot_x = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), Input.NDC_delta.x);
54
+ const rot_y = new Quaternion().setFromAxisAngle(new Vector3(1, 0, 0), Input.NDC_delta.y);
55
55
 
56
56
  this.object.quaternion.multiply(rot_x);
57
57
  rot_y.multiply(this.object.quaternion);
@@ -59,8 +59,8 @@ export default class SDFText
59
59
 
60
60
  set_rotation(orientation = 0, tilt = 0) // 0..360, -90..0..90
61
61
  {
62
- let new_orientation = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), (orientation / 360) * Math.PI * 2);
63
- let new_tilt = new Quaternion().setFromAxisAngle(new Vector3(1, 0, 0), (-tilt / 360) * Math.PI * 2);
62
+ const new_orientation = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), (orientation / 360) * Math.PI * 2);
63
+ const new_tilt = new Quaternion().setFromAxisAngle(new Vector3(1, 0, 0), (-tilt / 360) * Math.PI * 2);
64
64
 
65
65
  this.quaternion.copy(new_orientation.multiply(new_tilt));
66
66
  this.matrix_is_dirty = true;
@@ -114,31 +114,31 @@ export default class SDFText
114
114
 
115
115
  for (let i = 0; i < text.length; i++)
116
116
  {
117
- let unicode = text.charCodeAt(i);
118
- let glyph = this.glyph_layout.find(element => element.unicode === unicode);
117
+ const unicode = text.charCodeAt(i);
118
+ const glyph = this.glyph_layout.find(element => element.unicode === unicode);
119
119
  if (glyph)
120
120
  {
121
121
  if (glyph.planeBounds)
122
122
  {
123
- let text_glyph = new TextGlyph(cursor, glyph.planeBounds, glyph.atlasBounds);
123
+ const text_glyph = new TextGlyph(cursor, glyph.planeBounds, glyph.atlasBounds);
124
124
  this.glyphs.push(text_glyph);
125
125
  }
126
126
  cursor += glyph.advance;
127
127
  }
128
128
  }
129
129
 
130
- let box2 = new Box2();
131
- let first_glyph = this.glyphs[0];
130
+ const box2 = new Box2();
131
+ const first_glyph = this.glyphs[0];
132
132
  box2.setFromCenterAndSize(first_glyph.position.clone().add(new Vector2(first_glyph.scale.x / 2, first_glyph.scale.y / 2)), first_glyph.scale);
133
133
 
134
134
  for (let i = 1; i < this.glyphs.length; i++)
135
135
  {
136
- let g = this.glyphs[i];
137
- let box = new Box2().setFromCenterAndSize(g.position.clone().add(new Vector2(g.scale.x / 2, g.scale.y / 2)), g.scale);
136
+ const g = this.glyphs[i];
137
+ const box = new Box2().setFromCenterAndSize(g.position.clone().add(new Vector2(g.scale.x / 2, g.scale.y / 2)), g.scale);
138
138
  box2.union(box);
139
139
  }
140
140
 
141
- let box2_size = new Vector2();
141
+ const box2_size = new Vector2();
142
142
  box2.getSize(box2_size);
143
143
  for (let i = 0; i < this.glyphs.length; i++)
144
144
  {
@@ -16,26 +16,26 @@ export default class SDFTextBatch extends Mesh
16
16
  {
17
17
  constructor(font_layout, atlas_texture)
18
18
  {
19
- let max_allocations = 2000;
19
+ const max_allocations = 2000;
20
20
 
21
- let instanced_geometry = new InstancedBufferGeometry();
21
+ const instanced_geometry = new InstancedBufferGeometry();
22
22
  instanced_geometry.instanceCount = 0;
23
23
 
24
- let geometry = new PlaneBufferGeometry(1, 1);
24
+ const geometry = new PlaneBufferGeometry(1, 1);
25
25
  geometry.translate(0.5, 0.5, 0);
26
26
  instanced_geometry.setAttribute('position', new Float32BufferAttribute(geometry.getAttribute('position').array, 3));
27
27
  instanced_geometry.setAttribute('uv', new Float32BufferAttribute(geometry.getAttribute('uv').array, 2));
28
28
  instanced_geometry.index = geometry.index;
29
29
 
30
- let transformsCol0 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
31
- let transformsCol1 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
32
- let transformsCol2 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
33
- let transformsCol3 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
30
+ const transformsCol0 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
31
+ const transformsCol1 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
32
+ const transformsCol2 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
33
+ const transformsCol3 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
34
34
 
35
- let glyph_bounds = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
36
- let plane_bounds = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
35
+ const glyph_bounds = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
36
+ const plane_bounds = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
37
37
 
38
- let color = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
38
+ const color = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
39
39
 
40
40
  transformsCol0.usage = DynamicDrawUsage;
41
41
  transformsCol1.usage = DynamicDrawUsage;
@@ -71,7 +71,7 @@ export default class SDFTextBatch extends Mesh
71
71
 
72
72
  add_text(text_str)
73
73
  {
74
- let elem = new SDFText(this.font_layout.glyphs, text_str);
74
+ const elem = new SDFText(this.font_layout.glyphs, text_str);
75
75
  this.text_elements.push(elem);
76
76
  return elem;
77
77
  }
@@ -84,15 +84,15 @@ export default class SDFTextBatch extends Mesh
84
84
 
85
85
  update(force_update)
86
86
  {
87
- let glyph_bounds_atr = this.geometry.getAttribute('glyph_bounds');
88
- let plane_bounds_atr = this.geometry.getAttribute('plane_bounds');
87
+ const glyph_bounds_atr = this.geometry.getAttribute('glyph_bounds');
88
+ const plane_bounds_atr = this.geometry.getAttribute('plane_bounds');
89
89
 
90
- let transformsCol0 = this.geometry.getAttribute('transformsCol0');
91
- let transformsCol1 = this.geometry.getAttribute('transformsCol1');
92
- let transformsCol2 = this.geometry.getAttribute('transformsCol2');
93
- let transformsCol3 = this.geometry.getAttribute('transformsCol3');
90
+ const transformsCol0 = this.geometry.getAttribute('transformsCol0');
91
+ const transformsCol1 = this.geometry.getAttribute('transformsCol1');
92
+ const transformsCol2 = this.geometry.getAttribute('transformsCol2');
93
+ const transformsCol3 = this.geometry.getAttribute('transformsCol3');
94
94
 
95
- let color_atr = this.geometry.getAttribute('color');
95
+ const color_atr = this.geometry.getAttribute('color');
96
96
 
97
97
  let matrix_needs_update = force_update === true;
98
98
  let glyph_needs_update = force_update === true;
@@ -101,7 +101,7 @@ export default class SDFTextBatch extends Mesh
101
101
  let glyph_count = 0;
102
102
  for (let i = 0; i < this.text_elements.length; i++)
103
103
  {
104
- let text = this.text_elements[i];
104
+ const text = this.text_elements[i];
105
105
 
106
106
  if (text.matrix_is_dirty)
107
107
  {
@@ -121,15 +121,15 @@ export default class SDFTextBatch extends Mesh
121
121
  text.clear_color_dirty();
122
122
  }
123
123
 
124
- let matrix = text.matrix;
125
- let color = text.color;
126
- let opacity = text.opacity;
124
+ const matrix = text.matrix;
125
+ const color = text.color;
126
+ const opacity = text.opacity;
127
127
 
128
128
  for (let glyph_i = 0; glyph_i < text.glyphs.length; glyph_i++)
129
129
  {
130
- let glyph = text.glyphs[glyph_i];
130
+ const glyph = text.glyphs[glyph_i];
131
131
 
132
- let buffer_i = glyph_count;
132
+ const buffer_i = glyph_count;
133
133
 
134
134
  glyph_bounds_atr.setXYZW(buffer_i, glyph.atlas_bounds.x, glyph.atlas_bounds.y, glyph.atlas_bounds.z, glyph.atlas_bounds.w);
135
135
  plane_bounds_atr.setXYZW(buffer_i, glyph.position.x, glyph.position.y, glyph.scale.x, glyph.scale.y);
@@ -4,8 +4,8 @@ export default class TextGlyph
4
4
  {
5
5
  constructor(offset, plane_bounds, atlas_bounds)
6
6
  {
7
- let width = plane_bounds.right - plane_bounds.left;
8
- let height = plane_bounds.top - plane_bounds.bottom;
7
+ const width = plane_bounds.right - plane_bounds.left;
8
+ const height = plane_bounds.top - plane_bounds.bottom;
9
9
 
10
10
  this.scale = new Vector2(width, height);
11
11
  this.position = new Vector2(offset + plane_bounds.left, plane_bounds.bottom);
@@ -5,7 +5,7 @@ export default class RGBADataTexture extends CustomDataTexture
5
5
  {
6
6
  constructor(width, height)
7
7
  {
8
- let data = new Uint8Array(width * height * 4);
8
+ const data = new Uint8Array(width * height * 4);
9
9
  super(data, width, height, RGBAFormat);
10
10
  this.multiplier = 255;
11
11
  }
@@ -6,7 +6,7 @@ export default class RGBAFloatDataTexture extends CustomDataTexture
6
6
  {
7
7
  constructor(width, height)
8
8
  {
9
- let data = new Float32Array(width * height * 4);
9
+ const data = new Float32Array(width * height * 4);
10
10
  super(data, width, height, RGBAFormat, FloatType);
11
11
  }
12
12
  }
@@ -5,7 +5,7 @@ export default class RGBDataTexture extends CustomDataTexture
5
5
  {
6
6
  constructor(width, height)
7
7
  {
8
- let data = new Uint8Array(width * height * 3);
8
+ const data = new Uint8Array(width * height * 3);
9
9
  super(data, width, height, RGBFormat);
10
10
  this.multiplier = 255;
11
11
  }
@@ -6,7 +6,7 @@ export default class RGBFloatDataTexture extends CustomDataTexture
6
6
  {
7
7
  constructor(width, height)
8
8
  {
9
- let data = new Float32Array(width * height * 3);
9
+ const data = new Float32Array(width * height * 3);
10
10
  super(data, width, height, RGBFormat, FloatType);
11
11
  }
12
12
  }
@@ -17,17 +17,17 @@ export default class ManipulatorHandle extends Object3D
17
17
  {
18
18
  super();
19
19
 
20
- let length = 10;
20
+ const length = 10;
21
21
  this.arrow_helper = new ArrowHelper(direction, new Vector3(0, 0, 0), length, color, undefined, 1);
22
22
  this.add(this.arrow_helper);
23
23
 
24
- let collider_size = new Vector3();
24
+ const collider_size = new Vector3();
25
25
  collider_size.x = TMath.clamp(direction.x * length, 1, 30);
26
26
  collider_size.y = TMath.clamp(direction.y * length, 1, 30);
27
27
  collider_size.z = TMath.clamp(direction.z * length, 1, 30);
28
28
 
29
- let geometry = new BoxGeometry(collider_size.x, collider_size.y, collider_size.z);
30
- let material = new MeshBasicMaterial({ color: color, depthTest: false, depthWrite: false });
29
+ const geometry = new BoxGeometry(collider_size.x, collider_size.y, collider_size.z);
30
+ const material = new MeshBasicMaterial({ color: color, depthTest: false, depthWrite: false });
31
31
  material.visible = false;
32
32
  this.box_collider = new Mesh(geometry, material);
33
33
  this.box_collider.position.add(direction.clone().multiplyScalar(length * 0.5));
@@ -33,10 +33,10 @@ export default class ObjectEditor
33
33
  {
34
34
  if (Input.left_mouse_button_pressed)
35
35
  {
36
- let x = this.object_picker.pick(Input.NDC, this.selectable_objects);
36
+ const x = this.object_picker.pick(Input.NDC, this.selectable_objects);
37
37
  if (x !== 0)
38
38
  {
39
- let selected_obj = this.selectable_objects[x - 1];
39
+ const selected_obj = this.selectable_objects[x - 1];
40
40
  // this.object_manipulator.position.copy(selected_obj.position);
41
41
  this.object_manipulator.set_target(selected_obj);
42
42
  }
@@ -59,7 +59,7 @@ export default class ObjectManipulator extends Object3D
59
59
  this.tmp_local_pos.copy(this.position);
60
60
  this.target_obj.parent.worldToLocal(this.tmp_local_pos);
61
61
  this.target_obj.position.copy(this.tmp_local_pos);
62
- let scope = this;
62
+ const scope = this;
63
63
  EventManager.fire_unit_position_updated({
64
64
  unit_id: scope.target_obj.name,
65
65
  position: scope.target_obj.position
@@ -69,8 +69,8 @@ export default class ObjectManipulator extends Object3D
69
69
 
70
70
  set_translation_axis(active_handle)
71
71
  {
72
- let vertical = active_handle.get_normalized_screen_direction().dot(this.tmp_up_v2);
73
- let horizontal = active_handle.get_normalized_screen_direction().dot(this.tmp_right_v2);
72
+ const vertical = active_handle.get_normalized_screen_direction().dot(this.tmp_up_v2);
73
+ const horizontal = active_handle.get_normalized_screen_direction().dot(this.tmp_right_v2);
74
74
 
75
75
  if (Math.abs(vertical) > Math.abs(horizontal))
76
76
  {
@@ -17,7 +17,7 @@ export default class GPUParticleSystem extends Object3D
17
17
  // let position = new ParticlePositionAttribute("_Position");
18
18
  if (init_attribute_uvs && geometry.getAttribute('storage_uv') === undefined)
19
19
  {
20
- let uv_storage_attr = this.build_uv_storage_attribute(geometry.getAttribute('position').count);
20
+ const uv_storage_attr = this.build_uv_storage_attribute(geometry.getAttribute('position').count);
21
21
  geometry.setAttribute('storage_uv', uv_storage_attr);
22
22
  }
23
23
  // position.init_from_geometry(geometry);
@@ -25,7 +25,7 @@ export default class GPUParticleSystem extends Object3D
25
25
 
26
26
  // material.uniforms._Position.value = position.read.texture;
27
27
 
28
- let points = new Points(geometry, material);
28
+ const points = new Points(geometry, material);
29
29
  points.frustumCulled = false;
30
30
  this.particles = points;
31
31
 
@@ -44,8 +44,8 @@ export default class GPUParticleSystem extends Object3D
44
44
 
45
45
  build_uv_storage_attribute(particle_count)
46
46
  {
47
- let resolution = this.calculate_resolution(particle_count);
48
- let uvs = new Float32Array(particle_count * 2);
47
+ const resolution = this.calculate_resolution(particle_count);
48
+ const uvs = new Float32Array(particle_count * 2);
49
49
  for (let i = 0, j = 0; i < particle_count * 2; i += 2, j++)
50
50
  {
51
51
  uvs[i] = ((j % resolution) / resolution) + (0.5 / resolution);
@@ -35,8 +35,8 @@ export default class ParticleAttribute
35
35
 
36
36
  build_RT(particle_count)
37
37
  {
38
- let resolution = this.calculate_resolution(particle_count);
39
- let options = {
38
+ const resolution = this.calculate_resolution(particle_count);
39
+ const options = {
40
40
  minFilter: NearestFilter,
41
41
  magFilter: NearestFilter,
42
42
  format: RGBAFormat,
@@ -56,7 +56,7 @@ export default class ParticleAttribute
56
56
 
57
57
  swap_RT()
58
58
  {
59
- let tmp = this.read;
59
+ const tmp = this.read;
60
60
  this.read = this.write;
61
61
  this.write = tmp;
62
62
  }
@@ -72,7 +72,7 @@ export default class ParticleAttribute
72
72
 
73
73
  render_geometry_to_RT(geometry, material, RT)
74
74
  {
75
- let points = new Points(geometry, material);
75
+ const points = new Points(geometry, material);
76
76
  points.frustumCulled = false;
77
77
  // let scene = new Scene();
78
78
  // scene.add( points );