@zephyr3d/scene 0.8.2 → 0.9.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/dist/animation/animationset.js +473 -60
- package/dist/animation/animationset.js.map +1 -1
- package/dist/animation/cloth/gpu_cloth_system.js +2516 -0
- package/dist/animation/cloth/gpu_cloth_system.js.map +1 -0
- package/dist/animation/fixed_geometry_cache_track.js +138 -0
- package/dist/animation/fixed_geometry_cache_track.js.map +1 -0
- package/dist/animation/geometry_cache_utils.js +120 -0
- package/dist/animation/geometry_cache_utils.js.map +1 -0
- package/dist/animation/ik_modifier.js +9 -1
- package/dist/animation/ik_modifier.js.map +1 -1
- package/dist/animation/joint_dynamics/collision.js +469 -0
- package/dist/animation/joint_dynamics/collision.js.map +1 -0
- package/dist/animation/joint_dynamics/constraints.js +329 -0
- package/dist/animation/joint_dynamics/constraints.js.map +1 -0
- package/dist/animation/joint_dynamics/controller.js +699 -0
- package/dist/animation/joint_dynamics/controller.js.map +1 -0
- package/dist/animation/joint_dynamics/joint_dynamics_system.js +393 -0
- package/dist/animation/joint_dynamics/joint_dynamics_system.js.map +1 -0
- package/dist/animation/joint_dynamics/solver.js +794 -0
- package/dist/animation/joint_dynamics/solver.js.map +1 -0
- package/dist/animation/joint_dynamics/types.js +19 -0
- package/dist/animation/joint_dynamics/types.js.map +1 -0
- package/dist/animation/joint_dynamics/vrm_spring_bone.js +46 -0
- package/dist/animation/joint_dynamics/vrm_spring_bone.js.map +1 -0
- package/dist/animation/joint_dynamics_modifier.js +51 -0
- package/dist/animation/joint_dynamics_modifier.js.map +1 -0
- package/dist/animation/pca_geometry_cache_track.js +222 -0
- package/dist/animation/pca_geometry_cache_track.js.map +1 -0
- package/dist/animation/skeleton.js +2011 -139
- package/dist/animation/skeleton.js.map +1 -1
- package/dist/animation/skeleton_modifier.js +3 -5
- package/dist/animation/skeleton_modifier.js.map +1 -1
- package/dist/animation/spring/multi_chain_spring_system.js +2 -0
- package/dist/animation/spring/multi_chain_spring_system.js.map +1 -1
- package/dist/animation/spring/spring_chain.js +3 -2
- package/dist/animation/spring/spring_chain.js.map +1 -1
- package/dist/animation/spring/spring_collider.js +35 -5
- package/dist/animation/spring/spring_collider.js.map +1 -1
- package/dist/animation/spring/spring_particle.js +1 -0
- package/dist/animation/spring/spring_particle.js.map +1 -1
- package/dist/animation/spring/spring_system.js +325 -28
- package/dist/animation/spring/spring_system.js.map +1 -1
- package/dist/animation/spring2/collision.js +469 -0
- package/dist/animation/spring2/collision.js.map +1 -0
- package/dist/animation/spring2/constraints.js +329 -0
- package/dist/animation/spring2/constraints.js.map +1 -0
- package/dist/animation/spring2/controller.js +434 -0
- package/dist/animation/spring2/controller.js.map +1 -0
- package/dist/animation/spring2/math.js +16 -0
- package/dist/animation/spring2/math.js.map +1 -0
- package/dist/animation/spring2/solver.js +624 -0
- package/dist/animation/spring2/solver.js.map +1 -0
- package/dist/animation/spring2/spring_system.js +118 -0
- package/dist/animation/spring2/spring_system.js.map +1 -0
- package/dist/animation/spring2/types.js +19 -0
- package/dist/animation/spring2/types.js.map +1 -0
- package/dist/animation/spring_modifier.js +17 -1
- package/dist/animation/spring_modifier.js.map +1 -1
- package/dist/app/engine.js +42 -15
- package/dist/app/engine.js.map +1 -1
- package/dist/app/runtimescript.js +132 -1
- package/dist/app/runtimescript.js.map +1 -1
- package/dist/app/screen.js +3 -3
- package/dist/app/screen.js.map +1 -1
- package/dist/app/scriptingsystem.js +69 -37
- package/dist/app/scriptingsystem.js.map +1 -1
- package/dist/app/scriptregistry.js +157 -146
- package/dist/app/scriptregistry.js.map +1 -1
- package/dist/asset/assetmanager.js +2 -1
- package/dist/asset/assetmanager.js.map +1 -1
- package/dist/asset/loaders/zabc/zabc_loader.js +570 -0
- package/dist/asset/loaders/zabc/zabc_loader.js.map +1 -0
- package/dist/asset/model.js +192 -0
- package/dist/asset/model.js.map +1 -1
- package/dist/camera/base.js +26 -7
- package/dist/camera/base.js.map +1 -1
- package/dist/camera/camera.js +146 -24
- package/dist/camera/camera.js.map +1 -1
- package/dist/camera/fps.js +2 -2
- package/dist/camera/fps.js.map +1 -1
- package/dist/camera/orbit.js +2 -2
- package/dist/camera/orbit.js.map +1 -1
- package/dist/index.d.ts +11728 -8535
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/dist/material/lambert.js +1 -1
- package/dist/material/lambert.js.map +1 -1
- package/dist/material/material.js +9 -3
- package/dist/material/material.js.map +1 -1
- package/dist/material/meshmaterial.js +54 -7
- package/dist/material/meshmaterial.js.map +1 -1
- package/dist/material/mixins/lightmodel/blinnphong.js +17 -7
- package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
- package/dist/material/mixins/lightmodel/lambert.js +7 -2
- package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +108 -16
- package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js +222 -14
- package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js +24 -12
- package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
- package/dist/material/mixins/lit.js +11 -8
- package/dist/material/mixins/lit.js.map +1 -1
- package/dist/material/mixins/pbr/common.js +72 -5
- package/dist/material/mixins/pbr/common.js.map +1 -1
- package/dist/material/pbrblueprint.js +148 -1
- package/dist/material/pbrblueprint.js.map +1 -1
- package/dist/material/pbrmr.js +125 -2
- package/dist/material/pbrmr.js.map +1 -1
- package/dist/material/shader/helper.js +10 -4
- package/dist/material/shader/helper.js.map +1 -1
- package/dist/material/water.js +2 -2
- package/dist/material/water.js.map +1 -1
- package/dist/posteffect/coloradjust.js +145 -0
- package/dist/posteffect/coloradjust.js.map +1 -0
- package/dist/posteffect/taa.js +68 -32
- package/dist/posteffect/taa.js.map +1 -1
- package/dist/render/cluster_light.js +17 -12
- package/dist/render/cluster_light.js.map +1 -1
- package/dist/render/deferredlightpass.js +510 -0
- package/dist/render/deferredlightpass.js.map +1 -0
- package/dist/render/deferredshadowlightpass.js +428 -0
- package/dist/render/deferredshadowlightpass.js.map +1 -0
- package/dist/render/drawable.js.map +1 -1
- package/dist/render/drawable_mixin.js +21 -12
- package/dist/render/drawable_mixin.js.map +1 -1
- package/dist/render/envlight.js +20 -22
- package/dist/render/envlight.js.map +1 -1
- package/dist/render/gbufferpass.js +50 -0
- package/dist/render/gbufferpass.js.map +1 -0
- package/dist/render/lightpass.js +1 -2
- package/dist/render/lightpass.js.map +1 -1
- package/dist/render/primitive.js +1 -1
- package/dist/render/primitive.js.map +1 -1
- package/dist/render/render_queue.js +3 -2
- package/dist/render/render_queue.js.map +1 -1
- package/dist/render/renderer.js +5 -358
- package/dist/render/renderer.js.map +1 -1
- package/dist/render/rendergraph/executor.js +15 -12
- package/dist/render/rendergraph/executor.js.map +1 -1
- package/dist/render/rendergraph/forward_plus_builder.js +144 -88
- package/dist/render/rendergraph/forward_plus_builder.js.map +1 -1
- package/dist/render/rendergraph/history_resource_manager.js +178 -0
- package/dist/render/rendergraph/history_resource_manager.js.map +1 -0
- package/dist/render/rendergraph/rendergraph.js +12 -1
- package/dist/render/rendergraph/rendergraph.js.map +1 -1
- package/dist/render/rendergraph/types.js +2 -2
- package/dist/render/rendergraph/types.js.map +1 -1
- package/dist/render/sky.js +26 -9
- package/dist/render/sky.js.map +1 -1
- package/dist/scene/basesprite.js +4 -3
- package/dist/scene/basesprite.js.map +1 -1
- package/dist/scene/batchgroup.js +4 -4
- package/dist/scene/environment.js +7 -4
- package/dist/scene/environment.js.map +1 -1
- package/dist/scene/light.js +184 -18
- package/dist/scene/light.js.map +1 -1
- package/dist/scene/mesh.js +30 -0
- package/dist/scene/mesh.js.map +1 -1
- package/dist/scene/particlesys.js +3 -2
- package/dist/scene/particlesys.js.map +1 -1
- package/dist/scene/raycast_visitor.js +29 -3
- package/dist/scene/raycast_visitor.js.map +1 -1
- package/dist/scene/scene.js +86 -19
- package/dist/scene/scene.js.map +1 -1
- package/dist/scene/scene_node.js +87 -31
- package/dist/scene/scene_node.js.map +1 -1
- package/dist/scene/script_attachment.js +59 -0
- package/dist/scene/script_attachment.js.map +1 -0
- package/dist/scene/terrain-cm/grass.js +3 -2
- package/dist/scene/terrain-cm/grass.js.map +1 -1
- package/dist/scene/terrain-cm/terrain-cm.js +4 -3
- package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
- package/dist/scene/water.js +3 -2
- package/dist/scene/water.js.map +1 -1
- package/dist/shaders/shadow.js +2 -2
- package/dist/shaders/shadow.js.map +1 -1
- package/dist/shadow/shadowmapper.js +74 -4
- package/dist/shadow/shadowmapper.js.map +1 -1
- package/dist/shapes/box.js +163 -0
- package/dist/shapes/box.js.map +1 -1
- package/dist/shapes/capsule.js +216 -0
- package/dist/shapes/capsule.js.map +1 -0
- package/dist/shapes/cylinder.js +91 -0
- package/dist/shapes/cylinder.js.map +1 -1
- package/dist/shapes/plane.js +32 -0
- package/dist/shapes/plane.js.map +1 -1
- package/dist/shapes/tetrahedron.js +211 -0
- package/dist/shapes/tetrahedron.js.map +1 -1
- package/dist/shapes/torus.js +173 -0
- package/dist/shapes/torus.js.map +1 -1
- package/dist/utility/blueprint/common/math.js +111 -1
- package/dist/utility/blueprint/common/math.js.map +1 -1
- package/dist/utility/blueprint/material/inputs.js +235 -1
- package/dist/utility/blueprint/material/inputs.js.map +1 -1
- package/dist/utility/blueprint/material/ir.js +154 -10
- package/dist/utility/blueprint/material/ir.js.map +1 -1
- package/dist/utility/blueprint/material/texture.js +273 -19
- package/dist/utility/blueprint/material/texture.js.map +1 -1
- package/dist/utility/serialization/json.js +12 -2
- package/dist/utility/serialization/json.js.map +1 -1
- package/dist/utility/serialization/manager.js +30 -11
- package/dist/utility/serialization/manager.js.map +1 -1
- package/dist/utility/serialization/scene/animation.js +250 -7
- package/dist/utility/serialization/scene/animation.js.map +1 -1
- package/dist/utility/serialization/scene/batch.js +4 -2
- package/dist/utility/serialization/scene/batch.js.map +1 -1
- package/dist/utility/serialization/scene/camera.js +154 -2
- package/dist/utility/serialization/scene/camera.js.map +1 -1
- package/dist/utility/serialization/scene/cloth_script.js +834 -0
- package/dist/utility/serialization/scene/cloth_script.js.map +1 -0
- package/dist/utility/serialization/scene/common.js +7 -0
- package/dist/utility/serialization/scene/common.js.map +1 -1
- package/dist/utility/serialization/scene/light.js +120 -4
- package/dist/utility/serialization/scene/light.js.map +1 -1
- package/dist/utility/serialization/scene/material.js +453 -1
- package/dist/utility/serialization/scene/material.js.map +1 -1
- package/dist/utility/serialization/scene/mesh.js +4 -2
- package/dist/utility/serialization/scene/mesh.js.map +1 -1
- package/dist/utility/serialization/scene/node.js +298 -10
- package/dist/utility/serialization/scene/node.js.map +1 -1
- package/dist/utility/serialization/scene/particle.js +4 -2
- package/dist/utility/serialization/scene/particle.js.map +1 -1
- package/dist/utility/serialization/scene/primitive.js +100 -3
- package/dist/utility/serialization/scene/primitive.js.map +1 -1
- package/dist/utility/serialization/scene/scene.js +130 -3
- package/dist/utility/serialization/scene/scene.js.map +1 -1
- package/dist/utility/serialization/scene/script.js +66 -0
- package/dist/utility/serialization/scene/script.js.map +1 -0
- package/dist/utility/serialization/scene/spring_script.js +596 -0
- package/dist/utility/serialization/scene/spring_script.js.map +1 -0
- package/dist/utility/serialization/scene/sprite.js +5 -3
- package/dist/utility/serialization/scene/sprite.js.map +1 -1
- package/dist/utility/serialization/scene/terrain.js +4 -2
- package/dist/utility/serialization/scene/terrain.js.map +1 -1
- package/dist/utility/serialization/scene/water.js +4 -2
- package/dist/utility/serialization/scene/water.js.map +1 -1
- package/dist/utility/serialization/types.js.map +1 -1
- package/dist/values.js +5 -1
- package/dist/values.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,834 @@
|
|
|
1
|
+
import { createGPUClothWrapBindingData } from '../../../animation/cloth/gpu_cloth_system.js';
|
|
2
|
+
import { defineProps } from '../types.js';
|
|
3
|
+
|
|
4
|
+
const clothConfigHostMap = new WeakMap();
|
|
5
|
+
const clothTargetHostMap = new WeakMap();
|
|
6
|
+
const clothTargetOwnerMap = new WeakMap();
|
|
7
|
+
function clamp01(value) {
|
|
8
|
+
return Math.min(Math.max(value, 0), 1);
|
|
9
|
+
}
|
|
10
|
+
function normalizePlaneDirection(value) {
|
|
11
|
+
return value < 0 ? -1 : 1;
|
|
12
|
+
}
|
|
13
|
+
function resolveClothHostScope(host) {
|
|
14
|
+
return typeof host?.getPrefabNode === 'function' && host.getPrefabNode() || host.scene?.rootNode || host;
|
|
15
|
+
}
|
|
16
|
+
function resolveClothMeshById(host, meshId) {
|
|
17
|
+
const id = String(meshId ?? '').trim();
|
|
18
|
+
if (!host || !id) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const scope = resolveClothHostScope(host);
|
|
22
|
+
const candidate = scope?.findNodeById?.(id);
|
|
23
|
+
return candidate?.isMesh?.() && candidate.primitive ? candidate : null;
|
|
24
|
+
}
|
|
25
|
+
function resolveClothMeshLabel(host, meshId) {
|
|
26
|
+
const id = String(meshId ?? '').trim();
|
|
27
|
+
if (!id) {
|
|
28
|
+
return '';
|
|
29
|
+
}
|
|
30
|
+
const mesh = resolveClothMeshById(host, id);
|
|
31
|
+
if (mesh) {
|
|
32
|
+
const name = String(mesh.name ?? '').trim();
|
|
33
|
+
return name || mesh.persistentId || id;
|
|
34
|
+
}
|
|
35
|
+
return `[Missing] ${id}`;
|
|
36
|
+
}
|
|
37
|
+
function getClothConfigHost(config) {
|
|
38
|
+
return clothConfigHostMap.get(config) ?? null;
|
|
39
|
+
}
|
|
40
|
+
function getClothTargetHost(target) {
|
|
41
|
+
const owner = clothTargetOwnerMap.get(target);
|
|
42
|
+
return clothTargetHostMap.get(target) ?? (owner ? clothConfigHostMap.get(owner) : null) ?? null;
|
|
43
|
+
}
|
|
44
|
+
function setClothTargetOwner(target, owner, host) {
|
|
45
|
+
clothTargetOwnerMap.set(target, owner);
|
|
46
|
+
if (host) {
|
|
47
|
+
clothTargetHostMap.set(target, host);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function clearClothTargetBinding(target) {
|
|
51
|
+
target.bindingData = '';
|
|
52
|
+
target.bindingSignature = '';
|
|
53
|
+
}
|
|
54
|
+
function clearClothBindings(config) {
|
|
55
|
+
for (const target of config.targetMeshes){
|
|
56
|
+
clearClothTargetBinding(target);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function setClothBindingStatus(config, status) {
|
|
60
|
+
config.bindingStatus = status;
|
|
61
|
+
}
|
|
62
|
+
function ensureDefaultTargetMeshEntry(config) {
|
|
63
|
+
if (config.targetMeshes.length === 0) {
|
|
64
|
+
const target = new ClothTargetMeshConfig();
|
|
65
|
+
config.targetMeshes.push(target);
|
|
66
|
+
setClothTargetOwner(target, config, getClothConfigHost(config));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function invalidateClothBindings(config, status = 'Binding cache needs rebuild') {
|
|
70
|
+
clearClothBindings(config);
|
|
71
|
+
setClothBindingStatus(config, status);
|
|
72
|
+
}
|
|
73
|
+
async function bindClothTargetMeshes(config) {
|
|
74
|
+
const host = getClothConfigHost(config);
|
|
75
|
+
if (config.bindingInProgress) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const simulationMesh = resolveClothMeshById(host, config.simulationMeshId) || (host?.isMesh?.() && host.primitive ? host : null);
|
|
79
|
+
if (!simulationMesh) {
|
|
80
|
+
setClothBindingStatus(config, 'Set Simulation Mesh before binding.');
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const targetEntries = config.targetMeshes.filter((entry)=>String(entry.meshId ?? '').trim().length > 0);
|
|
84
|
+
if (targetEntries.length === 0) {
|
|
85
|
+
setClothBindingStatus(config, 'Add at least one Target Mesh before binding.');
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
config.bindingInProgress = true;
|
|
89
|
+
setClothBindingStatus(config, 'Binding target meshes...');
|
|
90
|
+
let successCount = 0;
|
|
91
|
+
const failedTargets = [];
|
|
92
|
+
try {
|
|
93
|
+
for (const entry of targetEntries){
|
|
94
|
+
const targetMesh = resolveClothMeshById(getClothTargetHost(entry), entry.meshId);
|
|
95
|
+
if (!targetMesh) {
|
|
96
|
+
clearClothTargetBinding(entry);
|
|
97
|
+
failedTargets.push(resolveClothMeshLabel(host, entry.meshId));
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (targetMesh === simulationMesh) {
|
|
101
|
+
clearClothTargetBinding(entry);
|
|
102
|
+
failedTargets.push(resolveClothMeshLabel(host, entry.meshId));
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const data = await createGPUClothWrapBindingData(simulationMesh, targetMesh);
|
|
107
|
+
entry.bindingData = JSON.stringify(data);
|
|
108
|
+
entry.bindingSignature = `${data.version}:${data.vertexCount}:${data.sourceVertexCount}:${data.influenceCount}`;
|
|
109
|
+
successCount++;
|
|
110
|
+
} catch (err) {
|
|
111
|
+
clearClothTargetBinding(entry);
|
|
112
|
+
failedTargets.push(`${resolveClothMeshLabel(host, entry.meshId)}: ${err instanceof Error ? err.message : String(err)}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
} finally{
|
|
116
|
+
config.bindingInProgress = false;
|
|
117
|
+
}
|
|
118
|
+
if (successCount > 0 && failedTargets.length === 0) {
|
|
119
|
+
setClothBindingStatus(config, `Bound ${successCount} target mesh(es).`);
|
|
120
|
+
} else if (successCount > 0) {
|
|
121
|
+
setClothBindingStatus(config, `Bound ${successCount} target mesh(es), ${failedTargets.length} failed: ${failedTargets.join('; ')}`);
|
|
122
|
+
} else {
|
|
123
|
+
setClothBindingStatus(config, failedTargets[0] || 'Binding failed.');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function bindClothScriptConfigHost(config, host) {
|
|
127
|
+
clothConfigHostMap.set(config, host);
|
|
128
|
+
ensureDefaultTargetMeshEntry(config);
|
|
129
|
+
for (const target of config.targetMeshes){
|
|
130
|
+
setClothTargetOwner(target, config, host);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
class ClothColliderConfig {
|
|
134
|
+
type;
|
|
135
|
+
enabled;
|
|
136
|
+
bone;
|
|
137
|
+
offsetX;
|
|
138
|
+
offsetY;
|
|
139
|
+
offsetZ;
|
|
140
|
+
endOffsetX;
|
|
141
|
+
endOffsetY;
|
|
142
|
+
endOffsetZ;
|
|
143
|
+
normalX;
|
|
144
|
+
normalY;
|
|
145
|
+
normalZ;
|
|
146
|
+
radius;
|
|
147
|
+
constructor(type = 'sphere'){
|
|
148
|
+
this.type = type;
|
|
149
|
+
this.enabled = true;
|
|
150
|
+
this.bone = '';
|
|
151
|
+
this.offsetX = 0;
|
|
152
|
+
this.offsetY = 0;
|
|
153
|
+
this.offsetZ = 0;
|
|
154
|
+
this.endOffsetX = 0;
|
|
155
|
+
this.endOffsetY = 0.2;
|
|
156
|
+
this.endOffsetZ = 0;
|
|
157
|
+
this.normalX = 0;
|
|
158
|
+
this.normalY = 1;
|
|
159
|
+
this.normalZ = 0;
|
|
160
|
+
this.radius = 0.15;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
class ClothTargetMeshConfig {
|
|
164
|
+
meshId;
|
|
165
|
+
bindingData;
|
|
166
|
+
bindingSignature;
|
|
167
|
+
constructor(){
|
|
168
|
+
this.meshId = '';
|
|
169
|
+
this.bindingData = '';
|
|
170
|
+
this.bindingSignature = '';
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
class ClothScriptConfig {
|
|
174
|
+
enabled;
|
|
175
|
+
autoUpdate;
|
|
176
|
+
simulationMeshId;
|
|
177
|
+
targetMeshes;
|
|
178
|
+
bindingStatus;
|
|
179
|
+
bindingInProgress;
|
|
180
|
+
damping;
|
|
181
|
+
dynamicFriction;
|
|
182
|
+
staticFriction;
|
|
183
|
+
stiffness;
|
|
184
|
+
poseFollow;
|
|
185
|
+
substeps;
|
|
186
|
+
gravityX;
|
|
187
|
+
gravityY;
|
|
188
|
+
gravityZ;
|
|
189
|
+
solverIterations;
|
|
190
|
+
vertexPinWeightsByTarget;
|
|
191
|
+
pinnedVertexIndicesByTarget;
|
|
192
|
+
maxNeighbors;
|
|
193
|
+
maxTrianglesPerVertex;
|
|
194
|
+
workgroupSize;
|
|
195
|
+
rebuildNormals;
|
|
196
|
+
colliders;
|
|
197
|
+
constructor(){
|
|
198
|
+
this.enabled = true;
|
|
199
|
+
this.autoUpdate = true;
|
|
200
|
+
this.simulationMeshId = '';
|
|
201
|
+
this.targetMeshes = [
|
|
202
|
+
new ClothTargetMeshConfig()
|
|
203
|
+
];
|
|
204
|
+
this.bindingStatus = 'Binding cache needs rebuild';
|
|
205
|
+
this.bindingInProgress = false;
|
|
206
|
+
this.damping = 0.02;
|
|
207
|
+
this.dynamicFriction = 0.15;
|
|
208
|
+
this.staticFriction = 0.3;
|
|
209
|
+
this.stiffness = 0.3;
|
|
210
|
+
this.poseFollow = 0;
|
|
211
|
+
this.substeps = 2;
|
|
212
|
+
this.gravityX = 0;
|
|
213
|
+
this.gravityY = -9.8;
|
|
214
|
+
this.gravityZ = 0;
|
|
215
|
+
this.solverIterations = 5;
|
|
216
|
+
this.vertexPinWeightsByTarget = '';
|
|
217
|
+
this.pinnedVertexIndicesByTarget = '';
|
|
218
|
+
this.maxNeighbors = 8;
|
|
219
|
+
this.maxTrianglesPerVertex = 16;
|
|
220
|
+
this.workgroupSize = 64;
|
|
221
|
+
this.rebuildNormals = true;
|
|
222
|
+
this.colliders = [];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
function getClothColliderConfigClass() {
|
|
226
|
+
return {
|
|
227
|
+
ctor: ClothColliderConfig,
|
|
228
|
+
name: 'ClothColliderConfig',
|
|
229
|
+
noTitle: true,
|
|
230
|
+
createFunc () {
|
|
231
|
+
return {
|
|
232
|
+
obj: new ClothColliderConfig()
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
getProps () {
|
|
236
|
+
return defineProps([
|
|
237
|
+
{
|
|
238
|
+
name: 'Type',
|
|
239
|
+
type: 'string',
|
|
240
|
+
options: {
|
|
241
|
+
group: 'Shape',
|
|
242
|
+
enum: {
|
|
243
|
+
labels: [
|
|
244
|
+
'Sphere',
|
|
245
|
+
'Capsule',
|
|
246
|
+
'Plane'
|
|
247
|
+
],
|
|
248
|
+
values: [
|
|
249
|
+
'sphere',
|
|
250
|
+
'capsule',
|
|
251
|
+
'plane'
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
get (value) {
|
|
256
|
+
value.str[0] = this.type;
|
|
257
|
+
},
|
|
258
|
+
set (value) {
|
|
259
|
+
this.type = value.str[0] ?? 'sphere';
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
name: 'Enabled',
|
|
264
|
+
type: 'bool',
|
|
265
|
+
options: {
|
|
266
|
+
group: 'General'
|
|
267
|
+
},
|
|
268
|
+
get (value) {
|
|
269
|
+
value.bool[0] = this.enabled;
|
|
270
|
+
},
|
|
271
|
+
set (value) {
|
|
272
|
+
this.enabled = !!value.bool[0];
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: 'Bone',
|
|
277
|
+
type: 'string',
|
|
278
|
+
options: {
|
|
279
|
+
group: 'General'
|
|
280
|
+
},
|
|
281
|
+
get (value) {
|
|
282
|
+
value.str[0] = this.bone;
|
|
283
|
+
},
|
|
284
|
+
set (value) {
|
|
285
|
+
this.bone = value.str[0] ?? '';
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: 'Offset',
|
|
290
|
+
type: 'vec3',
|
|
291
|
+
options: {
|
|
292
|
+
group: 'Shape'
|
|
293
|
+
},
|
|
294
|
+
isValid () {
|
|
295
|
+
return this.type !== 'plane';
|
|
296
|
+
},
|
|
297
|
+
get (value) {
|
|
298
|
+
value.num[0] = this.offsetX;
|
|
299
|
+
value.num[1] = this.offsetY;
|
|
300
|
+
value.num[2] = this.offsetZ;
|
|
301
|
+
},
|
|
302
|
+
set (value) {
|
|
303
|
+
this.offsetX = value.num[0];
|
|
304
|
+
this.offsetY = value.num[1];
|
|
305
|
+
this.offsetZ = value.num[2];
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: 'EndOffset',
|
|
310
|
+
type: 'vec3',
|
|
311
|
+
options: {
|
|
312
|
+
group: 'Shape'
|
|
313
|
+
},
|
|
314
|
+
isValid () {
|
|
315
|
+
return this.type === 'capsule';
|
|
316
|
+
},
|
|
317
|
+
get (value) {
|
|
318
|
+
value.num[0] = this.endOffsetX;
|
|
319
|
+
value.num[1] = this.endOffsetY;
|
|
320
|
+
value.num[2] = this.endOffsetZ;
|
|
321
|
+
},
|
|
322
|
+
set (value) {
|
|
323
|
+
this.endOffsetX = value.num[0];
|
|
324
|
+
this.endOffsetY = value.num[1];
|
|
325
|
+
this.endOffsetZ = value.num[2];
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
name: 'Radius',
|
|
330
|
+
type: 'float',
|
|
331
|
+
options: {
|
|
332
|
+
group: 'Shape',
|
|
333
|
+
minValue: 0
|
|
334
|
+
},
|
|
335
|
+
isValid () {
|
|
336
|
+
return this.type !== 'plane';
|
|
337
|
+
},
|
|
338
|
+
get (value) {
|
|
339
|
+
value.num[0] = this.radius;
|
|
340
|
+
},
|
|
341
|
+
set (value) {
|
|
342
|
+
this.radius = value.num[0];
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: 'Normal',
|
|
347
|
+
type: 'float',
|
|
348
|
+
options: {
|
|
349
|
+
group: 'Shape',
|
|
350
|
+
minValue: -1,
|
|
351
|
+
maxValue: 1
|
|
352
|
+
},
|
|
353
|
+
isValid () {
|
|
354
|
+
return this.type === 'plane';
|
|
355
|
+
},
|
|
356
|
+
get (value) {
|
|
357
|
+
value.num[0] = this.normalY;
|
|
358
|
+
},
|
|
359
|
+
set (value) {
|
|
360
|
+
this.normalX = 0;
|
|
361
|
+
this.normalY = normalizePlaneDirection(value.num[0]);
|
|
362
|
+
this.normalZ = 0;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
]);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function getClothTargetMeshConfigClass() {
|
|
370
|
+
return {
|
|
371
|
+
ctor: ClothTargetMeshConfig,
|
|
372
|
+
name: 'ClothTargetMeshConfig',
|
|
373
|
+
noTitle: true,
|
|
374
|
+
createFunc () {
|
|
375
|
+
return {
|
|
376
|
+
obj: new ClothTargetMeshConfig()
|
|
377
|
+
};
|
|
378
|
+
},
|
|
379
|
+
getProps () {
|
|
380
|
+
return defineProps([
|
|
381
|
+
{
|
|
382
|
+
name: 'TargetMesh',
|
|
383
|
+
type: 'string',
|
|
384
|
+
options: {
|
|
385
|
+
sceneNode: {
|
|
386
|
+
kind: 'mesh'
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
isPersistent () {
|
|
390
|
+
return false;
|
|
391
|
+
},
|
|
392
|
+
get (value) {
|
|
393
|
+
value.str[0] = resolveClothMeshLabel(getClothTargetHost(this), this.meshId);
|
|
394
|
+
},
|
|
395
|
+
set (value) {
|
|
396
|
+
const nextId = String(value.str[0] ?? '').trim();
|
|
397
|
+
if (this.meshId !== nextId) {
|
|
398
|
+
this.meshId = nextId;
|
|
399
|
+
clearClothTargetBinding(this);
|
|
400
|
+
const owner = clothTargetOwnerMap.get(this);
|
|
401
|
+
if (owner) {
|
|
402
|
+
setClothBindingStatus(owner, 'Binding cache needs rebuild');
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: 'MeshId',
|
|
409
|
+
type: 'string',
|
|
410
|
+
isHidden () {
|
|
411
|
+
return true;
|
|
412
|
+
},
|
|
413
|
+
get (value) {
|
|
414
|
+
value.str[0] = this.meshId;
|
|
415
|
+
},
|
|
416
|
+
set (value) {
|
|
417
|
+
this.meshId = value.str[0] ?? '';
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
name: 'BindingData',
|
|
422
|
+
type: 'string',
|
|
423
|
+
isHidden () {
|
|
424
|
+
return true;
|
|
425
|
+
},
|
|
426
|
+
get (value) {
|
|
427
|
+
value.str[0] = this.bindingData;
|
|
428
|
+
},
|
|
429
|
+
set (value) {
|
|
430
|
+
this.bindingData = value.str[0] ?? '';
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
name: 'BindingSignature',
|
|
435
|
+
type: 'string',
|
|
436
|
+
isHidden () {
|
|
437
|
+
return true;
|
|
438
|
+
},
|
|
439
|
+
get (value) {
|
|
440
|
+
value.str[0] = this.bindingSignature;
|
|
441
|
+
},
|
|
442
|
+
set (value) {
|
|
443
|
+
this.bindingSignature = value.str[0] ?? '';
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
]);
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
function getClothScriptConfigClass() {
|
|
451
|
+
return {
|
|
452
|
+
ctor: ClothScriptConfig,
|
|
453
|
+
name: 'ClothScriptConfig',
|
|
454
|
+
noTitle: true,
|
|
455
|
+
createFunc () {
|
|
456
|
+
return {
|
|
457
|
+
obj: new ClothScriptConfig()
|
|
458
|
+
};
|
|
459
|
+
},
|
|
460
|
+
getProps () {
|
|
461
|
+
return defineProps([
|
|
462
|
+
{
|
|
463
|
+
name: 'Enabled',
|
|
464
|
+
type: 'bool',
|
|
465
|
+
options: {
|
|
466
|
+
group: 'General'
|
|
467
|
+
},
|
|
468
|
+
get (value) {
|
|
469
|
+
value.bool[0] = this.enabled;
|
|
470
|
+
},
|
|
471
|
+
set (value) {
|
|
472
|
+
this.enabled = !!value.bool[0];
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
name: 'AutoUpdate',
|
|
477
|
+
type: 'bool',
|
|
478
|
+
options: {
|
|
479
|
+
group: 'General'
|
|
480
|
+
},
|
|
481
|
+
get (value) {
|
|
482
|
+
value.bool[0] = this.autoUpdate;
|
|
483
|
+
},
|
|
484
|
+
set (value) {
|
|
485
|
+
this.autoUpdate = !!value.bool[0];
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
name: 'SimulationMesh',
|
|
490
|
+
type: 'string',
|
|
491
|
+
options: {
|
|
492
|
+
group: 'General',
|
|
493
|
+
sceneNode: {
|
|
494
|
+
kind: 'mesh'
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
isPersistent () {
|
|
498
|
+
return false;
|
|
499
|
+
},
|
|
500
|
+
get (value) {
|
|
501
|
+
value.str[0] = resolveClothMeshLabel(getClothConfigHost(this), this.simulationMeshId);
|
|
502
|
+
},
|
|
503
|
+
set (value) {
|
|
504
|
+
const nextId = String(value.str[0] ?? '').trim();
|
|
505
|
+
if (this.simulationMeshId !== nextId) {
|
|
506
|
+
this.simulationMeshId = nextId;
|
|
507
|
+
invalidateClothBindings(this);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
name: 'SimulationMeshId',
|
|
513
|
+
type: 'string',
|
|
514
|
+
isHidden () {
|
|
515
|
+
return true;
|
|
516
|
+
},
|
|
517
|
+
get (value) {
|
|
518
|
+
value.str[0] = this.simulationMeshId;
|
|
519
|
+
},
|
|
520
|
+
set (value) {
|
|
521
|
+
this.simulationMeshId = value.str[0] ?? '';
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: 'TargetMesh',
|
|
526
|
+
type: 'object_array',
|
|
527
|
+
options: {
|
|
528
|
+
group: 'Binding',
|
|
529
|
+
objectTypes: [
|
|
530
|
+
ClothTargetMeshConfig
|
|
531
|
+
],
|
|
532
|
+
inlineObjectArray: true
|
|
533
|
+
},
|
|
534
|
+
get (value) {
|
|
535
|
+
ensureDefaultTargetMeshEntry(this);
|
|
536
|
+
value.object = this.targetMeshes;
|
|
537
|
+
},
|
|
538
|
+
set (value) {
|
|
539
|
+
this.targetMeshes = (value.object ?? []).filter((entry)=>entry instanceof ClothTargetMeshConfig);
|
|
540
|
+
ensureDefaultTargetMeshEntry(this);
|
|
541
|
+
const host = getClothConfigHost(this);
|
|
542
|
+
for (const entry of this.targetMeshes){
|
|
543
|
+
setClothTargetOwner(entry, this, host);
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
add (value, index) {
|
|
547
|
+
const target = value.object?.[0] ?? new ClothTargetMeshConfig();
|
|
548
|
+
setClothTargetOwner(target, this, getClothConfigHost(this));
|
|
549
|
+
this.targetMeshes.splice(index ?? this.targetMeshes.length, 0, target);
|
|
550
|
+
setClothBindingStatus(this, 'Binding cache needs rebuild');
|
|
551
|
+
},
|
|
552
|
+
delete (index) {
|
|
553
|
+
this.targetMeshes.splice(index, 1);
|
|
554
|
+
ensureDefaultTargetMeshEntry(this);
|
|
555
|
+
setClothBindingStatus(this, 'Binding cache needs rebuild');
|
|
556
|
+
},
|
|
557
|
+
create () {
|
|
558
|
+
return new ClothTargetMeshConfig();
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
name: 'BindingStatus',
|
|
563
|
+
type: 'string',
|
|
564
|
+
readonly: true,
|
|
565
|
+
options: {
|
|
566
|
+
group: 'Binding'
|
|
567
|
+
},
|
|
568
|
+
isPersistent () {
|
|
569
|
+
return false;
|
|
570
|
+
},
|
|
571
|
+
get (value) {
|
|
572
|
+
value.str[0] = this.bindingStatus;
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
name: 'Binding',
|
|
577
|
+
type: 'command',
|
|
578
|
+
options: {
|
|
579
|
+
group: 'Binding'
|
|
580
|
+
},
|
|
581
|
+
get (value) {
|
|
582
|
+
value.str[0] = this.bindingInProgress ? 'Binding...' : 'Bind';
|
|
583
|
+
value.str[1] = 'Clear';
|
|
584
|
+
},
|
|
585
|
+
command (index) {
|
|
586
|
+
if (index === 0) {
|
|
587
|
+
if (!this.bindingInProgress) {
|
|
588
|
+
void bindClothTargetMeshes(this);
|
|
589
|
+
}
|
|
590
|
+
} else {
|
|
591
|
+
clearClothBindings(this);
|
|
592
|
+
setClothBindingStatus(this, 'Binding cache cleared.');
|
|
593
|
+
}
|
|
594
|
+
return true;
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
name: 'VertexPinWeightsByTarget',
|
|
599
|
+
type: 'string',
|
|
600
|
+
isHidden () {
|
|
601
|
+
return true;
|
|
602
|
+
},
|
|
603
|
+
get (value) {
|
|
604
|
+
value.str[0] = this.vertexPinWeightsByTarget;
|
|
605
|
+
},
|
|
606
|
+
set (value) {
|
|
607
|
+
this.vertexPinWeightsByTarget = value.str[0] ?? '';
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
name: 'PinnedVertexIndicesByTarget',
|
|
612
|
+
type: 'string',
|
|
613
|
+
isHidden () {
|
|
614
|
+
return true;
|
|
615
|
+
},
|
|
616
|
+
get (value) {
|
|
617
|
+
value.str[0] = this.pinnedVertexIndicesByTarget;
|
|
618
|
+
},
|
|
619
|
+
set (value) {
|
|
620
|
+
this.pinnedVertexIndicesByTarget = value.str[0] ?? '';
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: 'Gravity',
|
|
625
|
+
type: 'vec3',
|
|
626
|
+
options: {
|
|
627
|
+
group: 'Simulation'
|
|
628
|
+
},
|
|
629
|
+
get (value) {
|
|
630
|
+
value.num[0] = this.gravityX;
|
|
631
|
+
value.num[1] = this.gravityY;
|
|
632
|
+
value.num[2] = this.gravityZ;
|
|
633
|
+
},
|
|
634
|
+
set (value) {
|
|
635
|
+
this.gravityX = value.num[0];
|
|
636
|
+
this.gravityY = value.num[1];
|
|
637
|
+
this.gravityZ = value.num[2];
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
name: 'Damping',
|
|
642
|
+
type: 'float',
|
|
643
|
+
options: {
|
|
644
|
+
group: 'Simulation',
|
|
645
|
+
minValue: 0,
|
|
646
|
+
maxValue: 1
|
|
647
|
+
},
|
|
648
|
+
get (value) {
|
|
649
|
+
value.num[0] = this.damping;
|
|
650
|
+
},
|
|
651
|
+
set (value) {
|
|
652
|
+
this.damping = clamp01(value.num[0]);
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
name: 'Stiffness',
|
|
657
|
+
type: 'float',
|
|
658
|
+
options: {
|
|
659
|
+
group: 'Simulation',
|
|
660
|
+
minValue: 0,
|
|
661
|
+
maxValue: 1
|
|
662
|
+
},
|
|
663
|
+
get (value) {
|
|
664
|
+
value.num[0] = this.stiffness;
|
|
665
|
+
},
|
|
666
|
+
set (value) {
|
|
667
|
+
this.stiffness = clamp01(value.num[0]);
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
name: 'DynamicFriction',
|
|
672
|
+
type: 'float',
|
|
673
|
+
options: {
|
|
674
|
+
group: 'Simulation',
|
|
675
|
+
minValue: 0,
|
|
676
|
+
maxValue: 1
|
|
677
|
+
},
|
|
678
|
+
get (value) {
|
|
679
|
+
value.num[0] = this.dynamicFriction;
|
|
680
|
+
},
|
|
681
|
+
set (value) {
|
|
682
|
+
this.dynamicFriction = clamp01(value.num[0]);
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
name: 'PoseFollow',
|
|
687
|
+
type: 'float',
|
|
688
|
+
options: {
|
|
689
|
+
group: 'PoseFollow',
|
|
690
|
+
minValue: 0,
|
|
691
|
+
maxValue: 1
|
|
692
|
+
},
|
|
693
|
+
get (value) {
|
|
694
|
+
value.num[0] = this.poseFollow;
|
|
695
|
+
},
|
|
696
|
+
set (value) {
|
|
697
|
+
this.poseFollow = clamp01(value.num[0]);
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
name: 'StaticFriction',
|
|
702
|
+
type: 'float',
|
|
703
|
+
options: {
|
|
704
|
+
group: 'Simulation',
|
|
705
|
+
minValue: 0,
|
|
706
|
+
maxValue: 1
|
|
707
|
+
},
|
|
708
|
+
get (value) {
|
|
709
|
+
value.num[0] = this.staticFriction;
|
|
710
|
+
},
|
|
711
|
+
set (value) {
|
|
712
|
+
this.staticFriction = clamp01(value.num[0]);
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
name: 'SolverIterations',
|
|
717
|
+
type: 'int',
|
|
718
|
+
options: {
|
|
719
|
+
group: 'Simulation',
|
|
720
|
+
minValue: 1,
|
|
721
|
+
maxValue: 32
|
|
722
|
+
},
|
|
723
|
+
get (value) {
|
|
724
|
+
value.num[0] = this.solverIterations;
|
|
725
|
+
},
|
|
726
|
+
set (value) {
|
|
727
|
+
this.solverIterations = value.num[0];
|
|
728
|
+
}
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
name: 'Substeps',
|
|
732
|
+
type: 'int',
|
|
733
|
+
options: {
|
|
734
|
+
group: 'Simulation',
|
|
735
|
+
minValue: 1,
|
|
736
|
+
maxValue: 8
|
|
737
|
+
},
|
|
738
|
+
get (value) {
|
|
739
|
+
value.num[0] = this.substeps;
|
|
740
|
+
},
|
|
741
|
+
set (value) {
|
|
742
|
+
this.substeps = Math.max(1, Math.min(8, value.num[0] | 0));
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
name: 'MaxNeighbors',
|
|
747
|
+
type: 'int',
|
|
748
|
+
options: {
|
|
749
|
+
group: 'Advanced',
|
|
750
|
+
minValue: 1,
|
|
751
|
+
maxValue: 64
|
|
752
|
+
},
|
|
753
|
+
get (value) {
|
|
754
|
+
value.num[0] = this.maxNeighbors;
|
|
755
|
+
},
|
|
756
|
+
set (value) {
|
|
757
|
+
this.maxNeighbors = value.num[0];
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
name: 'MaxTrianglesPerVertex',
|
|
762
|
+
type: 'int',
|
|
763
|
+
options: {
|
|
764
|
+
group: 'Advanced',
|
|
765
|
+
minValue: 1,
|
|
766
|
+
maxValue: 64
|
|
767
|
+
},
|
|
768
|
+
get (value) {
|
|
769
|
+
value.num[0] = this.maxTrianglesPerVertex;
|
|
770
|
+
},
|
|
771
|
+
set (value) {
|
|
772
|
+
this.maxTrianglesPerVertex = value.num[0];
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
name: 'WorkgroupSize',
|
|
777
|
+
type: 'int',
|
|
778
|
+
options: {
|
|
779
|
+
group: 'Advanced',
|
|
780
|
+
minValue: 1,
|
|
781
|
+
maxValue: 256
|
|
782
|
+
},
|
|
783
|
+
get (value) {
|
|
784
|
+
value.num[0] = this.workgroupSize;
|
|
785
|
+
},
|
|
786
|
+
set (value) {
|
|
787
|
+
this.workgroupSize = value.num[0];
|
|
788
|
+
}
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
name: 'RebuildNormals',
|
|
792
|
+
type: 'bool',
|
|
793
|
+
options: {
|
|
794
|
+
group: 'Advanced'
|
|
795
|
+
},
|
|
796
|
+
get (value) {
|
|
797
|
+
value.bool[0] = this.rebuildNormals;
|
|
798
|
+
},
|
|
799
|
+
set (value) {
|
|
800
|
+
this.rebuildNormals = !!value.bool[0];
|
|
801
|
+
}
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: 'Colliders',
|
|
805
|
+
type: 'object_array',
|
|
806
|
+
options: {
|
|
807
|
+
group: 'Collider',
|
|
808
|
+
objectTypes: [
|
|
809
|
+
ClothColliderConfig
|
|
810
|
+
]
|
|
811
|
+
},
|
|
812
|
+
get (value) {
|
|
813
|
+
value.object = this.colliders;
|
|
814
|
+
},
|
|
815
|
+
set (value) {
|
|
816
|
+
this.colliders = value.object ?? [];
|
|
817
|
+
},
|
|
818
|
+
add (value, index) {
|
|
819
|
+
this.colliders.splice(index ?? this.colliders.length, 0, value.object[0]);
|
|
820
|
+
},
|
|
821
|
+
delete (index) {
|
|
822
|
+
this.colliders.splice(index, 1);
|
|
823
|
+
},
|
|
824
|
+
create () {
|
|
825
|
+
return new ClothColliderConfig();
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
]);
|
|
829
|
+
}
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export { ClothColliderConfig, ClothScriptConfig, ClothTargetMeshConfig, bindClothScriptConfigHost, getClothColliderConfigClass, getClothScriptConfigClass, getClothTargetMeshConfigClass };
|
|
834
|
+
//# sourceMappingURL=cloth_script.js.map
|