ohzi-core 12.2.0 → 12.2.1
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/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/index.module.js +2 -0
- package/build/index.module.js.map +1 -0
- package/package.json +2 -1
- package/src/BaseApplication.js +11 -2
- package/src/Browser.js +10 -3
- package/src/CameraManager.js +5 -0
- package/src/Capabilities.js +1 -0
- package/src/CustomBezierCurve.js +12 -0
- package/src/Debug.js +99 -5
- package/src/Graphics.js +86 -6
- package/src/Initializer.js +5 -0
- package/src/KeyboardInput.js +40 -1
- package/src/OS.js +1 -1
- package/src/OScreen.js +19 -4
- package/src/OrthographicCamera.js +13 -0
- package/src/PerspectiveCamera.js +11 -0
- package/src/ReflectionPlaneContext.js +5 -1
- package/src/RenderLayers.js +1 -1
- package/src/RenderLoop.js +9 -0
- package/src/RenderOrder.js +1 -1
- package/src/ResourceContainer.js +21 -0
- package/src/SceneManager.js +14 -4
- package/src/Screen.js +71 -0
- package/src/Time.js +4 -0
- package/src/UI.js +16 -1
- package/src/action_sequencer/ActionEvent.js +6 -1
- package/src/action_sequencer/ActionInterpolator.js +16 -2
- package/src/action_sequencer/ActionSequencer.js +65 -2
- package/src/action_sequencer/NumberInterpolator.js +15 -0
- package/src/action_sequencer/VectorInterpolator.js +13 -1
- package/src/blitter_index.js +1 -0
- package/src/canvas_drawer/CanvasDrawer.js +37 -4
- package/src/canvas_drawer/MultiLineTextDrawer.js +8 -1
- package/src/canvas_drawer/SimpleTextDrawer.js +7 -1
- package/src/components/AudioClip.js +11 -1
- package/src/components/AxisHelper.js +1 -1
- package/src/components/BaseObject.js +8 -5
- package/src/components/EdgeMesh.js +30 -2
- package/src/components/GeometryEdgeVisualizer.js +10 -1
- package/src/components/Grid.js +4 -0
- package/src/components/Line.js +31 -7
- package/src/components/MultiLinePath.js +9 -5
- package/src/components/MultiLineText2D.js +13 -2
- package/src/components/ObjectAxis.js +5 -0
- package/src/components/ObjectOrientedBoundingBox.js +26 -1
- package/src/components/PlaneHelper.js +1 -1
- package/src/components/Shape2D.js +11 -3
- package/src/components/Shape3D.js +10 -4
- package/src/components/Text2D.js +11 -3
- package/src/components/UIElement.js +40 -4
- package/src/components/UpdatableMaterialMesh.js +11 -3
- package/src/components/WorldImage.js +10 -2
- package/src/index.js +3 -1
- package/src/loaders/AsyncAbstractLoader.js +16 -0
- package/src/loaders/AsyncObjectsLoader.js +6 -0
- package/src/primitives/Arrow.js +6 -0
- package/src/primitives/Cube.js +6 -1
- package/src/primitives/HorizontalPlane.js +8 -1
- package/src/primitives/Sphere.js +7 -0
- package/src/primitives/VerticalPlane.js +8 -1
- package/src/ui/ui_element_state/OnIdle.js +5 -0
- package/src/ui/ui_element_state/OnMouseEnter.js +11 -0
- package/src/ui/ui_element_state/OnMouseExit.js +5 -0
- package/src/ui/ui_element_state/OnMouseHover.js +13 -0
- package/src/ui/ui_element_state/UIElementState.js +17 -3
- package/src/utilities/EasingFunctions.js +5 -0
- package/types/BaseApplication.d.ts +18 -11
- package/types/Browser.d.ts +20 -19
- package/types/CameraManager.d.ts +14 -13
- package/types/Capabilities.d.ts +8 -8
- package/types/CustomBezierCurve.d.ts +19 -7
- package/types/Debug.d.ts +198 -37
- package/types/Graphics.d.ts +143 -61
- package/types/Initializer.d.ts +10 -6
- package/types/KeyboardInput.d.ts +65 -20
- package/types/OS.d.ts +20 -20
- package/types/OScreen.d.ts +37 -22
- package/types/OrthographicCamera.d.ts +20 -6
- package/types/PerspectiveCamera.d.ts +18 -6
- package/types/ReflectionPlaneContext.d.ts +13 -8
- package/types/RenderLayers.d.ts +6 -6
- package/types/RenderLoop.d.ts +132 -14
- package/types/RenderOrder.d.ts +8 -8
- package/types/ResourceContainer.d.ts +29 -10
- package/types/SceneManager.d.ts +15 -12
- package/types/Screen.d.ts +27 -0
- package/types/Time.d.ts +29 -24
- package/types/UI.d.ts +92 -18
- package/types/action_sequencer/ActionEvent.d.ts +12 -7
- package/types/action_sequencer/ActionInterpolator.d.ts +18 -5
- package/types/action_sequencer/ActionSequencer.d.ts +104 -36
- package/types/action_sequencer/NumberInterpolator.d.ts +18 -9
- package/types/action_sequencer/VectorInterpolator.d.ts +13 -7
- package/types/blitter_index.d.ts +6 -6
- package/types/canvas_drawer/CanvasDrawer.d.ts +51 -13
- package/types/canvas_drawer/MultiLineTextDrawer.d.ts +13 -5
- package/types/canvas_drawer/SimpleTextDrawer.d.ts +13 -6
- package/types/components/AudioClip.d.ts +25 -13
- package/types/components/AxisHelper.d.ts +6 -6
- package/types/components/BaseObject.d.ts +12 -5
- package/types/components/EdgeMesh.d.ts +42 -13
- package/types/components/GeometryEdgeVisualizer.d.ts +12 -4
- package/types/components/Grid.d.ts +4 -2
- package/types/components/Line.d.ts +42 -16
- package/types/components/MultiLinePath.d.ts +10 -4
- package/types/components/MultiLineText2D.d.ts +22 -10
- package/types/components/ObjectAxis.d.ts +8 -3
- package/types/components/ObjectOrientedBoundingBox.d.ts +45 -18
- package/types/components/PlaneHelper.d.ts +6 -6
- package/types/components/Shape2D.d.ts +14 -4
- package/types/components/Shape3D.d.ts +10 -3
- package/types/components/Text2D.d.ts +21 -13
- package/types/components/UIElement.d.ts +87 -52
- package/types/components/UpdatableMaterialMesh.d.ts +12 -4
- package/types/components/WorldImage.d.ts +23 -13
- package/types/components/mouse_interactors/ObjectRotator.d.ts +12 -0
- package/types/components/sdf_text/SDFText.d.ts +35 -30
- package/types/components/sdf_text/SDFTextBatch.d.ts +12 -12
- package/types/components/sdf_text/TextGlyph.d.ts +8 -6
- package/types/data_textures/CustomDataTexture.d.ts +11 -11
- package/types/data_textures/RGBADataTexture.d.ts +4 -4
- package/types/data_textures/RGBAFloatDataTexture.d.ts +4 -4
- package/types/data_textures/RGBDataTexture.d.ts +4 -4
- package/types/data_textures/RGBFloatDataTexture.d.ts +4 -4
- package/types/editor/ManipulatorHandle.d.ts +23 -14
- package/types/editor/ObjectEditor.d.ts +18 -16
- package/types/editor/ObjectManipulator.d.ts +23 -19
- package/types/editor/ObjectPicker.d.ts +19 -16
- package/types/gpu_particles/GPUParticleSystem.d.ts +22 -15
- package/types/gpu_particles/ParticleAttribute.d.ts +19 -18
- package/types/gpu_particles/ParticlePositionAttribute.d.ts +6 -6
- package/types/html_utilities/CSSAnimator.d.ts +31 -31
- package/types/html_utilities/css_animator_states/Animating.d.ts +8 -8
- package/types/html_utilities/css_animator_states/Idle.d.ts +6 -6
- package/types/index.d.ts +110 -108
- package/types/loaders/AsyncAbstractLoader.d.ts +41 -27
- package/types/loaders/AsyncAudiosLoader.d.ts +6 -5
- package/types/loaders/AsyncObjectsLoader.d.ts +6 -6
- package/types/loaders/AsyncTexturesLoader.d.ts +9 -8
- package/types/loaders/assets_loader/AssetLoader.d.ts +4 -0
- package/types/loaders/assets_loader/AsyncAssetsLoaderWorker.d.ts +1 -0
- package/types/loaders/assets_loader/ResourceBatch.d.ts +14 -0
- package/types/loaders/assets_loader/ResourceContainer.d.ts +9 -0
- package/types/loaders/assets_loader/ResourceLoaderChecker.d.ts +8 -0
- package/types/materials/AddMaterial.d.ts +5 -5
- package/types/materials/AlphaFilterMaterial.d.ts +6 -6
- package/types/materials/BaseShaderMaterial.d.ts +4 -3
- package/types/materials/BlitMaterial.d.ts +4 -3
- package/types/materials/BloomComposeMaterial.d.ts +4 -7
- package/types/materials/BoxBlurMaterial.d.ts +4 -4
- package/types/materials/ClearAlphaMaterial.d.ts +3 -3
- package/types/materials/ClearColorMaterial.d.ts +7 -7
- package/types/materials/ClearDepthNormalMaterial.d.ts +4 -4
- package/types/materials/DeferredRendererComposeMaterial.d.ts +7 -7
- package/types/materials/DepthNormalMaterial.d.ts +6 -4
- package/types/materials/DisplayNormalTextureMaterial.d.ts +4 -4
- package/types/materials/DualFilteringBlurMaterial.d.ts +4 -4
- package/types/materials/FXAAMaterial.d.ts +3 -3
- package/types/materials/GaussianBlurMaterial.d.ts +6 -6
- package/types/materials/LuminosityHighPassMaterial.d.ts +4 -4
- package/types/materials/MedianFilterMaterial.d.ts +7 -6
- package/types/materials/NormalMaterial.d.ts +4 -2
- package/types/materials/SDFScreenTextMaterial.d.ts +9 -11
- package/types/materials/SDFTextMaterial.d.ts +10 -12
- package/types/materials/SSAOComposeMaterial.d.ts +4 -4
- package/types/materials/SSAOMaterial.d.ts +8 -6
- package/types/materials/ScreenSpaceTextureMaterial.d.ts +7 -7
- package/types/materials/UIElementMaterial.d.ts +4 -7
- package/types/materials/UnrealBloomComposeMaterial.d.ts +16 -16
- package/types/materials/UnrealBlurMaterial.d.ts +4 -4
- package/types/materials/UnrealComposeMaterial.d.ts +4 -4
- package/types/materials/ViewPositionMaterial.d.ts +4 -3
- package/types/materials/deferred/DeferredPointLightMaterial.d.ts +9 -10
- package/types/materials/gpu_particles/AttributeUpdateMaterial.d.ts +7 -0
- package/types/materials/gpu_particles/BasicParticleMaterial.d.ts +4 -0
- package/types/materials/gpu_particles/ParticleStorageMaterial.d.ts +4 -2
- package/types/materials/gpu_particles/PositionStorageMaterial.d.ts +3 -4
- package/types/object_pool/Pool.d.ts +10 -10
- package/types/primitives/Arrow.d.ts +15 -8
- package/types/primitives/Cube.d.ts +10 -3
- package/types/primitives/HorizontalPlane.d.ts +11 -3
- package/types/primitives/Sphere.d.ts +11 -3
- package/types/primitives/VerticalPlane.d.ts +11 -3
- package/types/raycast/GroupRaycaster.d.ts +15 -13
- package/types/raycast/PlaneDragResolver.d.ts +16 -15
- package/types/raycast/PlaneRaycastResolver.d.ts +5 -5
- package/types/raycast/PlaneRaycaster.d.ts +9 -7
- package/types/raycast/RaycastResolver.d.ts +5 -5
- package/types/raycast/SurfaceDragResolver.d.ts +15 -13
- package/types/raycast/states/BaseState.d.ts +5 -5
- package/types/raycast/states/IdleState.d.ts +3 -5
- package/types/raycast/states/OnRaycastEnter.d.ts +3 -5
- package/types/raycast/states/OnRaycastExit.d.ts +3 -4
- package/types/raycast/states/OnRaycastHover.d.ts +3 -5
- package/types/render_mode/BaseRender.d.ts +7 -7
- package/types/render_mode/BloomRender.d.ts +12 -10
- package/types/render_mode/DebugNormalsRender.d.ts +3 -3
- package/types/render_mode/DeferredRender.d.ts +13 -9
- package/types/render_mode/NormalAORender.d.ts +18 -17
- package/types/render_mode/NormalRender.d.ts +3 -3
- package/types/render_mode/OutlineRender.d.ts +25 -20
- package/types/render_mode/PlanarReflectionsRender.d.ts +19 -13
- package/types/render_mode/UnrealBloomRender.d.ts +21 -20
- package/types/render_mode/VRRender.d.ts +4 -4
- package/types/render_utilities/Blitter.d.ts +19 -15
- package/types/render_utilities/Blurrer.d.ts +9 -8
- package/types/render_utilities/DepthAndNormalsRenderer.d.ts +11 -10
- package/types/render_utilities/DualFilteringBlurrer.d.ts +18 -17
- package/types/render_utilities/GaussianBlurrer.d.ts +27 -26
- package/types/render_utilities/MedianFilter.d.ts +11 -9
- package/types/render_utilities/ViewPositionRenderer.d.ts +10 -9
- package/types/resource_loader/AbstractLoader.d.ts +21 -21
- package/types/resource_loader/AsyncTextureLoader.d.ts +11 -11
- package/types/resource_loader/AudioLoader.d.ts +9 -9
- package/types/resource_loader/BasisLoader.d.ts +6 -6
- package/types/resource_loader/CubemapLoader.d.ts +8 -7
- package/types/resource_loader/DAELoader.d.ts +7 -6
- package/types/resource_loader/DDSLoader.d.ts +7 -6
- package/types/resource_loader/FileLoader.d.ts +7 -6
- package/types/resource_loader/FontLoader.d.ts +7 -6
- package/types/resource_loader/GLTFDRACOLoader.d.ts +7 -6
- package/types/resource_loader/GLTFLoader.d.ts +7 -6
- package/types/resource_loader/HDRCubeTextureLoader.d.ts +8 -7
- package/types/resource_loader/JSONLoader.d.ts +5 -4
- package/types/resource_loader/OBJLoader.d.ts +7 -6
- package/types/resource_loader/PointArrayLoader.d.ts +9 -7
- package/types/resource_loader/RGBETextureLoader.d.ts +7 -6
- package/types/resource_loader/ResourceBatch.d.ts +13 -13
- package/types/resource_loader/SVGLoader.d.ts +7 -6
- package/types/resource_loader/TextLoader.d.ts +7 -6
- package/types/resource_loader/TextureLoader.d.ts +4 -4
- package/types/resource_loader/VideoLoader.d.ts +4 -4
- package/types/scenes/AbstractScene.d.ts +32 -32
- package/types/scenes/loading_states/CompilatorManager.d.ts +8 -8
- package/types/scenes/loading_states/HighQualityLoadingState.d.ts +3 -3
- package/types/scenes/loading_states/LoadingState.d.ts +31 -31
- package/types/scenes/loading_states/RegularLoadingState.d.ts +5 -5
- package/types/static_batcher/BatchedMesh.d.ts +16 -15
- package/types/static_batcher/GeometryBatch.d.ts +41 -37
- package/types/static_batcher/GeometryBatcher.d.ts +9 -9
- package/types/static_batcher/MeshBatcher.d.ts +5 -5
- package/types/ui/ui_element_position/ScreenSpacePosition.d.ts +5 -4
- package/types/ui/ui_element_position/WorldSpacePosition.d.ts +7 -5
- package/types/ui/ui_element_state/OnIdle.d.ts +9 -3
- package/types/ui/ui_element_state/OnMouseEnter.d.ts +3 -3
- package/types/ui/ui_element_state/OnMouseExit.d.ts +3 -3
- package/types/ui/ui_element_state/OnMouseHover.d.ts +8 -4
- package/types/ui/ui_element_state/UIElementState.d.ts +17 -5
- package/types/utilities/ArrayUtilities.d.ts +7 -7
- package/types/utilities/CameraUtilities.d.ts +40 -36
- package/types/utilities/EasingFunctions.d.ts +36 -35
- package/types/utilities/FrustumPointFitter.d.ts +14 -14
- package/types/utilities/GeometryUtilities.d.ts +5 -4
- package/types/utilities/HTMLUtilities.d.ts +6 -6
- package/types/utilities/ImageUtilities.d.ts +5 -4
- package/types/utilities/MeshSampler.d.ts +20 -20
- package/types/utilities/ModelUtilities.d.ts +15 -15
- package/types/utilities/OMath.d.ts +21 -21
- package/types/utilities/ObjectUtilities.d.ts +7 -7
- package/types/utilities/OrthographicFrustumPointFitter.d.ts +8 -7
- package/types/utilities/PerspectiveFrustumPointFitter.d.ts +14 -12
- package/types/utilities/StringUtilities.d.ts +6 -6
- package/types/utilities/TimeUtilities.d.ts +3 -3
- package/types/utilities/Validation.d.ts +6 -6
- package/types/view_components/ApplicationView.d.ts +13 -13
- package/types/view_components/TransitionManager.d.ts +20 -20
- package/types/view_components/ViewComponent.d.ts +15 -15
- package/types/view_components/ViewComponentManager.d.ts +13 -13
- package/types/view_components/ViewManager.d.ts +22 -23
- package/types/view_components/ViewState.d.ts +14 -14
- package/types/view_components/transition/ActionSequencerBuilder.d.ts +16 -16
- package/types/view_components/transition/DrawIOAnimationSheet.d.ts +17 -17
- package/types/view_components/transition/TransitionTable.d.ts +8 -8
- package/types/view_components/transition/ViewStateTransitionHandler.d.ts +19 -19
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { Line } from './Line';
|
|
2
3
|
|
|
3
|
-
import { Object3D } from 'three';
|
|
4
|
+
import { Object3D, Vector3 } from 'three'; // eslint-disable-line no-unused-vars
|
|
4
5
|
|
|
5
6
|
class MultiLinePath extends Object3D
|
|
6
7
|
{
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @param {Array<Vector3[]>} paths
|
|
10
|
+
*/
|
|
11
|
+
constructor(paths)
|
|
8
12
|
{
|
|
9
13
|
super();
|
|
10
14
|
|
|
11
15
|
this.paths = [];
|
|
12
16
|
for (let i = 0; i < paths.length; i++)
|
|
13
17
|
{
|
|
14
|
-
const line = new Line(paths[i]
|
|
15
|
-
this.paths.push
|
|
18
|
+
const line = new Line(paths[i]);
|
|
19
|
+
this.paths.push(line);
|
|
16
20
|
this.add(line);
|
|
17
21
|
}
|
|
18
22
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { Text2D } from './Text2D';
|
|
2
3
|
|
|
3
4
|
import { Object3D } from 'three';
|
|
@@ -5,7 +6,14 @@ import { Vector2 } from 'three';
|
|
|
5
6
|
|
|
6
7
|
class MultiLineText2D extends Object3D
|
|
7
8
|
{
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @param {string[]} text_array
|
|
11
|
+
* @param {string} [font]
|
|
12
|
+
* @param {string | number} [color]
|
|
13
|
+
* @param {Vector2} [pivot]
|
|
14
|
+
* @param {boolean} [is_static]
|
|
15
|
+
*/
|
|
16
|
+
constructor(text_array, font, color, pivot, is_static) // eslint-disable-line no-unused-vars
|
|
9
17
|
{
|
|
10
18
|
super();
|
|
11
19
|
|
|
@@ -45,11 +53,14 @@ class MultiLineText2D extends Object3D
|
|
|
45
53
|
{
|
|
46
54
|
for (let i = 0; i < this.text_array.length; i++)
|
|
47
55
|
{
|
|
48
|
-
this.text_array[i].size
|
|
56
|
+
this.text_array[i].size.set(value, value, value);
|
|
49
57
|
}
|
|
50
58
|
this.update_text_positions();
|
|
51
59
|
}
|
|
52
60
|
|
|
61
|
+
/**
|
|
62
|
+
* @returns {string[]}
|
|
63
|
+
*/
|
|
53
64
|
get texts()
|
|
54
65
|
{
|
|
55
66
|
return [];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { Arrow } from '../primitives/Arrow';
|
|
2
3
|
|
|
3
4
|
import { Object3D } from 'three';
|
|
@@ -5,6 +6,10 @@ import { Vector3 } from 'three';
|
|
|
5
6
|
|
|
6
7
|
class ObjectAxis extends Object3D
|
|
7
8
|
{
|
|
9
|
+
/**
|
|
10
|
+
* @param {Object3D} obj
|
|
11
|
+
* @param {number} [size]
|
|
12
|
+
*/
|
|
8
13
|
constructor(obj, size)
|
|
9
14
|
{
|
|
10
15
|
super();
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-check
|
|
2
2
|
import { Vector3 } from 'three';
|
|
3
3
|
import { Quaternion } from 'three';
|
|
4
4
|
|
|
5
5
|
class ObjectOrientedBoundingBox
|
|
6
6
|
{
|
|
7
|
+
/**
|
|
8
|
+
* @param {Vector3[]} points
|
|
9
|
+
*/
|
|
7
10
|
constructor(points)
|
|
8
11
|
{
|
|
9
12
|
let degrees = 0;
|
|
@@ -104,6 +107,9 @@ class ObjectOrientedBoundingBox
|
|
|
104
107
|
// Debug.draw_line(center.clone().add(deep_left),center.clone().add(deep_right));
|
|
105
108
|
}
|
|
106
109
|
|
|
110
|
+
/**
|
|
111
|
+
* @param {Vector3[]} points
|
|
112
|
+
*/
|
|
107
113
|
get_center(points)
|
|
108
114
|
{
|
|
109
115
|
const v = new Vector3();
|
|
@@ -115,6 +121,10 @@ class ObjectOrientedBoundingBox
|
|
|
115
121
|
return v;
|
|
116
122
|
}
|
|
117
123
|
|
|
124
|
+
/**
|
|
125
|
+
* @param {Vector3} min
|
|
126
|
+
* @param {Vector3} max
|
|
127
|
+
*/
|
|
118
128
|
box_volume(min, max)
|
|
119
129
|
{
|
|
120
130
|
const difference = max.clone().sub(min);
|
|
@@ -126,6 +136,9 @@ class ObjectOrientedBoundingBox
|
|
|
126
136
|
return this.max.clone().sub(this.min);
|
|
127
137
|
}
|
|
128
138
|
|
|
139
|
+
/**
|
|
140
|
+
* @param {Vector3} point
|
|
141
|
+
*/
|
|
129
142
|
is_inside_XZ(point)
|
|
130
143
|
{
|
|
131
144
|
const pos = point.clone();
|
|
@@ -144,6 +157,9 @@ class ObjectOrientedBoundingBox
|
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
159
|
|
|
160
|
+
/**
|
|
161
|
+
* @param {Vector3} reference_point
|
|
162
|
+
*/
|
|
147
163
|
closest_point_on_bounds(reference_point)
|
|
148
164
|
{
|
|
149
165
|
const force = new Vector3();
|
|
@@ -167,6 +183,9 @@ class ObjectOrientedBoundingBox
|
|
|
167
183
|
return this.local_to_world_dir(force);
|
|
168
184
|
}
|
|
169
185
|
|
|
186
|
+
/**
|
|
187
|
+
* @param {Vector3} point
|
|
188
|
+
*/
|
|
170
189
|
world_to_local(point)
|
|
171
190
|
{
|
|
172
191
|
const pos = point.clone().sub(this.center);
|
|
@@ -174,6 +193,9 @@ class ObjectOrientedBoundingBox
|
|
|
174
193
|
return pos;
|
|
175
194
|
}
|
|
176
195
|
|
|
196
|
+
/**
|
|
197
|
+
* @param {Vector3} point
|
|
198
|
+
*/
|
|
177
199
|
local_to_world(point)
|
|
178
200
|
{
|
|
179
201
|
const pos = point.clone();
|
|
@@ -182,6 +204,9 @@ class ObjectOrientedBoundingBox
|
|
|
182
204
|
return pos;
|
|
183
205
|
}
|
|
184
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @param {Vector3} direction
|
|
209
|
+
*/
|
|
185
210
|
local_to_world_dir(direction)
|
|
186
211
|
{
|
|
187
212
|
const dir = direction.clone();
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { GeometryEdgeVisualizer } from './GeometryEdgeVisualizer';
|
|
2
3
|
|
|
3
|
-
import { Mesh } from 'three';
|
|
4
|
+
import { Mesh, Vector2 } from 'three'; // eslint-disable-line no-unused-vars
|
|
4
5
|
import { Shape } from 'three';
|
|
5
|
-
import {
|
|
6
|
+
import { ShapeGeometry } from 'three';
|
|
6
7
|
import { MeshBasicMaterial } from 'three';
|
|
7
8
|
|
|
8
9
|
class Shape2D extends Mesh
|
|
9
10
|
{
|
|
11
|
+
/**
|
|
12
|
+
* @param {Vector2[]} points_2D
|
|
13
|
+
* @param {boolean} show_edges
|
|
14
|
+
*/
|
|
10
15
|
constructor(points_2D, show_edges)
|
|
11
16
|
{
|
|
12
17
|
const shape = new Shape(points_2D);
|
|
13
|
-
const geometry = new
|
|
18
|
+
const geometry = new ShapeGeometry(shape);
|
|
14
19
|
geometry.rotateX(3.14 / 2);
|
|
15
20
|
|
|
16
21
|
const material = new MeshBasicMaterial({ color: 0xff0000 });
|
|
@@ -26,6 +31,9 @@ class Shape2D extends Mesh
|
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @param {ShapeGeometry} geometry
|
|
36
|
+
*/
|
|
29
37
|
invert_normals(geometry)
|
|
30
38
|
{
|
|
31
39
|
const indices = geometry.index.array;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { GeometryEdgeVisualizer } from './GeometryEdgeVisualizer';
|
|
2
3
|
|
|
3
|
-
import { Mesh } from 'three';
|
|
4
|
+
import { Mesh, Vector2 } from 'three'; // eslint-disable-line no-unused-vars
|
|
4
5
|
import { Shape } from 'three';
|
|
5
|
-
import {
|
|
6
|
+
import { ExtrudeGeometry } from 'three';
|
|
6
7
|
import { MeshNormalMaterial } from 'three';
|
|
7
8
|
|
|
8
9
|
class Shape3D extends Mesh
|
|
9
10
|
{
|
|
11
|
+
/**
|
|
12
|
+
* @param {Vector2[]} points_2D
|
|
13
|
+
* @param {boolean} show_edges
|
|
14
|
+
* @param {number} [height]
|
|
15
|
+
*/
|
|
10
16
|
constructor(points_2D, show_edges, height)
|
|
11
17
|
{
|
|
12
18
|
const shape = new Shape(points_2D);
|
|
@@ -21,11 +27,11 @@ class Shape3D extends Mesh
|
|
|
21
27
|
bevelSegments: 1
|
|
22
28
|
};
|
|
23
29
|
|
|
24
|
-
const geometry = new
|
|
30
|
+
const geometry = new ExtrudeGeometry(shape, extrudeSettings);
|
|
25
31
|
geometry.rotateX(3.14 / 2);
|
|
26
32
|
geometry.translate(0, height, 0);
|
|
27
33
|
|
|
28
|
-
const material = new MeshNormalMaterial(
|
|
34
|
+
const material = new MeshNormalMaterial();
|
|
29
35
|
super(geometry, material);
|
|
30
36
|
|
|
31
37
|
if (show_edges)
|
package/src/components/Text2D.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { WorldImage } from './WorldImage';
|
|
2
3
|
import { SimpleTextDrawer } from '../canvas_drawer/SimpleTextDrawer';
|
|
3
4
|
|
|
4
|
-
import { LinearMipMapLinearFilter } from 'three';
|
|
5
|
+
import { LinearMipMapLinearFilter, Vector2 } from 'three'; // eslint-disable-line no-unused-vars
|
|
5
6
|
import { LinearFilter } from 'three';
|
|
6
7
|
|
|
7
8
|
class Text2D extends WorldImage
|
|
8
9
|
{
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} text
|
|
12
|
+
* @param {string} font
|
|
13
|
+
* @param {string | Number} color
|
|
14
|
+
* @param {Vector2} pivot
|
|
15
|
+
* @param {boolean} [is_static]
|
|
16
|
+
*/
|
|
17
|
+
constructor(text, font, color, pivot, is_static) // eslint-disable-line no-unused-vars
|
|
10
18
|
{
|
|
11
|
-
const simple_text_drawer = new SimpleTextDrawer(
|
|
19
|
+
const simple_text_drawer = new SimpleTextDrawer();
|
|
12
20
|
|
|
13
21
|
const draw_settings = {
|
|
14
22
|
font: font,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-check
|
|
2
2
|
import { OScreen } from '../OScreen';
|
|
3
3
|
|
|
4
4
|
import { UIElementMaterial } from '../materials/UIElementMaterial';
|
|
@@ -11,21 +11,29 @@ import { OnMouseEnter } from '../ui/ui_element_state/OnMouseEnter';
|
|
|
11
11
|
import { OnMouseExit } from '../ui/ui_element_state/OnMouseExit';
|
|
12
12
|
import { OnMouseHover } from '../ui/ui_element_state/OnMouseHover';
|
|
13
13
|
|
|
14
|
-
import { Mesh } from 'three';
|
|
14
|
+
import { Mesh, Texture } from 'three'; // eslint-disable-line no-unused-vars
|
|
15
15
|
import { PlaneGeometry } from 'three';
|
|
16
16
|
import { Vector2 } from 'three';
|
|
17
17
|
import { Vector3 } from 'three';
|
|
18
18
|
import { NearestFilter } from 'three';
|
|
19
19
|
import { Box2 } from 'three';
|
|
20
|
+
import { UIElementState } from '../ui/ui_element_state/UIElementState'; // eslint-disable-line no-unused-vars
|
|
20
21
|
|
|
21
22
|
class UIElement extends Mesh
|
|
22
23
|
{
|
|
23
|
-
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} [vert]
|
|
26
|
+
* @param {string} [frag]
|
|
27
|
+
*/
|
|
28
|
+
constructor(vert, frag) // eslint-disable-line no-unused-vars
|
|
24
29
|
{
|
|
25
|
-
|
|
30
|
+
const material = new UIElementMaterial();
|
|
31
|
+
super(new PlaneGeometry(1, 1), material);
|
|
32
|
+
this.material = material;
|
|
26
33
|
|
|
27
34
|
this.is_clickable = false;
|
|
28
35
|
|
|
36
|
+
/** @type {WorldSpacePosition | ScreenSpacePosition} */
|
|
29
37
|
this.position_strategy = new WorldSpacePosition();
|
|
30
38
|
this.current_state = new OnIdle();
|
|
31
39
|
|
|
@@ -54,6 +62,9 @@ class UIElement extends Mesh
|
|
|
54
62
|
this.pixel_offset = new Vector2();
|
|
55
63
|
}
|
|
56
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @param {number} value
|
|
67
|
+
*/
|
|
57
68
|
set_render_order(value)
|
|
58
69
|
{
|
|
59
70
|
this.renderOrder = value;
|
|
@@ -64,12 +75,18 @@ class UIElement extends Mesh
|
|
|
64
75
|
return this.material.uniforms._PivotPoint.value;
|
|
65
76
|
}
|
|
66
77
|
|
|
78
|
+
/**
|
|
79
|
+
* @param {Vector2} offset
|
|
80
|
+
*/
|
|
67
81
|
set_pixel_offset(offset)
|
|
68
82
|
{
|
|
69
83
|
this.pixel_offset.copy(offset);
|
|
70
84
|
this.material.uniforms._PixelOffset.value.copy(offset);
|
|
71
85
|
}
|
|
72
86
|
|
|
87
|
+
/**
|
|
88
|
+
*@param {UIElementState} new_state
|
|
89
|
+
*/
|
|
73
90
|
set_state(new_state)
|
|
74
91
|
{
|
|
75
92
|
this.current_state.on_exit(this);
|
|
@@ -77,6 +94,7 @@ class UIElement extends Mesh
|
|
|
77
94
|
this.current_state.on_enter(this);
|
|
78
95
|
}
|
|
79
96
|
|
|
97
|
+
// @ts-ignore
|
|
80
98
|
get position()
|
|
81
99
|
{
|
|
82
100
|
return this._position;
|
|
@@ -117,6 +135,9 @@ class UIElement extends Mesh
|
|
|
117
135
|
this.position_strategy = new ScreenSpacePosition();
|
|
118
136
|
}
|
|
119
137
|
|
|
138
|
+
/**
|
|
139
|
+
* @param {Texture} texture
|
|
140
|
+
*/
|
|
120
141
|
set_texture(texture)
|
|
121
142
|
{
|
|
122
143
|
texture.minFilter = NearestFilter;
|
|
@@ -130,6 +151,9 @@ class UIElement extends Mesh
|
|
|
130
151
|
this.visible = true;
|
|
131
152
|
}
|
|
132
153
|
|
|
154
|
+
/**
|
|
155
|
+
* @param {Vector2} normalized_mouse_pos
|
|
156
|
+
*/
|
|
133
157
|
update_state(normalized_mouse_pos)
|
|
134
158
|
{
|
|
135
159
|
this.material.uniforms._ScreenSize.value.set(OScreen.width, OScreen.height);
|
|
@@ -140,6 +164,9 @@ class UIElement extends Mesh
|
|
|
140
164
|
this.current_state.update(this, normalized_mouse_pos);
|
|
141
165
|
}
|
|
142
166
|
|
|
167
|
+
/**
|
|
168
|
+
* @param {Vector2} normalized_mouse_pos
|
|
169
|
+
*/
|
|
143
170
|
is_mouse_over(normalized_mouse_pos)
|
|
144
171
|
{
|
|
145
172
|
this.screen_pos_tmp.copy(this.cached_NDC_position);
|
|
@@ -155,6 +182,9 @@ class UIElement extends Mesh
|
|
|
155
182
|
return rect.containsPoint(this.mouse_pos_tmp);
|
|
156
183
|
}
|
|
157
184
|
|
|
185
|
+
/**
|
|
186
|
+
* @param {Vector2} projected_pos
|
|
187
|
+
*/
|
|
158
188
|
to_screen_position(projected_pos)
|
|
159
189
|
{
|
|
160
190
|
projected_pos.x = (projected_pos.x * 0.5 + 0.5) * OScreen.width + this.pixel_offset.x;
|
|
@@ -168,6 +198,9 @@ class UIElement extends Mesh
|
|
|
168
198
|
return pos;
|
|
169
199
|
}
|
|
170
200
|
|
|
201
|
+
/**
|
|
202
|
+
* @param {Vector2} screen_pos
|
|
203
|
+
*/
|
|
171
204
|
set_screen_space_position(screen_pos)
|
|
172
205
|
{
|
|
173
206
|
this.position.x = (screen_pos.x / OScreen.width) * 2 - 1;
|
|
@@ -185,6 +218,9 @@ class UIElement extends Mesh
|
|
|
185
218
|
this.material.dispose();
|
|
186
219
|
}
|
|
187
220
|
|
|
221
|
+
/**
|
|
222
|
+
* @param {Vector2} [vector2]
|
|
223
|
+
*/
|
|
188
224
|
get_size(vector2)
|
|
189
225
|
{
|
|
190
226
|
if (vector2)
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { BufferGeometry, Material, Mesh } from 'three'; // eslint-disable-line no-unused-vars
|
|
2
3
|
|
|
3
4
|
class UpdatableMaterialMesh extends Mesh
|
|
4
5
|
{
|
|
6
|
+
/**
|
|
7
|
+
* @param {BufferGeometry} geometry
|
|
8
|
+
* @param {Material} material
|
|
9
|
+
*/
|
|
5
10
|
constructor(geometry, material)
|
|
6
11
|
{
|
|
7
12
|
super(geometry, material);
|
|
8
|
-
|
|
13
|
+
this.material = material;
|
|
9
14
|
const self = this;
|
|
10
15
|
|
|
11
16
|
this.onBeforeRender = () =>
|
|
12
17
|
{
|
|
13
|
-
self.material.update
|
|
18
|
+
if ('update' in self.material && typeof self.material.update === 'function')
|
|
19
|
+
{
|
|
20
|
+
self.material.update();
|
|
21
|
+
}
|
|
14
22
|
};
|
|
15
23
|
}
|
|
16
24
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// @ts-ignore
|
|
1
3
|
import basic_texture_vert from '../shaders/basic_texture/basic_texture.vert';
|
|
4
|
+
// @ts-ignore
|
|
2
5
|
import basic_texture_frag from '../shaders/basic_texture/basic_texture.frag';
|
|
3
6
|
|
|
4
|
-
import { Mesh } from 'three';
|
|
7
|
+
import { Mesh, Texture } from 'three'; // eslint-disable-line no-unused-vars
|
|
5
8
|
import { Vector2 } from 'three';
|
|
6
9
|
import { ShaderMaterial } from 'three';
|
|
7
10
|
import { DoubleSide } from 'three';
|
|
@@ -10,6 +13,10 @@ import { Vector3 } from 'three';
|
|
|
10
13
|
|
|
11
14
|
class WorldImage extends Mesh
|
|
12
15
|
{
|
|
16
|
+
/**
|
|
17
|
+
* @param {Texture} texture
|
|
18
|
+
* @param {Vector2} [pivot]
|
|
19
|
+
*/
|
|
13
20
|
constructor(texture, pivot)
|
|
14
21
|
{
|
|
15
22
|
pivot = pivot || new Vector2(0, 0);
|
|
@@ -36,6 +43,7 @@ class WorldImage extends Mesh
|
|
|
36
43
|
|
|
37
44
|
this.tmp_bb_size = new Vector3();
|
|
38
45
|
this.geometry.boundingBox.getSize(this.tmp_bb_size);
|
|
46
|
+
this.material = material;
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
update_texture()
|
|
@@ -57,7 +65,7 @@ class WorldImage extends Mesh
|
|
|
57
65
|
|
|
58
66
|
set size(value)
|
|
59
67
|
{
|
|
60
|
-
this.scale.
|
|
68
|
+
this.scale.copy(value);
|
|
61
69
|
this.material.uniforms._Scale.value = value;
|
|
62
70
|
}
|
|
63
71
|
|
package/src/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { BaseApplication } from './BaseApplication';
|
|
2
3
|
import { AddMaterial } from './materials/AddMaterial';
|
|
3
4
|
import { BaseShaderMaterial } from './materials/BaseShaderMaterial';
|
|
@@ -33,6 +34,7 @@ import { UnrealBloomRender } from './render_mode/UnrealBloomRender';
|
|
|
33
34
|
import { VRRender } from './render_mode/VRRender';
|
|
34
35
|
import { RenderLoop } from './RenderLoop';
|
|
35
36
|
import { SceneManager } from './SceneManager';
|
|
37
|
+
import { Screen } from './Screen';
|
|
36
38
|
import { Time } from './Time';
|
|
37
39
|
import { UI } from './UI';
|
|
38
40
|
import { DrawIOAnimationSheet } from './view_components/transition/DrawIOAnimationSheet';
|
|
@@ -127,6 +129,6 @@ export {
|
|
|
127
129
|
ModelUtilities, NormalAORender,
|
|
128
130
|
NormalRender, NumberInterpolator, ObjectUtilities, OBJLoader, OMath, OrthographicCamera, OrthographicFrustumPointFitter, OS, OScreen, ParticleAttribute,
|
|
129
131
|
ParticlePositionAttribute, PerspectiveCamera, PerspectiveFrustumPointFitter, PointArrayLoader, RegularLoadingState, RenderLoop, ResourceBatch,
|
|
130
|
-
ResourceContainer, RGBETextureLoader, SceneManager, SDFTextBatch, SimpleTextDrawer, Sphere, StringUtilities, Text2D, TextLoader, TextureLoader, Time, TimeUtilities, TransitionManager, TransitionTable, UI, UIElement, UnrealBloomComposeMaterial, UnrealBloomRender, UpdatableMaterialMesh, Validation, VectorInterpolator, VerticalPlane, VideoLoader, ViewComponent,
|
|
132
|
+
ResourceContainer, RGBETextureLoader, SceneManager, Screen, SDFTextBatch, SimpleTextDrawer, Sphere, StringUtilities, Text2D, TextLoader, TextureLoader, Time, TimeUtilities, TransitionManager, TransitionTable, UI, UIElement, UnrealBloomComposeMaterial, UnrealBloomRender, UpdatableMaterialMesh, Validation, VectorInterpolator, VerticalPlane, VideoLoader, ViewComponent,
|
|
131
133
|
ViewComponentManager, ViewManager, VRRender, WorldImage
|
|
132
134
|
};
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { ResourceContainer } from '../ResourceContainer';
|
|
2
3
|
|
|
3
4
|
class AsyncAbstractLoader
|
|
4
5
|
{
|
|
6
|
+
/**
|
|
7
|
+
* @param {string} name
|
|
8
|
+
* @param {any[]} assets
|
|
9
|
+
* @param {Worker} worker
|
|
10
|
+
*/
|
|
5
11
|
constructor(name, assets, worker)
|
|
6
12
|
{
|
|
7
13
|
this.resource_container = ResourceContainer;
|
|
@@ -106,6 +112,9 @@ class AsyncAbstractLoader
|
|
|
106
112
|
this.worker.postMessage({ type: 'assets', loader_name: this.name, data: this.assets });
|
|
107
113
|
}
|
|
108
114
|
|
|
115
|
+
/**
|
|
116
|
+
* @param {MessageEvent} e
|
|
117
|
+
*/
|
|
109
118
|
on_message(e)
|
|
110
119
|
{
|
|
111
120
|
const message = e.data;
|
|
@@ -118,6 +127,9 @@ class AsyncAbstractLoader
|
|
|
118
127
|
}
|
|
119
128
|
}
|
|
120
129
|
|
|
130
|
+
/**
|
|
131
|
+
* @param {any} resources
|
|
132
|
+
*/
|
|
121
133
|
__on_assets_loaded(resources)
|
|
122
134
|
{
|
|
123
135
|
this.worker.removeEventListener('message', this.bound_on_message);
|
|
@@ -135,9 +147,13 @@ class AsyncAbstractLoader
|
|
|
135
147
|
}
|
|
136
148
|
}
|
|
137
149
|
|
|
150
|
+
/**
|
|
151
|
+
* @returns {any[]}
|
|
152
|
+
*/
|
|
138
153
|
__setup_loaders()
|
|
139
154
|
{
|
|
140
155
|
console.warn('Not implemented');
|
|
156
|
+
return [];
|
|
141
157
|
}
|
|
142
158
|
}
|
|
143
159
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { GLTFDRACOLoader } from '../resource_loader/GLTFDRACOLoader';
|
|
2
3
|
import { GLTFLoader } from '../resource_loader/GLTFLoader';
|
|
3
4
|
import { ResourceContainer } from '../ResourceContainer';
|
|
@@ -5,6 +6,11 @@ import { AsyncAbstractLoader } from './AsyncAbstractLoader';
|
|
|
5
6
|
|
|
6
7
|
class AsyncObjectsLoader extends AsyncAbstractLoader
|
|
7
8
|
{
|
|
9
|
+
/**
|
|
10
|
+
* @param {string} scene_name
|
|
11
|
+
* @param {any[]} assets
|
|
12
|
+
* @param {Worker} worker
|
|
13
|
+
*/
|
|
8
14
|
constructor(scene_name, assets, worker)
|
|
9
15
|
{
|
|
10
16
|
super(scene_name, assets, worker);
|
package/src/primitives/Arrow.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { ConeGeometry, CylinderGeometry, Mesh, MeshBasicMaterial, Vector3 } from 'three';
|
|
2
3
|
|
|
3
4
|
import * as BufferGeometryUtils from 'three/examples/jsm/utils/BufferGeometryUtils.js';
|
|
4
5
|
|
|
5
6
|
class Arrow extends Mesh
|
|
6
7
|
{
|
|
8
|
+
/**
|
|
9
|
+
* @param {string | number} [color]
|
|
10
|
+
* @param {number} [length]
|
|
11
|
+
* @param {Vector3} [dir]
|
|
12
|
+
*/
|
|
7
13
|
constructor(color, length, dir)
|
|
8
14
|
{
|
|
9
15
|
color = color || '#FF0000';
|
package/src/primitives/Cube.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-check
|
|
2
2
|
import { Vector3, Mesh } from 'three';
|
|
3
3
|
import { BoxGeometry } from 'three';
|
|
4
4
|
import { MeshBasicMaterial } from 'three';
|
|
5
5
|
|
|
6
6
|
class Cube extends Mesh
|
|
7
7
|
{
|
|
8
|
+
/**
|
|
9
|
+
* @param {Vector3} [size]
|
|
10
|
+
* @param {Vector3} [segments]
|
|
11
|
+
* @param {number | string} [color]
|
|
12
|
+
*/
|
|
8
13
|
constructor(size, segments, color)
|
|
9
14
|
{
|
|
10
15
|
size = size || new Vector3(1, 1, 1);
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { Material, Mesh } from 'three'; // eslint-disable-line no-unused-vars
|
|
2
3
|
import { MeshBasicMaterial } from 'three';
|
|
3
4
|
import { PlaneGeometry } from 'three';
|
|
4
5
|
|
|
5
6
|
class HorizontalPlane extends Mesh
|
|
6
7
|
{
|
|
8
|
+
/**
|
|
9
|
+
* @param {number} [width]
|
|
10
|
+
* @param {number} [height]
|
|
11
|
+
* @param {number | string} [color]
|
|
12
|
+
* @param {Material} [material]
|
|
13
|
+
*/
|
|
7
14
|
constructor(width, height, color, material)
|
|
8
15
|
{
|
|
9
16
|
width = width || 1;
|
package/src/primitives/Sphere.js
CHANGED
|
@@ -2,6 +2,10 @@ import { Mesh, MeshBasicMaterial, SphereGeometry } from 'three';
|
|
|
2
2
|
|
|
3
3
|
class Sphere extends Mesh
|
|
4
4
|
{
|
|
5
|
+
/**
|
|
6
|
+
* @param {number} radius
|
|
7
|
+
* @param {number | string} color
|
|
8
|
+
*/
|
|
5
9
|
constructor(radius, color)
|
|
6
10
|
{
|
|
7
11
|
color = color || '#FF0000';
|
|
@@ -9,6 +13,9 @@ class Sphere extends Mesh
|
|
|
9
13
|
const geometry = new SphereGeometry(radius, 64, 64);
|
|
10
14
|
const material = new MeshBasicMaterial({ color: color });
|
|
11
15
|
super(geometry, material);
|
|
16
|
+
this.radius = radius;
|
|
17
|
+
this.color = color;
|
|
18
|
+
this.center = this.position;
|
|
12
19
|
}
|
|
13
20
|
}
|
|
14
21
|
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { Material, Mesh } from 'three'; // eslint-disable-line no-unused-vars
|
|
2
3
|
import { PlaneGeometry } from 'three';
|
|
3
4
|
import { MeshBasicMaterial } from 'three';
|
|
4
5
|
|
|
5
6
|
class VerticalPlane extends Mesh
|
|
6
7
|
{
|
|
8
|
+
/**
|
|
9
|
+
* @param {number} [width]
|
|
10
|
+
* @param {number} [height]
|
|
11
|
+
* @param {number | string} [color]
|
|
12
|
+
* @param {Material} [material]
|
|
13
|
+
*/
|
|
7
14
|
constructor(width, height, color, material)
|
|
8
15
|
{
|
|
9
16
|
width = width || 1;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UIElement } from '../../components/UIElement'; // eslint-disable-line no-unused-vars
|
|
1
2
|
import { UIElementState } from './UIElementState';
|
|
2
3
|
|
|
3
4
|
class OnIdle extends UIElementState
|
|
@@ -7,6 +8,10 @@ class OnIdle extends UIElementState
|
|
|
7
8
|
super();
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* @param {UIElement} ui_element
|
|
13
|
+
* @param {Vector2} normalized_mouse_position
|
|
14
|
+
*/
|
|
10
15
|
update(ui_element, normalized_mouse_position)
|
|
11
16
|
{
|
|
12
17
|
if (ui_element.is_mouse_over(normalized_mouse_position))
|