@haiyue/extensions 0.1.0 → 0.2.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/README.md +25 -0
- package/dist/animation/Animation2DComponent.d.ts +18 -0
- package/dist/animation/Animation2DExtensionRegistry.d.ts +7 -0
- package/dist/animation/Animation2DRenderSystem.d.ts +6 -0
- package/dist/animation/Animation2DRuntime.d.ts +6 -2
- package/dist/animation/AnimationTextRasterizer.d.ts +4 -0
- package/dist/animation/AnimationVisual2D.d.ts +58 -2
- package/dist/animation/interaction/InteractionRuntime.d.ts +83 -0
- package/dist/animation/interaction/runtime-types.d.ts +257 -0
- package/dist/animation.d.ts +3 -1
- package/dist/animation.js +551 -59
- package/dist/animation3d.js +1 -1
- package/dist/canvas-text.js +1 -1
- package/dist/chunks/2d-ui-animation-2d.generated-FpziAeGJ.js +4 -0
- package/dist/chunks/2d-ui-indexed-sprite.generated-DmKR0CC3.js +4 -0
- package/dist/chunks/Animation2DStateMachine-BHcA6Cu3.js +18212 -0
- package/dist/chunks/{AnimationStateMachineController-BIcAh-sT.js → AnimationStateMachineController-4sKaqh9E.js} +2 -2
- package/dist/chunks/AnimationVisual2D-8y3qp0_U.js +230 -0
- package/dist/chunks/{RenderSystem2DBase-DDT61dAu.js → RenderSystem2DBase-CF2s00vg.js} +2 -2
- package/dist/controls/VirtualJoystickControls.d.ts +46 -0
- package/dist/controls/contracts.d.ts +91 -0
- package/dist/controls.d.ts +2 -0
- package/dist/controls.js +358 -0
- package/dist/deformable-animation/runtime/DeformableMesh2DRuntimeExtension.d.ts +11 -0
- package/dist/deformable-animation/runtime/DeformableMesh2DSampler.d.ts +11 -0
- package/dist/deformable-animation.d.ts +5 -0
- package/dist/deformable-animation.js +316 -0
- package/dist/experimental-indexed-sprite.d.ts +5 -0
- package/dist/experimental-indexed-sprite.js +482 -0
- package/dist/gltf-worker-runtime.js +9 -9
- package/dist/hya-state-machine.js +3 -2
- package/dist/index.js +1 -1
- package/dist/indexed-sprite/AtlasLayout.d.ts +2 -0
- package/dist/indexed-sprite/IndexedSpriteRenderer.d.ts +23 -0
- package/dist/indexed-sprite/contracts.d.ts +89 -0
- package/dist/internal/2d-ui-shader-artifact.js +232 -23
- package/dist/ray-tracing/acceleration/bvh.d.ts +37 -0
- package/dist/ray-tracing/acceleration/index.d.ts +6 -0
- package/dist/ray-tracing/acceleration/pack.d.ts +152 -0
- package/dist/ray-tracing/acceleration/query.d.ts +4 -0
- package/dist/ray-tracing/acceleration/runtime.d.ts +30 -0
- package/dist/ray-tracing/acceleration/tlas.d.ts +4 -0
- package/dist/ray-tracing/acceleration/types.d.ts +165 -0
- package/dist/ray-tracing/denoise/index.d.ts +3 -0
- package/dist/ray-tracing/denoise/layout.d.ts +9 -0
- package/dist/ray-tracing/denoise/runtime.d.ts +23 -0
- package/dist/ray-tracing/denoise/types.d.ts +28 -0
- package/dist/ray-tracing/hybrid/contract.d.ts +2 -0
- package/dist/ray-tracing/hybrid/index.d.ts +5 -0
- package/dist/ray-tracing/hybrid/layout.d.ts +17 -0
- package/dist/ray-tracing/hybrid/plan.d.ts +2 -0
- package/dist/ray-tracing/hybrid/runtime.d.ts +31 -0
- package/dist/ray-tracing/hybrid/shaders/hybrid-artifact.generated.d.ts +625 -0
- package/dist/ray-tracing/hybrid/types.d.ts +144 -0
- package/dist/ray-tracing/lifecycle/device-recovery.d.ts +31 -0
- package/dist/ray-tracing/lifecycle/index.d.ts +2 -0
- package/dist/ray-tracing/lifecycle/types.d.ts +37 -0
- package/dist/ray-tracing/material/index.d.ts +2 -0
- package/dist/ray-tracing/material/pack.d.ts +5 -0
- package/dist/ray-tracing/material/types.d.ts +63 -0
- package/dist/ray-tracing/reference/index.d.ts +122 -0
- package/dist/ray-tracing/renderer/index.d.ts +7 -0
- package/dist/ray-tracing/renderer/layout.d.ts +20 -0
- package/dist/ray-tracing/renderer/plan.d.ts +2 -0
- package/dist/ray-tracing/renderer/reference.d.ts +17 -0
- package/dist/ray-tracing/renderer/runtime.d.ts +39 -0
- package/dist/ray-tracing/renderer/scene.d.ts +4 -0
- package/dist/ray-tracing/renderer/types.d.ts +115 -0
- package/dist/ray-tracing/sampling/index.d.ts +8 -0
- package/dist/ray-tracing/sampling/layout.d.ts +12 -0
- package/dist/ray-tracing/sampling/plan.d.ts +5 -0
- package/dist/ray-tracing/sampling/revision.d.ts +15 -0
- package/dist/ray-tracing/sampling/runtime.d.ts +44 -0
- package/dist/ray-tracing/sampling/sequence.d.ts +2 -0
- package/dist/ray-tracing/sampling/types.d.ts +96 -0
- package/dist/ray-tracing/scene/index.d.ts +41 -0
- package/dist/ray-tracing/traversal/index.d.ts +4 -0
- package/dist/ray-tracing/traversal/layout.d.ts +16 -0
- package/dist/ray-tracing/traversal/plan.d.ts +2 -0
- package/dist/ray-tracing/traversal/runtime.d.ts +25 -0
- package/dist/ray-tracing/traversal/types.d.ts +79 -0
- package/dist/ray-tracing/worker/client.d.ts +25 -0
- package/dist/ray-tracing/worker/index.d.ts +5 -0
- package/dist/ray-tracing/worker/runtime.d.ts +11 -0
- package/dist/ray-tracing/worker/serialization.d.ts +16 -0
- package/dist/ray-tracing/worker/source.d.ts +1 -0
- package/dist/ray-tracing/worker/types.d.ts +91 -0
- package/dist/ray-tracing.d.ts +17 -0
- package/dist/ray-tracing.js +7666 -0
- package/dist/spine.js +1 -1
- package/dist/tilemap.js +1 -1
- package/package.json +26 -23
- package/dist/animation/Animation2DStateMachineVisualRuntime.d.ts +0 -27
- package/dist/animation/Particle2DDescriptorAdapter.d.ts +0 -5
- package/dist/animation3d/Animation3DResource.d.ts +0 -28
- package/dist/animation3d/hya/HyaAnimation3DStateMachineRuntime.d.ts +0 -65
- package/dist/animation3d/hya/index.d.ts +0 -4
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.d.ts +0 -81
- package/dist/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.d.ts +0 -39
- package/dist/animation3d/runtime/integration/index.d.ts +0 -2
- package/dist/animation3d/runtime/mixer/Action.d.ts +0 -150
- package/dist/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.d.ts +0 -6
- package/dist/animation3d/runtime/mixer/Mixer.d.ts +0 -59
- package/dist/animation3d/runtime/mixer/PoseBuffer.d.ts +0 -1
- package/dist/animation3d/runtime/mixer/TrackSampler.d.ts +0 -24
- package/dist/animation3d/runtime/mixer/index.d.ts +0 -4
- package/dist/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.d.ts +0 -1
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.d.ts +0 -1
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineController.d.ts +0 -1
- package/dist/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.d.ts +0 -1
- package/dist/animation3d/runtime/state-machine/index.d.ts +0 -6
- package/dist/benchmark.d.ts +0 -30
- package/dist/chunks/2d-ui-animation-2d.generated-D4aHzFU2.js +0 -4
- package/dist/chunks/Animation2DStateMachine-9IonguNa.js +0 -3245
- package/dist/gltf/GltfAccessorReader.d.ts +0 -7
- package/dist/gltf/GltfDracoDecoder.d.ts +0 -4
- package/dist/gltf/GltfLoaderErrors.d.ts +0 -4
- package/dist/gltf/GltfMaterialDescriptor.d.ts +0 -23
- package/dist/gltf/GltfMaterialLoader.d.ts +0 -6
- package/dist/gltf-worker-runtime.d.ts +0 -7
- package/dist/plugins/pluginUtils.d.ts +0 -20
- package/dist/plugins.d.ts +0 -6
- package/dist/shaders/generated/2d-ui-artifact.generated.d.ts +0 -658
- package/dist/spine/Spine2DGpuRenderer.d.ts +0 -65
- package/dist/spine/Spine2DRuntime.d.ts +0 -103
- package/dist/spine/SpineAnimationBoneTimelines.d.ts +0 -8
- package/dist/spine/SpineFloatBuilder.d.ts +0 -15
- package/dist/spine/SpinePathConstraintSolver.d.ts +0 -32
- package/dist/spine/SpineSkeletonRuntime.d.ts +0 -185
- package/dist/spine/SpineSlotAnimation.d.ts +0 -17
- package/dist/spine/SpineTimelineRuntime.d.ts +0 -25
- package/dist/spine/SpineVertexBuilder.d.ts +0 -61
- package/dist/tilemap/Tilemap2DRenderer.d.ts +0 -24
- package/dist/utils/arrayAccess.d.ts +0 -4
- package/dist/utils/camera2d.d.ts +0 -12
- package/src/animation/Animation2DComponent.ts +0 -135
- package/src/animation/Animation2DExtensionRegistry.ts +0 -52
- package/src/animation/Animation2DRenderSystem.ts +0 -1026
- package/src/animation/Animation2DRuntime.ts +0 -1326
- package/src/animation/Animation2DStateMachine.ts +0 -39
- package/src/animation/Animation2DStateMachineComponent.ts +0 -228
- package/src/animation/Animation2DStateMachineRuntime.ts +0 -141
- package/src/animation/Animation2DStateMachineSystem.ts +0 -60
- package/src/animation/Animation2DStateMachineVisualRuntime.ts +0 -282
- package/src/animation/Animation2DSystem.ts +0 -72
- package/src/animation/AnimationAssetLoader.ts +0 -84
- package/src/animation/AnimationAudioClip.ts +0 -140
- package/src/animation/AnimationPathTessellator.ts +0 -691
- package/src/animation/AnimationTextRasterizer.ts +0 -340
- package/src/animation/AnimationVisual2D.ts +0 -153
- package/src/animation/HyaAnimation2DClipAdapter.ts +0 -845
- package/src/animation/Particle2DDescriptorAdapter.ts +0 -35
- package/src/animation/runtime/mixer/Action.ts +0 -876
- package/src/animation/runtime/mixer/Mixer.ts +0 -505
- package/src/animation/runtime/mixer/PoseBuffer.ts +0 -105
- package/src/animation/runtime/mixer/Sampler.ts +0 -252
- package/src/animation/runtime/mixer/Types.ts +0 -138
- package/src/animation/runtime/mixer/index.ts +0 -31
- package/src/animation-state-machine/AnimationStateMachine.ts +0 -146
- package/src/animation-state-machine/AnimationStateMachineChannels.ts +0 -116
- package/src/animation-state-machine/runtime/Animation2DStateMachineMixerAdapter.ts +0 -197
- package/src/animation-state-machine/runtime/AnimationStateMachineBlendTreeWeights.ts +0 -503
- package/src/animation-state-machine/runtime/AnimationStateMachineCompiler.ts +0 -763
- package/src/animation-state-machine/runtime/AnimationStateMachineController.ts +0 -987
- package/src/animation-state-machine/runtime/AnimationStateMachineMixerPort.ts +0 -54
- package/src/animation-state-machine/runtime/index.ts +0 -47
- package/src/animation.ts +0 -33
- package/src/animation3d/Animation3DAction.ts +0 -73
- package/src/animation3d/Animation3DBinding.ts +0 -116
- package/src/animation3d/Animation3DClip.ts +0 -22
- package/src/animation3d/Animation3DError.ts +0 -34
- package/src/animation3d/Animation3DMixer.ts +0 -82
- package/src/animation3d/Animation3DPose.ts +0 -100
- package/src/animation3d/Animation3DPoseBuffer.ts +0 -85
- package/src/animation3d/Animation3DResource.ts +0 -49
- package/src/animation3d/Animation3DStateMachine.ts +0 -126
- package/src/animation3d/Animation3DStateMachineRuntime.ts +0 -191
- package/src/animation3d/Animation3DTrack.ts +0 -29
- package/src/animation3d/hya/HyaAnimation3DRuntime.ts +0 -756
- package/src/animation3d/hya/HyaAnimation3DStateMachineRuntime.ts +0 -618
- package/src/animation3d/hya/HyaAnimation3DTypes.ts +0 -168
- package/src/animation3d/hya/index.ts +0 -10
- package/src/animation3d/index.ts +0 -76
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerAdapter.ts +0 -325
- package/src/animation3d/runtime/integration/Animation3DStateMachineMixerIntegration.ts +0 -158
- package/src/animation3d/runtime/integration/index.ts +0 -9
- package/src/animation3d/runtime/mixer/Action.ts +0 -833
- package/src/animation3d/runtime/mixer/Animation3DMixerRuntimeStore.ts +0 -26
- package/src/animation3d/runtime/mixer/Mixer.ts +0 -562
- package/src/animation3d/runtime/mixer/PoseBuffer.ts +0 -1
- package/src/animation3d/runtime/mixer/TrackSampler.ts +0 -399
- package/src/animation3d/runtime/mixer/index.ts +0 -8
- package/src/animation3d/runtime/state-machine/Animation3DBlendTreeWeights.ts +0 -4
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineCompiler.ts +0 -1
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineController.ts +0 -1
- package/src/animation3d/runtime/state-machine/Animation3DStateMachineMixerPort.ts +0 -1
- package/src/animation3d/runtime/state-machine/index.ts +0 -45
- package/src/animation3d.ts +0 -5
- package/src/benchmark.ts +0 -168
- package/src/canvas-text/CanvasText2DRenderSystem.ts +0 -292
- package/src/canvas-text/CanvasTextComponent.ts +0 -47
- package/src/canvas-text.ts +0 -4
- package/src/experimental-gltf-worker.ts +0 -18
- package/src/experimental-spine-worker.ts +0 -9
- package/src/gltf/GltfAccessorReader.ts +0 -271
- package/src/gltf/GltfAnimation3DAdapter.ts +0 -680
- package/src/gltf/GltfAnimationRuntime.ts +0 -392
- package/src/gltf/GltfAssetWorkerClient.ts +0 -136
- package/src/gltf/GltfCompatibilityReport.ts +0 -214
- package/src/gltf/GltfConservativeBounds.ts +0 -219
- package/src/gltf/GltfDracoDecoder.ts +0 -251
- package/src/gltf/GltfExtensionAdapter.ts +0 -340
- package/src/gltf/GltfLoaderContract.ts +0 -333
- package/src/gltf/GltfLoaderErrors.ts +0 -59
- package/src/gltf/GltfMaterialDescriptor.ts +0 -134
- package/src/gltf/GltfMaterialEncoder.ts +0 -173
- package/src/gltf/GltfMaterialLoader.ts +0 -293
- package/src/gltf/GltfModelComponent.ts +0 -115
- package/src/gltf/GltfModelSystem.ts +0 -208
- package/src/gltf/GltfPlugin.ts +0 -84
- package/src/gltf/GltfSchema.ts +0 -229
- package/src/gltf/GltfUvSemanticPlanner.ts +0 -166
- package/src/gltf/gltfLoader.ts +0 -910
- package/src/gltf-animation3d.ts +0 -10
- package/src/gltf-worker-runtime.ts +0 -10
- package/src/gltf.ts +0 -56
- package/src/grid/Grid2DComponent.ts +0 -69
- package/src/grid.ts +0 -2
- package/src/hya-state-machine.ts +0 -19
- package/src/index.ts +0 -2
- package/src/plugins/pluginUtils.ts +0 -50
- package/src/plugins.ts +0 -6
- package/src/shaders/generated/2d-ui-animation-2d.generated.wgsl +0 -242
- package/src/shaders/generated/2d-ui-artifact.generated.ts +0 -867
- package/src/shaders/generated/2d-ui-canvas-text-2d.generated.wgsl +0 -38
- package/src/shaders/generated/2d-ui-spine2d.generated.wgsl +0 -41
- package/src/shaders/generated/2d-ui-tilemap2d.generated.wgsl +0 -36
- package/src/spine/Spine2DComponent.ts +0 -168
- package/src/spine/Spine2DGpuRenderer.ts +0 -449
- package/src/spine/Spine2DRenderSystem.ts +0 -199
- package/src/spine/Spine2DRuntime.ts +0 -1529
- package/src/spine/SpineAnimationBoneTimelines.ts +0 -30
- package/src/spine/SpineAssetParser.ts +0 -20
- package/src/spine/SpineAssetWorkerClient.ts +0 -112
- package/src/spine/SpineAssetWorkerContract.ts +0 -4
- package/src/spine/SpineAtlasParser.ts +0 -127
- package/src/spine/SpineFloatBuilder.ts +0 -66
- package/src/spine/SpinePathConstraintSolver.ts +0 -582
- package/src/spine/SpinePlugin.ts +0 -76
- package/src/spine/SpineSkeletonRuntime.ts +0 -521
- package/src/spine/SpineSlotAnimation.ts +0 -195
- package/src/spine/SpineTimelineRuntime.ts +0 -453
- package/src/spine/SpineVertexBuilder.ts +0 -686
- package/src/spine.ts +0 -7
- package/src/tilemap/Tilemap2DComponent.ts +0 -232
- package/src/tilemap/Tilemap2DRenderSystem.ts +0 -58
- package/src/tilemap/Tilemap2DRenderer.ts +0 -289
- package/src/tilemap/TilemapPlugin.ts +0 -75
- package/src/tilemap.ts +0 -6
- package/src/tween/Tween2DComponent.ts +0 -83
- package/src/tween/Tween2DSystem.ts +0 -78
- package/src/tween.ts +0 -4
- package/src/types/earcut.d.ts +0 -7
- package/src/types/wgsl.d.ts +0 -4
- package/src/utils/RenderSystem2DBase.ts +0 -164
- package/src/utils/arrayAccess.ts +0 -17
- package/src/utils/camera2d.ts +0 -68
- package/src/utils/render2dGpu.ts +0 -132
- package/test/fixtures/gltf/animation-characterization.gltf +0 -344
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// haiyue:builtin-render canvas-text-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
|
-
}
|
|
11
|
-
|
|
12
|
-
@group(0) @binding(0) var<uniform> camera : CameraUniforms;
|
|
13
|
-
@group(1) @binding(0) var<uniform> object : ObjectUniforms;
|
|
14
|
-
@group(2) @binding(0) var textTexture : texture_2d<f32>;
|
|
15
|
-
@group(2) @binding(1) var textSampler : sampler;
|
|
16
|
-
|
|
17
|
-
struct VertexInput {
|
|
18
|
-
@location(0) position : vec2<f32>,
|
|
19
|
-
@location(1) uv : vec2<f32>,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
struct VertexOutput {
|
|
23
|
-
@builtin(position) clipPos : vec4<f32>,
|
|
24
|
-
@location(0) uv : vec2<f32>,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@vertex
|
|
28
|
-
fn vs_main(input : VertexInput) -> VertexOutput {
|
|
29
|
-
var out : VertexOutput;
|
|
30
|
-
out.clipPos = camera.viewProj * object.model * vec4<f32>(input.position, 0.0, 1.0);
|
|
31
|
-
out.uv = input.uv;
|
|
32
|
-
return out;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@fragment
|
|
36
|
-
fn fs_main(input : VertexOutput) -> @location(0) vec4<f32> {
|
|
37
|
-
return textureSample(textTexture, textSampler, input.uv);
|
|
38
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// haiyue:builtin-render spine2d
|
|
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
|
-
}
|
|
11
|
-
|
|
12
|
-
@group(0) @binding(0) var<uniform> camera : CameraUniforms;
|
|
13
|
-
@group(1) @binding(0) var<uniform> object : ObjectUniforms;
|
|
14
|
-
@group(2) @binding(0) var atlasTexture : texture_2d<f32>;
|
|
15
|
-
@group(2) @binding(1) var atlasSampler : sampler;
|
|
16
|
-
|
|
17
|
-
struct VertexInput {
|
|
18
|
-
@location(0) position : vec2<f32>,
|
|
19
|
-
@location(1) uv : vec2<f32>,
|
|
20
|
-
@location(2) color : vec4<f32>,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
struct VertexOutput {
|
|
24
|
-
@builtin(position) clipPos : vec4<f32>,
|
|
25
|
-
@location(0) uv : vec2<f32>,
|
|
26
|
-
@location(1) color : vec4<f32>,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@vertex
|
|
30
|
-
fn vs_main(input : VertexInput) -> VertexOutput {
|
|
31
|
-
var out : VertexOutput;
|
|
32
|
-
out.clipPos = camera.viewProj * object.model * vec4<f32>(input.position, 0.0, 1.0);
|
|
33
|
-
out.uv = input.uv;
|
|
34
|
-
out.color = input.color;
|
|
35
|
-
return out;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@fragment
|
|
39
|
-
fn fs_main(input : VertexOutput) -> @location(0) vec4<f32> {
|
|
40
|
-
return textureSample(atlasTexture, atlasSampler, input.uv) * input.color;
|
|
41
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// haiyue:builtin-render tilemap2d
|
|
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
|
-
}
|
|
11
|
-
|
|
12
|
-
@group(0) @binding(0) var<uniform> camera : CameraUniforms;
|
|
13
|
-
@group(1) @binding(0) var<uniform> object : ObjectUniforms;
|
|
14
|
-
|
|
15
|
-
struct VertexInput {
|
|
16
|
-
@location(0) position : vec2<f32>,
|
|
17
|
-
@location(1) color : vec4<f32>,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
struct VertexOutput {
|
|
21
|
-
@builtin(position) clipPos : vec4<f32>,
|
|
22
|
-
@location(0) color : vec4<f32>,
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
@vertex
|
|
26
|
-
fn vs_main(input : VertexInput) -> VertexOutput {
|
|
27
|
-
var out : VertexOutput;
|
|
28
|
-
out.clipPos = camera.viewProj * object.model * vec4<f32>(input.position, 0.0, 1.0);
|
|
29
|
-
out.color = input.color;
|
|
30
|
-
return out;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@fragment
|
|
34
|
-
fn fs_main(input : VertexOutput) -> @location(0) vec4<f32> {
|
|
35
|
-
return input.color;
|
|
36
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { Component } from '@haiyue/engine';
|
|
2
|
-
import { UniqueCheckType } from '@haiyue/engine/ecs';
|
|
3
|
-
|
|
4
|
-
export interface Spine2DComponentOptions {
|
|
5
|
-
jsonUrl?: string;
|
|
6
|
-
atlasUrl?: string;
|
|
7
|
-
imageUrl?: string;
|
|
8
|
-
imageUrls?: Record<string, string>;
|
|
9
|
-
skin?: string;
|
|
10
|
-
animation?: string;
|
|
11
|
-
loop?: boolean;
|
|
12
|
-
timeScale?: number;
|
|
13
|
-
scale?: number;
|
|
14
|
-
premultipliedAlpha?: boolean;
|
|
15
|
-
debugMesh?: boolean;
|
|
16
|
-
debugBones?: boolean;
|
|
17
|
-
mixDuration?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type Spine2DStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
21
|
-
|
|
22
|
-
export class Spine2DComponent extends Component {
|
|
23
|
-
static override UniqueCheckType = UniqueCheckType.SYMBOL | UniqueCheckType.REPLACE;
|
|
24
|
-
static override UniqueSymbol = Symbol.for('Spine2DComponent');
|
|
25
|
-
static editor = {
|
|
26
|
-
fields: {
|
|
27
|
-
jsonUrl: { type: 'text', label: 'Skeleton JSON URL' },
|
|
28
|
-
atlasUrl: { type: 'text', label: 'Atlas URL' },
|
|
29
|
-
imageUrl: { type: 'text', label: 'Image URL Override' },
|
|
30
|
-
skin: { type: 'text', label: 'Skin' },
|
|
31
|
-
animation: { type: 'text', label: 'Animation' },
|
|
32
|
-
loop: { type: 'boolean', label: 'Loop' },
|
|
33
|
-
timeScale: { type: 'number', label: 'Time Scale', step: 0.1 },
|
|
34
|
-
scale: { type: 'number', label: 'Scale', min: 0.001, step: 0.1 },
|
|
35
|
-
premultipliedAlpha: { type: 'boolean', label: 'Premultiplied Alpha' },
|
|
36
|
-
debugMesh: { type: 'boolean', label: 'Debug Mesh' },
|
|
37
|
-
debugBones: { type: 'boolean', label: 'Debug Bones' },
|
|
38
|
-
mixDuration: { type: 'number', label: 'Mix Duration', min: 0, step: 0.05 },
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
private _jsonUrl = '';
|
|
43
|
-
private _atlasUrl = '';
|
|
44
|
-
private _imageUrl = '';
|
|
45
|
-
private _imageUrls: Record<string, string> = {};
|
|
46
|
-
private _imageUrlsKey = '{}';
|
|
47
|
-
private _skin = 'default';
|
|
48
|
-
private _sourceKey = '';
|
|
49
|
-
private _sourceKeyDirty = true;
|
|
50
|
-
|
|
51
|
-
animation: string;
|
|
52
|
-
loop: boolean;
|
|
53
|
-
timeScale: number;
|
|
54
|
-
scale: number;
|
|
55
|
-
premultipliedAlpha: boolean;
|
|
56
|
-
debugMesh: boolean;
|
|
57
|
-
debugBones: boolean;
|
|
58
|
-
mixDuration: number;
|
|
59
|
-
|
|
60
|
-
status: Spine2DStatus = 'idle';
|
|
61
|
-
error: string | null = null;
|
|
62
|
-
elapsed = 0;
|
|
63
|
-
previousAnimation = '';
|
|
64
|
-
previousElapsed = 0;
|
|
65
|
-
mixElapsed = 0;
|
|
66
|
-
runtimeKey = '';
|
|
67
|
-
loadingKey = '';
|
|
68
|
-
|
|
69
|
-
constructor(options: Spine2DComponentOptions = {}) {
|
|
70
|
-
super('Spine2DComponent');
|
|
71
|
-
this.jsonUrl = options.jsonUrl ?? '';
|
|
72
|
-
this.atlasUrl = options.atlasUrl ?? '';
|
|
73
|
-
this.imageUrl = options.imageUrl ?? '';
|
|
74
|
-
this.imageUrls = options.imageUrls ?? {};
|
|
75
|
-
this.skin = options.skin ?? 'default';
|
|
76
|
-
this.animation = options.animation ?? '';
|
|
77
|
-
this.loop = options.loop ?? true;
|
|
78
|
-
this.timeScale = options.timeScale ?? 1;
|
|
79
|
-
this.scale = options.scale ?? 1;
|
|
80
|
-
this.premultipliedAlpha = options.premultipliedAlpha ?? false;
|
|
81
|
-
this.debugMesh = options.debugMesh ?? false;
|
|
82
|
-
this.debugBones = options.debugBones ?? false;
|
|
83
|
-
this.mixDuration = options.mixDuration ?? 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
get jsonUrl(): string {
|
|
87
|
-
return this._jsonUrl;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
set jsonUrl(value: string) {
|
|
91
|
-
if (this._jsonUrl === value) return;
|
|
92
|
-
this._jsonUrl = value;
|
|
93
|
-
this.invalidateSourceKey(false);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
get atlasUrl(): string {
|
|
97
|
-
return this._atlasUrl;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
set atlasUrl(value: string) {
|
|
101
|
-
if (this._atlasUrl === value) return;
|
|
102
|
-
this._atlasUrl = value;
|
|
103
|
-
this.invalidateSourceKey(false);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
get imageUrl(): string {
|
|
107
|
-
return this._imageUrl;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
set imageUrl(value: string) {
|
|
111
|
-
if (this._imageUrl === value) return;
|
|
112
|
-
this._imageUrl = value;
|
|
113
|
-
this.invalidateSourceKey(false);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
get imageUrls(): Record<string, string> {
|
|
117
|
-
return this._imageUrls;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
set imageUrls(value: Record<string, string>) {
|
|
121
|
-
if (this._imageUrls === value) return;
|
|
122
|
-
this._imageUrls = value;
|
|
123
|
-
this._imageUrlsKey = JSON.stringify(value);
|
|
124
|
-
this.invalidateSourceKey(false);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
get skin(): string {
|
|
128
|
-
return this._skin;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
set skin(value: string) {
|
|
132
|
-
if (this._skin === value) return;
|
|
133
|
-
this._skin = value;
|
|
134
|
-
this.invalidateSourceKey(false);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
get sourceKey(): string {
|
|
138
|
-
if (this._sourceKeyDirty) {
|
|
139
|
-
this._sourceKey = `${this._jsonUrl}|${this._atlasUrl}|${this._imageUrl}|${this._imageUrlsKey}|${this._skin}`;
|
|
140
|
-
this._sourceKeyDirty = false;
|
|
141
|
-
}
|
|
142
|
-
return this._sourceKey;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
invalidateSourceKey(refreshImageUrlsKey = true): this {
|
|
146
|
-
if (refreshImageUrlsKey) this._imageUrlsKey = JSON.stringify(this._imageUrls);
|
|
147
|
-
this._sourceKeyDirty = true;
|
|
148
|
-
return this;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
override clone(): Spine2DComponent {
|
|
152
|
-
return new Spine2DComponent({
|
|
153
|
-
jsonUrl: this.jsonUrl,
|
|
154
|
-
atlasUrl: this.atlasUrl,
|
|
155
|
-
imageUrl: this.imageUrl,
|
|
156
|
-
imageUrls: { ...this.imageUrls },
|
|
157
|
-
skin: this.skin,
|
|
158
|
-
animation: this.animation,
|
|
159
|
-
loop: this.loop,
|
|
160
|
-
timeScale: this.timeScale,
|
|
161
|
-
scale: this.scale,
|
|
162
|
-
premultipliedAlpha: this.premultipliedAlpha,
|
|
163
|
-
debugMesh: this.debugMesh,
|
|
164
|
-
debugBones: this.debugBones,
|
|
165
|
-
mixDuration: this.mixDuration,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|