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,193 @@
|
|
|
1
|
+
import SDFText from './SDFText';
|
|
2
|
+
import SDFTextMaterial from '../../materials/SDFTextMaterial';
|
|
3
|
+
import ArrayUtilities from '../../utilities/ArrayUtilities';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
PlaneBufferGeometry,
|
|
7
|
+
Mesh,
|
|
8
|
+
Vector2,
|
|
9
|
+
InstancedBufferGeometry,
|
|
10
|
+
InstancedBufferAttribute,
|
|
11
|
+
Float32BufferAttribute,
|
|
12
|
+
DynamicDrawUsage
|
|
13
|
+
} from 'three';
|
|
14
|
+
|
|
15
|
+
export default class SDFTextBatch extends Mesh
|
|
16
|
+
{
|
|
17
|
+
constructor(font_layout, atlas_texture)
|
|
18
|
+
{
|
|
19
|
+
let max_allocations = 2000;
|
|
20
|
+
|
|
21
|
+
let instanced_geometry = new InstancedBufferGeometry();
|
|
22
|
+
instanced_geometry.instanceCount = 0;
|
|
23
|
+
|
|
24
|
+
let geometry = new PlaneBufferGeometry(1, 1);
|
|
25
|
+
geometry.translate(0.5, 0.5, 0);
|
|
26
|
+
instanced_geometry.setAttribute('position', new Float32BufferAttribute(geometry.getAttribute('position').array, 3));
|
|
27
|
+
instanced_geometry.setAttribute('uv', new Float32BufferAttribute(geometry.getAttribute('uv').array, 2));
|
|
28
|
+
instanced_geometry.index = geometry.index;
|
|
29
|
+
|
|
30
|
+
let transformsCol0 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
|
|
31
|
+
let transformsCol1 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
|
|
32
|
+
let transformsCol2 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
|
|
33
|
+
let transformsCol3 = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
|
|
34
|
+
|
|
35
|
+
let glyph_bounds = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
|
|
36
|
+
let plane_bounds = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
|
|
37
|
+
|
|
38
|
+
let color = new InstancedBufferAttribute(new Float32Array(max_allocations * 4), 4, false);
|
|
39
|
+
|
|
40
|
+
transformsCol0.usage = DynamicDrawUsage;
|
|
41
|
+
transformsCol1.usage = DynamicDrawUsage;
|
|
42
|
+
transformsCol2.usage = DynamicDrawUsage;
|
|
43
|
+
transformsCol3.usage = DynamicDrawUsage;
|
|
44
|
+
glyph_bounds.usage = DynamicDrawUsage;
|
|
45
|
+
plane_bounds.usage = DynamicDrawUsage;
|
|
46
|
+
color.usage = DynamicDrawUsage;
|
|
47
|
+
|
|
48
|
+
instanced_geometry.setAttribute('transformsCol0', transformsCol0);
|
|
49
|
+
instanced_geometry.setAttribute('transformsCol1', transformsCol1);
|
|
50
|
+
instanced_geometry.setAttribute('transformsCol2', transformsCol2);
|
|
51
|
+
instanced_geometry.setAttribute('transformsCol3', transformsCol3);
|
|
52
|
+
|
|
53
|
+
instanced_geometry.setAttribute('glyph_bounds', glyph_bounds);
|
|
54
|
+
instanced_geometry.setAttribute('plane_bounds', plane_bounds);
|
|
55
|
+
instanced_geometry.setAttribute('color', color);
|
|
56
|
+
|
|
57
|
+
super(instanced_geometry, new SDFTextMaterial(atlas_texture));
|
|
58
|
+
|
|
59
|
+
this.text_elements = [];
|
|
60
|
+
this.font_layout = font_layout;
|
|
61
|
+
|
|
62
|
+
this.material.set_atlas_size(new Vector2(font_layout.atlas.width, font_layout.atlas.height));
|
|
63
|
+
|
|
64
|
+
this.frustumCulled = false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
set_boldness(value)
|
|
68
|
+
{
|
|
69
|
+
this.material.set_boldness(value);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
add_text(text_str)
|
|
73
|
+
{
|
|
74
|
+
let elem = new SDFText(this.font_layout.glyphs, text_str);
|
|
75
|
+
this.text_elements.push(elem);
|
|
76
|
+
return elem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
remove_text(text_elem)
|
|
80
|
+
{
|
|
81
|
+
ArrayUtilities.remove_elem(this.text_elements, text_elem);
|
|
82
|
+
this.update(true);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
update(force_update)
|
|
86
|
+
{
|
|
87
|
+
let glyph_bounds_atr = this.geometry.getAttribute('glyph_bounds');
|
|
88
|
+
let plane_bounds_atr = this.geometry.getAttribute('plane_bounds');
|
|
89
|
+
|
|
90
|
+
let transformsCol0 = this.geometry.getAttribute('transformsCol0');
|
|
91
|
+
let transformsCol1 = this.geometry.getAttribute('transformsCol1');
|
|
92
|
+
let transformsCol2 = this.geometry.getAttribute('transformsCol2');
|
|
93
|
+
let transformsCol3 = this.geometry.getAttribute('transformsCol3');
|
|
94
|
+
|
|
95
|
+
let color_atr = this.geometry.getAttribute('color');
|
|
96
|
+
|
|
97
|
+
let matrix_needs_update = force_update === true;
|
|
98
|
+
let glyph_needs_update = force_update === true;
|
|
99
|
+
let color_needs_update = force_update === true;
|
|
100
|
+
|
|
101
|
+
let glyph_count = 0;
|
|
102
|
+
for (let i = 0; i < this.text_elements.length; i++)
|
|
103
|
+
{
|
|
104
|
+
let text = this.text_elements[i];
|
|
105
|
+
|
|
106
|
+
if (text.matrix_is_dirty)
|
|
107
|
+
{
|
|
108
|
+
matrix_needs_update = true;
|
|
109
|
+
text.update_matrix();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (text.glyph_is_dirty)
|
|
113
|
+
{
|
|
114
|
+
glyph_needs_update = true;
|
|
115
|
+
text.clear_glyph_dirty();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (text.color_is_dirty)
|
|
119
|
+
{
|
|
120
|
+
color_needs_update = true;
|
|
121
|
+
text.clear_color_dirty();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
let matrix = text.matrix;
|
|
125
|
+
let color = text.color;
|
|
126
|
+
let opacity = text.opacity;
|
|
127
|
+
|
|
128
|
+
for (let glyph_i = 0; glyph_i < text.glyphs.length; glyph_i++)
|
|
129
|
+
{
|
|
130
|
+
let glyph = text.glyphs[glyph_i];
|
|
131
|
+
|
|
132
|
+
let buffer_i = glyph_count;
|
|
133
|
+
|
|
134
|
+
glyph_bounds_atr.setXYZW(buffer_i, glyph.atlas_bounds.x, glyph.atlas_bounds.y, glyph.atlas_bounds.z, glyph.atlas_bounds.w);
|
|
135
|
+
plane_bounds_atr.setXYZW(buffer_i, glyph.position.x, glyph.position.y, glyph.scale.x, glyph.scale.y);
|
|
136
|
+
|
|
137
|
+
transformsCol0.setXYZW(buffer_i, matrix.elements[0],
|
|
138
|
+
matrix.elements[1],
|
|
139
|
+
matrix.elements[2],
|
|
140
|
+
matrix.elements[3]);
|
|
141
|
+
|
|
142
|
+
transformsCol1.setXYZW(buffer_i, matrix.elements[4],
|
|
143
|
+
matrix.elements[5],
|
|
144
|
+
matrix.elements[6],
|
|
145
|
+
matrix.elements[7]);
|
|
146
|
+
|
|
147
|
+
transformsCol2.setXYZW(buffer_i, matrix.elements[8],
|
|
148
|
+
matrix.elements[9],
|
|
149
|
+
matrix.elements[10],
|
|
150
|
+
matrix.elements[11]);
|
|
151
|
+
|
|
152
|
+
transformsCol3.setXYZW(buffer_i, matrix.elements[12],
|
|
153
|
+
matrix.elements[13],
|
|
154
|
+
matrix.elements[14],
|
|
155
|
+
matrix.elements[15]);
|
|
156
|
+
|
|
157
|
+
color_atr.setXYZW(buffer_i, color.r, color.g, color.b, opacity);
|
|
158
|
+
|
|
159
|
+
glyph_count++;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
this.geometry.instanceCount = glyph_count;
|
|
164
|
+
|
|
165
|
+
if (glyph_count > this.max_allocations)
|
|
166
|
+
{
|
|
167
|
+
console.error('SDFTextBatch exceeded maximum glyph allocations(max/current): ', this.max_allocations, glyph_count, this);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (matrix_needs_update)
|
|
171
|
+
{
|
|
172
|
+
transformsCol0.needsUpdate = true;
|
|
173
|
+
transformsCol1.needsUpdate = true;
|
|
174
|
+
transformsCol2.needsUpdate = true;
|
|
175
|
+
transformsCol3.needsUpdate = true;
|
|
176
|
+
}
|
|
177
|
+
if (glyph_needs_update)
|
|
178
|
+
{
|
|
179
|
+
glyph_bounds_atr.needsUpdate = true;
|
|
180
|
+
plane_bounds_atr.needsUpdate = true;
|
|
181
|
+
}
|
|
182
|
+
if (color_needs_update)
|
|
183
|
+
{
|
|
184
|
+
color_atr.needsUpdate = true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
dispose()
|
|
189
|
+
{
|
|
190
|
+
this.geometry.dispose();
|
|
191
|
+
this.material.dispose();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Vector2, Vector4 } from 'three';
|
|
2
|
+
|
|
3
|
+
export default class TextGlyph
|
|
4
|
+
{
|
|
5
|
+
constructor(offset, plane_bounds, atlas_bounds)
|
|
6
|
+
{
|
|
7
|
+
let width = plane_bounds.right - plane_bounds.left;
|
|
8
|
+
let height = plane_bounds.top - plane_bounds.bottom;
|
|
9
|
+
|
|
10
|
+
this.scale = new Vector2(width, height);
|
|
11
|
+
this.position = new Vector2(offset + plane_bounds.left, plane_bounds.bottom);
|
|
12
|
+
|
|
13
|
+
this.atlas_bounds = new Vector4(atlas_bounds.left, atlas_bounds.right, atlas_bounds.top, atlas_bounds.bottom);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import CameraManager from '../CameraManager';
|
|
2
|
+
import Input from '../Input';
|
|
3
|
+
|
|
4
|
+
import { ArrowHelper } from 'three';
|
|
5
|
+
import { Vector2 } from 'three';
|
|
6
|
+
import { Vector3 } from 'three';
|
|
7
|
+
import { Object3D } from 'three';
|
|
8
|
+
import { BoxGeometry } from 'three';
|
|
9
|
+
import { MeshBasicMaterial } from 'three';
|
|
10
|
+
import { Mesh } from 'three';
|
|
11
|
+
import { Raycaster } from 'three';
|
|
12
|
+
import { Math as TMath } from 'three';
|
|
13
|
+
|
|
14
|
+
export default class ManipulatorHandle extends Object3D
|
|
15
|
+
{
|
|
16
|
+
constructor(direction, color)
|
|
17
|
+
{
|
|
18
|
+
super();
|
|
19
|
+
|
|
20
|
+
let length = 10;
|
|
21
|
+
this.arrow_helper = new ArrowHelper(direction, new Vector3(0, 0, 0), length, color, undefined, 1);
|
|
22
|
+
this.add(this.arrow_helper);
|
|
23
|
+
|
|
24
|
+
let collider_size = new Vector3();
|
|
25
|
+
collider_size.x = TMath.clamp(direction.x * length, 1, 30);
|
|
26
|
+
collider_size.y = TMath.clamp(direction.y * length, 1, 30);
|
|
27
|
+
collider_size.z = TMath.clamp(direction.z * length, 1, 30);
|
|
28
|
+
|
|
29
|
+
let geometry = new BoxGeometry(collider_size.x, collider_size.y, collider_size.z);
|
|
30
|
+
let material = new MeshBasicMaterial({ color: color, depthTest: false, depthWrite: false });
|
|
31
|
+
material.visible = false;
|
|
32
|
+
this.box_collider = new Mesh(geometry, material);
|
|
33
|
+
this.box_collider.position.add(direction.clone().multiplyScalar(length * 0.5));
|
|
34
|
+
this.add(this.box_collider);
|
|
35
|
+
|
|
36
|
+
this.direction = direction;
|
|
37
|
+
this.raycaster = new Raycaster();
|
|
38
|
+
this.raycast_result = undefined;
|
|
39
|
+
|
|
40
|
+
this.tmp_p1 = new Vector3(0, 0, 0);
|
|
41
|
+
this.tmp_p2 = new Vector3(0, 0, 0);
|
|
42
|
+
|
|
43
|
+
this.tmp_v2 = new Vector2(0, 0);
|
|
44
|
+
|
|
45
|
+
this.half_unit_vec = new Vector3(0.5, 0.5, 0.5);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
is_mouse_over()
|
|
49
|
+
{
|
|
50
|
+
this.raycaster.setFromCamera(Input.NDC, CameraManager.current);
|
|
51
|
+
this.raycast_result = this.raycaster.intersectObject(this.box_collider);
|
|
52
|
+
if (this.raycast_result.length > 0)
|
|
53
|
+
{
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get_normalized_screen_direction()
|
|
60
|
+
{
|
|
61
|
+
this.getWorldPosition(this.tmp_p1);
|
|
62
|
+
this.tmp_p2.copy(this.tmp_p1).add(this.direction);
|
|
63
|
+
|
|
64
|
+
this.tmp_p1.project(CameraManager.current).multiplyScalar(0.5).add(this.half_unit_vec);
|
|
65
|
+
this.tmp_p2.project(CameraManager.current).multiplyScalar(0.5).add(this.half_unit_vec);
|
|
66
|
+
|
|
67
|
+
this.tmp_p2.sub(this.tmp_p1);
|
|
68
|
+
return this.tmp_v2.copy(this.tmp_p2).normalize();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import Input from '../Input';
|
|
2
|
+
import ObjectManipulator from './ObjectManipulator';
|
|
3
|
+
import ObjectPicker from './ObjectPicker';
|
|
4
|
+
|
|
5
|
+
import { Raycaster } from 'three';
|
|
6
|
+
|
|
7
|
+
export default class ObjectEditor
|
|
8
|
+
{
|
|
9
|
+
constructor(renderer, scene, camera)
|
|
10
|
+
{
|
|
11
|
+
this.raycaster = new Raycaster();
|
|
12
|
+
|
|
13
|
+
this.selected_object = undefined;
|
|
14
|
+
this.object_manipulator = new ObjectManipulator();
|
|
15
|
+
this.object_picker = new ObjectPicker(renderer, scene, camera);
|
|
16
|
+
|
|
17
|
+
this.scene = scene;
|
|
18
|
+
this.camera = camera;
|
|
19
|
+
|
|
20
|
+
this.selectable_objects = [];
|
|
21
|
+
|
|
22
|
+
scene.add(this.object_manipulator);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
refresh_scene()
|
|
26
|
+
{
|
|
27
|
+
this.selectable_objects.length = 0;
|
|
28
|
+
this.__populate_selectable_objects(this.selectable_objects);
|
|
29
|
+
this.__set_object_ids(this.selectable_objects);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
update()
|
|
33
|
+
{
|
|
34
|
+
if (Input.left_mouse_button_pressed)
|
|
35
|
+
{
|
|
36
|
+
let x = this.object_picker.pick(Input.NDC, this.selectable_objects);
|
|
37
|
+
if (x !== 0)
|
|
38
|
+
{
|
|
39
|
+
let selected_obj = this.selectable_objects[x - 1];
|
|
40
|
+
// this.object_manipulator.position.copy(selected_obj.position);
|
|
41
|
+
this.object_manipulator.set_target(selected_obj);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this.object_manipulator.update();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
__populate_selectable_objects(array)
|
|
49
|
+
{
|
|
50
|
+
this.scene.traverse((child) =>
|
|
51
|
+
{
|
|
52
|
+
if (child.selectable_material)
|
|
53
|
+
{
|
|
54
|
+
array.push(child);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
__set_object_ids(array)
|
|
60
|
+
{
|
|
61
|
+
for (let i = 0; i < array.length; i++)
|
|
62
|
+
{
|
|
63
|
+
array[i].selectable_material.uniforms._Color.value.setHex(i + 1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import ManipulatorHandle from '../editor/ManipulatorHandle';
|
|
2
|
+
import Input from '../Input';
|
|
3
|
+
import EventManager from '../EventManager';
|
|
4
|
+
|
|
5
|
+
import { Object3D } from 'three';
|
|
6
|
+
import { Vector2 } from 'three';
|
|
7
|
+
import { Vector3 } from 'three';
|
|
8
|
+
|
|
9
|
+
export default class ObjectManipulator extends Object3D
|
|
10
|
+
{
|
|
11
|
+
constructor()
|
|
12
|
+
{
|
|
13
|
+
super();
|
|
14
|
+
this.target_obj = undefined;
|
|
15
|
+
|
|
16
|
+
this.up_handle = new ManipulatorHandle(new Vector3(0, 1, 0), 0x00ff00);
|
|
17
|
+
this.right_handle = new ManipulatorHandle(new Vector3(1, 0, 0), 0xff0000);
|
|
18
|
+
this.forward_handle = new ManipulatorHandle(new Vector3(0, 0, 1), 0x0000ff);
|
|
19
|
+
|
|
20
|
+
this.add(this.up_handle);
|
|
21
|
+
this.add(this.right_handle);
|
|
22
|
+
this.add(this.forward_handle);
|
|
23
|
+
|
|
24
|
+
this.active_handle = undefined;
|
|
25
|
+
|
|
26
|
+
this.tmp_displacement_vector = new Vector3();
|
|
27
|
+
this.tmp_local_pos = new Vector3();
|
|
28
|
+
|
|
29
|
+
this.target_obj = undefined;
|
|
30
|
+
|
|
31
|
+
this.tmp_up_v2 = new Vector2(0, 1);
|
|
32
|
+
this.tmp_right_v2 = new Vector2(1, 0);
|
|
33
|
+
|
|
34
|
+
this.use_vertical_translation = false;
|
|
35
|
+
this.translation_sign = false;
|
|
36
|
+
|
|
37
|
+
this.visible = false;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
update()
|
|
41
|
+
{
|
|
42
|
+
this.check_active_handle();
|
|
43
|
+
|
|
44
|
+
if (this.active_handle && this.target_obj)
|
|
45
|
+
{
|
|
46
|
+
this.tmp_displacement_vector.copy(this.active_handle.direction);
|
|
47
|
+
if (this.use_vertical_translation)
|
|
48
|
+
{
|
|
49
|
+
this.tmp_displacement_vector.multiplyScalar(-Input.NDC_delta.y);
|
|
50
|
+
}
|
|
51
|
+
else
|
|
52
|
+
{
|
|
53
|
+
this.tmp_displacement_vector.multiplyScalar(Input.NDC_delta.x);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this.tmp_displacement_vector.multiplyScalar(Input.NDC_delta.length() * 250 * this.translation_sign);
|
|
57
|
+
this.position.add(this.tmp_displacement_vector);
|
|
58
|
+
|
|
59
|
+
this.tmp_local_pos.copy(this.position);
|
|
60
|
+
this.target_obj.parent.worldToLocal(this.tmp_local_pos);
|
|
61
|
+
this.target_obj.position.copy(this.tmp_local_pos);
|
|
62
|
+
let scope = this;
|
|
63
|
+
EventManager.fire_unit_position_updated({
|
|
64
|
+
unit_id: scope.target_obj.name,
|
|
65
|
+
position: scope.target_obj.position
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
set_translation_axis(active_handle)
|
|
71
|
+
{
|
|
72
|
+
let vertical = active_handle.get_normalized_screen_direction().dot(this.tmp_up_v2);
|
|
73
|
+
let horizontal = active_handle.get_normalized_screen_direction().dot(this.tmp_right_v2);
|
|
74
|
+
|
|
75
|
+
if (Math.abs(vertical) > Math.abs(horizontal))
|
|
76
|
+
{
|
|
77
|
+
this.use_vertical_translation = true;
|
|
78
|
+
this.translation_sign = Math.sign(vertical);
|
|
79
|
+
}
|
|
80
|
+
else
|
|
81
|
+
{
|
|
82
|
+
this.use_vertical_translation = false;
|
|
83
|
+
this.translation_sign = Math.sign(horizontal);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
check_active_handle()
|
|
88
|
+
{
|
|
89
|
+
if (Input.left_mouse_button_down && this.active_handle === undefined)
|
|
90
|
+
{
|
|
91
|
+
if (this.right_handle.is_mouse_over())
|
|
92
|
+
{
|
|
93
|
+
this.active_handle = this.right_handle;
|
|
94
|
+
}
|
|
95
|
+
if (this.forward_handle.is_mouse_over())
|
|
96
|
+
{
|
|
97
|
+
this.active_handle = this.forward_handle;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (this.active_handle)
|
|
101
|
+
{
|
|
102
|
+
this.set_translation_axis(this.active_handle);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (Input.left_mouse_button_released)
|
|
107
|
+
{
|
|
108
|
+
this.active_handle = undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
set_target(obj)
|
|
113
|
+
{
|
|
114
|
+
this.target_obj = obj;
|
|
115
|
+
this.visible = true;
|
|
116
|
+
obj.getWorldPosition(this.position);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import RenderLayers from '../RenderLayers';
|
|
2
|
+
import Screen from '../Screen';
|
|
3
|
+
|
|
4
|
+
import { Color } from 'three';
|
|
5
|
+
import { WebGLRenderTarget } from 'three';
|
|
6
|
+
import { Vector2 } from 'three';
|
|
7
|
+
|
|
8
|
+
export default class ObjectPicker
|
|
9
|
+
{
|
|
10
|
+
constructor(renderer, scene, camera)
|
|
11
|
+
{
|
|
12
|
+
this.renderer = renderer;
|
|
13
|
+
this.readback_buffer = new Uint8Array(4);
|
|
14
|
+
this.scene = scene;
|
|
15
|
+
this.camera = camera;
|
|
16
|
+
this.camera_layers = camera.layers;
|
|
17
|
+
|
|
18
|
+
this.clear_color = new Color('#000000');
|
|
19
|
+
this.picking_texture = new WebGLRenderTarget(Screen.width, Screen.height);
|
|
20
|
+
this.tmp_scene_auto_update = undefined;
|
|
21
|
+
|
|
22
|
+
this.tmp_mouse_pos = new Vector2();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
pick(mouse_NDC, objects)
|
|
26
|
+
{
|
|
27
|
+
this.__prepare_scene(objects);
|
|
28
|
+
this.renderer.setRenderTarget(this.picking_texture);
|
|
29
|
+
this.renderer.setClearColor(this.clear_color, 1);
|
|
30
|
+
this.renderer.clear();
|
|
31
|
+
this.renderer.render(this.scene, this.camera, this.picking_texture);
|
|
32
|
+
this.renderer.setRenderTarget();
|
|
33
|
+
|
|
34
|
+
this.__restore_scene(objects);
|
|
35
|
+
|
|
36
|
+
return this.__readback_id(mouse_NDC);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
__prepare_scene(objects)
|
|
40
|
+
{
|
|
41
|
+
for (let i = 0; i < objects.length; i++)
|
|
42
|
+
{
|
|
43
|
+
objects[i].material = objects[i].selectable_material;
|
|
44
|
+
objects[i].store_layer_state();
|
|
45
|
+
objects[i].layers.set(RenderLayers.selectable);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this.camera_layers = this.camera.layers.mask;
|
|
49
|
+
this.camera.layers.set(RenderLayers.selectable);
|
|
50
|
+
this.tmp_scene_auto_update = this.scene.autoUpdate;
|
|
51
|
+
this.scene.autoUpdate = false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
__restore_scene(objects)
|
|
55
|
+
{
|
|
56
|
+
for (let i = 0; i < objects.length; i++)
|
|
57
|
+
{
|
|
58
|
+
objects[i].restore_material();
|
|
59
|
+
objects[i].restore_layer_state();
|
|
60
|
+
}
|
|
61
|
+
this.camera.layers.mask = this.camera_layers;
|
|
62
|
+
this.scene.autoUpdate = this.tmp_scene_auto_update;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
__readback_id(mouse_NDC)
|
|
66
|
+
{
|
|
67
|
+
this.tmp_mouse_pos.copy(mouse_NDC);
|
|
68
|
+
this.tmp_mouse_pos.multiplyScalar(0.5);
|
|
69
|
+
this.tmp_mouse_pos.x = (this.tmp_mouse_pos.x + 0.5) * Screen.width;
|
|
70
|
+
this.tmp_mouse_pos.y = (this.tmp_mouse_pos.y + 0.5) * Screen.height;
|
|
71
|
+
this.renderer.readRenderTargetPixels(this.picking_texture, this.tmp_mouse_pos.x, this.tmp_mouse_pos.y, 1, 1, this.readback_buffer);
|
|
72
|
+
|
|
73
|
+
return (this.readback_buffer[2]) | (this.readback_buffer[1] << 8) | (this.readback_buffer[0] << 16);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Object3D } from 'three';
|
|
2
|
+
import { BufferAttribute } from 'three';
|
|
3
|
+
import { Points } from 'three';
|
|
4
|
+
|
|
5
|
+
export default class GPUParticleSystem extends Object3D
|
|
6
|
+
{
|
|
7
|
+
constructor()
|
|
8
|
+
{
|
|
9
|
+
super();
|
|
10
|
+
this.attributes = [];
|
|
11
|
+
|
|
12
|
+
this.particles = undefined;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
set_from_geometry(geometry, material, init_attribute_uvs)
|
|
16
|
+
{
|
|
17
|
+
// let position = new ParticlePositionAttribute("_Position");
|
|
18
|
+
if (init_attribute_uvs && geometry.getAttribute('storage_uv') === undefined)
|
|
19
|
+
{
|
|
20
|
+
let uv_storage_attr = this.build_uv_storage_attribute(geometry.getAttribute('position').count);
|
|
21
|
+
geometry.setAttribute('storage_uv', uv_storage_attr);
|
|
22
|
+
}
|
|
23
|
+
// position.init_from_geometry(geometry);
|
|
24
|
+
// this.attributes.push(position);
|
|
25
|
+
|
|
26
|
+
// material.uniforms._Position.value = position.read.texture;
|
|
27
|
+
|
|
28
|
+
let points = new Points(geometry, material);
|
|
29
|
+
points.frustumCulled = false;
|
|
30
|
+
this.particles = points;
|
|
31
|
+
|
|
32
|
+
this.add(points);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
add_texture_attribute(buffer_attribute)
|
|
36
|
+
{
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
add_attribute(name, buffer_attribute)
|
|
41
|
+
{
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
build_uv_storage_attribute(particle_count)
|
|
46
|
+
{
|
|
47
|
+
let resolution = this.calculate_resolution(particle_count);
|
|
48
|
+
let uvs = new Float32Array(particle_count * 2);
|
|
49
|
+
for (let i = 0, j = 0; i < particle_count * 2; i += 2, j++)
|
|
50
|
+
{
|
|
51
|
+
uvs[i] = ((j % resolution) / resolution) + (0.5 / resolution);
|
|
52
|
+
uvs[i + 1] = (Math.floor(j / resolution) / resolution) + (0.5 / resolution);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return new BufferAttribute(uvs, 2);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
calculate_resolution(particle_count)
|
|
59
|
+
{
|
|
60
|
+
return Math.ceil(Math.sqrt(particle_count));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
update()
|
|
64
|
+
{
|
|
65
|
+
for (let i = 0; i < this.attributes.length; i++)
|
|
66
|
+
{
|
|
67
|
+
this.attributes[i].update();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
set_attribute_update_material(attribute_name, mat)
|
|
72
|
+
{
|
|
73
|
+
for (let i = 0; i < this.attributes.length; i++)
|
|
74
|
+
{
|
|
75
|
+
if (this.attributes[i].name === attribute_name)
|
|
76
|
+
{
|
|
77
|
+
this.attributes[i].update_material = mat;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
dispose()
|
|
83
|
+
{
|
|
84
|
+
this.particles.geometry.dispose();
|
|
85
|
+
this.particles.material.dispose();
|
|
86
|
+
}
|
|
87
|
+
}
|