@haiyue/extensions 0.1.0
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 +21 -0
- package/README.md +30 -0
- package/dist/animation/Animation2DComponent.d.ts +46 -0
- package/dist/animation/Animation2DExtensionRegistry.d.ts +27 -0
- package/dist/animation/Animation2DRenderSystem.d.ts +89 -0
- package/dist/animation/Animation2DRuntime.d.ts +99 -0
- package/dist/animation/Animation2DStateMachine.d.ts +13 -0
- package/dist/animation/Animation2DStateMachineComponent.d.ts +54 -0
- package/dist/animation/Animation2DStateMachineRuntime.d.ts +30 -0
- package/dist/animation/Animation2DStateMachineSystem.d.ts +14 -0
- package/dist/animation/Animation2DStateMachineVisualRuntime.d.ts +27 -0
- package/dist/animation/Animation2DSystem.d.ts +14 -0
- package/dist/animation/AnimationAssetLoader.d.ts +9 -0
- package/dist/animation/AnimationAudioClip.d.ts +26 -0
- package/dist/animation/AnimationPathTessellator.d.ts +52 -0
- package/dist/animation/AnimationTextRasterizer.d.ts +21 -0
- package/dist/animation/AnimationVisual2D.d.ts +68 -0
- package/dist/animation/HyaAnimation2DClipAdapter.d.ts +16 -0
- package/dist/animation/Particle2DDescriptorAdapter.d.ts +5 -0
- package/dist/animation/runtime/mixer/Action.d.ts +150 -0
- package/dist/animation/runtime/mixer/Mixer.d.ts +54 -0
- package/dist/animation/runtime/mixer/PoseBuffer.d.ts +23 -0
- package/dist/animation/runtime/mixer/Sampler.d.ts +17 -0
- package/dist/animation/runtime/mixer/Types.d.ts +101 -0
- package/dist/animation/runtime/mixer/index.d.ts +6 -0
- package/dist/animation-state-machine/AnimationStateMachine.d.ts +111 -0
- package/dist/animation-state-machine/AnimationStateMachineChannels.d.ts +23 -0
- package/dist/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.d.ts +51 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.d.ts +14 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineCompiler.d.ts +109 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineController.d.ts +103 -0
- package/dist/animation-state-machine/runtime/AnimationStateMachineMixerPort.d.ts +35 -0
- package/dist/animation-state-machine/runtime/index.d.ts +7 -0
- package/dist/animation.d.ts +15 -0
- package/dist/animation.js +1171 -0
- package/dist/animation3d/Animation3DAction.d.ts +46 -0
- package/dist/animation3d/Animation3DBinding.d.ts +85 -0
- package/dist/animation3d/Animation3DClip.d.ts +20 -0
- package/dist/animation3d/Animation3DError.d.ts +13 -0
- package/dist/animation3d/Animation3DMixer.d.ts +27 -0
- package/dist/animation3d/Animation3DPose.d.ts +40 -0
- package/dist/animation3d/Animation3DPoseBuffer.d.ts +24 -0
- package/dist/animation3d/Animation3DResource.d.ts +28 -0
- package/dist/animation3d/Animation3DStateMachine.d.ts +95 -0
- package/dist/animation3d/Animation3DStateMachineRuntime.d.ts +70 -0
- package/dist/animation3d/Animation3DTrack.d.ts +19 -0
- package/dist/animation3d/hya/HyaAnimation3DRuntime.d.ts +73 -0
- package/dist/animation3d/hya/HyaAnimation3DStateMachineRuntime.d.ts +65 -0
- package/dist/animation3d/hya/HyaAnimation3DTypes.d.ts +170 -0
- package/dist/animation3d/hya/index.d.ts +4 -0
- package/dist/animation3d/index.d.ts +14 -0
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.d.ts +81 -0
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.d.ts +39 -0
- package/dist/animation3d/runtime/integration/index.d.ts +2 -0
- package/dist/animation3d/runtime/mixer/Action.d.ts +150 -0
- package/dist/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.d.ts +6 -0
- package/dist/animation3d/runtime/mixer/Mixer.d.ts +59 -0
- package/dist/animation3d/runtime/mixer/PoseBuffer.d.ts +1 -0
- package/dist/animation3d/runtime/mixer/TrackSampler.d.ts +24 -0
- package/dist/animation3d/runtime/mixer/index.d.ts +4 -0
- package/dist/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineController.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.d.ts +1 -0
- package/dist/animation3d/runtime/state-machine/index.d.ts +6 -0
- package/dist/animation3d.d.ts +5 -0
- package/dist/animation3d.js +1708 -0
- package/dist/benchmark.d.ts +30 -0
- package/dist/benchmark.js +119 -0
- package/dist/canvas-text/CanvasText2DRenderSystem.d.ts +24 -0
- package/dist/canvas-text/CanvasTextComponent.d.ts +18 -0
- package/dist/canvas-text.d.ts +4 -0
- package/dist/canvas-text.js +276 -0
- package/dist/chunks/2d-ui-animation-2d.generated-D4aHzFU2.js +4 -0
- package/dist/chunks/2d-ui-canvas-text-2d.generated-C0Eaej2m.js +4 -0
- package/dist/chunks/2d-ui-spine2d.generated-CUUi8xjl.js +4 -0
- package/dist/chunks/2d-ui-tilemap2d.generated-gebw4mX7.js +4 -0
- package/dist/chunks/Animation2DStateMachine-9IonguNa.js +3245 -0
- package/dist/chunks/AnimationStateMachineController-BIcAh-sT.js +1438 -0
- package/dist/chunks/GltfAnimation3DAdapter-Cu3rQQsW.js +2240 -0
- package/dist/chunks/GltfAnimationRuntime-CRHsLycN.js +631 -0
- package/dist/chunks/RenderSystem2DBase-DDT61dAu.js +227 -0
- package/dist/chunks/Spine2DRuntime-D9M9LAQR.js +3056 -0
- package/dist/chunks/SpineAssetParser-BSDmPge1.js +378 -0
- package/dist/chunks/gltfLoader-Dm22jLYB.js +2085 -0
- package/dist/chunks/pluginUtils-CvwroRMd.js +33 -0
- package/dist/experimental-gltf-worker.d.ts +4 -0
- package/dist/experimental-gltf-worker.js +138 -0
- package/dist/experimental-spine-worker.d.ts +4 -0
- package/dist/experimental-spine-worker.js +110 -0
- package/dist/gltf/GltfAccessorReader.d.ts +7 -0
- package/dist/gltf/GltfAnimation3DAdapter.d.ts +47 -0
- package/dist/gltf/GltfAnimationRuntime.d.ts +10 -0
- package/dist/gltf/GltfAssetWorkerClient.d.ts +20 -0
- package/dist/gltf/GltfCompatibilityReport.d.ts +70 -0
- package/dist/gltf/GltfConservativeBounds.d.ts +18 -0
- package/dist/gltf/GltfDracoDecoder.d.ts +4 -0
- package/dist/gltf/GltfExtensionAdapter.d.ts +54 -0
- package/dist/gltf/GltfLoaderContract.d.ts +249 -0
- package/dist/gltf/GltfLoaderErrors.d.ts +4 -0
- package/dist/gltf/GltfMaterialDescriptor.d.ts +23 -0
- package/dist/gltf/GltfMaterialEncoder.d.ts +20 -0
- package/dist/gltf/GltfMaterialLoader.d.ts +6 -0
- package/dist/gltf/GltfModelComponent.d.ts +72 -0
- package/dist/gltf/GltfModelSystem.d.ts +37 -0
- package/dist/gltf/GltfPlugin.d.ts +6 -0
- package/dist/gltf/GltfSchema.d.ts +225 -0
- package/dist/gltf/GltfUvSemanticPlanner.d.ts +33 -0
- package/dist/gltf/gltfLoader.d.ts +9 -0
- package/dist/gltf-animation3d.d.ts +3 -0
- package/dist/gltf-animation3d.js +8 -0
- package/dist/gltf-worker-runtime.d.ts +7 -0
- package/dist/gltf-worker-runtime.js +6981 -0
- package/dist/gltf.d.ts +12 -0
- package/dist/gltf.js +517 -0
- package/dist/grid/Grid2DComponent.d.ts +25 -0
- package/dist/grid.d.ts +2 -0
- package/dist/grid.js +56 -0
- package/dist/hya-state-machine.d.ts +7 -0
- package/dist/hya-state-machine.js +2934 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/internal/2d-ui-shader-artifact.js +870 -0
- package/dist/plugins/pluginUtils.d.ts +20 -0
- package/dist/plugins.d.ts +6 -0
- package/dist/shaders/generated/2d-ui-artifact.generated.d.ts +658 -0
- package/dist/spine/Spine2DComponent.d.ts +116 -0
- package/dist/spine/Spine2DGpuRenderer.d.ts +65 -0
- package/dist/spine/Spine2DRenderSystem.d.ts +27 -0
- package/dist/spine/Spine2DRuntime.d.ts +103 -0
- package/dist/spine/SpineAnimationBoneTimelines.d.ts +8 -0
- package/dist/spine/SpineAssetParser.d.ts +18 -0
- package/dist/spine/SpineAssetWorkerClient.d.ts +19 -0
- package/dist/spine/SpineAssetWorkerContract.d.ts +6 -0
- package/dist/spine/SpineAtlasParser.d.ts +21 -0
- package/dist/spine/SpineFloatBuilder.d.ts +15 -0
- package/dist/spine/SpinePathConstraintSolver.d.ts +32 -0
- package/dist/spine/SpinePlugin.d.ts +8 -0
- package/dist/spine/SpineSkeletonRuntime.d.ts +185 -0
- package/dist/spine/SpineSlotAnimation.d.ts +17 -0
- package/dist/spine/SpineTimelineRuntime.d.ts +25 -0
- package/dist/spine/SpineVertexBuilder.d.ts +61 -0
- package/dist/spine.d.ts +7 -0
- package/dist/spine.js +578 -0
- package/dist/tilemap/Tilemap2DComponent.d.ts +110 -0
- package/dist/tilemap/Tilemap2DRenderSystem.d.ts +11 -0
- package/dist/tilemap/Tilemap2DRenderer.d.ts +24 -0
- package/dist/tilemap/TilemapPlugin.d.ts +8 -0
- package/dist/tilemap.d.ts +6 -0
- package/dist/tilemap.js +535 -0
- package/dist/tween/Tween2DComponent.d.ts +70 -0
- package/dist/tween/Tween2DSystem.d.ts +12 -0
- package/dist/tween.d.ts +4 -0
- package/dist/tween.js +138 -0
- package/dist/utils/RenderSystem2DBase.d.ts +42 -0
- package/dist/utils/arrayAccess.d.ts +4 -0
- package/dist/utils/camera2d.d.ts +12 -0
- package/dist/utils/render2dGpu.d.ts +32 -0
- package/package.json +124 -0
- package/src/animation/Animation2DComponent.ts +135 -0
- package/src/animation/Animation2DExtensionRegistry.ts +52 -0
- package/src/animation/Animation2DRenderSystem.ts +1026 -0
- package/src/animation/Animation2DRuntime.ts +1326 -0
- package/src/animation/Animation2DStateMachine.ts +39 -0
- package/src/animation/Animation2DStateMachineComponent.ts +228 -0
- package/src/animation/Animation2DStateMachineRuntime.ts +141 -0
- package/src/animation/Animation2DStateMachineSystem.ts +60 -0
- package/src/animation/Animation2DStateMachineVisualRuntime.ts +282 -0
- package/src/animation/Animation2DSystem.ts +72 -0
- package/src/animation/AnimationAssetLoader.ts +84 -0
- package/src/animation/AnimationAudioClip.ts +140 -0
- package/src/animation/AnimationPathTessellator.ts +691 -0
- package/src/animation/AnimationTextRasterizer.ts +340 -0
- package/src/animation/AnimationVisual2D.ts +153 -0
- package/src/animation/HyaAnimation2DClipAdapter.ts +845 -0
- package/src/animation/Particle2DDescriptorAdapter.ts +35 -0
- package/src/animation/runtime/mixer/Action.ts +876 -0
- package/src/animation/runtime/mixer/Mixer.ts +505 -0
- package/src/animation/runtime/mixer/PoseBuffer.ts +105 -0
- package/src/animation/runtime/mixer/Sampler.ts +252 -0
- package/src/animation/runtime/mixer/Types.ts +138 -0
- package/src/animation/runtime/mixer/index.ts +31 -0
- package/src/animation-state-machine/AnimationStateMachine.ts +146 -0
- package/src/animation-state-machine/AnimationStateMachineChannels.ts +116 -0
- package/src/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.ts +197 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.ts +503 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineCompiler.ts +763 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineController.ts +987 -0
- package/src/animation-state-machine/runtime/AnimationStateMachineMixerPort.ts +54 -0
- package/src/animation-state-machine/runtime/index.ts +47 -0
- package/src/animation.ts +33 -0
- package/src/animation3d/Animation3DAction.ts +73 -0
- package/src/animation3d/Animation3DBinding.ts +116 -0
- package/src/animation3d/Animation3DClip.ts +22 -0
- package/src/animation3d/Animation3DError.ts +34 -0
- package/src/animation3d/Animation3DMixer.ts +82 -0
- package/src/animation3d/Animation3DPose.ts +100 -0
- package/src/animation3d/Animation3DPoseBuffer.ts +85 -0
- package/src/animation3d/Animation3DResource.ts +49 -0
- package/src/animation3d/Animation3DStateMachine.ts +126 -0
- package/src/animation3d/Animation3DStateMachineRuntime.ts +191 -0
- package/src/animation3d/Animation3DTrack.ts +29 -0
- package/src/animation3d/hya/HyaAnimation3DRuntime.ts +756 -0
- package/src/animation3d/hya/HyaAnimation3DStateMachineRuntime.ts +618 -0
- package/src/animation3d/hya/HyaAnimation3DTypes.ts +168 -0
- package/src/animation3d/hya/index.ts +10 -0
- package/src/animation3d/index.ts +76 -0
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.ts +325 -0
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.ts +158 -0
- package/src/animation3d/runtime/integration/index.ts +9 -0
- package/src/animation3d/runtime/mixer/Action.ts +833 -0
- package/src/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.ts +26 -0
- package/src/animation3d/runtime/mixer/Mixer.ts +562 -0
- package/src/animation3d/runtime/mixer/PoseBuffer.ts +1 -0
- package/src/animation3d/runtime/mixer/TrackSampler.ts +399 -0
- package/src/animation3d/runtime/mixer/index.ts +8 -0
- package/src/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.ts +4 -0
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.ts +1 -0
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineController.ts +1 -0
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.ts +1 -0
- package/src/animation3d/runtime/state-machine/index.ts +45 -0
- package/src/animation3d.ts +5 -0
- package/src/benchmark.ts +168 -0
- package/src/canvas-text/CanvasText2DRenderSystem.ts +292 -0
- package/src/canvas-text/CanvasTextComponent.ts +47 -0
- package/src/canvas-text.ts +4 -0
- package/src/experimental-gltf-worker.ts +18 -0
- package/src/experimental-spine-worker.ts +9 -0
- package/src/gltf/GltfAccessorReader.ts +271 -0
- package/src/gltf/GltfAnimation3DAdapter.ts +680 -0
- package/src/gltf/GltfAnimationRuntime.ts +392 -0
- package/src/gltf/GltfAssetWorkerClient.ts +136 -0
- package/src/gltf/GltfCompatibilityReport.ts +214 -0
- package/src/gltf/GltfConservativeBounds.ts +219 -0
- package/src/gltf/GltfDracoDecoder.ts +251 -0
- package/src/gltf/GltfExtensionAdapter.ts +340 -0
- package/src/gltf/GltfLoaderContract.ts +333 -0
- package/src/gltf/GltfLoaderErrors.ts +59 -0
- package/src/gltf/GltfMaterialDescriptor.ts +134 -0
- package/src/gltf/GltfMaterialEncoder.ts +173 -0
- package/src/gltf/GltfMaterialLoader.ts +293 -0
- package/src/gltf/GltfModelComponent.ts +115 -0
- package/src/gltf/GltfModelSystem.ts +208 -0
- package/src/gltf/GltfPlugin.ts +84 -0
- package/src/gltf/GltfSchema.ts +229 -0
- package/src/gltf/GltfUvSemanticPlanner.ts +166 -0
- package/src/gltf/gltfLoader.ts +910 -0
- package/src/gltf-animation3d.ts +10 -0
- package/src/gltf-worker-runtime.ts +10 -0
- package/src/gltf.ts +56 -0
- package/src/grid/Grid2DComponent.ts +69 -0
- package/src/grid.ts +2 -0
- package/src/hya-state-machine.ts +19 -0
- package/src/index.ts +2 -0
- package/src/plugins/pluginUtils.ts +50 -0
- package/src/plugins.ts +6 -0
- package/src/shaders/generated/2d-ui-animation-2d.generated.wgsl +242 -0
- package/src/shaders/generated/2d-ui-artifact.generated.ts +867 -0
- package/src/shaders/generated/2d-ui-canvas-text-2d.generated.wgsl +38 -0
- package/src/shaders/generated/2d-ui-spine2d.generated.wgsl +41 -0
- package/src/shaders/generated/2d-ui-tilemap2d.generated.wgsl +36 -0
- package/src/spine/Spine2DComponent.ts +168 -0
- package/src/spine/Spine2DGpuRenderer.ts +449 -0
- package/src/spine/Spine2DRenderSystem.ts +199 -0
- package/src/spine/Spine2DRuntime.ts +1529 -0
- package/src/spine/SpineAnimationBoneTimelines.ts +30 -0
- package/src/spine/SpineAssetParser.ts +20 -0
- package/src/spine/SpineAssetWorkerClient.ts +112 -0
- package/src/spine/SpineAssetWorkerContract.ts +4 -0
- package/src/spine/SpineAtlasParser.ts +127 -0
- package/src/spine/SpineFloatBuilder.ts +66 -0
- package/src/spine/SpinePathConstraintSolver.ts +582 -0
- package/src/spine/SpinePlugin.ts +76 -0
- package/src/spine/SpineSkeletonRuntime.ts +521 -0
- package/src/spine/SpineSlotAnimation.ts +195 -0
- package/src/spine/SpineTimelineRuntime.ts +453 -0
- package/src/spine/SpineVertexBuilder.ts +686 -0
- package/src/spine.ts +7 -0
- package/src/tilemap/Tilemap2DComponent.ts +232 -0
- package/src/tilemap/Tilemap2DRenderSystem.ts +58 -0
- package/src/tilemap/Tilemap2DRenderer.ts +289 -0
- package/src/tilemap/TilemapPlugin.ts +75 -0
- package/src/tilemap.ts +6 -0
- package/src/tween/Tween2DComponent.ts +83 -0
- package/src/tween/Tween2DSystem.ts +78 -0
- package/src/tween.ts +4 -0
- package/src/types/earcut.d.ts +7 -0
- package/src/types/wgsl.d.ts +4 -0
- package/src/utils/RenderSystem2DBase.ts +164 -0
- package/src/utils/arrayAccess.ts +17 -0
- package/src/utils/camera2d.ts +68 -0
- package/src/utils/render2dGpu.ts +132 -0
- package/test/fixtures/gltf/animation-characterization.gltf +344 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Stable glTF adapter for the source-independent Animation3D runtime. */
|
|
2
|
+
export {
|
|
3
|
+
GltfAnimation3DRuntime,
|
|
4
|
+
createGltfAnimation3DClips,
|
|
5
|
+
createGltfAnimation3DRuntime,
|
|
6
|
+
} from './gltf/GltfAnimation3DAdapter.js';
|
|
7
|
+
export type {
|
|
8
|
+
GltfAnimation3DRuntimeOptions,
|
|
9
|
+
GltfAnimation3DRuntimeState,
|
|
10
|
+
} from './gltf/GltfAnimation3DAdapter.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-contained module entry consumed by module workers.
|
|
3
|
+
*
|
|
4
|
+
* Keep these exports backed by the production glTF loader so worker parsing,
|
|
5
|
+
* Draco decoding, and geometry preparation cannot drift from the main thread.
|
|
6
|
+
*/
|
|
7
|
+
export {
|
|
8
|
+
loadParsedGltfAsset,
|
|
9
|
+
prepareGltfGeometryPayloads,
|
|
10
|
+
} from './gltf/gltfLoader';
|
package/src/gltf.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export { GltfModelComponent } from './gltf/GltfModelComponent';
|
|
2
|
+
export type { GltfModelComponentOptions, GltfModelStatus } from './gltf/GltfModelComponent';
|
|
3
|
+
export { GltfModelSystem } from './gltf/GltfModelSystem';
|
|
4
|
+
export type { GltfModelSystemOptions } from './gltf/GltfModelSystem';
|
|
5
|
+
export { applyGltfAnimationClip, disposeGltfModel, GLTF_EXTENSION_CAPABILITIES, loadGltfModel, setGltfMaterialVariant } from './gltf/gltfLoader';
|
|
6
|
+
export {
|
|
7
|
+
DEFAULT_GLTF_EXTENSION_ADAPTERS,
|
|
8
|
+
collectGltfMaterialExtensionPatches,
|
|
9
|
+
collectGltfMaterialVariantNames,
|
|
10
|
+
collectGltfMaterialVariantReferences,
|
|
11
|
+
resolveGltfExtensionAdapters,
|
|
12
|
+
} from './gltf/GltfExtensionAdapter';
|
|
13
|
+
export { encodeGltfPbrMaterial } from './gltf/GltfMaterialEncoder';
|
|
14
|
+
export type {
|
|
15
|
+
EncodedGltfPbrMaterial,
|
|
16
|
+
EncodeGltfPbrMaterialOptions,
|
|
17
|
+
} from './gltf/GltfMaterialEncoder';
|
|
18
|
+
export type {
|
|
19
|
+
DracoDecoderConfig,
|
|
20
|
+
DracoDecoderFactory,
|
|
21
|
+
DracoDecoderModule,
|
|
22
|
+
GltfAssetWorker,
|
|
23
|
+
GltfAnimationClip,
|
|
24
|
+
GltfAnimationInfo,
|
|
25
|
+
GltfAnimationInterpolation,
|
|
26
|
+
GltfAnimationPath,
|
|
27
|
+
GltfAssetStats,
|
|
28
|
+
GltfExtensionCapability,
|
|
29
|
+
GltfExtensionAdapter,
|
|
30
|
+
GltfExtensionReport,
|
|
31
|
+
GltfExtensionReportEntry,
|
|
32
|
+
GltfExtensionSupport,
|
|
33
|
+
GltfLoadWarning,
|
|
34
|
+
GltfCompatibilityExtensionEntry,
|
|
35
|
+
GltfCompatibilityIssue,
|
|
36
|
+
GltfCompatibilityPerformanceSummary,
|
|
37
|
+
GltfCompatibilityReport,
|
|
38
|
+
GltfCompatibilityStatus,
|
|
39
|
+
GltfPrimitiveBoundsCompatibilityEntry,
|
|
40
|
+
GltfPrimitiveBoundsSupport,
|
|
41
|
+
GltfPrimitiveUvSemanticCompatibilityEntry,
|
|
42
|
+
GltfTextureCompatibilityEntry,
|
|
43
|
+
GltfTextureMipmapSource,
|
|
44
|
+
LoadedGltfModel,
|
|
45
|
+
LoadGltfOptions,
|
|
46
|
+
} from './gltf/gltfLoader';
|
|
47
|
+
export type {
|
|
48
|
+
GltfMaterialExtensionContext,
|
|
49
|
+
GltfMaterialExtensionPatch,
|
|
50
|
+
GltfMaterialStatePatch,
|
|
51
|
+
GltfMaterialTextureBinding,
|
|
52
|
+
GltfMaterialVariantReference,
|
|
53
|
+
GltfPrimitiveExtensionContext,
|
|
54
|
+
} from './gltf/GltfExtensionAdapter';
|
|
55
|
+
export { createGltfPlugin } from './gltf/GltfPlugin';
|
|
56
|
+
export type { GltfPluginOptions } from './gltf/GltfPlugin';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Component } from '@haiyue/engine';
|
|
2
|
+
import { UniqueCheckType } from '@haiyue/engine/ecs';
|
|
3
|
+
|
|
4
|
+
export interface Grid2DComponentOptions {
|
|
5
|
+
columns?: number;
|
|
6
|
+
rows?: number;
|
|
7
|
+
cellWidth?: number;
|
|
8
|
+
cellHeight?: number;
|
|
9
|
+
originX?: number;
|
|
10
|
+
originY?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class Grid2DComponent extends Component {
|
|
14
|
+
static override UniqueCheckType = UniqueCheckType.SYMBOL | UniqueCheckType.REPLACE;
|
|
15
|
+
static override UniqueSymbol = Symbol.for('Grid2DComponent');
|
|
16
|
+
|
|
17
|
+
columns: number;
|
|
18
|
+
rows: number;
|
|
19
|
+
cellWidth: number;
|
|
20
|
+
cellHeight: number;
|
|
21
|
+
originX: number;
|
|
22
|
+
originY: number;
|
|
23
|
+
|
|
24
|
+
constructor(options: Grid2DComponentOptions = {}) {
|
|
25
|
+
super('Grid2DComponent');
|
|
26
|
+
this.columns = Math.max(1, Math.floor(options.columns ?? 10));
|
|
27
|
+
this.rows = Math.max(1, Math.floor(options.rows ?? 20));
|
|
28
|
+
this.cellWidth = options.cellWidth ?? 32;
|
|
29
|
+
this.cellHeight = options.cellHeight ?? 32;
|
|
30
|
+
this.originX = options.originX ?? 0;
|
|
31
|
+
this.originY = options.originY ?? 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
gridToWorld(column: number, row: number): [number, number] {
|
|
35
|
+
return [
|
|
36
|
+
this.originX + column * this.cellWidth,
|
|
37
|
+
this.originY + row * this.cellHeight,
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
gridToWorldCenter(column: number, row: number): [number, number] {
|
|
42
|
+
return [
|
|
43
|
+
this.originX + (column + 0.5) * this.cellWidth,
|
|
44
|
+
this.originY + (row + 0.5) * this.cellHeight,
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
worldToGrid(x: number, y: number): [number, number] {
|
|
49
|
+
return [
|
|
50
|
+
Math.floor((x - this.originX) / this.cellWidth),
|
|
51
|
+
Math.floor((y - this.originY) / this.cellHeight),
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
contains(column: number, row: number): boolean {
|
|
56
|
+
return column >= 0 && row >= 0 && column < this.columns && row < this.rows;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
override clone(): Grid2DComponent {
|
|
60
|
+
return new Grid2DComponent({
|
|
61
|
+
columns: this.columns,
|
|
62
|
+
rows: this.rows,
|
|
63
|
+
cellWidth: this.cellWidth,
|
|
64
|
+
cellHeight: this.cellHeight,
|
|
65
|
+
originX: this.originX,
|
|
66
|
+
originY: this.originY,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
package/src/grid.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { Animation2DStateMachineComponent } from './animation/Animation2DStateMachineComponent';
|
|
2
|
+
export type { Animation2DStateMachineComponentOptions } from './animation/Animation2DStateMachineComponent';
|
|
3
|
+
export { Animation2DStateMachineSystem } from './animation/Animation2DStateMachineSystem';
|
|
4
|
+
export type { Animation2DStateMachineSystemOptions } from './animation/Animation2DStateMachineSystem';
|
|
5
|
+
export {
|
|
6
|
+
createHyaAnimation2DClips,
|
|
7
|
+
getHyaStateMachineExtension,
|
|
8
|
+
} from './animation/HyaAnimation2DClipAdapter';
|
|
9
|
+
export {
|
|
10
|
+
AnimationStateMachineChannelError,
|
|
11
|
+
assertAudioStateMachineCompatible,
|
|
12
|
+
audioStateMachineCompatibilityDiagnostic,
|
|
13
|
+
hyaStateMachineChannelCapability,
|
|
14
|
+
HYA_STATE_MACHINE_CHANNEL_REGISTRY,
|
|
15
|
+
} from './animation-state-machine/AnimationStateMachineChannels';
|
|
16
|
+
export type {
|
|
17
|
+
AnimationStateMachineChannelDiagnostic,
|
|
18
|
+
AnimationStateMachineChannelDiagnosticCode,
|
|
19
|
+
} from './animation-state-machine/AnimationStateMachineChannels';
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { EnginePlugin, RenderPipelineEntryOptions, ScenePluginContext, System } from '@haiyue/engine/experimental';
|
|
2
|
+
import type { Entity, HaiyueEngine, World } from '@haiyue/engine';
|
|
3
|
+
|
|
4
|
+
export const EXTENSIONS_PLUGIN_VERSION = '0.1.0';
|
|
5
|
+
|
|
6
|
+
export interface EditorViewportContributionContext {
|
|
7
|
+
world: World;
|
|
8
|
+
engine: HaiyueEngine;
|
|
9
|
+
camera2DEntity: Entity;
|
|
10
|
+
registerRenderSystem?: (system: System, options?: RenderPipelineEntryOptions) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function removeSystem(context: ScenePluginContext, system: System | null): void {
|
|
14
|
+
if (system) context.world.removeSystem(system);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function installEditorRenderSystem<T extends System & { autoUpdate: boolean; setCameraEntity?(entity: Entity): unknown }>(
|
|
18
|
+
context: EditorViewportContributionContext,
|
|
19
|
+
constructor: new (...args: never[]) => T,
|
|
20
|
+
create: () => T,
|
|
21
|
+
): { dispose(): void } {
|
|
22
|
+
let system = context.world.getSystem(constructor) as T | null;
|
|
23
|
+
const created = system === null;
|
|
24
|
+
if (!system) {
|
|
25
|
+
system = create();
|
|
26
|
+
context.world.addSystem(system);
|
|
27
|
+
}
|
|
28
|
+
system.setCameraEntity?.(context.camera2DEntity);
|
|
29
|
+
if (context.registerRenderSystem) {
|
|
30
|
+
system.autoUpdate = false;
|
|
31
|
+
context.registerRenderSystem(system);
|
|
32
|
+
} else {
|
|
33
|
+
system.autoUpdate = true;
|
|
34
|
+
}
|
|
35
|
+
return ownedEditorViewportSystem(context.world, system, created);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function ownedEditorViewportSystem(
|
|
39
|
+
world: World,
|
|
40
|
+
system: System,
|
|
41
|
+
owned: boolean,
|
|
42
|
+
): { dispose(): void } {
|
|
43
|
+
return {
|
|
44
|
+
dispose() {
|
|
45
|
+
if (owned && world.hasSystem(system)) world.removeSystem(system);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type { EnginePlugin, RenderPipelineEntryOptions };
|
package/src/plugins.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createGltfPlugin } from './gltf/GltfPlugin';
|
|
2
|
+
export type { GltfPluginOptions } from './gltf/GltfPlugin';
|
|
3
|
+
export { createSpinePlugin } from './spine/SpinePlugin';
|
|
4
|
+
export type { SpinePluginOptions } from './spine/SpinePlugin';
|
|
5
|
+
export { createTilemapPlugin } from './tilemap/TilemapPlugin';
|
|
6
|
+
export type { TilemapPluginOptions } from './tilemap/TilemapPlugin';
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
// haiyue:builtin-render animation-2d
|
|
2
|
+
// source: shader-language/builtin-components-2d-ui-family.json
|
|
3
|
+
|
|
4
|
+
struct CameraUniforms {
|
|
5
|
+
viewProj : mat4x4<f32>,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
struct ObjectUniforms {
|
|
9
|
+
model : mat4x4<f32>,
|
|
10
|
+
color : vec4<f32>,
|
|
11
|
+
params : vec4<f32>, // x: composite layer count, y: output offscreen source
|
|
12
|
+
uvRect : vec4<f32>,
|
|
13
|
+
compositeParams : array<vec4<f32>, 8>, // mode, operation, feather x/y
|
|
14
|
+
compositeExpansion0 : vec4<f32>,
|
|
15
|
+
compositeExpansion1 : vec4<f32>,
|
|
16
|
+
gradientParams : vec4<f32>, // kind, stop count, opacity
|
|
17
|
+
gradientGeometry : vec4<f32>, // start.xy, end.xy
|
|
18
|
+
gradientColors : array<vec4<f32>, 8>,
|
|
19
|
+
gradientOffsets0 : vec4<f32>,
|
|
20
|
+
gradientOffsets1 : vec4<f32>,
|
|
21
|
+
effectKinds0 : vec4<f32>,
|
|
22
|
+
effectKinds1 : vec4<f32>,
|
|
23
|
+
effectData : array<EffectData, 8>,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
struct EffectData {
|
|
27
|
+
data0 : vec4<f32>,
|
|
28
|
+
data1 : vec4<f32>,
|
|
29
|
+
data2 : vec4<f32>,
|
|
30
|
+
data3 : vec4<f32>,
|
|
31
|
+
data4 : vec4<f32>,
|
|
32
|
+
data5 : vec4<f32>,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@group(0) @binding(0) var<uniform> camera : CameraUniforms;
|
|
36
|
+
@group(1) @binding(0) var<uniform> object : ObjectUniforms;
|
|
37
|
+
@group(2) @binding(0) var baseTexture : texture_2d<f32>;
|
|
38
|
+
@group(2) @binding(1) var baseSampler : sampler;
|
|
39
|
+
@group(3) @binding(0) var compositeTexture0 : texture_2d<f32>;
|
|
40
|
+
@group(3) @binding(1) var compositeTexture1 : texture_2d<f32>;
|
|
41
|
+
@group(3) @binding(2) var compositeTexture2 : texture_2d<f32>;
|
|
42
|
+
@group(3) @binding(3) var compositeTexture3 : texture_2d<f32>;
|
|
43
|
+
@group(3) @binding(4) var compositeTexture4 : texture_2d<f32>;
|
|
44
|
+
@group(3) @binding(5) var compositeTexture5 : texture_2d<f32>;
|
|
45
|
+
@group(3) @binding(6) var compositeTexture6 : texture_2d<f32>;
|
|
46
|
+
@group(3) @binding(7) var compositeTexture7 : texture_2d<f32>;
|
|
47
|
+
@group(3) @binding(8) var compositeSampler : sampler;
|
|
48
|
+
|
|
49
|
+
struct VertexInput {
|
|
50
|
+
@location(0) position : vec2<f32>,
|
|
51
|
+
@location(1) uv : vec2<f32>,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
struct VertexOutput {
|
|
55
|
+
@builtin(position) clipPos : vec4<f32>,
|
|
56
|
+
@location(0) uv : vec2<f32>,
|
|
57
|
+
@location(1) localPosition : vec2<f32>,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@vertex
|
|
61
|
+
fn vs_main(input : VertexInput) -> VertexOutput {
|
|
62
|
+
var out : VertexOutput;
|
|
63
|
+
out.clipPos = camera.viewProj * object.model * vec4<f32>(input.position, 0.0, 1.0);
|
|
64
|
+
out.uv = object.uvRect.xy + input.uv * object.uvRect.zw;
|
|
65
|
+
out.localPosition = input.position;
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
struct EffectVertexOutput {
|
|
70
|
+
@builtin(position) clipPos : vec4<f32>,
|
|
71
|
+
@location(0) uv : vec2<f32>,
|
|
72
|
+
@location(1) @interpolate(flat) effectIndex : u32,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@vertex
|
|
76
|
+
fn vs_effect(@builtin(vertex_index) vertexIndex : u32, @builtin(instance_index) effectIndex : u32) -> EffectVertexOutput {
|
|
77
|
+
let uv = vec2<f32>(f32((vertexIndex << 1u) & 2u), f32(vertexIndex & 2u));
|
|
78
|
+
var out : EffectVertexOutput;
|
|
79
|
+
out.clipPos = vec4<f32>(uv * vec2<f32>(2.0, -2.0) + vec2<f32>(-1.0, 1.0), 0.0, 1.0);
|
|
80
|
+
out.uv = uv;
|
|
81
|
+
out.effectIndex = effectIndex;
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
fn decode_coverage(value : vec4<f32>, mode : f32) -> f32 {
|
|
86
|
+
var coverage = select(value.a, dot(value.rgb, vec3<f32>(0.2126, 0.7152, 0.0722)), mode > 1.5);
|
|
87
|
+
if ((mode > 0.5 && mode < 1.5) || mode > 2.5) { coverage = 1.0 - coverage; }
|
|
88
|
+
return clamp(coverage, 0.0, 1.0);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
fn filtered_coverage(
|
|
92
|
+
source : texture_2d<f32>,
|
|
93
|
+
uv : vec2<f32>,
|
|
94
|
+
parameters : vec4<f32>,
|
|
95
|
+
expansion : f32,
|
|
96
|
+
) -> f32 {
|
|
97
|
+
let dimensions = vec2<f32>(textureDimensions(source));
|
|
98
|
+
let radius = max(vec2<f32>(abs(expansion)), parameters.zw);
|
|
99
|
+
let stepUv = radius / max(dimensions, vec2<f32>(1.0));
|
|
100
|
+
let center = decode_coverage(textureSample(source, compositeSampler, uv), parameters.x);
|
|
101
|
+
if (max(radius.x, radius.y) < 0.001) { return center; }
|
|
102
|
+
let a = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(-stepUv.x, -stepUv.y)), parameters.x);
|
|
103
|
+
let b = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(0.0, -stepUv.y)), parameters.x);
|
|
104
|
+
let c = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(stepUv.x, -stepUv.y)), parameters.x);
|
|
105
|
+
let d = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(-stepUv.x, 0.0)), parameters.x);
|
|
106
|
+
let e = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(stepUv.x, 0.0)), parameters.x);
|
|
107
|
+
let f = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(-stepUv.x, stepUv.y)), parameters.x);
|
|
108
|
+
let g = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(0.0, stepUv.y)), parameters.x);
|
|
109
|
+
let h = decode_coverage(textureSample(source, compositeSampler, uv + vec2<f32>(stepUv.x, stepUv.y)), parameters.x);
|
|
110
|
+
var expanded = center;
|
|
111
|
+
if (expansion > 0.001) { expanded = max(center, max(max(max(a, b), max(c, d)), max(max(e, f), max(g, h)))); }
|
|
112
|
+
if (expansion < -0.001) { expanded = min(center, min(min(min(a, b), min(c, d)), min(min(e, f), min(g, h)))); }
|
|
113
|
+
if (max(parameters.z, parameters.w) < 0.001) { return expanded; }
|
|
114
|
+
let blurred = (center * 2.0 + a + b + c + d + e + f + g + h) / 10.0;
|
|
115
|
+
return mix(expanded, blurred, clamp(max(parameters.z, parameters.w), 0.0, 1.0));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
fn combine_coverage(current : f32, next : f32, operation : f32) -> f32 {
|
|
119
|
+
if (operation < 0.5) { return current + next * (1.0 - current); }
|
|
120
|
+
if (operation < 1.5) { return max(0.0, current - next); }
|
|
121
|
+
if (operation < 2.5) { return current * next; }
|
|
122
|
+
return abs(current - next);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
fn gradient_offset(index : i32) -> f32 {
|
|
126
|
+
if (index < 4) { return object.gradientOffsets0[index]; }
|
|
127
|
+
return object.gradientOffsets1[index - 4];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
fn gradient_color(position : vec2<f32>) -> vec4<f32> {
|
|
131
|
+
let start = object.gradientGeometry.xy;
|
|
132
|
+
let delta = object.gradientGeometry.zw - start;
|
|
133
|
+
var progress = dot(position - start, delta) / max(dot(delta, delta), 1e-6);
|
|
134
|
+
if (object.gradientParams.x > 1.5) { progress = length(position - start) / max(length(delta), 1e-6); }
|
|
135
|
+
progress = clamp(progress, 0.0, 1.0);
|
|
136
|
+
var previousOffset = gradient_offset(0);
|
|
137
|
+
var previousColor = object.gradientColors[0];
|
|
138
|
+
for (var index = 1; index < 8; index++) {
|
|
139
|
+
if (f32(index) >= object.gradientParams.y) { break; }
|
|
140
|
+
let nextOffset = gradient_offset(index);
|
|
141
|
+
let nextColor = object.gradientColors[index];
|
|
142
|
+
if (progress <= nextOffset) {
|
|
143
|
+
let local = clamp((progress - previousOffset) / max(nextOffset - previousOffset, 1e-6), 0.0, 1.0);
|
|
144
|
+
return mix(previousColor, nextColor, local) * vec4<f32>(1.0, 1.0, 1.0, object.gradientParams.z);
|
|
145
|
+
}
|
|
146
|
+
previousOffset = nextOffset;
|
|
147
|
+
previousColor = nextColor;
|
|
148
|
+
}
|
|
149
|
+
return previousColor * vec4<f32>(1.0, 1.0, 1.0, object.gradientParams.z);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
fn effect_kind(index : u32) -> f32 {
|
|
153
|
+
if (index < 4u) { return object.effectKinds0[index]; }
|
|
154
|
+
return object.effectKinds1[index - 4u];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
fn unpremultiply(value : vec4<f32>) -> vec4<f32> {
|
|
158
|
+
if (value.a <= 1e-6) { return vec4<f32>(0.0); }
|
|
159
|
+
return vec4<f32>(value.rgb / value.a, value.a);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
fn apply_color_effect(value : vec4<f32>, index : u32) -> vec4<f32> {
|
|
163
|
+
let kind = effect_kind(index);
|
|
164
|
+
let data = object.effectData[index];
|
|
165
|
+
var color = unpremultiply(value);
|
|
166
|
+
if (kind < 1.5) {
|
|
167
|
+
let luminance = dot(color.rgb, vec3<f32>(0.2126, 0.7152, 0.0722));
|
|
168
|
+
let tinted = mix(data.data0.xyz, vec3<f32>(data.data0.w, data.data1.x, data.data1.y), luminance);
|
|
169
|
+
color = vec4<f32>(mix(color.rgb, tinted, clamp(data.data1.z, 0.0, 1.0)), color.a);
|
|
170
|
+
} else if (kind < 2.5) {
|
|
171
|
+
color = vec4<f32>(data.data0.rgb, color.a);
|
|
172
|
+
color.a = color.a * data.data0.a * clamp(data.data1.x, 0.0, 1.0);
|
|
173
|
+
} else if (kind < 3.5) {
|
|
174
|
+
color.a = color.a * clamp(data.data0.x, 0.0, 1.0);
|
|
175
|
+
} else if (kind < 4.5) {
|
|
176
|
+
let source = color;
|
|
177
|
+
color = vec4<f32>(
|
|
178
|
+
dot(source, data.data0) + data.data1.x,
|
|
179
|
+
dot(source, vec4<f32>(data.data1.yzw, data.data2.x)) + data.data2.y,
|
|
180
|
+
dot(source, vec4<f32>(data.data2.zw, data.data3.xy)) + data.data3.z,
|
|
181
|
+
dot(source, vec4<f32>(data.data3.w, data.data4.xyz)) + data.data4.w
|
|
182
|
+
);
|
|
183
|
+
color = clamp(color, vec4<f32>(0.0), vec4<f32>(1.0));
|
|
184
|
+
}
|
|
185
|
+
return vec4<f32>(color.rgb * color.a, color.a);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
fn sample_blurred(uv : vec2<f32>, radius : vec2<f32>) -> vec4<f32> {
|
|
189
|
+
let dimensions = max(vec2<f32>(textureDimensions(baseTexture)), vec2<f32>(1.0));
|
|
190
|
+
let stepUv = radius / dimensions;
|
|
191
|
+
if (max(radius.x, radius.y) < 0.01) { return textureSampleLevel(baseTexture, baseSampler, uv, 0.0); }
|
|
192
|
+
var value = textureSampleLevel(baseTexture, baseSampler, uv, 0.0) * 0.25;
|
|
193
|
+
value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(-stepUv.x, 0.0), 0.0) * 0.125;
|
|
194
|
+
value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(stepUv.x, 0.0), 0.0) * 0.125;
|
|
195
|
+
value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(0.0, -stepUv.y), 0.0) * 0.125;
|
|
196
|
+
value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(0.0, stepUv.y), 0.0) * 0.125;
|
|
197
|
+
value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(-stepUv.x, -stepUv.y), 0.0) * 0.0625;
|
|
198
|
+
value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(stepUv.x, -stepUv.y), 0.0) * 0.0625;
|
|
199
|
+
value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(-stepUv.x, stepUv.y), 0.0) * 0.0625;
|
|
200
|
+
value += textureSampleLevel(baseTexture, baseSampler, uv + vec2<f32>(stepUv.x, stepUv.y), 0.0) * 0.0625;
|
|
201
|
+
return value;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@fragment
|
|
205
|
+
fn fs_effect(input : EffectVertexOutput) -> @location(0) vec4<f32> {
|
|
206
|
+
let kind = effect_kind(input.effectIndex);
|
|
207
|
+
let data = object.effectData[input.effectIndex];
|
|
208
|
+
if (kind < 4.5) { return apply_color_effect(textureSampleLevel(baseTexture, baseSampler, input.uv, 0.0), input.effectIndex); }
|
|
209
|
+
if (kind < 5.5) { return sample_blurred(input.uv, max(data.data0.xy, vec2<f32>(0.0))); }
|
|
210
|
+
let dimensions = max(vec2<f32>(textureDimensions(baseTexture)), vec2<f32>(1.0));
|
|
211
|
+
let shadowUv = input.uv - data.data1.yz / dimensions;
|
|
212
|
+
let shadowCoverage = sample_blurred(shadowUv, vec2<f32>(max(data.data1.w, 0.0))).a;
|
|
213
|
+
let shadowAlpha = clamp(shadowCoverage * data.data1.x * data.data0.a, 0.0, 1.0);
|
|
214
|
+
let shadow = vec4<f32>(data.data0.rgb * shadowAlpha, shadowAlpha);
|
|
215
|
+
let foreground = textureSampleLevel(baseTexture, baseSampler, input.uv, 0.0);
|
|
216
|
+
return foreground + shadow * (1.0 - foreground.a);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@fragment
|
|
220
|
+
fn fs_present(input : EffectVertexOutput) -> @location(0) vec4<f32> {
|
|
221
|
+
return textureSampleLevel(baseTexture, baseSampler, input.uv, 0.0);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@fragment
|
|
225
|
+
fn fs_main(input : VertexOutput) -> @location(0) vec4<f32> {
|
|
226
|
+
var base = textureSample(baseTexture, baseSampler, input.uv) * object.color;
|
|
227
|
+
if (object.gradientParams.x > 0.5) { base = gradient_color(input.localPosition) * object.color; }
|
|
228
|
+
var coverage = 1.0;
|
|
229
|
+
if (object.params.x > 0.5) {
|
|
230
|
+
let uv = input.clipPos.xy / vec2<f32>(textureDimensions(compositeTexture0));
|
|
231
|
+
coverage = select(0.0, 1.0, object.compositeParams[0].y > 0.5 && object.compositeParams[0].y < 2.5);
|
|
232
|
+
coverage = combine_coverage(coverage, filtered_coverage(compositeTexture0, uv, object.compositeParams[0], object.compositeExpansion0.x), object.compositeParams[0].y);
|
|
233
|
+
if (object.params.x > 1.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture1, uv, object.compositeParams[1], object.compositeExpansion0.y), object.compositeParams[1].y); }
|
|
234
|
+
if (object.params.x > 2.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture2, uv, object.compositeParams[2], object.compositeExpansion0.z), object.compositeParams[2].y); }
|
|
235
|
+
if (object.params.x > 3.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture3, uv, object.compositeParams[3], object.compositeExpansion0.w), object.compositeParams[3].y); }
|
|
236
|
+
if (object.params.x > 4.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture4, uv, object.compositeParams[4], object.compositeExpansion1.x), object.compositeParams[4].y); }
|
|
237
|
+
if (object.params.x > 5.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture5, uv, object.compositeParams[5], object.compositeExpansion1.y), object.compositeParams[5].y); }
|
|
238
|
+
if (object.params.x > 6.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture6, uv, object.compositeParams[6], object.compositeExpansion1.z), object.compositeParams[6].y); }
|
|
239
|
+
if (object.params.x > 7.5) { coverage = combine_coverage(coverage, filtered_coverage(compositeTexture7, uv, object.compositeParams[7], object.compositeExpansion1.w), object.compositeParams[7].y); }
|
|
240
|
+
}
|
|
241
|
+
return vec4<f32>(base.rgb, base.a * coverage);
|
|
242
|
+
}
|