ohzi-core 5.13.2 → 5.14.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.
- package/{LICENSE.md → LICENSE} +1 -1
- package/build/index.module.js +1 -1
- package/build/index.module.js.map +1 -1
- package/package.json +12 -4
- package/src/.vscode/settings.json +3 -0
- package/src/BaseApplication.js +20 -0
- package/src/CameraManager.js +19 -0
- package/src/Capabilities.js +11 -0
- package/src/Configuration.js +22 -0
- package/src/CustomBezierCurve.js +44 -0
- package/src/Debug.js +260 -0
- package/src/EventManager.js +150 -0
- package/src/Graphics.js +334 -0
- package/src/Initializer.js +55 -0
- package/src/Input.js +21 -0
- package/src/KeyboardInput.js +128 -0
- package/src/OS.js +103 -0
- package/src/OrthographicCamera.js +13 -0
- package/src/PerspectiveCamera.js +13 -0
- package/src/ReflectionPlaneContext.js +17 -0
- package/src/RenderLayers.js +28 -0
- package/src/RenderLoop.js +97 -0
- package/src/RenderOrder.js +38 -0
- package/src/ResourceContainer.js +39 -0
- package/src/SceneManager.js +44 -0
- package/src/Screen.js +62 -0
- package/src/Time.js +38 -0
- package/src/UI.js +90 -0
- package/src/action_sequencer/ActionEvent.js +15 -0
- package/src/action_sequencer/ActionInterpolator.js +23 -0
- package/src/action_sequencer/ActionSequencer.js +195 -0
- package/src/action_sequencer/NumberInterpolator.js +24 -0
- package/src/action_sequencer/VectorInterpolator.js +20 -0
- package/src/blitter_index.js +13 -0
- package/src/canvas_drawer/CanvasDrawer.js +111 -0
- package/src/canvas_drawer/MultiLineTextDrawer.js +49 -0
- package/src/canvas_drawer/SimpleTextDrawer.js +47 -0
- package/src/components/AudioClip.js +41 -0
- package/src/components/AxisHelper.js +58 -0
- package/src/components/BaseObject.js +45 -0
- package/src/components/EdgeMesh.js +151 -0
- package/src/components/GeometryEdgeVisualizer.js +45 -0
- package/src/components/Grid.js +33 -0
- package/src/components/Line.js +199 -0
- package/src/components/MultiLinePath.js +19 -0
- package/src/components/MultiLineText2D.js +62 -0
- package/src/components/ObjectAxis.js +20 -0
- package/src/components/ObjectOrientedBoundingBox.js +201 -0
- package/src/components/PlaneHelper.js +36 -0
- package/src/components/Shape2D.js +42 -0
- package/src/components/Shape3D.js +38 -0
- package/src/components/Text2D.js +39 -0
- package/src/components/UIElement.js +208 -0
- package/src/components/UpdatableMaterialMesh.js +16 -0
- package/src/components/WorldImage.js +91 -0
- package/src/components/mouse_interactors/ObjectRotator.js +61 -0
- package/src/components/sdf_text/SDFText.js +154 -0
- package/src/components/sdf_text/SDFTextBatch.js +193 -0
- package/src/components/sdf_text/TextGlyph.js +15 -0
- package/src/editor/ManipulatorHandle.js +70 -0
- package/src/editor/ObjectEditor.js +66 -0
- package/src/editor/ObjectManipulator.js +118 -0
- package/src/editor/ObjectPicker.js +75 -0
- package/src/editor/shaders/object_picker.frag +6 -0
- package/src/editor/shaders/object_picker.vert +8 -0
- package/src/gpu_particles/GPUParticleSystem.js +87 -0
- package/src/gpu_particles/ParticleAttribute.js +83 -0
- package/src/gpu_particles/ParticlePositionAttribute.js +20 -0
- package/src/html_utilities/CSSAnimator.js +64 -0
- package/src/html_utilities/css_animator_states/Animating.js +45 -0
- package/src/html_utilities/css_animator_states/Idle.js +25 -0
- package/src/index.js +171 -0
- package/src/materials/AddMaterial.js +17 -0
- package/src/materials/AlphaFilterMaterial.js +20 -0
- package/src/materials/BaseShaderMaterial.js +19 -0
- package/src/materials/BlitMaterial.js +28 -0
- package/src/materials/BloomComposeMaterial.js +22 -0
- package/src/materials/BoxBlurMaterial.js +13 -0
- package/src/materials/ClearAlphaMaterial.js +13 -0
- package/src/materials/ClearColorMaterial.js +31 -0
- package/src/materials/ClearDepthNormalMaterial.js +13 -0
- package/src/materials/DeferredRendererComposeMaterial.js +32 -0
- package/src/materials/DepthNormalMaterial.js +28 -0
- package/src/materials/DisplayNormalTextureMaterial.js +15 -0
- package/src/materials/DualFilteringBlurMaterial.js +11 -0
- package/src/materials/FXAAMaterial.js +10 -0
- package/src/materials/GaussianBlurMaterial.js +28 -0
- package/src/materials/LuminosityHighPassMaterial.js +15 -0
- package/src/materials/MedianFilterMaterial.js +42 -0
- package/src/materials/NormalMaterial.js +17 -0
- package/src/materials/SDFScreenTextMaterial.js +31 -0
- package/src/materials/SDFTextMaterial.js +37 -0
- package/src/materials/SSAOComposeMaterial.js +11 -0
- package/src/materials/SSAOMaterial.js +66 -0
- package/src/materials/ScreenSpaceTextureMaterial.js +65 -0
- package/src/materials/UIElementMaterial.js +25 -0
- package/src/materials/UnrealBloomComposeMaterial.js +95 -0
- package/src/materials/UnrealBlurMaterial.js +17 -0
- package/src/materials/UnrealComposeMaterial.js +24 -0
- package/src/materials/ViewPositionMaterial.js +17 -0
- package/src/materials/deferred/DeferredPointLightMaterial.js +39 -0
- package/src/materials/gpu_particles/AttributeUpdateMaterial.js +33 -0
- package/src/materials/gpu_particles/BasicParticleMaterial.js +23 -0
- package/src/materials/gpu_particles/ParticleStorageMaterial.js +27 -0
- package/src/materials/gpu_particles/PositionStorageMaterial.js +10 -0
- package/src/object_pool/Pool.js +73 -0
- package/src/primitives/Arrow.js +57 -0
- package/src/primitives/Cube.js +17 -0
- package/src/primitives/HorizontalPlane.js +18 -0
- package/src/primitives/Sphere.js +15 -0
- package/src/primitives/VerticalPlane.js +17 -0
- package/src/raycast/GroupRaycaster.js +41 -0
- package/src/raycast/PlaneDragResolver.js +89 -0
- package/src/raycast/PlaneRaycastResolver.js +22 -0
- package/src/raycast/PlaneRaycaster.js +23 -0
- package/src/raycast/RaycastResolver.js +22 -0
- package/src/raycast/SurfaceDragResolver.js +77 -0
- package/src/raycast/states/BaseState.js +16 -0
- package/src/raycast/states/IdleState.js +17 -0
- package/src/raycast/states/OnRaycastEnter.js +15 -0
- package/src/raycast/states/OnRaycastExit.js +16 -0
- package/src/raycast/states/OnRaycastHover.js +25 -0
- package/src/render_mode/BaseRender.js +32 -0
- package/src/render_mode/BloomRender.js +60 -0
- package/src/render_mode/DebugNormalsRender.js +20 -0
- package/src/render_mode/DeferredRender.js +112 -0
- package/src/render_mode/NormalAORender.js +71 -0
- package/src/render_mode/NormalRender.js +36 -0
- package/src/render_mode/OutlineRender.js +154 -0
- package/src/render_mode/PlanarReflectionsRender.js +118 -0
- package/src/render_mode/TransparencyMixRender.js +143 -0
- package/src/render_mode/UnrealBloomRender.js +109 -0
- package/src/render_utilities/Blitter.js +99 -0
- package/src/render_utilities/Blurrer.js +29 -0
- package/src/render_utilities/DepthAndNormalsRenderer.js +45 -0
- package/src/render_utilities/DualFilteringBlurrer.js +56 -0
- package/src/render_utilities/GaussianBlurrer.js +146 -0
- package/src/render_utilities/MedianFilter.js +66 -0
- package/src/render_utilities/ViewPositionRenderer.js +48 -0
- package/src/resource_loader/AbstractLoader.js +103 -0
- package/src/resource_loader/AudioLoader.js +42 -0
- package/src/resource_loader/BasisLoader.js +50 -0
- package/src/resource_loader/CubemapLoader.js +48 -0
- package/src/resource_loader/DAELoader.js +39 -0
- package/src/resource_loader/DDSLoader.js +39 -0
- package/src/resource_loader/FileLoader.js +39 -0
- package/src/resource_loader/FontLoader.js +39 -0
- package/src/resource_loader/GLTFDRACOLoader.js +45 -0
- package/src/resource_loader/GLTFLoader.js +40 -0
- package/src/resource_loader/HDRCubeTextureLoader.js +43 -0
- package/src/resource_loader/JSONLoader.js +40 -0
- package/src/resource_loader/OBJLoader.js +39 -0
- package/src/resource_loader/PointArrayLoader.js +63 -0
- package/src/resource_loader/RGBETextureLoader.js +42 -0
- package/src/resource_loader/ResourceBatch.js +174 -0
- package/src/resource_loader/SVGLoader.js +39 -0
- package/src/resource_loader/TextLoader.js +39 -0
- package/src/resource_loader/TextureLoader.js +40 -0
- package/src/shaders/add/add.frag +9 -0
- package/src/shaders/anti_aliasing/fxaa.frag +72 -0
- package/src/shaders/basic_color/basic_color.frag +6 -0
- package/src/shaders/basic_color/basic_color.vert +10 -0
- package/src/shaders/basic_line/basic_line.frag +37 -0
- package/src/shaders/basic_line/basic_line.vert +37 -0
- package/src/shaders/basic_texture/basic_texture.frag +10 -0
- package/src/shaders/basic_texture/basic_texture.vert +17 -0
- package/src/shaders/bloom/bloom_compose_frag.glsl +22 -0
- package/src/shaders/bloom/cheap_bloom_compose_frag.glsl +13 -0
- package/src/shaders/box_blur/box_blur.frag +24 -0
- package/src/shaders/box_blur/compose.frag +31 -0
- package/src/shaders/clear/clear_depth_normal.frag +25 -0
- package/src/shaders/copy/copy.frag +7 -0
- package/src/shaders/copy/copy.vert +6 -0
- package/src/shaders/deferred/blit_copy.vert +11 -0
- package/src/shaders/deferred/deferred_compose.frag +59 -0
- package/src/shaders/deferred/point_light.frag +66 -0
- package/src/shaders/deferred/point_light.vert +13 -0
- package/src/shaders/depth_normals/debug_normals.frag +48 -0
- package/src/shaders/depth_normals/depth_normals.frag +30 -0
- package/src/shaders/depth_normals/depth_normals.vert +13 -0
- package/src/shaders/dual_filter_blur/alpha_filter.frag +14 -0
- package/src/shaders/dual_filter_blur/downsample.frag +21 -0
- package/src/shaders/dual_filter_blur/upsample.frag +24 -0
- package/src/shaders/edge_visualizer/edge_visualizer.frag +18 -0
- package/src/shaders/edge_visualizer/edge_visualizer.vert +16 -0
- package/src/shaders/edges/corners.frag +11 -0
- package/src/shaders/edges/corners.vert +31 -0
- package/src/shaders/edges/edges.frag +7 -0
- package/src/shaders/edges/edges.vert +27 -0
- package/src/shaders/gaussian_blur/gaussian_blur.frag +25 -0
- package/src/shaders/gaussian_blur/unreal_bloom_compose.frag +24 -0
- package/src/shaders/gpu_particles/common_utils.glsl +13 -0
- package/src/shaders/gpu_particles/generic_storage.frag +7 -0
- package/src/shaders/gpu_particles/store/store_position.vert +14 -0
- package/src/shaders/gpu_particles/update/basic_update.frag +21 -0
- package/src/shaders/gpu_particles/visualize/visualize.frag +11 -0
- package/src/shaders/gpu_particles/visualize/visualize.vert +12 -0
- package/src/shaders/grid/grid.frag +17 -0
- package/src/shaders/grid/grid.vert +10 -0
- package/src/shaders/luminosity_high_pass/luminosity_high_pass.frag +23 -0
- package/src/shaders/median_filter/median_filter.frag +134 -0
- package/src/shaders/normal/normal.frag +6 -0
- package/src/shaders/normal/normal.vert +6 -0
- package/src/shaders/sdf_text/sdf_screen_text.frag +51 -0
- package/src/shaders/sdf_text/sdf_screen_text.vert +42 -0
- package/src/shaders/sdf_text/sdf_text.frag +53 -0
- package/src/shaders/sdf_text/sdf_text.vert +42 -0
- package/src/shaders/ssao/hbao.frag +264 -0
- package/src/shaders/ssao/ssao.frag +95 -0
- package/src/shaders/ssao/ssao.vert +11 -0
- package/src/shaders/ssao/ssao_compose.frag +14 -0
- package/src/shaders/transparent_mix/copy.frag +7 -0
- package/src/shaders/transparent_mix/transparent_mix.frag +19 -0
- package/src/shaders/transparent_mix/transparent_mix.vert +8 -0
- package/src/shaders/ui/ss_texture.frag +11 -0
- package/src/shaders/ui/ss_texture.vert +32 -0
- package/src/shaders/ui/ws_texture.vert +39 -0
- package/src/shaders/ui_element/ui_element.frag +11 -0
- package/src/shaders/ui_element/ui_element.vert +32 -0
- package/src/shaders/unreal_blur/unreal_blur.frag +25 -0
- package/src/shaders/unreal_blur/unreal_compose.frag +24 -0
- package/src/shaders/write_view_position/write_view_position.frag +7 -0
- package/src/shaders/write_view_position/write_view_position.vert +9 -0
- package/src/static_batcher/GeometryBatch.js +312 -0
- package/src/static_batcher/GeometryBatcher.js +62 -0
- package/src/ui/ui_element_position/ScreenSpacePosition.js +14 -0
- package/src/ui/ui_element_position/WorldSpacePosition.js +21 -0
- package/src/ui/ui_element_state/OnIdle.js +17 -0
- package/src/ui/ui_element_state/OnMouseEnter.js +26 -0
- package/src/ui/ui_element_state/OnMouseExit.js +15 -0
- package/src/ui/ui_element_state/OnMouseHover.js +31 -0
- package/src/ui/ui_element_state/UIElementState.js +18 -0
- package/src/utilities/ArrayUtilities.js +55 -0
- package/src/utilities/CameraUtilities.js +197 -0
- package/src/utilities/EasingFunctions.js +215 -0
- package/src/utilities/FrustumPointFitter.js +255 -0
- package/src/utilities/GeometryUtilities.js +74 -0
- package/src/utilities/ImageUtilities.js +26 -0
- package/src/utilities/MathUtilities.js +110 -0
- package/src/utilities/MeshSampler.js +100 -0
- package/src/utilities/ModelUtilities.js +161 -0
- package/src/utilities/ObjectUtilities.js +55 -0
- package/src/utilities/OrthographicFrustumPointFitter.js +47 -0
- package/src/utilities/PerspectiveFrustumPointFitter.js +250 -0
- package/src/utilities/StringUtilities.js +32 -0
- package/src/utilities/TimeUtilities.js +22 -0
- package/src/utilities/Validation.js +34 -0
- package/src/view_components/ApplicationView.js +60 -0
- package/src/view_components/ViewComponent.js +37 -0
- package/src/view_components/ViewComponentManager.js +58 -0
- package/src/view_components/ViewContext.js +14 -0
- package/src/view_components/ViewManager.js +119 -0
- package/src/view_components/ViewState.js +54 -0
- package/src/view_components/transition/ActionSequencerBuilder.js +91 -0
- package/src/view_components/transition/DrawIOAnimationSheet.js +90 -0
- package/src/view_components/transition/TransitionTable.js +44 -0
- package/src/view_components/transition/ViewStateTransitionHandler.js +81 -0
- package/types/BaseApplication.d.ts +8 -0
- package/types/CameraManager.d.ts +8 -0
- package/types/Capabilities.d.ts +6 -0
- package/types/Configuration.d.ts +6 -0
- package/types/Debug.d.ts +37 -0
- package/types/EventManager.d.ts +42 -0
- package/types/Graphics.d.ts +36 -0
- package/types/Initializer.d.ts +4 -0
- package/types/Input.d.ts +8 -0
- package/types/OS.d.ts +19 -0
- package/types/OrthographicCamera.d.ts +5 -0
- package/types/PerspectiveCamera.d.ts +5 -0
- package/types/ReflectionPlaneContext.d.ts +6 -0
- package/types/RenderLayers.d.ts +6 -0
- package/types/RenderLoop.d.ts +13 -0
- package/types/ResourceContainer.d.ts +8 -0
- package/types/SceneManager.d.ts +10 -0
- package/types/Screen.d.ts +17 -0
- package/types/Time.d.ts +11 -0
- package/types/UI.d.ts +15 -0
- package/types/action_sequencer/ActionEvent.d.ts +6 -0
- package/types/action_sequencer/ActionInterpolator.d.ts +5 -0
- package/types/action_sequencer/ActionSequencer.d.ts +28 -0
- package/types/action_sequencer/NumberInterpolator.d.ts +8 -0
- package/types/action_sequencer/VectorInterpolator.d.ts +7 -0
- package/types/canvas_drawer/CanvasDrawer.d.ts +13 -0
- package/types/canvas_drawer/MultiLineTextDrawer.d.ts +5 -0
- package/types/canvas_drawer/SimpleTextDrawer.d.ts +5 -0
- package/types/components/AudioClip.d.ts +12 -0
- package/types/components/AxisHelper.d.ts +6 -0
- package/types/components/BaseObject.d.ts +5 -0
- package/types/components/EdgeMesh.d.ts +13 -0
- package/types/components/GeometryEdgeVisualizer.d.ts +4 -0
- package/types/components/Grid.d.ts +2 -0
- package/types/components/Line.d.ts +16 -0
- package/types/components/MultiLinePath.d.ts +4 -0
- package/types/components/MultiLineText2D.d.ts +10 -0
- package/types/components/ObjectAxis.d.ts +3 -0
- package/types/components/ObjectOrientedBoundingBox.d.ts +18 -0
- package/types/components/PlaneHelper.d.ts +6 -0
- package/types/components/Shape2D.d.ts +4 -0
- package/types/components/Shape3D.d.ts +3 -0
- package/types/components/Text2D.d.ts +13 -0
- package/types/components/UIElement.d.ts +52 -0
- package/types/components/UpdatableMaterialMesh.d.ts +4 -0
- package/types/components/WorldImage.d.ts +13 -0
- package/types/components/sdf_text/SDFText.d.ts +30 -0
- package/types/components/sdf_text/SDFTextBatch.d.ts +12 -0
- package/types/components/sdf_text/TextGlyph.d.ts +6 -0
- package/types/editor/ManipulatorHandle.d.ts +14 -0
- package/types/editor/ObjectEditor.d.ts +16 -0
- package/types/editor/ObjectManipulator.d.ts +19 -0
- package/types/editor/ObjectPicker.d.ts +16 -0
- package/types/gpu_particles/GPUParticleSystem.d.ts +12 -0
- package/types/gpu_particles/ParticleAttribute.d.ts +15 -0
- package/types/gpu_particles/ParticlePositionAttribute.d.ts +4 -0
- package/types/html_utilities/CSSAnimator.d.ts +30 -0
- package/types/html_utilities/css_animator_states/Animating.d.ts +8 -0
- package/types/html_utilities/css_animator_states/Idle.d.ts +6 -0
- package/types/index.d.ts +73 -0
- package/types/materials/AddMaterial.d.ts +5 -0
- package/types/materials/AlphaFilterMaterial.d.ts +6 -0
- package/types/materials/BaseShaderMaterial.d.ts +3 -0
- package/types/materials/BlitMaterial.d.ts +3 -0
- package/types/materials/BloomComposeMaterial.d.ts +7 -0
- package/types/materials/BoxBlurMaterial.d.ts +4 -0
- package/types/materials/ClearAlphaMaterial.d.ts +3 -0
- package/types/materials/ClearColorMaterial.d.ts +7 -0
- package/types/materials/ClearDepthNormalMaterial.d.ts +4 -0
- package/types/materials/DeferredRendererComposeMaterial.d.ts +7 -0
- package/types/materials/DepthNormalMaterial.d.ts +4 -0
- package/types/materials/DisplayNormalTextureMaterial.d.ts +4 -0
- package/types/materials/DualFilteringBlurMaterial.d.ts +4 -0
- package/types/materials/FXAAMaterial.d.ts +3 -0
- package/types/materials/GaussianBlurMaterial.d.ts +6 -0
- package/types/materials/LuminosityHighPassMaterial.d.ts +4 -0
- package/types/materials/MedianFilterMaterial.d.ts +6 -0
- package/types/materials/NormalMaterial.d.ts +2 -0
- package/types/materials/SDFScreenTextMaterial.d.ts +11 -0
- package/types/materials/SDFTextMaterial.d.ts +12 -0
- package/types/materials/SSAOComposeMaterial.d.ts +4 -0
- package/types/materials/SSAOMaterial.d.ts +6 -0
- package/types/materials/ScreenSpaceTextureMaterial.d.ts +7 -0
- package/types/materials/UIElementMaterial.d.ts +7 -0
- package/types/materials/UnrealBloomComposeMaterial.d.ts +17 -0
- package/types/materials/UnrealBlurMaterial.d.ts +4 -0
- package/types/materials/UnrealComposeMaterial.d.ts +4 -0
- package/types/materials/ViewPositionMaterial.d.ts +3 -0
- package/types/materials/deferred/DeferredPointLightMaterial.d.ts +10 -0
- package/types/materials/gpu_particles/ParticleStorageMaterial.d.ts +3 -0
- package/types/materials/gpu_particles/PositionStorageMaterial.d.ts +4 -0
- package/types/object_pool/Pool.d.ts +10 -0
- package/types/primitives/Arrow.d.ts +8 -0
- package/types/primitives/Cube.d.ts +3 -0
- package/types/primitives/HorizontalPlane.d.ts +3 -0
- package/types/primitives/Sphere.d.ts +3 -0
- package/types/primitives/VerticalPlane.d.ts +3 -0
- package/types/raycast/GroupRaycaster.d.ts +13 -0
- package/types/raycast/PlaneDragResolver.d.ts +14 -0
- package/types/raycast/PlaneRaycastResolver.d.ts +5 -0
- package/types/raycast/PlaneRaycaster.d.ts +7 -0
- package/types/raycast/RaycastResolver.d.ts +5 -0
- package/types/raycast/SurfaceDragResolver.d.ts +13 -0
- package/types/raycast/states/BaseState.d.ts +5 -0
- package/types/raycast/states/IdleState.d.ts +5 -0
- package/types/raycast/states/OnRaycastEnter.d.ts +5 -0
- package/types/raycast/states/OnRaycastExit.d.ts +4 -0
- package/types/raycast/states/OnRaycastHover.d.ts +4 -0
- package/types/render_mode/BaseRender.d.ts +7 -0
- package/types/render_mode/BloomRender.d.ts +10 -0
- package/types/render_mode/DebugNormalsRender.d.ts +4 -0
- package/types/render_mode/DeferredRender.d.ts +9 -0
- package/types/render_mode/NormalAORender.d.ts +16 -0
- package/types/render_mode/NormalRender.d.ts +4 -0
- package/types/render_mode/OutlineRender.d.ts +20 -0
- package/types/render_mode/PlanarReflectionsRender.d.ts +13 -0
- package/types/render_mode/TransparencyMixRender.d.ts +21 -0
- package/types/render_mode/UnrealBloomRender.d.ts +19 -0
- package/types/render_utilities/Blitter.d.ts +16 -0
- package/types/render_utilities/Blurrer.d.ts +9 -0
- package/types/render_utilities/DepthAndNormalsRenderer.d.ts +12 -0
- package/types/render_utilities/DualFilteringBlurrer.d.ts +19 -0
- package/types/render_utilities/GaussianBlurrer.d.ts +27 -0
- package/types/render_utilities/MedianFilter.d.ts +10 -0
- package/types/render_utilities/ViewPositionRenderer.d.ts +9 -0
- package/types/resource_loader/AbstractLoader.d.ts +18 -0
- package/types/resource_loader/AudioLoader.d.ts +8 -0
- package/types/resource_loader/BasisLoader.d.ts +6 -0
- package/types/resource_loader/CubemapLoader.d.ts +7 -0
- package/types/resource_loader/DAELoader.d.ts +6 -0
- package/types/resource_loader/DDSLoader.d.ts +6 -0
- package/types/resource_loader/FileLoader.d.ts +6 -0
- package/types/resource_loader/FontLoader.d.ts +6 -0
- package/types/resource_loader/GLTFDRACOLoader.d.ts +7 -0
- package/types/resource_loader/GLTFLoader.d.ts +5 -0
- package/types/resource_loader/HDRCubeTextureLoader.d.ts +7 -0
- package/types/resource_loader/JSONLoader.d.ts +6 -0
- package/types/resource_loader/OBJLoader.d.ts +6 -0
- package/types/resource_loader/PointArrayLoader.d.ts +7 -0
- package/types/resource_loader/RGBETextureLoader.d.ts +6 -0
- package/types/resource_loader/ResourceBatch.d.ts +28 -0
- package/types/resource_loader/SVGLoader.d.ts +6 -0
- package/types/resource_loader/TextLoader.d.ts +6 -0
- package/types/resource_loader/TextureLoader.d.ts +6 -0
- package/types/static_batcher/GeometryBatch.d.ts +37 -0
- package/types/static_batcher/GeometryBatcher.d.ts +7 -0
- package/types/ui/ui_element_position/ScreenSpacePosition.d.ts +4 -0
- package/types/ui/ui_element_position/WorldSpacePosition.d.ts +5 -0
- package/types/ui/ui_element_state/OnIdle.d.ts +5 -0
- package/types/ui/ui_element_state/OnMouseEnter.d.ts +5 -0
- package/types/ui/ui_element_state/OnMouseExit.d.ts +5 -0
- package/types/ui/ui_element_state/OnMouseHover.d.ts +5 -0
- package/types/ui/ui_element_state/UIElementState.d.ts +5 -0
- package/types/utilities/ArrayUtilities.d.ts +7 -0
- package/types/utilities/CameraUtilities.d.ts +24 -0
- package/types/utilities/EasingFunctions.d.ts +35 -0
- package/types/utilities/FrustumPointFitter.d.ts +14 -0
- package/types/utilities/GeometryUtilities.d.ts +4 -0
- package/types/utilities/ImageUtilities.d.ts +4 -0
- package/types/utilities/MathUtilities.d.ts +12 -0
- package/types/utilities/MeshSampler.d.ts +14 -0
- package/types/utilities/ModelUtilities.d.ts +13 -0
- package/types/utilities/ObjectUtilities.d.ts +5 -0
- package/types/utilities/OrthographicFrustumPointFitter.d.ts +7 -0
- package/types/utilities/PerspectiveFrustumPointFitter.d.ts +12 -0
- package/types/utilities/StringUtilities.d.ts +5 -0
- package/types/utilities/TimeUtilities.d.ts +3 -0
- package/types/utilities/Validation.d.ts +6 -0
- package/types/view_components/ApplicationView.d.ts +11 -0
- package/types/view_components/ViewComponent.d.ts +13 -0
- package/types/view_components/ViewComponentManager.d.ts +10 -0
- package/types/view_components/ViewContext.d.ts +6 -0
- package/types/view_components/ViewManager.d.ts +24 -0
- package/types/view_components/ViewState.d.ts +15 -0
- package/types/view_components/transition/ActionSequencerBuilder.d.ts +15 -0
- package/types/view_components/transition/DrawIOAnimationSheet.d.ts +17 -0
- package/types/view_components/transition/TransitionTable.d.ts +8 -0
- package/types/view_components/transition/ViewStateTransitionHandler.d.ts +16 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
|
|
2
|
+
import Screen from '../Screen';
|
|
3
|
+
|
|
4
|
+
import UIElementMaterial from '../materials/UIElementMaterial';
|
|
5
|
+
|
|
6
|
+
import ScreenSpacePosition from '../ui/ui_element_position/ScreenSpacePosition';
|
|
7
|
+
import WorldSpacePosition from '../ui/ui_element_position/WorldSpacePosition';
|
|
8
|
+
|
|
9
|
+
import OnIdle from '../ui/ui_element_state/OnIdle';
|
|
10
|
+
import OnMouseEnter from '../ui/ui_element_state/OnMouseEnter';
|
|
11
|
+
import OnMouseExit from '../ui/ui_element_state/OnMouseExit';
|
|
12
|
+
import OnMouseHover from '../ui/ui_element_state/OnMouseHover';
|
|
13
|
+
|
|
14
|
+
import { Mesh } from 'three';
|
|
15
|
+
import { PlaneGeometry } from 'three';
|
|
16
|
+
import { Vector2 } from 'three';
|
|
17
|
+
import { Vector3 } from 'three';
|
|
18
|
+
import { NearestFilter } from 'three';
|
|
19
|
+
import { Box2 } from 'three';
|
|
20
|
+
|
|
21
|
+
export default class UIElement extends Mesh
|
|
22
|
+
{
|
|
23
|
+
constructor(vert, frag)
|
|
24
|
+
{
|
|
25
|
+
super(new PlaneGeometry(1, 1), new UIElementMaterial());
|
|
26
|
+
|
|
27
|
+
this.is_clickable = false;
|
|
28
|
+
|
|
29
|
+
this.position_strategy = new WorldSpacePosition();
|
|
30
|
+
this.current_state = new OnIdle();
|
|
31
|
+
|
|
32
|
+
this._position = new Vector3();
|
|
33
|
+
|
|
34
|
+
this._on_idle_state = new OnIdle();
|
|
35
|
+
this._on_enter_state = new OnMouseEnter();
|
|
36
|
+
this._on_exit_state = new OnMouseExit();
|
|
37
|
+
this._on_hover_state = new OnMouseHover();
|
|
38
|
+
|
|
39
|
+
this.on_enter = undefined;
|
|
40
|
+
this.on_exit = undefined;
|
|
41
|
+
this.on_hover = undefined;
|
|
42
|
+
|
|
43
|
+
this.mouse_pos_tmp = new Vector2();
|
|
44
|
+
this.cached_NDC_position = new Vector2();
|
|
45
|
+
this.screen_pos_tmp = new Vector2();
|
|
46
|
+
|
|
47
|
+
this.texture_size = new Vector2(1, 1);
|
|
48
|
+
|
|
49
|
+
this.frustumCulled = false;
|
|
50
|
+
this.matrixAutoUpdate = false;
|
|
51
|
+
this.renderOrder = 0;
|
|
52
|
+
|
|
53
|
+
this.size = 1;
|
|
54
|
+
this.pixel_offset = new Vector2();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
set_render_order(value)
|
|
58
|
+
{
|
|
59
|
+
this.renderOrder = value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get pivot_point()
|
|
63
|
+
{
|
|
64
|
+
return this.material.uniforms._PivotPoint.value;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
set_pixel_offset(offset)
|
|
68
|
+
{
|
|
69
|
+
this.pixel_offset.copy(offset);
|
|
70
|
+
this.material.uniforms._PixelOffset.value.copy(offset);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
set_state(new_state)
|
|
74
|
+
{
|
|
75
|
+
this.current_state.on_exit(this);
|
|
76
|
+
this.current_state = new_state;
|
|
77
|
+
this.current_state.on_enter(this);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get position()
|
|
81
|
+
{
|
|
82
|
+
return this._position;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
set use_depth(boolean)
|
|
86
|
+
{
|
|
87
|
+
this.material.depthTest = boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get use_depth()
|
|
91
|
+
{
|
|
92
|
+
return this.material.depthTest;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
set depth_offset(value)
|
|
96
|
+
{
|
|
97
|
+
this.material.uniforms._DepthOffset.value = value;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
get depth_offset()
|
|
101
|
+
{
|
|
102
|
+
return this.material.uniforms._DepthOffset.value;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
clear_state()
|
|
106
|
+
{
|
|
107
|
+
this.visible = false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
set_world_space_coordinate_system()
|
|
111
|
+
{
|
|
112
|
+
this.position_strategy = new WorldSpacePosition();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
set_screen_space_coordinate_system()
|
|
116
|
+
{
|
|
117
|
+
this.position_strategy = new ScreenSpacePosition();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
set_texture(texture)
|
|
121
|
+
{
|
|
122
|
+
texture.minFilter = NearestFilter;
|
|
123
|
+
texture.magFilter = NearestFilter;
|
|
124
|
+
texture.needsUpdate = true;
|
|
125
|
+
|
|
126
|
+
this.texture_size.set(texture.image.width, texture.image.height);
|
|
127
|
+
|
|
128
|
+
this.material.uniforms._MainTex.value = texture;
|
|
129
|
+
this.get_size(this.material.uniforms._TextureSize.value);
|
|
130
|
+
this.visible = true;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
update_state(normalized_mouse_pos)
|
|
134
|
+
{
|
|
135
|
+
this.material.uniforms._ScreenSize.value.set(Screen.width, Screen.height);
|
|
136
|
+
this.get_size(this.material.uniforms._TextureSize.value);
|
|
137
|
+
|
|
138
|
+
this.cached_NDC_position.copy(this.position_strategy.get_pos_NDC(this.position));
|
|
139
|
+
this.material.uniforms._NDC.value.copy(this.position);
|
|
140
|
+
this.current_state.update(this, normalized_mouse_pos);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
is_mouse_over(normalized_mouse_pos)
|
|
144
|
+
{
|
|
145
|
+
this.screen_pos_tmp.copy(this.cached_NDC_position);
|
|
146
|
+
this.to_screen_position(this.screen_pos_tmp);
|
|
147
|
+
this.screen_pos_tmp.x += this.pixel_offset.x;
|
|
148
|
+
this.screen_pos_tmp.y += this.pixel_offset.y;
|
|
149
|
+
|
|
150
|
+
let rect = new Box2().setFromCenterAndSize(this.screen_pos_tmp, this.get_size());
|
|
151
|
+
|
|
152
|
+
this.mouse_pos_tmp.copy(normalized_mouse_pos);
|
|
153
|
+
this.to_screen_position(this.mouse_pos_tmp);
|
|
154
|
+
|
|
155
|
+
return rect.containsPoint(this.mouse_pos_tmp);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
to_screen_position(projected_pos)
|
|
159
|
+
{
|
|
160
|
+
projected_pos.x = (projected_pos.x * 0.5 + 0.5) * Screen.width + this.pixel_offset.x;
|
|
161
|
+
projected_pos.y = (projected_pos.y * 0.5 + 0.5) * Screen.height + this.pixel_offset.y;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
get_screen_space_position()
|
|
165
|
+
{
|
|
166
|
+
let pos = this.cached_NDC_position.clone();
|
|
167
|
+
this.to_screen_position(pos);
|
|
168
|
+
return pos;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
set_screen_space_position(screen_pos)
|
|
172
|
+
{
|
|
173
|
+
this.position.x = (screen_pos.x / Screen.width) * 2 - 1;
|
|
174
|
+
this.position.y = (screen_pos.y / Screen.height) * 2 - 1;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
dispose()
|
|
178
|
+
{
|
|
179
|
+
if (this.material.uniforms._MainTex.value)
|
|
180
|
+
{
|
|
181
|
+
this.material.uniforms._MainTex.value.dispose();
|
|
182
|
+
}
|
|
183
|
+
Screen.remove_screen_material(this.material);
|
|
184
|
+
this.geometry.dispose();
|
|
185
|
+
this.material.dispose();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
get_size(vector2)
|
|
189
|
+
{
|
|
190
|
+
if (vector2)
|
|
191
|
+
{
|
|
192
|
+
return vector2.copy(this.texture_size).multiplyScalar(this.size / Screen.dpr);
|
|
193
|
+
}
|
|
194
|
+
else
|
|
195
|
+
{
|
|
196
|
+
return new Vector2().copy(this.texture_size).multiplyScalar(this.size / Screen.dpr);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
on_mouse_enter()
|
|
201
|
+
{}
|
|
202
|
+
|
|
203
|
+
on_mouse_exit()
|
|
204
|
+
{}
|
|
205
|
+
|
|
206
|
+
on_mouse_hover()
|
|
207
|
+
{}
|
|
208
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Mesh } from 'three';
|
|
2
|
+
|
|
3
|
+
export default class UpdatableMaterialMesh extends Mesh
|
|
4
|
+
{
|
|
5
|
+
constructor(geometry, material)
|
|
6
|
+
{
|
|
7
|
+
super(geometry, material);
|
|
8
|
+
|
|
9
|
+
let self = this;
|
|
10
|
+
|
|
11
|
+
this.onBeforeRender = () =>
|
|
12
|
+
{
|
|
13
|
+
self.material.update();
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import basic_texture_vert from '../shaders/basic_texture/basic_texture.vert';
|
|
2
|
+
import basic_texture_frag from '../shaders/basic_texture/basic_texture.frag';
|
|
3
|
+
|
|
4
|
+
import { Mesh } from 'three';
|
|
5
|
+
import { Vector2 } from 'three';
|
|
6
|
+
import { ShaderMaterial } from 'three';
|
|
7
|
+
import { DoubleSide } from 'three';
|
|
8
|
+
import { PlaneGeometry } from 'three';
|
|
9
|
+
import { Vector3 } from 'three';
|
|
10
|
+
|
|
11
|
+
export default class WorldImage extends Mesh
|
|
12
|
+
{
|
|
13
|
+
constructor(texture, pivot)
|
|
14
|
+
{
|
|
15
|
+
pivot = pivot || new Vector2(0, 0);
|
|
16
|
+
let material = new ShaderMaterial({
|
|
17
|
+
uniforms: {
|
|
18
|
+
_MainTex: { value: texture },
|
|
19
|
+
_ScreenAligned: { value: 0 },
|
|
20
|
+
_Scale: { value: 1 },
|
|
21
|
+
_Opacity: { value: 1 }
|
|
22
|
+
},
|
|
23
|
+
vertexShader: basic_texture_vert,
|
|
24
|
+
fragmentShader: basic_texture_frag,
|
|
25
|
+
transparent: true,
|
|
26
|
+
depthWrite: false,
|
|
27
|
+
side: DoubleSide
|
|
28
|
+
});
|
|
29
|
+
let geometry = new PlaneGeometry(1, 1, 1);
|
|
30
|
+
geometry.translate(-pivot.x / 2, -pivot.y / 2, 0);
|
|
31
|
+
let current_scale = texture.image.width / texture.image.height;
|
|
32
|
+
geometry.scale(current_scale, 1, 1);
|
|
33
|
+
super(geometry, material);
|
|
34
|
+
this.current_scale = current_scale;
|
|
35
|
+
this.geometry.computeBoundingBox();
|
|
36
|
+
|
|
37
|
+
this.tmp_bb_size = new Vector3();
|
|
38
|
+
this.geometry.boundingBox.getSize(this.tmp_bb_size);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
update_texture()
|
|
42
|
+
{
|
|
43
|
+
this.material.uniforms._MainTex.value.needsUpdate = true;
|
|
44
|
+
let img = this.material.uniforms._MainTex.value.image;
|
|
45
|
+
|
|
46
|
+
this.geometry.scale(1 / this.current_scale, 1, 1);
|
|
47
|
+
this.current_scale = img.width / img.height;
|
|
48
|
+
this.geometry.scale(this.current_scale, 1, 1);
|
|
49
|
+
this.geometry.computeBoundingBox();
|
|
50
|
+
this.geometry.boundingBox.getSize(this.tmp_bb_size);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get size()
|
|
54
|
+
{
|
|
55
|
+
return this.tmp_bb_size.clone().multiplyScalar(this.scale.x);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
set size(value)
|
|
59
|
+
{
|
|
60
|
+
this.scale.set(value, value, value);
|
|
61
|
+
this.material.uniforms._Scale.value = value;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
set screen_aligned(boolean)
|
|
65
|
+
{
|
|
66
|
+
this.material.uniforms._ScreenAligned.value = boolean === true ? 1 : 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get screen_aligned()
|
|
70
|
+
{
|
|
71
|
+
return this.material.uniforms._ScreenAligned.value === 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
set opacity(opacity)
|
|
75
|
+
{
|
|
76
|
+
this.material.uniforms._Opacity.value = opacity;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get opacity()
|
|
80
|
+
{
|
|
81
|
+
return this.material.uniforms._Opacity.value;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
dispose()
|
|
85
|
+
{
|
|
86
|
+
this.geometry.dispose();
|
|
87
|
+
this.parent.remove(this);
|
|
88
|
+
this.material.uniforms._MainTex.value.dispose();
|
|
89
|
+
this.material.dispose();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import RaycastResolver from '../../raycast/RaycastResolver';
|
|
2
|
+
import GroupRaycaster from '../../raycast/GroupRaycaster';
|
|
3
|
+
import Input from '../../Input';
|
|
4
|
+
|
|
5
|
+
import { Vector3 } from 'three';
|
|
6
|
+
import { Quaternion } from 'three';
|
|
7
|
+
|
|
8
|
+
export default class ObjectRotator extends RaycastResolver
|
|
9
|
+
{
|
|
10
|
+
constructor(object)
|
|
11
|
+
{
|
|
12
|
+
super();
|
|
13
|
+
|
|
14
|
+
this.is_mouse_over = false;
|
|
15
|
+
this.rotation_active = false;
|
|
16
|
+
|
|
17
|
+
this.object = object;
|
|
18
|
+
this.group_raycaster = new GroupRaycaster([object], this);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
on_enter(intersected_object)
|
|
22
|
+
{
|
|
23
|
+
this.is_mouse_over = true;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
on_exit()
|
|
27
|
+
{
|
|
28
|
+
this.is_mouse_over = false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
is_active()
|
|
32
|
+
{
|
|
33
|
+
return this.rotation_active;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
update()
|
|
37
|
+
{
|
|
38
|
+
this.group_raycaster.update();
|
|
39
|
+
|
|
40
|
+
if (this.is_mouse_over && Input.left_mouse_button_down)
|
|
41
|
+
{
|
|
42
|
+
this.rotation_active = true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// left button no longer being pressed
|
|
46
|
+
if (!Input.left_mouse_button_down)
|
|
47
|
+
{
|
|
48
|
+
this.rotation_active = false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (this.rotation_active)
|
|
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);
|
|
55
|
+
|
|
56
|
+
this.object.quaternion.multiply(rot_x);
|
|
57
|
+
rot_y.multiply(this.object.quaternion);
|
|
58
|
+
this.object.quaternion.copy(rot_y);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { Vector3, Quaternion, Matrix4, Color, Box2, Vector2 } from 'three';
|
|
2
|
+
import TextGlyph from './TextGlyph';
|
|
3
|
+
|
|
4
|
+
export default class SDFText
|
|
5
|
+
{
|
|
6
|
+
constructor(glyph_layout, text = '')
|
|
7
|
+
{
|
|
8
|
+
this.glyph_layout = glyph_layout;
|
|
9
|
+
|
|
10
|
+
this.glyphs = [];
|
|
11
|
+
|
|
12
|
+
this.glyph_is_dirty = true;
|
|
13
|
+
this.matrix_is_dirty = true;
|
|
14
|
+
this.color_is_dirty = true;
|
|
15
|
+
|
|
16
|
+
this.position = new Vector3();
|
|
17
|
+
this.quaternion = new Quaternion();
|
|
18
|
+
this.scale = new Vector3(1, 1, 1);
|
|
19
|
+
this.matrix = new Matrix4();
|
|
20
|
+
|
|
21
|
+
this.color = new Color('#FFFFFF');
|
|
22
|
+
|
|
23
|
+
this.pivot_point = new Vector2();
|
|
24
|
+
this.__opacity = 1;
|
|
25
|
+
|
|
26
|
+
this.__text = text;
|
|
27
|
+
|
|
28
|
+
this.__generate_glyphs(text);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
set text(value)
|
|
32
|
+
{
|
|
33
|
+
this.__text = value;
|
|
34
|
+
this.__generate_glyphs(value);
|
|
35
|
+
this.matrix_is_dirty = true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get text()
|
|
39
|
+
{
|
|
40
|
+
return this.__text;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
update_matrix()
|
|
44
|
+
{
|
|
45
|
+
this.matrix.compose(this.position, this.quaternion, this.scale);
|
|
46
|
+
this.matrix_is_dirty = false;
|
|
47
|
+
this.glyph_is_dirty = true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
clear_glyph_dirty()
|
|
51
|
+
{
|
|
52
|
+
this.glyph_is_dirty = false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
clear_color_dirty()
|
|
56
|
+
{
|
|
57
|
+
this.color_is_dirty = false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
set_rotation(orientation = 0, tilt = 0) // 0..360, -90..0..90
|
|
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);
|
|
64
|
+
|
|
65
|
+
this.quaternion.copy(new_orientation.multiply(new_tilt));
|
|
66
|
+
this.matrix_is_dirty = true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
set_position(pos)
|
|
70
|
+
{
|
|
71
|
+
this.position.copy(pos);
|
|
72
|
+
this.matrix_is_dirty = true;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
set_size(size)
|
|
76
|
+
{
|
|
77
|
+
this.scale.set(size, size, size);
|
|
78
|
+
this.matrix_is_dirty = true;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
set_color(col)
|
|
82
|
+
{
|
|
83
|
+
this.color.set(col);
|
|
84
|
+
this.color_is_dirty = true;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
set_pivot(pivot)
|
|
88
|
+
{
|
|
89
|
+
this.pivot_point.copy(pivot);
|
|
90
|
+
this.update_glyphs();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
set opacity(op)
|
|
94
|
+
{
|
|
95
|
+
this.__opacity = op;
|
|
96
|
+
this.color_is_dirty = true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
get opacity()
|
|
100
|
+
{
|
|
101
|
+
return this.__opacity;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
update_glyphs()
|
|
105
|
+
{
|
|
106
|
+
this.__generate_glyphs(this.text);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
__generate_glyphs(text)
|
|
110
|
+
{
|
|
111
|
+
let cursor = 0;
|
|
112
|
+
|
|
113
|
+
this.glyphs.length = 0;
|
|
114
|
+
|
|
115
|
+
for (let i = 0; i < text.length; i++)
|
|
116
|
+
{
|
|
117
|
+
let unicode = text.charCodeAt(i);
|
|
118
|
+
let glyph = this.glyph_layout.find(element => element.unicode === unicode);
|
|
119
|
+
if (glyph)
|
|
120
|
+
{
|
|
121
|
+
if (glyph.planeBounds)
|
|
122
|
+
{
|
|
123
|
+
let text_glyph = new TextGlyph(cursor, glyph.planeBounds, glyph.atlasBounds);
|
|
124
|
+
this.glyphs.push(text_glyph);
|
|
125
|
+
}
|
|
126
|
+
cursor += glyph.advance;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
let box2 = new Box2();
|
|
131
|
+
let first_glyph = this.glyphs[0];
|
|
132
|
+
box2.setFromCenterAndSize(first_glyph.position.clone().add(new Vector2(first_glyph.scale.x / 2, first_glyph.scale.y / 2)), first_glyph.scale);
|
|
133
|
+
|
|
134
|
+
for (let i = 1; i < this.glyphs.length; i++)
|
|
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);
|
|
138
|
+
box2.union(box);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let box2_size = new Vector2();
|
|
142
|
+
box2.getSize(box2_size);
|
|
143
|
+
for (let i = 0; i < this.glyphs.length; i++)
|
|
144
|
+
{
|
|
145
|
+
this.glyphs[i].position.x -= box2_size.x / 2;
|
|
146
|
+
this.glyphs[i].position.y -= box2_size.y / 2;
|
|
147
|
+
|
|
148
|
+
this.glyphs[i].position.x += (box2_size.x / 2) * this.pivot_point.x;
|
|
149
|
+
this.glyphs[i].position.y += (box2_size.y / 2) * this.pivot_point.y;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
this.glyph_is_dirty = true;
|
|
153
|
+
}
|
|
154
|
+
}
|