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,97 @@
|
|
|
1
|
+
import Time from './Time';
|
|
2
|
+
import Input from './Input';
|
|
3
|
+
import UI from './UI';
|
|
4
|
+
import Debug from './Debug';
|
|
5
|
+
import BaseApplication from './BaseApplication';
|
|
6
|
+
import ViewManager from './view_components/ViewManager';
|
|
7
|
+
import ViewComponentManager from './view_components/ViewComponentManager';
|
|
8
|
+
|
|
9
|
+
export default class RenderLoop
|
|
10
|
+
{
|
|
11
|
+
constructor(target_application, graphics)
|
|
12
|
+
{
|
|
13
|
+
target_application = target_application || new BaseApplication();
|
|
14
|
+
|
|
15
|
+
this._frame_id = -1;
|
|
16
|
+
|
|
17
|
+
this.target_application = target_application;
|
|
18
|
+
this.graphics = graphics;
|
|
19
|
+
|
|
20
|
+
this.is_running = false;
|
|
21
|
+
this.frames_passed = 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
update()
|
|
25
|
+
{
|
|
26
|
+
if (!this.is_running)
|
|
27
|
+
{
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
Time.__update();
|
|
31
|
+
|
|
32
|
+
// ###### START CYCLE ######
|
|
33
|
+
if (this.frames_passed === 1)
|
|
34
|
+
{
|
|
35
|
+
this.target_application.on_post_start();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
this.target_application.update();
|
|
39
|
+
ViewManager.update();
|
|
40
|
+
ViewComponentManager.update();
|
|
41
|
+
|
|
42
|
+
this.target_application.on_pre_render();
|
|
43
|
+
|
|
44
|
+
this.graphics.update(); // render scene
|
|
45
|
+
UI.update(); // update after new camera matrix has been calculated
|
|
46
|
+
UI.render(this.graphics); // render ui layer on top
|
|
47
|
+
this.target_application.on_post_render();
|
|
48
|
+
|
|
49
|
+
Debug.render(this.graphics); // render debug layer
|
|
50
|
+
|
|
51
|
+
// ###### END CYCLE #######
|
|
52
|
+
Input.clear();
|
|
53
|
+
UI.clear();
|
|
54
|
+
Debug.clear();
|
|
55
|
+
|
|
56
|
+
this._frame_id = requestAnimationFrame(this.update.bind(this));
|
|
57
|
+
this.frames_passed++;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
start()
|
|
61
|
+
{
|
|
62
|
+
if (this.is_running) return; // sanity check
|
|
63
|
+
|
|
64
|
+
this.graphics.check_for_resize();
|
|
65
|
+
|
|
66
|
+
if (this.frames_passed === 0)
|
|
67
|
+
{
|
|
68
|
+
this.target_application.on_enter();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.is_running = true;
|
|
72
|
+
this.update();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
stop()
|
|
76
|
+
{
|
|
77
|
+
if (this.is_running === false) return; // sanity check
|
|
78
|
+
|
|
79
|
+
this.is_running = false;
|
|
80
|
+
this.target_application.on_exit();
|
|
81
|
+
|
|
82
|
+
cancelAnimationFrame(this._frame_id);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
set_state(new_state)
|
|
86
|
+
{
|
|
87
|
+
this.target_application.on_exit(this);
|
|
88
|
+
this.target_application = new_state;
|
|
89
|
+
this.target_application.on_enter(this);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
dispose()
|
|
93
|
+
{
|
|
94
|
+
this.stop();
|
|
95
|
+
this.frames_passed = 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
export default class RenderOrder
|
|
3
|
+
{
|
|
4
|
+
constructor()
|
|
5
|
+
{
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static get kiosk()
|
|
10
|
+
{
|
|
11
|
+
return 1000;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static get kiosk_circle()
|
|
15
|
+
{
|
|
16
|
+
return 999;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static get placeholder_image()
|
|
20
|
+
{
|
|
21
|
+
return 998;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static get step_icon()
|
|
25
|
+
{
|
|
26
|
+
return 991;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static get line()
|
|
30
|
+
{
|
|
31
|
+
return 990;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static get placeholder_text()
|
|
35
|
+
{
|
|
36
|
+
return 900;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import EventManager from './EventManager';
|
|
2
|
+
|
|
3
|
+
class ResourceContainer
|
|
4
|
+
{
|
|
5
|
+
init()
|
|
6
|
+
{
|
|
7
|
+
this.resources = {};
|
|
8
|
+
this.resources_by_url = {};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
set_resource(name, url, resource)
|
|
12
|
+
{
|
|
13
|
+
const urls = Object.keys(this.resources_by_url);
|
|
14
|
+
|
|
15
|
+
if (urls.includes(url))
|
|
16
|
+
{
|
|
17
|
+
this.resources[name] = this.resources_by_url[url];
|
|
18
|
+
}
|
|
19
|
+
else
|
|
20
|
+
{
|
|
21
|
+
this.resources[name] = resource;
|
|
22
|
+
this.resources_by_url[url] = resource;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
EventManager.fire_resource_loaded({ name: name, value: resource });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get_resource(name)
|
|
29
|
+
{
|
|
30
|
+
return this.resources[name];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get(name)
|
|
34
|
+
{
|
|
35
|
+
return this.resources[name];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default new ResourceContainer();
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Scene } from 'three';
|
|
2
|
+
|
|
3
|
+
class SceneManager
|
|
4
|
+
{
|
|
5
|
+
init()
|
|
6
|
+
{
|
|
7
|
+
this._current = new Scene();
|
|
8
|
+
this._current.name = 'default_scene';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
add_scene(name)
|
|
12
|
+
{
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get current()
|
|
17
|
+
{
|
|
18
|
+
return this._current;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
set current(scene)
|
|
22
|
+
{
|
|
23
|
+
this._current = scene;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
dispose()
|
|
27
|
+
{
|
|
28
|
+
this.current.traverse(child =>
|
|
29
|
+
{
|
|
30
|
+
if (child.geometry)
|
|
31
|
+
{
|
|
32
|
+
child.geometry.dispose();
|
|
33
|
+
child.material.dispose();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
while (this.current.children.length > 0)
|
|
38
|
+
{
|
|
39
|
+
this.current.remove(this.current.children[0]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default new SceneManager();
|
package/src/Screen.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Vector2 } from 'three';
|
|
2
|
+
|
|
3
|
+
class Screen
|
|
4
|
+
{
|
|
5
|
+
init()
|
|
6
|
+
{
|
|
7
|
+
this.width = 1;
|
|
8
|
+
this.height = 1;
|
|
9
|
+
|
|
10
|
+
this.position = new Vector2();
|
|
11
|
+
|
|
12
|
+
this.render_width = 1;
|
|
13
|
+
this.render_height = 1;
|
|
14
|
+
this.width_height = new Vector2(this.width, this.height);
|
|
15
|
+
|
|
16
|
+
this.dpr = 1;
|
|
17
|
+
this.pixel_size = new Vector2(1 / this.width, 1 / this.height);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
update_position(x, y)
|
|
21
|
+
{
|
|
22
|
+
this.position.set(x, y);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
update_size(width, height)
|
|
26
|
+
{
|
|
27
|
+
this.width = width;
|
|
28
|
+
this.height = height;
|
|
29
|
+
|
|
30
|
+
this.pixel_size = new Vector2(1 / this.width, 1 / this.height);
|
|
31
|
+
|
|
32
|
+
this.width_height.x = width;
|
|
33
|
+
this.width_height.y = height;
|
|
34
|
+
|
|
35
|
+
this.render_width = width * this.dpr;
|
|
36
|
+
this.render_height = height * this.dpr;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
apply_pixel_density_v2(vector2)
|
|
40
|
+
{
|
|
41
|
+
vector2.multiplyScalar(1 / this.dpr);
|
|
42
|
+
|
|
43
|
+
return vector2;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
apply_pixel_density(value)
|
|
47
|
+
{
|
|
48
|
+
return value * (1 / this.dpr);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get_pixel_size()
|
|
52
|
+
{
|
|
53
|
+
return this.pixel_size;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get aspect_ratio()
|
|
57
|
+
{
|
|
58
|
+
return this.width / this.height;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default new Screen();
|
package/src/Time.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Vector2 } from 'three';
|
|
2
|
+
import { Clock } from 'three';
|
|
3
|
+
|
|
4
|
+
class Time
|
|
5
|
+
{
|
|
6
|
+
init()
|
|
7
|
+
{
|
|
8
|
+
this.___time = new Clock();
|
|
9
|
+
this.__delta_time = 0;
|
|
10
|
+
this.__elapsed_time = 0;
|
|
11
|
+
this.__allocated_time = new Vector2(0, 0);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get delta_time()
|
|
15
|
+
{
|
|
16
|
+
return this.__delta_time < 0.4 ? this.__delta_time : 0.016;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get elapsed_time()
|
|
20
|
+
{
|
|
21
|
+
return this.__elapsed_time;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get shader_time()
|
|
25
|
+
{
|
|
26
|
+
this.__allocated_time.x = this.delta_time;
|
|
27
|
+
this.__allocated_time.y = this.elapsed_time;
|
|
28
|
+
return this.__allocated_time;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
__update()
|
|
32
|
+
{
|
|
33
|
+
this.__delta_time = this.___time.getDelta();
|
|
34
|
+
this.__elapsed_time = this.___time.getElapsedTime();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default new Time();
|
package/src/UI.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import Input from './Input';
|
|
2
|
+
import CameraManager from './CameraManager';
|
|
3
|
+
import Graphics from './Graphics';
|
|
4
|
+
|
|
5
|
+
import { Vector2 } from 'three';
|
|
6
|
+
import { Scene } from 'three';
|
|
7
|
+
import { OrthographicCamera } from 'three';
|
|
8
|
+
|
|
9
|
+
class UI
|
|
10
|
+
{
|
|
11
|
+
init()
|
|
12
|
+
{
|
|
13
|
+
this.ui_elements = [];
|
|
14
|
+
this._tmp_normalized_pos = new Vector2();
|
|
15
|
+
this.ss_scene = new Scene();
|
|
16
|
+
this.ss_scene.autoUpdate = false;
|
|
17
|
+
this.ss_scene.frustumCulled = false;
|
|
18
|
+
|
|
19
|
+
this.ws_scene = new Scene();
|
|
20
|
+
this.ws_scene.autoUpdate = false;
|
|
21
|
+
this.ws_scene.frustumCulled = false;
|
|
22
|
+
|
|
23
|
+
this.ss_camera = new OrthographicCamera(-1, 1, 1, -1, -100, 100);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
delete_element(elem)
|
|
27
|
+
{
|
|
28
|
+
let index = this.ui_elements.indexOf(elem);
|
|
29
|
+
if (index > -1)
|
|
30
|
+
{
|
|
31
|
+
this.ui_elements.splice(index, 1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
this.ss_scene.remove(elem);
|
|
35
|
+
this.ws_scene.remove(elem);
|
|
36
|
+
|
|
37
|
+
elem.dispose();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
add_screen_space_element(elem)
|
|
41
|
+
{
|
|
42
|
+
this.ui_elements.push(elem);
|
|
43
|
+
this.ss_scene.add(elem);
|
|
44
|
+
|
|
45
|
+
elem.set_screen_space_coordinate_system();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
add_world_space_element(elem)
|
|
49
|
+
{
|
|
50
|
+
this.ui_elements.push(elem);
|
|
51
|
+
this.ws_scene.add(elem);
|
|
52
|
+
|
|
53
|
+
elem.set_world_space_coordinate_system();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
update()
|
|
57
|
+
{
|
|
58
|
+
// this.ss_camera.left = -Screen.width / 2;
|
|
59
|
+
// this.ss_camera.right = Screen.width / 2;
|
|
60
|
+
// this.ss_camera.top = Screen.top / 2;
|
|
61
|
+
// this.ss_camera.right = -Screen.bottom / 2;
|
|
62
|
+
this.ss_camera.updateProjectionMatrix();
|
|
63
|
+
|
|
64
|
+
this._tmp_normalized_pos.copy(Input.NDC);
|
|
65
|
+
for (let i = 0; i < this.ui_elements.length; i++)
|
|
66
|
+
{
|
|
67
|
+
this.ui_elements[i].update_state(this._tmp_normalized_pos);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
render(renderer)
|
|
72
|
+
{
|
|
73
|
+
// renderer.render_ui(this.scene);
|
|
74
|
+
if (this.ss_scene.children.length > 0)
|
|
75
|
+
{
|
|
76
|
+
Graphics.render(this.ss_scene, this.ss_camera);
|
|
77
|
+
}
|
|
78
|
+
if (this.ws_scene.children.length > 0)
|
|
79
|
+
{
|
|
80
|
+
Graphics.render(this.ws_scene, CameraManager.current);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
clear()
|
|
85
|
+
{
|
|
86
|
+
this.current_clicked_element = undefined;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default new UI();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ViewContext from '../view_components/ViewContext';
|
|
2
|
+
|
|
3
|
+
export default class ActionEvent
|
|
4
|
+
{
|
|
5
|
+
constructor(name, method)
|
|
6
|
+
{
|
|
7
|
+
this.name = name;
|
|
8
|
+
this.method = method;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
trigger()
|
|
12
|
+
{
|
|
13
|
+
ViewContext.app[this.name][this.method]();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import EasingFunctions from '../utilities/EasingFunctions';
|
|
2
|
+
|
|
3
|
+
export default class ActionInterpolator
|
|
4
|
+
{
|
|
5
|
+
constructor(easing_function = 'linear')
|
|
6
|
+
{
|
|
7
|
+
this.easing_function = undefined;
|
|
8
|
+
|
|
9
|
+
if (typeof easing_function === 'string')
|
|
10
|
+
{
|
|
11
|
+
this.easing_function = EasingFunctions[easing_function];
|
|
12
|
+
}
|
|
13
|
+
else
|
|
14
|
+
{
|
|
15
|
+
this.easing_function = easing_function;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
update(context, t)
|
|
20
|
+
{
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
|
|
2
|
+
import { Math as TMath } from 'three';
|
|
3
|
+
|
|
4
|
+
export default class ActionSequencer
|
|
5
|
+
{
|
|
6
|
+
constructor(context)
|
|
7
|
+
{
|
|
8
|
+
this.elapsed_time = -0.00001;
|
|
9
|
+
|
|
10
|
+
this.playing = false;
|
|
11
|
+
|
|
12
|
+
this.action_events = [];
|
|
13
|
+
this.context = context;
|
|
14
|
+
|
|
15
|
+
this.initial_context = JSON.parse(JSON.stringify(context));
|
|
16
|
+
|
|
17
|
+
this.tmp_t = 0;
|
|
18
|
+
|
|
19
|
+
this.channels = {};
|
|
20
|
+
|
|
21
|
+
let channel_names = Object.keys(context);
|
|
22
|
+
for (let i = 0; i < channel_names.length; i++)
|
|
23
|
+
{
|
|
24
|
+
this.channels[channel_names[i]] = [];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
this.duration = 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
play()
|
|
31
|
+
{
|
|
32
|
+
this.playing = true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
stop()
|
|
36
|
+
{
|
|
37
|
+
this.playing = false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
reset()
|
|
41
|
+
{
|
|
42
|
+
this.elapsed_time = -0.00001;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
skip()
|
|
46
|
+
{
|
|
47
|
+
this.elapsed_time = this.get_duration();
|
|
48
|
+
this.__play_clips(this.elapsed_time, this.elapsed_time + 0.01);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
update(delta_time)
|
|
52
|
+
{
|
|
53
|
+
if (this.playing)
|
|
54
|
+
{
|
|
55
|
+
this.__play_clips(this.elapsed_time, this.elapsed_time + delta_time);
|
|
56
|
+
this.elapsed_time = this.elapsed_time + delta_time;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
set_progress(time)
|
|
61
|
+
{
|
|
62
|
+
this.elapsed_time = TMath.clamp(time, 0, this.duration);
|
|
63
|
+
this.__play_clips(this.elapsed_time, this.elapsed_time);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
set_normalized_progress(t)
|
|
67
|
+
{
|
|
68
|
+
this.elapsed_time = TMath.clamp(t, 0, 1) * this.duration;
|
|
69
|
+
this.__play_clips(this.elapsed_time, this.elapsed_time);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
get_progress()
|
|
73
|
+
{
|
|
74
|
+
return TMath.clamp(this.elapsed_time / this.get_duration(), 0, 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
is_finished()
|
|
78
|
+
{
|
|
79
|
+
return this.elapsed_time > this.get_duration();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
add_action_event(trigger_time, action)
|
|
83
|
+
{
|
|
84
|
+
this.action_events.push({
|
|
85
|
+
trigger_time: trigger_time,
|
|
86
|
+
action: action
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
this.duration = Math.max(this.duration, trigger_time);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
add_action_interpolator(from, to, interpolator, use_dynamic_from_value = false)
|
|
93
|
+
{
|
|
94
|
+
if (use_dynamic_from_value)
|
|
95
|
+
{
|
|
96
|
+
let keyframes = this.channels[interpolator.attribute_name];
|
|
97
|
+
|
|
98
|
+
if (keyframes === undefined)
|
|
99
|
+
{
|
|
100
|
+
console.error(`${interpolator.attribute_name} missing in initial state data.`);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (keyframes.length === 0)
|
|
104
|
+
{
|
|
105
|
+
interpolator.from = this.initial_context[interpolator.attribute_name];
|
|
106
|
+
}
|
|
107
|
+
else
|
|
108
|
+
{
|
|
109
|
+
interpolator.from = keyframes[keyframes.length - 1].interpolator.to;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
let keyframe = {
|
|
114
|
+
from: from,
|
|
115
|
+
to: to,
|
|
116
|
+
interpolator: interpolator
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
this.duration = Math.max(this.duration, to);
|
|
120
|
+
this.channels[interpolator.attribute_name].push(keyframe);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
get_property_target_value(name)
|
|
124
|
+
{
|
|
125
|
+
let keyframe = this.__get_nearest_keyframe(name, this.elapsed_time);
|
|
126
|
+
|
|
127
|
+
if (this.elapsed_time < keyframe.from)
|
|
128
|
+
{
|
|
129
|
+
return keyframe.interpolator.evaluate(0);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return keyframe.interpolator.evaluate(1);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
get_duration()
|
|
136
|
+
{
|
|
137
|
+
return this.duration;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
__play_clips(from, to)
|
|
141
|
+
{
|
|
142
|
+
for (let i = 0; i < this.action_events.length; i++)
|
|
143
|
+
{
|
|
144
|
+
if (this.action_events[i].trigger_time >= from &&
|
|
145
|
+
this.action_events[i].trigger_time < to)
|
|
146
|
+
{
|
|
147
|
+
// console.log("Play event: " + this.action_events[i].action.constructor.name + " at "+ this.action_events[i].trigger_time);
|
|
148
|
+
this.action_events[i].action.trigger();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
let channel_names = Object.keys(this.initial_context);
|
|
152
|
+
|
|
153
|
+
for (let i = 0; i < channel_names.length; i++)
|
|
154
|
+
{
|
|
155
|
+
let name = channel_names[i];
|
|
156
|
+
let keyframe = this.__get_nearest_keyframe(name, from);
|
|
157
|
+
this.context[name] = this.evaluate_keyframe(keyframe, from);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
evaluate_keyframe(keyframe, time)
|
|
162
|
+
{
|
|
163
|
+
this.tmp_t = this.__linear_map_01(time, keyframe.from, keyframe.to);
|
|
164
|
+
return keyframe.interpolator.evaluate(TMath.clamp(this.tmp_t, 0, 1));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
__linear_map_01(value,
|
|
168
|
+
from_range_start_value,
|
|
169
|
+
from_range_end_value)
|
|
170
|
+
{
|
|
171
|
+
return ((value - from_range_start_value) / (from_range_end_value - from_range_start_value)) * (1 - 0) + 0;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
__get_nearest_keyframe(channel_name, time)
|
|
175
|
+
{
|
|
176
|
+
let closest = undefined;
|
|
177
|
+
let min_time = 9999999;
|
|
178
|
+
let keyframes = this.channels[channel_name];
|
|
179
|
+
for (let i = 0; i < keyframes.length; i++)
|
|
180
|
+
{
|
|
181
|
+
let keyframe = keyframes[i];
|
|
182
|
+
let difference = Math.min(
|
|
183
|
+
Math.abs(keyframe.from - time),
|
|
184
|
+
Math.abs(keyframe.to - time)
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
if (difference < min_time)
|
|
188
|
+
{
|
|
189
|
+
min_time = difference;
|
|
190
|
+
closest = keyframe;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return closest;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ActionInterpolator from './ActionInterpolator';
|
|
2
|
+
import { Math as TMath } from 'three';
|
|
3
|
+
|
|
4
|
+
export default class NumberInterpolator extends ActionInterpolator
|
|
5
|
+
{
|
|
6
|
+
constructor(attribute_name, from = 0, to = 1, easing_function = 'linear')
|
|
7
|
+
{
|
|
8
|
+
super(easing_function);
|
|
9
|
+
|
|
10
|
+
this.attribute_name = attribute_name;
|
|
11
|
+
this.from = from;
|
|
12
|
+
this.to = to;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
update(context, t)
|
|
16
|
+
{
|
|
17
|
+
context[this.attribute_name] = TMath.lerp(this.from, this.to, this.easing_function(t));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
evaluate(t)
|
|
21
|
+
{
|
|
22
|
+
return TMath.lerp(this.from, this.to, this.easing_function(t));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import ActionInterpolator from './ActionInterpolator';
|
|
2
|
+
|
|
3
|
+
export default class VectorInterpolator extends ActionInterpolator
|
|
4
|
+
{
|
|
5
|
+
constructor(attribute_name, from = 0, to = 1, easing_function = 'linear')
|
|
6
|
+
{
|
|
7
|
+
super(easing_function);
|
|
8
|
+
|
|
9
|
+
this.attribute_name = attribute_name;
|
|
10
|
+
this.from = from;
|
|
11
|
+
this.to = to;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
update(context, t)
|
|
15
|
+
{
|
|
16
|
+
let tmp = this.from.clone();
|
|
17
|
+
tmp.lerp(this.to, this.easing_function(t));
|
|
18
|
+
context[this.attribute_name].copy(tmp);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import MedianFilter from './render_utilities/MedianFilter';
|
|
2
|
+
import GaussianBlurrer from './render_utilities/GaussianBlurrer';
|
|
3
|
+
import Blurrer from './render_utilities/Blurrer';
|
|
4
|
+
import Blitter from './render_utilities/Blitter';
|
|
5
|
+
|
|
6
|
+
import DualFilteringBlurMaterial from './materials/DualFilteringBlurMaterial';
|
|
7
|
+
export {
|
|
8
|
+
MedianFilter,
|
|
9
|
+
GaussianBlurrer,
|
|
10
|
+
Blurrer,
|
|
11
|
+
Blitter,
|
|
12
|
+
DualFilteringBlurMaterial
|
|
13
|
+
};
|