@hology/core 0.0.211 → 0.0.213

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.
Files changed (207) hide show
  1. package/dist/effects/sequence/index.d.ts +1 -0
  2. package/dist/effects/sequence/index.js +1 -1
  3. package/dist/effects/sequence/sequence-action.d.ts +5 -0
  4. package/dist/effects/sequence/sequence-actor.d.ts +7 -0
  5. package/dist/effects/sequence/sequence-actor.js +1 -1
  6. package/dist/effects/sequence/sequence-animation-retiming.js +1 -1
  7. package/dist/effects/sequence/sequence-data.d.ts +9 -0
  8. package/dist/effects/sequence/sequence-data.js +1 -1
  9. package/dist/effects/sequence/sequence-player.d.ts +12 -1
  10. package/dist/effects/sequence/sequence-player.js +1 -1
  11. package/dist/effects/sequence/sequence-transform.d.ts +10 -0
  12. package/dist/effects/sequence/sequence-transform.js +4 -0
  13. package/dist/effects/sequence/sequence-value-lane.d.ts +2 -0
  14. package/dist/effects/sequence/sequence-value-lane.js +1 -1
  15. package/dist/effects/vfx/initializsers.d.ts +8 -1
  16. package/dist/effects/vfx/initializsers.js +1 -1
  17. package/dist/effects/vfx/vfx-actor.d.ts +5 -0
  18. package/dist/effects/vfx/vfx-actor.js +1 -1
  19. package/dist/effects/vfx/vfx-asset.d.ts +2 -1
  20. package/dist/effects/vfx/vfx-asset.js +1 -1
  21. package/dist/effects/vfx/vfx-collision-behaviour.js +1 -1
  22. package/dist/effects/vfx/vfx-defs.d.ts +10 -1
  23. package/dist/effects/vfx/vfx-defs.js +1 -1
  24. package/dist/effects/vfx/vfx-materializer.js +1 -1
  25. package/dist/effects/vfx/vfx-renderers.d.ts +2 -0
  26. package/dist/effects/vfx/vfx-renderers.js +1 -1
  27. package/dist/gameplay/actors/actor.d.ts +21 -1
  28. package/dist/gameplay/actors/actor.js +1 -1
  29. package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts +3 -0
  30. package/dist/gameplay/actors/builtin/components/character/character-animation.js +1 -1
  31. package/dist/gameplay/actors/builtin/components/character/character-movement-like.d.ts +25 -0
  32. package/dist/gameplay/actors/builtin/components/character/character-movement-like.js +4 -0
  33. package/dist/gameplay/actors/builtin/components/character/character-movement-policy.d.ts +26 -0
  34. package/dist/gameplay/actors/builtin/components/character/character-movement-policy.js +4 -0
  35. package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts +158 -55
  36. package/dist/gameplay/actors/builtin/components/character/character-movement.js +1 -1
  37. package/dist/gameplay/actors/builtin/components/character/net-character-movement-protocol.d.ts +128 -0
  38. package/dist/gameplay/actors/builtin/components/character/net-character-movement-protocol.js +4 -0
  39. package/dist/gameplay/actors/builtin/components/character/old-character-movement.d.ts +100 -0
  40. package/dist/gameplay/actors/builtin/components/character/old-character-movement.js +4 -0
  41. package/dist/gameplay/actors/builtin/components/index.d.ts +2 -0
  42. package/dist/gameplay/actors/builtin/components/index.js +1 -1
  43. package/dist/gameplay/actors/builtin/components/mesh-component.d.ts +1 -0
  44. package/dist/gameplay/actors/builtin/components/mesh-component.js +1 -1
  45. package/dist/gameplay/actors/builtin/components/tween-component.js +1 -1
  46. package/dist/gameplay/actors/builtin/navmesh-actor.d.ts +2 -0
  47. package/dist/gameplay/actors/builtin/navmesh-actor.js +1 -1
  48. package/dist/gameplay/actors/builtin/trigger-volume.d.ts +3 -3
  49. package/dist/gameplay/actors/builtin/trigger-volume.js +1 -1
  50. package/dist/gameplay/actors/camera/camera-component.d.ts +1 -3
  51. package/dist/gameplay/actors/camera/camera-component.js +1 -1
  52. package/dist/gameplay/actors/camera/third-person-camera-component.d.ts +3 -0
  53. package/dist/gameplay/actors/camera/third-person-camera-component.js +1 -1
  54. package/dist/gameplay/actors/component.d.ts +3 -0
  55. package/dist/gameplay/actors/component.js +1 -1
  56. package/dist/gameplay/actors/controller/actor-controller.d.ts +16 -0
  57. package/dist/gameplay/actors/controller/actor-controller.js +4 -0
  58. package/dist/gameplay/actors/factory.d.ts +3 -0
  59. package/dist/gameplay/actors/factory.js +1 -1
  60. package/dist/gameplay/actors/index.d.ts +4 -0
  61. package/dist/gameplay/actors/index.js +1 -1
  62. package/dist/gameplay/actors/internal/component-init.js +1 -1
  63. package/dist/gameplay/actors/type-registry.d.ts +10 -0
  64. package/dist/gameplay/actors/type-registry.js +4 -0
  65. package/dist/gameplay/ai/behavior-tree/move.d.ts +2 -2
  66. package/dist/gameplay/animation/retarget.d.ts +50 -0
  67. package/dist/gameplay/animation/retarget.js +4 -0
  68. package/dist/gameplay/animation/root-motion.js +1 -1
  69. package/dist/gameplay/event-graph/actor-transform-properties.d.ts +6 -0
  70. package/dist/gameplay/event-graph/actor-transform-properties.js +4 -0
  71. package/dist/gameplay/event-graph/asset-actor-types.d.ts +3 -0
  72. package/dist/gameplay/event-graph/asset-actor-types.js +4 -0
  73. package/dist/gameplay/event-graph/asset-references.d.ts +12 -0
  74. package/dist/gameplay/event-graph/asset-references.js +4 -0
  75. package/dist/gameplay/event-graph/compiler.d.ts +107 -0
  76. package/dist/gameplay/event-graph/compiler.js +4 -0
  77. package/dist/gameplay/event-graph/decorators.d.ts +74 -0
  78. package/dist/gameplay/event-graph/decorators.js +4 -0
  79. package/dist/gameplay/event-graph/document-compiler.d.ts +107 -0
  80. package/dist/gameplay/event-graph/document-compiler.js +4 -0
  81. package/dist/gameplay/event-graph/event-graph-demo.d.ts +2 -0
  82. package/dist/gameplay/event-graph/event-graph-demo.js +4 -0
  83. package/dist/gameplay/event-graph/graph.d.ts +106 -0
  84. package/dist/gameplay/event-graph/graph.js +4 -0
  85. package/dist/gameplay/event-graph/index.d.ts +13 -0
  86. package/dist/gameplay/event-graph/index.js +4 -0
  87. package/dist/gameplay/event-graph/model.d.ts +71 -0
  88. package/dist/gameplay/event-graph/model.js +4 -0
  89. package/dist/gameplay/event-graph/nodes/execution-nodes.d.ts +115 -0
  90. package/dist/gameplay/event-graph/nodes/execution-nodes.js +4 -0
  91. package/dist/gameplay/event-graph/nodes/gameplay-nodes.d.ts +208 -0
  92. package/dist/gameplay/event-graph/nodes/gameplay-nodes.js +4 -0
  93. package/dist/gameplay/event-graph/nodes/index.d.ts +4 -0
  94. package/dist/gameplay/event-graph/nodes/index.js +4 -0
  95. package/dist/gameplay/event-graph/nodes/value-nodes.d.ts +53 -0
  96. package/dist/gameplay/event-graph/nodes/value-nodes.js +4 -0
  97. package/dist/gameplay/event-graph/registry.d.ts +33 -0
  98. package/dist/gameplay/event-graph/registry.js +4 -0
  99. package/dist/gameplay/event-graph/runtime-assets.d.ts +21 -0
  100. package/dist/gameplay/event-graph/runtime-assets.js +4 -0
  101. package/dist/gameplay/event-graph/runtime.d.ts +160 -0
  102. package/dist/gameplay/event-graph/runtime.js +4 -0
  103. package/dist/gameplay/event-graph/type-inference.d.ts +41 -0
  104. package/dist/gameplay/event-graph/type-inference.js +4 -0
  105. package/dist/gameplay/event-graph/types.d.ts +77 -0
  106. package/dist/gameplay/event-graph/types.js +4 -0
  107. package/dist/gameplay/index.d.ts +17 -2
  108. package/dist/gameplay/index.js +1 -1
  109. package/dist/gameplay/initiate.d.ts +4 -0
  110. package/dist/gameplay/initiate.js +1 -1
  111. package/dist/gameplay/input/input.d.ts +22 -17
  112. package/dist/gameplay/input/input.js +1 -1
  113. package/dist/gameplay/net/browser/index.d.ts +147 -0
  114. package/dist/gameplay/net/browser/index.js +4 -0
  115. package/dist/gameplay/net/index.d.ts +7 -0
  116. package/dist/gameplay/net/index.js +4 -0
  117. package/dist/gameplay/net/net-connection.d.ts +25 -0
  118. package/dist/gameplay/net/net-connection.js +4 -0
  119. package/dist/gameplay/net/net-session.d.ts +70 -0
  120. package/dist/gameplay/net/net-session.js +4 -0
  121. package/dist/gameplay/net/service/net-actor-role.d.ts +12 -0
  122. package/dist/gameplay/net/service/net-actor-role.js +4 -0
  123. package/dist/gameplay/net/service/net-decorator.d.ts +29 -0
  124. package/dist/gameplay/net/service/net-decorator.js +4 -0
  125. package/dist/gameplay/net/service/net-serializer.d.ts +15 -0
  126. package/dist/gameplay/net/service/net-serializer.js +4 -0
  127. package/dist/gameplay/net/service/net-service.d.ts +171 -0
  128. package/dist/gameplay/net/service/net-service.js +4 -0
  129. package/dist/gameplay/net/service/net-utils.d.ts +8 -0
  130. package/dist/gameplay/net/service/net-utils.js +4 -0
  131. package/dist/gameplay/net/service/replication.d.ts +31 -0
  132. package/dist/gameplay/net/service/replication.js +4 -0
  133. package/dist/gameplay/net/service/rpc-decorator.d.ts +21 -0
  134. package/dist/gameplay/net/service/rpc-decorator.js +4 -0
  135. package/dist/gameplay/net/service/rpc.d.ts +35 -0
  136. package/dist/gameplay/net/service/rpc.js +4 -0
  137. package/dist/gameplay/services/asset-loader.d.ts +10 -2
  138. package/dist/gameplay/services/asset-loader.js +1 -1
  139. package/dist/gameplay/services/physics/physics-system.d.ts +16 -1
  140. package/dist/gameplay/services/physics/physics-system.js +1 -1
  141. package/dist/gameplay/services/world.d.ts +25 -2
  142. package/dist/gameplay/services/world.js +1 -1
  143. package/dist/rendering/color-pass.js +1 -1
  144. package/dist/rendering.d.ts +2 -0
  145. package/dist/rendering.js +1 -1
  146. package/dist/scene/asset-resource-loader.d.ts +7 -1
  147. package/dist/scene/asset-resource-loader.js +1 -1
  148. package/dist/scene/batched-mesh-2.d.ts +9 -0
  149. package/dist/scene/batched-mesh-2.js +1 -1
  150. package/dist/scene/bootstrap.d.ts +2 -0
  151. package/dist/scene/bootstrap.js +1 -1
  152. package/dist/scene/custom-param-deserialize.js +1 -1
  153. package/dist/scene/custom-param-runtime-types.js +1 -1
  154. package/dist/scene/materializer.d.ts +29 -0
  155. package/dist/scene/materializer.js +1 -1
  156. package/dist/scene/model.d.ts +114 -2
  157. package/dist/scene/model.js +1 -1
  158. package/dist/scene/objects/prefab.js +1 -1
  159. package/dist/scene/storage/storage.d.ts +1 -1
  160. package/dist/scene/storage/storage.js +1 -1
  161. package/dist/shader/builtin/standard-shader.js +1 -1
  162. package/dist/shader/builtin/toon-shader.js +1 -1
  163. package/dist/shader/builtin/unlit-shader.js +1 -1
  164. package/dist/shader/color-layer.js +1 -1
  165. package/dist/shader/graph/compiler.d.ts +3 -0
  166. package/dist/shader/graph/compiler.js +1 -1
  167. package/dist/shader/graph/model.d.ts +1 -1
  168. package/dist/shader/graph/registry.js +1 -1
  169. package/dist/shader/parameter.d.ts +1 -1
  170. package/dist/shader/parameter.js +1 -1
  171. package/dist/shader-nodes/depth.js +1 -1
  172. package/dist/shader-nodes/scene-sample.js +1 -1
  173. package/dist/test/animation-retarget.test.d.ts +2 -0
  174. package/dist/test/animation-retarget.test.js +4 -0
  175. package/dist/test/batched-mesh-2.test.d.ts +2 -0
  176. package/dist/test/batched-mesh-2.test.js +4 -0
  177. package/dist/test/browser-net-session.test.d.ts +2 -0
  178. package/dist/test/browser-net-session.test.js +4 -0
  179. package/dist/test/event-graph-generated-code.test.d.ts +2 -0
  180. package/dist/test/event-graph-generated-code.test.js +4 -0
  181. package/dist/test/event-graph-types.test.d.ts +2 -0
  182. package/dist/test/event-graph-types.test.js +4 -0
  183. package/dist/test/event-graph.test.d.ts +2 -0
  184. package/dist/test/event-graph.test.js +4 -0
  185. package/dist/test/first-person-camera-component.test.js +1 -1
  186. package/dist/test/input.test.d.ts +2 -0
  187. package/dist/test/input.test.js +4 -0
  188. package/dist/test/net-character-movement.test.d.ts +2 -0
  189. package/dist/test/net-character-movement.test.js +4 -0
  190. package/dist/test/net-property-snapshot.test.d.ts +2 -0
  191. package/dist/test/net-property-snapshot.test.js +4 -0
  192. package/dist/test/prefab-instance-params.test.js +1 -1
  193. package/dist/test/sequence-animation-retiming.test.js +1 -1
  194. package/dist/test/sequence-camera-control.test.js +1 -1
  195. package/dist/test/sequence-scene-binding.test.d.ts +2 -0
  196. package/dist/test/sequence-scene-binding.test.js +4 -0
  197. package/dist/test/sequence-transform.test.d.ts +2 -0
  198. package/dist/test/sequence-transform.test.js +4 -0
  199. package/dist/test/shader-graph.test.js +1 -1
  200. package/dist/test/vfx-random-color-initializer.test.d.ts +2 -0
  201. package/dist/test/vfx-random-color-initializer.test.js +4 -0
  202. package/dist/test/world-prefab-spawn.test.d.ts +2 -0
  203. package/dist/test/world-prefab-spawn.test.js +4 -0
  204. package/dist/utils/three/placeholder-texture.d.ts +3 -0
  205. package/dist/utils/three/placeholder-texture.js +4 -0
  206. package/package.json +18 -2
  207. package/tsconfig.tsbuildinfo +1 -1
@@ -2,9 +2,10 @@ import { EulerOrder, Side } from 'three';
2
2
  import type { SequenceData } from '../effects/sequence/sequence-data.js';
3
3
  import type { BlendingMode, VfxAssetData } from '../effects/vfx/vfx-asset.js';
4
4
  import type { ShaderGraphDocument, ShaderGraphMaterialReference } from '../shader/graph/model.js';
5
+ import type { EventGraphDocument } from '../gameplay/event-graph/model.js';
5
6
  import type { AttachedComponent, SceneObject } from './materializer.js';
6
7
  import type { LibraryShapeType } from './objects/shapes.js';
7
- export type AssetType = 'mesh' | 'material' | 'shape' | 'particles' | 'light' | 'texture' | 'actor' | 'audio' | 'prefab' | 'vfx' | 'animationclip' | 'sequence' | 'shaderGraph' | 'data';
8
+ export type AssetType = 'mesh' | 'material' | 'shape' | 'particles' | 'light' | 'texture' | 'actor' | 'audio' | 'prefab' | 'vfx' | 'animationclip' | 'animationRig' | 'animationRetargeter' | 'sequence' | 'shaderGraph' | 'data';
8
9
  export type ShapeType = LibraryShapeType | 'landscape';
9
10
  export type LightType = 'point' | 'spot' | 'directional' | 'ambient' | 'rectArea';
10
11
  /**
@@ -48,7 +49,8 @@ export declare enum SerializedParamType {
48
49
  AnimationClip = 27,
49
50
  Sequence = 28,
50
51
  Struct = 29,
51
- DataAsset = 30
52
+ DataAsset = 30,
53
+ SequenceData = 31
52
54
  }
53
55
  export type VfxInputBinding = {
54
56
  type: 'vfxInput';
@@ -169,6 +171,104 @@ export type TextureSettings = {
169
171
  */
170
172
  textureArrayFileKey?: string;
171
173
  };
174
+ export type AnimationRigBone = {
175
+ /** Stable hierarchy path. Bone names alone are not guaranteed to be unique. */
176
+ id: string;
177
+ name: string;
178
+ parentIndex: number;
179
+ position: [number, number, number];
180
+ quaternion: [number, number, number, number];
181
+ scale: [number, number, number];
182
+ inverseBindMatrix: number[];
183
+ };
184
+ export type AnimationRigChainRole = 'root' | 'spine' | 'neck' | 'head' | 'leftArm' | 'rightArm' | 'leftLeg' | 'rightLeg' | 'leftHand' | 'rightHand' | 'leftFoot' | 'rightFoot' | 'leftFingers' | 'rightFingers' | string;
185
+ export type AnimationRigChain = {
186
+ id: string;
187
+ name: string;
188
+ role: AnimationRigChainRole;
189
+ startBoneId: string;
190
+ endBoneId: string;
191
+ };
192
+ export type AnimationRetargetPose = {
193
+ id: string;
194
+ name: string;
195
+ /** Sparse local-space quaternion offsets keyed by rig bone id. */
196
+ rotationOffsets: Record<string, [number, number, number, number]>;
197
+ rootOffset?: [number, number, number];
198
+ };
199
+ export type AnimationRigData = {
200
+ version: 1;
201
+ previewMeshId: AssetId;
202
+ /**
203
+ * Coordinate-basis correction applied around the imported rig. This does
204
+ * not change bone-local animation data or rig compatibility fingerprints.
205
+ */
206
+ basisPreset?: 'auto' | 'yUp' | 'unrealZUp' | 'custom';
207
+ basisYawDegrees?: number;
208
+ basisRotation?: [number, number, number, number];
209
+ /** Identifies the characterized skeleton when a model contains more than one. */
210
+ skinnedMeshName?: string;
211
+ bones: AnimationRigBone[];
212
+ topologyFingerprint: string;
213
+ bindPoseFingerprint: string;
214
+ retargetRootBoneId?: string;
215
+ pelvisBoneId?: string;
216
+ leftHandBoneId?: string;
217
+ rightHandBoneId?: string;
218
+ chains: AnimationRigChain[];
219
+ poses: AnimationRetargetPose[];
220
+ defaultPoseId?: string;
221
+ };
222
+ export type AnimationRetargetChainMapping = {
223
+ sourceChainId: string;
224
+ targetChainId: string;
225
+ enabled?: boolean;
226
+ rotationMode?: 'copy' | 'interpolated';
227
+ translationMode?: 'none' | 'scaled';
228
+ /** Reserved for the follow-up limb IK pass. */
229
+ ik?: {
230
+ enabled?: boolean;
231
+ poleBoneId?: string;
232
+ };
233
+ };
234
+ export type AnimationRetargeterData = {
235
+ version: 1;
236
+ solverVersion: number;
237
+ sourceRigId: AssetId;
238
+ targetRigId: AssetId;
239
+ sourceRigFingerprint: {
240
+ topology: string;
241
+ bindPose: string;
242
+ };
243
+ targetRigFingerprint: {
244
+ topology: string;
245
+ bindPose: string;
246
+ };
247
+ sourcePoseId?: string;
248
+ targetPoseId?: string;
249
+ chainMappings: AnimationRetargetChainMapping[];
250
+ rootSettings: {
251
+ scaleTranslation: boolean;
252
+ translationAxes: [boolean, boolean, boolean];
253
+ /**
254
+ * Target X/Y/Z source-axis mapping. 1/2/3 mean +X/+Y/+Z and negative
255
+ * values invert the selected source axis.
256
+ */
257
+ translationAxisMap: [number, number, number];
258
+ scaleMultiplier: number;
259
+ };
260
+ bakeSettings: {
261
+ framesPerSecond: number;
262
+ };
263
+ /** Source animation asset id -> generated target animation asset id. */
264
+ generatedOutputs: Record<AssetId, AssetId>;
265
+ };
266
+ export type GeneratedAnimationClipInfo = {
267
+ sourceClipId: AssetId;
268
+ retargeterId: AssetId;
269
+ generatorVersion: number;
270
+ inputHash: string;
271
+ };
172
272
  export type Asset = {
173
273
  id: string;
174
274
  /** A name of the asset. By default derived from the imported asset's file name. Should be unique. */
@@ -262,6 +362,8 @@ export type Asset = {
262
362
  shapeType?: CollisionShapeType;
263
363
  };
264
364
  colliders?: ModelColliderData[];
365
+ /** Animation rig this mesh is compatible with. */
366
+ animationRigId?: AssetId;
265
367
  };
266
368
  /** Prefab settings only for asset type prefab */
267
369
  prefab?: {
@@ -287,6 +389,8 @@ export type Asset = {
287
389
  * instance returns the exposed actor instance inside the prefab.
288
390
  */
289
391
  mainActorId?: string;
392
+ /** Optional gameplay event graph instantiated once for each prefab instance. */
393
+ eventGraph?: EventGraphDocument;
290
394
  };
291
395
  components?: AttachedComponent[];
292
396
  /** Texture settings only for asset type texture */
@@ -301,7 +405,15 @@ export type Asset = {
301
405
  anim?: {
302
406
  /** The name of the animation clip */
303
407
  clip: string;
408
+ /** Rig whose bone names and bind pose this clip targets. */
409
+ rigId?: AssetId;
410
+ /** Present when this is a replaceable editor-generated retarget output. */
411
+ generatedFrom?: GeneratedAnimationClipInfo;
304
412
  };
413
+ /** Animation rig settings only for asset type animationRig. */
414
+ animationRig?: AnimationRigData;
415
+ /** Animation retargeter settings only for asset type animationRetargeter. */
416
+ animationRetargeter?: AnimationRetargeterData;
305
417
  /** Sequence settings only for asset type sequence */
306
418
  sequence?: SequenceData;
307
419
  /** Shader graph settings only for asset type shaderGraph */
@@ -1,4 +1,4 @@
1
- export var DetailTier;!function(e){e[e.low=0]="low",e[e.medium=1]="medium",e[e.high=2]="high"}(DetailTier||(DetailTier={}));export var SerializedParamType;!function(e){e[e.FloatNode=0]="FloatNode",e[e.Number=1]="Number",e[e.Texture=2]="Texture",e[e.Sampler2DNode=3]="Sampler2DNode",e[e.Boolean=4]="Boolean",e[e.BooleanNode=5]="BooleanNode",e[e.Vector2=6]="Vector2",e[e.Vec2Node=7]="Vec2Node",e[e.Vector3=8]="Vector3",e[e.Vec3Node=9]="Vec3Node",e[e.Color=10]="Color",e[e.RgbNode=11]="RgbNode",e[e.String=12]="String",e[e.BaseActor=13]="BaseActor",e[e.Euler=14]="Euler",e[e.Object3D=15]="Object3D",e[e.Material=16]="Material",e[e.AudioBuffer=17]="AudioBuffer",e[e.Vector4=18]="Vector4",e[e.Vec4Node=19]="Vec4Node",e[e.VisualEffect=20]="VisualEffect",e[e.Array=21]="Array",e[e.Curve=22]="Curve",e[e.ColorLayer=23]="ColorLayer",e[e.MaskLayer=24]="MaskLayer",e[e.Prefab=25]="Prefab",e[e.PrefabActor=26]="PrefabActor",e[e.AnimationClip=27]="AnimationClip",e[e.Sequence=28]="Sequence",e[e.Struct=29]="Struct",e[e.DataAsset=30]="DataAsset"}(SerializedParamType||(SerializedParamType={}));/*
1
+ export var DetailTier;!function(e){e[e.low=0]="low",e[e.medium=1]="medium",e[e.high=2]="high"}(DetailTier||(DetailTier={}));export var SerializedParamType;!function(e){e[e.FloatNode=0]="FloatNode",e[e.Number=1]="Number",e[e.Texture=2]="Texture",e[e.Sampler2DNode=3]="Sampler2DNode",e[e.Boolean=4]="Boolean",e[e.BooleanNode=5]="BooleanNode",e[e.Vector2=6]="Vector2",e[e.Vec2Node=7]="Vec2Node",e[e.Vector3=8]="Vector3",e[e.Vec3Node=9]="Vec3Node",e[e.Color=10]="Color",e[e.RgbNode=11]="RgbNode",e[e.String=12]="String",e[e.BaseActor=13]="BaseActor",e[e.Euler=14]="Euler",e[e.Object3D=15]="Object3D",e[e.Material=16]="Material",e[e.AudioBuffer=17]="AudioBuffer",e[e.Vector4=18]="Vector4",e[e.Vec4Node=19]="Vec4Node",e[e.VisualEffect=20]="VisualEffect",e[e.Array=21]="Array",e[e.Curve=22]="Curve",e[e.ColorLayer=23]="ColorLayer",e[e.MaskLayer=24]="MaskLayer",e[e.Prefab=25]="Prefab",e[e.PrefabActor=26]="PrefabActor",e[e.AnimationClip=27]="AnimationClip",e[e.Sequence=28]="Sequence",e[e.Struct=29]="Struct",e[e.DataAsset=30]="DataAsset",e[e.SequenceData=31]="SequenceData"}(SerializedParamType||(SerializedParamType={}));/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
- export class Prefab{constructor(s){this.asset=s}}export class PrefabInstance{}export class PrefabOf{constructor(s){this.prefab=s}}/*
1
+ export class Prefab{constructor(s){this.asset=s}}export class PrefabInstance{constructor(){this.destroyed=!1}}export class PrefabOf{constructor(s){this.prefab=s}}/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -42,7 +42,7 @@ export declare class ObjectStorage<T extends StorageEntity> {
42
42
  * @param from Relative path
43
43
  * @param to Relative path that the given folder should be put into
44
44
  */
45
- moveToFolder(object: T, to: string): Promise<void>;
45
+ moveToFolder(object: T, to: string): Promise<T>;
46
46
  getAbsolutePath(relativePath?: string): string;
47
47
  getResourceAbsolutePath(relativePath?: string): string;
48
48
  /**
@@ -1,4 +1,4 @@
1
- import{randomUUID as e}from"../../utils/uuid.js";import{pathJoin as t}from"../../utils/files.js";import{EMPTY as a,filter as i,firstValueFrom as n,from as s,map as r,merge as h,mergeAll as o,mergeMap as l,Observable as c,of as d,startWith as u,Subject as p,switchMap as f,tap as w}from"rxjs";import{sleepDelay as m}from"../../utils/async.js";const y={},v={},x={},b={};null==y.read&&window.require&&(Object.assign(y,window.require("fs")),Object.assign(v,y.promises),Object.assign(x,window.require("path")),Object.assign(b,window.require("chokidar")));const j=null!=y.existsSync;let g=0,I=0;const P=[];async function F(e){await function(){if(g<32)return g++,Promise.resolve();return new Promise(e=>P.push(e))}();try{return await e()}finally{!function(){const e=P[I];if(null==e)return P.length=0,I=0,void g--;I++,I>64&&2*I>P.length&&(P.splice(0,I),I=0);e()}()}}function O(e){return F(()=>v.readFile(e))}function S(){if(j){const e="--path=",t=window.process.argv.find(t=>t.startsWith(e));return t?t.substring(e.length):""}return""}const C=/^[A-Z]:/;function A(...e){return 0===e.length?"":C.test(e[0])||j?x.join(...e):t(...e)}export class ObjectStorage{get pathResources(){return A(this.path+"-resources")}constructor(e,t,a=defaultSerializer){this.name=e,this.filePathFn=t,this.serializer=a,this.basePathUpdates=new p,this.basePath=this.basePathUpdates.pipe(r(e=>A(S(),e)),w(e=>{this.path=A(e,this.name),this.cachedIndex=null,this.loadingIndex=null,k(this.path),this.determineIfMetaFileShouldBeCreated()})),this.loaded=n(this.basePath),this.cachedIndex=null,this.loadingIndex=null,this.shouldCreateIndex=!1}setBasePath(e){this.basePathUpdates.next(e)}async determineIfMetaFileShouldBeCreated(){if(j)try{const e=["vite.renderer.config.ts","vite.config.ts"];for(const t of e){const e=A(S(),t);if(!await z(e))continue;if((await O(e)).toString().includes("hologyBuild"))return void(this.shouldCreateIndex=!1)}this.shouldCreateIndex=!0}catch(e){console.warn("Failed to read vite config to determine if meta files should be created")}}async createFolder(e,t=""){D(),await v.mkdir(x.join(this.path,t,e),{recursive:!0})}async deleteFolderForceDangerous(e){await v.rm(x.join(this.path,e),{recursive:!0,force:!0})}async moveFolder(e,t){if(D(),""==e)return void console.warn("Can not move a folder in root");const a=x.resolve(x.join(this.path,t),x.basename(e));if(await K(a)){if(a!==x.resolve(this.path,e))throw new Error("Can not move to directory as a file already exists with the same name")}else{if(function(e,t){const a=x.resolve(e),i=x.resolve(t),n=x.normalize(a)+x.sep;return(x.normalize(i)+x.sep).startsWith(n)}(x.join(this.path,e),x.join(this.path,t)))throw new Error("Can not move a folder into a folder it contains");await v.rename(x.join(this.path,e),a)}}async renameFolder(e,t){await v.rename(x.join(this.path,e),x.resolve(x.dirname(x.join(this.path,e)),t))}async moveToFolder(e,t){if(D(),e.path===t)return;await this.assertObjectFilePathAvailable({...e,path:t},e.id);const a=this.privateObjectPath({...e,path:t});await v.rename(this.privateObjectPath(e),a)}getAbsolutePath(e=""){return x.join(this.path,e)}getResourceAbsolutePath(e=""){return x.join(this.pathResources,e)}watchFolders(){return s(this.loaded).pipe(f(()=>s(k(this.path))),f(()=>this.watchDir(this.path).pipe(i(e=>!e.filename.endsWith(".json")),u(null),f(()=>s(v.readdir(this.path,{recursive:!0,withFileTypes:!0}))),r(e=>Array.from(new Set(e.filter(e=>e.isDirectory()).map(e=>x.relative(this.path,x.join(e.parentPath,e.name)).replace(/^\.$/,"")).values()))))))}watch(){D();const e=s(this.loaded).pipe(f(()=>s(k(this.pathResources))),f(()=>this.watchDir(this.pathResources)),l(e=>{if(null==e||!["add","change","unlink"].includes(e.event))return a;const t=x.basename(e.filename);return s(this.getAll()).pipe(l(e=>{const i=e.filter(e=>e.fileKey===t);return 0===i.length?a:s(i).pipe(l(e=>{const t=this.privateObjectRelativePath(e);return s(this.readFileIfExists(t)).pipe(r(a=>({event:"change",object:a,path:e.path,filename:t})))}))}))})),t=s(this.loaded).pipe(f(()=>this.watchDir(this.path)),l(e=>{const t={event:e.event,path:x.dirname(e.filename).replace(/^\.$/,""),filename:x.basename(e.filename)};return e.filename.endsWith(".json")?"unlink"!==e.event?s(this.readFileIfExists(e.filename)).pipe(w(e=>{null!=e&&(null==this.cachedIndex&&(this.cachedIndex={}),this.cachedIndex[e.id]={id:e.id,name:e.name??e.id,path:e.path},this.persistIndex())}),r(e=>({object:e,...t}))):d({object:null,...t}).pipe(w(()=>{const t=Object.keys(this.cachedIndex??{}).find(t=>this.privateObjectRelativePath(this.cachedIndex[t])===e.filename);t&&this.removeIndexEntry(t)})):"change"===e.event?s(this.reloadSubdirectory(e.filename)).pipe(o(),r(e=>({object:e,...t}))):a}));return h(t,e)}async reloadSubdirectory(e){return(await this.getAll(e)).filter(t=>t.path.startsWith(e))}async readFileIfExists(e){const t=A(this.path,e);for(let a=0;a<3;a++)try{const a=await O(t);return{...JSON.parse(a.toString()),path:x.dirname(e).replace(/^\.$/,""),filename:x.basename(e)}}catch(e){if(2===a)return console.error("Could not read file at "+t,e),null;await m(50*(a+1))}return null}async getAll(e){if(j){await this.loaded,await k(this.path);const t=await this.getObjectFilePaths(e??""),a=null==e||""===e,i=[];for(let e=0;e<t.length;e+=32){const a=Math.min(32,t.length-e),n=await Promise.all(Array.from({length:a},(a,i)=>{const n=t[e+i];return O(A(this.path,n)).then(e=>({...JSON.parse(e.toString()),path:x.dirname(n).replace(/^\.$/,""),filename:x.basename(n)}))}));i.push(...n)}return a&&(this.cachedIndex=R(i),await this.persistIndex()),i}const t=await this.loadIndex();return Promise.all(Object.keys(t).map(e=>this.get(e)))}async getObjectFilePaths(e){const t=this.path,a=x.join(t,e),i=[];return await async function e(a){const n=await v.readdir(a,{withFileTypes:!0});for(const s of n){const n=x.join(a,s.name);s.isDirectory()?await e(n):s.isFile()&&s.name.endsWith(".json")&&!/^[\._]/.test(s.name)&&i.push(x.relative(t,n))}}(a),i}async get(e){const t=await this.loadIndex(),a=t[e]??Object.values(t).find(t=>t.name===e);if(null==a)return;const i=this.privateObjectPath(a);if(!j)return(await fetch(i)).json();return await z(i)?{...JSON.parse((await O(i)).toString()),path:a.path??"",filename:x.basename(this.privateObjectRelativePath(a))}:null}async save(e){if(D(),await this.loaded,null==e.path){const t=(await this.loadIndex())[e.id];null!=t?.path&&(e={...e,path:t.path})}return await this.assertObjectFilePathAvailable(e,e.id),await v.writeFile(this.privateObjectPath(e),this.serialize(e)),await this.addOrUpdateIndexEntry(e),e}async rename(e,t){const a={...e,name:t};await this.assertObjectFilePathAvailable(a,e.id);const i=this.privateObjectPath(e),n=this.privateObjectPath(a);try{await v.rename(i,n)}catch(e){console.error(e),console.warn("Rename failed, retrying",{currentPath:i,newPath:n}),await m(400),await v.rename(i,n)}return await this.save(a),a}async delete(e){await v.unlink(this.privateObjectPath(e)),this.removeIndexEntry(e.id)}async create(t){D(),await this.loaded,t.id=e();const a=this.privateObjectPath(t);if(await this.assertObjectFilePathAvailable(t),await K(a))throw Error(`Can not create because a file already exists at ${a}`);return await v.writeFile(a,this.serialize(t)),await this.addOrUpdateIndexEntry(t),t}prepareCreate(t){return D(),t.id=e(),t}serialize(e){return this.serializer(e)}async addOrUpdateIndexEntry(e){null==this.cachedIndex&&await this.loadIndex(),this.cachedIndex[e.id]={id:e.id,name:e.name??e.id,path:e.path},await this.persistIndex()}removeIndexEntry(e){null!=this.cachedIndex&&delete this.cachedIndex[e],this.persistIndex()}async persistIndex(){j&&this.shouldCreateIndex&&null!=this.cachedIndex&&await v.writeFile(this.indexFilePath,JSON.stringify(this.cachedIndex,null,2))}get indexFilePath(){return A(this.path,"_meta.json")}async loadIndex(){if(null!=this.cachedIndex)return this.cachedIndex;this.loadingIndex??(this.loadingIndex=this.createIndex());try{return await this.loadingIndex}finally{this.loadingIndex=null}}async createIndex(){if(j){const e=await this.getAll();this.cachedIndex=R(e),await this.persistIndex()}else this.cachedIndex=await(await fetch(this.indexFilePath)).json();return this.cachedIndex}async ensureResourceDir(){await k(A(this.path+"-resources"))}async saveFile(e,t){return D(),await k(A(this.path+"-resources")),v.copyFile(t.path,A(this.path+"-resources",e.fileKey))}async saveExtraFile(e,t){return D(),await k(A(this.path+"-resources")),v.copyFile(e,A(this.path+"-resources",t))}getAssetPath(e){return window&&"function"==typeof window.require?window.require("path").join(this.path+"-resources",e.fileKey):A(this.path+"-resources",e.fileKey)}async replaceFile(e,t){if(await z(t))return v.copyFile(t,A(this.path+"-resources",e.fileKey));console.error("Failed to replace file using path "+t)}async deleteFile(e){if(null==e)return;D();const t=A(this.path+"-resources",e);return await z(t)?v.unlink(t):void 0}privateObjectPath(e){return A(this.path,this.privateObjectRelativePath(e))}privateObjectRelativePath(e){return this.filePathFn?A(e.path??"",this.filePathFn(e)):A(e.path??"",tokenizeName(e.name??e.id)+".json")}async assertObjectFilePathAvailable(e,t){const a=await this.findObjectFilePathCollision(e,t);if(null!=a)throw Error(`Can not save "${e.name??e.id}" because "${a.name}" already uses the same storage file name. Use a name that differs beyond letter casing.`)}async findObjectFilePathCollision(e,t){const a=E(this.privateObjectRelativePath(e)),i=await this.loadIndex();return Object.values(i).find(e=>e.id!==t&&E(this.privateObjectRelativePath(e))===a)??null}watchDir(e){return new c(t=>{if("win32"===process.platform&&j){const a=y.watch(e,{recursive:!0},(a,i)=>{if(i){const n=x.join(e,i);y.access(n,y.constants.F_OK,e=>{const n=e?"unlink":"rename"===a?"add":"change";t.next({event:n,filename:i})})}});return()=>a.close()}const a=b.watch(e,{cwd:e,ignoreInitial:!0,disableGlobbing:!0});return a.on("all",(e,a,i)=>{t.next({event:e,filename:a})}),a.on("error",()=>{}),()=>{a.close()}})}}export function tokenizeName(e){return e.trim().replace(/\s/g,"_").replace(/[^a-z0-9_\-\.]/gi,"")}function E(e){return e.replace(/\\/g,"/").toLowerCase()}function R(e){const t={};for(const a of e)t[a.id]={id:a.id,name:a.name??a.id,path:a.path};return t}async function k(e){j&&(await z(e)||await v.mkdir(e,{recursive:!0}))}function z(e){return!!j&&new Promise(function(t,a){y.exists(e,function(e){t(e)})})}function D(){if(!j)throw new Error("Must have direct access to filesystem")}async function K(e){try{await v.access(e,v.constants.F_OK)}catch(e){return!1}return!0}export function defaultSerializer(e){const t={...e};return delete t.path,delete t.filename,JSON.stringify(t,null,2)}/*
1
+ import{randomUUID as e}from"../../utils/uuid.js";import{pathJoin as t}from"../../utils/files.js";import{EMPTY as a,filter as i,firstValueFrom as n,from as s,map as r,merge as h,mergeAll as o,mergeMap as l,Observable as c,of as d,startWith as u,Subject as p,switchMap as f,tap as w}from"rxjs";import{sleepDelay as m}from"../../utils/async.js";const y={},v={},x={},b={};null==y.read&&window.require&&(Object.assign(y,window.require("fs")),Object.assign(v,y.promises),Object.assign(x,window.require("path")),Object.assign(b,window.require("chokidar")));const j=null!=y.existsSync;let g=0,I=0;const P=[];async function F(e){await function(){if(g<32)return g++,Promise.resolve();return new Promise(e=>P.push(e))}();try{return await e()}finally{!function(){const e=P[I];if(null==e)return P.length=0,I=0,void g--;I++,I>64&&2*I>P.length&&(P.splice(0,I),I=0);e()}()}}function O(e){return F(()=>v.readFile(e))}function S(){if(j){const e="--path=",t=window.process.argv.find(t=>t.startsWith(e));return t?t.substring(e.length):""}return""}const C=/^[A-Z]:/;function E(...e){return 0===e.length?"":C.test(e[0])||j?x.join(...e):t(...e)}export class ObjectStorage{get pathResources(){return E(this.path+"-resources")}constructor(e,t,a=defaultSerializer){this.name=e,this.filePathFn=t,this.serializer=a,this.basePathUpdates=new p,this.basePath=this.basePathUpdates.pipe(r(e=>E(S(),e)),w(e=>{this.path=E(e,this.name),this.cachedIndex=null,this.loadingIndex=null,k(this.path),this.determineIfMetaFileShouldBeCreated()})),this.loaded=n(this.basePath),this.cachedIndex=null,this.loadingIndex=null,this.shouldCreateIndex=!1}setBasePath(e){this.basePathUpdates.next(e)}async determineIfMetaFileShouldBeCreated(){if(j)try{const e=["vite.renderer.config.ts","vite.config.ts"];for(const t of e){const e=E(S(),t);if(!await z(e))continue;if((await O(e)).toString().includes("hologyBuild"))return void(this.shouldCreateIndex=!1)}this.shouldCreateIndex=!0}catch(e){console.warn("Failed to read vite config to determine if meta files should be created")}}async createFolder(e,t=""){D(),await v.mkdir(x.join(this.path,t,e),{recursive:!0})}async deleteFolderForceDangerous(e){await v.rm(x.join(this.path,e),{recursive:!0,force:!0})}async moveFolder(e,t){if(D(),""==e)return void console.warn("Can not move a folder in root");const a=x.resolve(x.join(this.path,t),x.basename(e));if(await U(a)){if(a!==x.resolve(this.path,e))throw new Error("Can not move to directory as a file already exists with the same name")}else{if(function(e,t){const a=x.resolve(e),i=x.resolve(t),n=x.normalize(a)+x.sep;return(x.normalize(i)+x.sep).startsWith(n)}(x.join(this.path,e),x.join(this.path,t)))throw new Error("Can not move a folder into a folder it contains");await v.rename(x.join(this.path,e),a)}}async renameFolder(e,t){await v.rename(x.join(this.path,e),x.resolve(x.dirname(x.join(this.path,e)),t))}async moveToFolder(e,t){if(D(),(e.path??"")===t)return e;const a={...e,path:t};await this.assertObjectFilePathAvailable(a,e.id);const i=this.privateObjectPath(a);return await v.rename(this.privateObjectPath(e),i),await this.addOrUpdateIndexEntry(a),a}getAbsolutePath(e=""){return x.join(this.path,e)}getResourceAbsolutePath(e=""){return x.join(this.pathResources,e)}watchFolders(){return s(this.loaded).pipe(f(()=>s(k(this.path))),f(()=>this.watchDir(this.path).pipe(i(e=>!e.filename.endsWith(".json")),u(null),f(()=>s(v.readdir(this.path,{recursive:!0,withFileTypes:!0}))),r(e=>Array.from(new Set(e.filter(e=>e.isDirectory()).map(e=>x.relative(this.path,x.join(e.parentPath,e.name)).replace(/^\.$/,"")).values()))))))}watch(){D();const e=s(this.loaded).pipe(f(()=>s(k(this.pathResources))),f(()=>this.watchDir(this.pathResources)),l(e=>{if(null==e||!["add","change","unlink"].includes(e.event))return a;const t=x.basename(e.filename);return s(this.getAll()).pipe(l(e=>{const i=e.filter(e=>e.fileKey===t);return 0===i.length?a:s(i).pipe(l(e=>{const t=this.privateObjectRelativePath(e);return s(this.readFileIfExists(t)).pipe(r(a=>({event:"change",object:a,path:e.path,filename:t})))}))}))})),t=s(this.loaded).pipe(f(()=>this.watchDir(this.path)),l(e=>{const t={event:e.event,path:x.dirname(e.filename).replace(/^\.$/,""),filename:x.basename(e.filename)};return e.filename.endsWith(".json")?"unlink"!==e.event?s(this.readFileIfExists(e.filename)).pipe(w(e=>{null!=e&&(null==this.cachedIndex&&(this.cachedIndex={}),this.cachedIndex[e.id]={id:e.id,name:e.name??e.id,path:e.path},this.persistIndex())}),r(e=>({object:e,...t}))):d({object:null,...t}).pipe(w(()=>{const t=Object.keys(this.cachedIndex??{}).find(t=>this.privateObjectRelativePath(this.cachedIndex[t])===e.filename);t&&this.removeIndexEntry(t)})):"change"===e.event?s(this.reloadSubdirectory(e.filename)).pipe(o(),r(e=>({object:e,...t}))):a}));return h(t,e)}async reloadSubdirectory(e){return(await this.getAll(e)).filter(t=>t.path.startsWith(e))}async readFileIfExists(e){const t=E(this.path,e);for(let a=0;a<3;a++)try{const a=await O(t);return{...JSON.parse(a.toString()),path:x.dirname(e).replace(/^\.$/,""),filename:x.basename(e)}}catch(e){if(2===a)return console.error("Could not read file at "+t,e),null;await m(50*(a+1))}return null}async getAll(e){if(j){await this.loaded,await k(this.path);const t=await this.getObjectFilePaths(e??""),a=null==e||""===e,i=[];for(let e=0;e<t.length;e+=32){const a=Math.min(32,t.length-e),n=await Promise.all(Array.from({length:a},(a,i)=>{const n=t[e+i];return O(E(this.path,n)).then(e=>({...JSON.parse(e.toString()),path:x.dirname(n).replace(/^\.$/,""),filename:x.basename(n)}))}));i.push(...n)}return a&&(this.cachedIndex=R(i),await this.persistIndex()),i}const t=await this.loadIndex();return Promise.all(Object.keys(t).map(e=>this.get(e)))}async getObjectFilePaths(e){const t=this.path,a=x.join(t,e),i=[];return await async function e(a){const n=await v.readdir(a,{withFileTypes:!0});for(const s of n){const n=x.join(a,s.name);s.isDirectory()?await e(n):s.isFile()&&s.name.endsWith(".json")&&!/^[\._]/.test(s.name)&&i.push(x.relative(t,n))}}(a),i}async get(e){const t=await this.loadIndex(),a=t[e]??Object.values(t).find(t=>t.name===e);if(null==a)return;const i=this.privateObjectPath(a);if(!j)return(await fetch(i)).json();return await z(i)?{...JSON.parse((await O(i)).toString()),path:a.path??"",filename:x.basename(this.privateObjectRelativePath(a))}:null}async save(e){if(D(),await this.loaded,null==e.path){const t=(await this.loadIndex())[e.id];null!=t?.path&&(e={...e,path:t.path})}return await this.assertObjectFilePathAvailable(e,e.id),await v.writeFile(this.privateObjectPath(e),this.serialize(e)),await this.addOrUpdateIndexEntry(e),e}async rename(e,t){const a={...e,name:t};await this.assertObjectFilePathAvailable(a,e.id);const i=this.privateObjectPath(e),n=this.privateObjectPath(a);try{await v.rename(i,n)}catch(e){console.error(e),console.warn("Rename failed, retrying",{currentPath:i,newPath:n}),await m(400),await v.rename(i,n)}return await this.save(a),a}async delete(e){await v.unlink(this.privateObjectPath(e)),this.removeIndexEntry(e.id)}async create(t){D(),await this.loaded,t.id=e();const a=this.privateObjectPath(t);if(await this.assertObjectFilePathAvailable(t),await U(a))throw Error(`Can not create because a file already exists at ${a}`);return await v.writeFile(a,this.serialize(t)),await this.addOrUpdateIndexEntry(t),t}prepareCreate(t){return D(),t.id=e(),t}serialize(e){return this.serializer(e)}async addOrUpdateIndexEntry(e){null==this.cachedIndex&&await this.loadIndex(),this.cachedIndex[e.id]={id:e.id,name:e.name??e.id,path:e.path},await this.persistIndex()}removeIndexEntry(e){null!=this.cachedIndex&&delete this.cachedIndex[e],this.persistIndex()}async persistIndex(){j&&this.shouldCreateIndex&&null!=this.cachedIndex&&await v.writeFile(this.indexFilePath,JSON.stringify(this.cachedIndex,null,2))}get indexFilePath(){return E(this.path,"_meta.json")}async loadIndex(){if(null!=this.cachedIndex)return this.cachedIndex;this.loadingIndex??(this.loadingIndex=this.createIndex());try{return await this.loadingIndex}finally{this.loadingIndex=null}}async createIndex(){if(j){const e=await this.getAll();this.cachedIndex=R(e),await this.persistIndex()}else this.cachedIndex=await(await fetch(this.indexFilePath)).json();return this.cachedIndex}async ensureResourceDir(){await k(E(this.path+"-resources"))}async saveFile(e,t){return D(),await k(E(this.path+"-resources")),v.copyFile(t.path,E(this.path+"-resources",e.fileKey))}async saveExtraFile(e,t){return D(),await k(E(this.path+"-resources")),v.copyFile(e,E(this.path+"-resources",t))}getAssetPath(e){return window&&"function"==typeof window.require?window.require("path").join(this.path+"-resources",e.fileKey):E(this.path+"-resources",e.fileKey)}async replaceFile(e,t){if(await z(t))return v.copyFile(t,E(this.path+"-resources",e.fileKey));console.error("Failed to replace file using path "+t)}async deleteFile(e){if(null==e)return;D();const t=E(this.path+"-resources",e);return await z(t)?v.unlink(t):void 0}privateObjectPath(e){return E(this.path,this.privateObjectRelativePath(e))}privateObjectRelativePath(e){return this.filePathFn?E(e.path??"",this.filePathFn(e)):E(e.path??"",tokenizeName(e.name??e.id)+".json")}async assertObjectFilePathAvailable(e,t){const a=await this.findObjectFilePathCollision(e,t);if(null!=a)throw Error(`Can not save "${e.name??e.id}" because "${a.name}" already uses the same storage file name. Use a name that differs beyond letter casing.`)}async findObjectFilePathCollision(e,t){const a=A(this.privateObjectRelativePath(e)),i=await this.loadIndex();return Object.values(i).find(e=>e.id!==t&&A(this.privateObjectRelativePath(e))===a)??null}watchDir(e){return new c(t=>{if("win32"===process.platform&&j){const a=y.watch(e,{recursive:!0},(a,i)=>{if(i){const n=x.join(e,i);y.access(n,y.constants.F_OK,e=>{const n=e?"unlink":"rename"===a?"add":"change";t.next({event:n,filename:i})})}});return()=>a.close()}const a=b.watch(e,{cwd:e,ignoreInitial:!0,disableGlobbing:!0});return a.on("all",(e,a,i)=>{t.next({event:e,filename:a})}),a.on("error",()=>{}),()=>{a.close()}})}}export function tokenizeName(e){return e.trim().replace(/\s/g,"_").replace(/[^a-z0-9_\-\.]/gi,"")}function A(e){return e.replace(/\\/g,"/").toLowerCase()}function R(e){const t={};for(const a of e)t[a.id]={id:a.id,name:a.name??a.id,path:a.path};return t}async function k(e){j&&(await z(e)||await v.mkdir(e,{recursive:!0}))}function z(e){return!!j&&new Promise(function(t,a){y.exists(e,function(e){t(e)})})}function D(){if(!j)throw new Error("Must have direct access to filesystem")}async function U(e){try{await v.access(e,v.constants.F_OK)}catch(e){return!1}return!0}export function defaultSerializer(e){const t={...e};return delete t.path,delete t.filename,JSON.stringify(t,null,2)}/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
- import{__decorate as e,__metadata as a}from"tslib";import{Color as t,MeshStandardMaterial as n,Texture as r,Vector2 as i}from"three";import{Shader as s}from"../shader.js";import{Parameter as o}from"../parameter.js";import*as p from"three";import{attributes as l,AttributeVec3Node as d,colorToNormal as h,ifDefApply as m,NodeShaderMaterial as u,normalize as v,Sampler2DNode as c,standardMaterial as y,UniformSampler2d as S,uniformFloat as g,uniformVec2 as f,uniformVec3 as M,varying as x,varyingAttributes as C,varyingTransformed as b,vec2 as w,UniformVec3Node as O,UniformFloatNode as R}from"three-shader-graph";import{parallaxOcclusionMapping as L}from"../../shader-nodes/pom.js";const T=new r,N=new i(1,1);export class StandardShader extends s{constructor(){super(...arguments),this.color=new t("#FFFFFF"),this.map=new S("map",T),this.opacity=1,this.alphaMap=new S("alphaMap",T),this.roughness=1,this.roughnessMap=new S("roughnessMap",T),this.metalness=0,this.metalnessMap=new S("metalnessMap",T),this.lightMap=new S("lightMap",T),this.aoMap=new S("aoMap",T),this.emissiveMap=new S("emissiveMap",T),this.normalMap=new S("normalMap",T),this.normalScale=new i(1,1),this.sheen=0,this.sheenColor=new t("#FFFFFF"),this.sheenColorMap=new S("sheenColorMap",T),this.sheenRoughness=.5,this.sheenRoughnessMap=new S("sheenRoughnessMap",T),this.anisotropyMap=new S("anisotropyMap",T),this.anisotropy=0,this.heightMap=new S("heightMap",T),this.vertexColor=!1,this.uvScale=N}build(){F(this.map,p.SRGBColorSpace),F(this.alphaMap,p.LinearSRGBColorSpace),F(this.roughnessMap,p.LinearSRGBColorSpace),F(this.metalnessMap,p.LinearSRGBColorSpace),F(this.aoMap,p.LinearSRGBColorSpace),F(this.emissiveMap,p.SRGBColorSpace),F(this.normalMap,p.LinearSRGBColorSpace),F(this.sheenColorMap,p.LinearSRGBColorSpace),F(this.sheenRoughnessMap,p.LinearSRGBColorSpace),F(this.anisotropyMap,p.LinearSRGBColorSpace);let e=!1;const a=f("uvScale",this.uvScale??N);let n=C.uv.multiply(a);B(this.heightMap)&&0!==(this.heightScale??.05)&&(n=L(n,this.heightMap,g("heightScale",this.heightScale??.05)));const r=x(new d("particleData"));let s=m("IS_PARTICLE",new R("opacity",this.opacity,void 0,!1),e=>e.multiply(r.x)),o=new O("color",(new p.Vector3).setFromColor(this.color),void 0,!1).rgb;if(B(this.map)){const e=this.map.sample(n);o=o.multiply(e.rgb),s=s.multiply(e.a)}B(this.alphaMap)&&(s=s.multiply(this.alphaMap.sample(n).r)),!0===this.vertexColor&&(o=o.multiply(x(l.color.rgb)));let c=null,S=null;B(this.aoMap)&&(S=g("aoMapIntensity",this.aoMapIntensity??1),c=this.aoMap.sample(n).r);let T=g("roughness",this.roughness??1);B(this.roughnessMap)&&(T=T.multiply(this.roughnessMap.sample(n).g),e=!0);let P=g("metalness",this.metalness??0);B(this.metalnessMap)&&(P=P.multiply(this.metalnessMap.sample(n).b),e=!0);let D=null;B(this.lightMap)&&(D=this.lightMap.sample(n).rgb.multiplyScalar(g("lightMapIntensity",this.lightMapIntensity??1)));let _=M("emissive",(new p.Vector3).setFromColor(this.emissive??new t(0))).rgb;B(this.emissiveMap)&&(_=_.multiply(this.emissiveMap.sample(n).rgb));const I=g("emissiveIntensity",this.emissiveIntensity??1);let E=b.normal;if(B(this.normalMap)){const e=g("normalScale",this.normalScale?.x??1);E=h(this.normalMap.sample(n),e)}let V=null,G=null;if((this.sheen??0)>0){const e=g("sheen",this.sheen??0);V=M("sheenColor",(new p.Vector3).setFromColor(this.sheenColor??new t(16777215))).rgb.multiplyScalar(e),B(this.sheenColorMap)&&(V=V.multiply(this.sheenColorMap.sample(n).rgb)),G=g("sheenRoughness",this.sheenRoughness??.5),B(this.sheenRoughnessMap)&&(G=G.multiply(this.sheenRoughnessMap.sample(n).a))}(this.roughness<1||this.metalness>0)&&(e=!0);let H=null,A=null;if((this.anisotropy??0)>0&&(H=g("anisotropy",this.anisotropy??0),A=f("anisotropyDirection",(U=this.anisotropyRotation??0,new i(Math.cos(U),Math.sin(U)))),B(this.anisotropyMap))){const e=this.anisotropyMap.sample(n),a=v(w(e.r,e.g).multiplyScalar(2).subtract(w(1,1)));A=w(A.x.multiply(a.x).subtract(A.y.multiply(a.y)),A.y.multiply(a.x).add(A.x.multiply(a.y))),H=H.multiply(e.b)}var U;const z=new u({color:y({color:o.rgba(s),roughness:T,metalness:P,ambientOcclusion:c,ambientOcclusionIntensity:S,emissive:_,emissiveIntensity:I,normal:E,bakedLight:D,sheenColor:V,sheenRoughness:G,anisotropy:H,anisotropyDirection:A,specular:e}),opacity:s,roughness:T,normal:E,emissive:_.multiplyScalar(I),envMap:this.envMap});return null!=this.envMap&&(z.uniforms.envMapIntensity={value:this.envMapIntensity??1}),z.vertexColors=!0===this.vertexColor,z}}function B(e){return null!=e&&(!(e instanceof S)||null!=e.value&&e.value!==T)}e([o(),a("design:type",t)],StandardShader.prototype,"color",void 0),e([o({label:"Color Map"}),a("design:type",c)],StandardShader.prototype,"map",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"opacity",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"alphaMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"roughness",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"roughnessMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"metalness",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"metalnessMap",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"lightMap",void 0),e([o(),a("design:type",Number)],StandardShader.prototype,"lightMapIntensity",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"aoMap",void 0),e([o(),a("design:type",Number)],StandardShader.prototype,"aoMapIntensity",void 0),e([o(),a("design:type",t)],StandardShader.prototype,"emissive",void 0),e([o({range:[0,10]}),a("design:type",Number)],StandardShader.prototype,"emissiveIntensity",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"emissiveMap",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"normalMap",void 0),e([o(),a("design:type",i)],StandardShader.prototype,"normalScale",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"sheen",void 0),e([o(),a("design:type",t)],StandardShader.prototype,"sheenColor",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"sheenColorMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"sheenRoughness",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"sheenRoughnessMap",void 0),e([o(),a("design:type",Number)],StandardShader.prototype,"anisotropyRotation",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"anisotropyMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"anisotropy",void 0),e([o(),a("design:type",r)],StandardShader.prototype,"envMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"envMapIntensity",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"heightMap",void 0),e([o(),a("design:type",Number)],StandardShader.prototype,"heightScale",void 0),e([o(),a("design:type",Boolean)],StandardShader.prototype,"vertexColor",void 0),e([o(),a("design:type",i)],StandardShader.prototype,"uvScale",void 0);export var ParallaxType;!function(e){e[e.none=0]="none",e[e.offset=1]="offset",e[e.pom=2]="pom"}(ParallaxType||(ParallaxType={}));export class ParallaxStandardMaterial extends n{constructor(e={}){super(e),e.heightMap&&(this.heightMap=e.heightMap),this.heightScale=e.heightScale??.05,this.parallaxType=e.parallaxType??ParallaxType.pom,this.minLayers=e.minLayers??10,this.maxLayers=e.maxLayers??32}onBeforeCompile(e){e.uniforms.heightMap={value:this.heightMap},e.uniforms.heightScale={value:this.heightScale},e.uniforms.minLayers={value:this.minLayers},e.uniforms.maxLayers={value:this.maxLayers},e.uniforms.parallaxType={value:this.parallaxType},e.vertexTangents=!0,e.vertexShader=e.vertexShader.replace("#include <uv_pars_vertex>","\n #include <uv_pars_vertex>\n "),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>","\n #include <begin_vertex>\n "),e.fragmentShader=e.fragmentShader.replace("#include <uv_pars_fragment>","\n #include <uv_pars_fragment>\n uniform sampler2D heightMap;\n uniform float heightScale;\n uniform int minLayers;\n uniform int maxLayers;\n uniform int parallaxType;\n\n vec2 parallaxOffset(vec2 uv, vec3 viewDir, vec3 normal) {\n // Compute TBN in fragment shader using screen-space derivatives\n vec3 dp1 = dFdx(-vViewPosition);\n vec3 dp2 = dFdy(-vViewPosition);\n vec2 duv1 = dFdx(uv);\n vec2 duv2 = dFdy(uv);\n \n vec3 dp2perp = cross(dp2, normal);\n vec3 dp1perp = cross(normal, dp1);\n vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n \n float invmax = inversesqrt(max(dot(T,T), dot(B,B)));\n mat3 tbn = mat3(T * invmax, B * invmax, normal);\n vec3 viewDirTS = -viewDir * tbn;\n\n float h = texture(heightMap, uv).r;\n return uv - (viewDirTS.xy / viewDirTS.z) * (h * heightScale);\n }\n\n vec2 parallaxOcclusion2(vec2 uv, vec3 viewDir, vec3 normal) {\n // Compute TBN in fragment shader using screen-space derivatives\n vec3 dp1 = dFdx(-vViewPosition);\n vec3 dp2 = dFdy(-vViewPosition);\n vec2 duv1 = dFdx(uv);\n vec2 duv2 = dFdy(uv);\n \n vec3 dp2perp = cross(dp2, normal);\n vec3 dp1perp = cross(normal, dp1);\n vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n \n float invmax = inversesqrt(max(dot(T,T), dot(B,B)));\n mat3 tbn = mat3(T * invmax, B * invmax, normal);\n vec3 vv = -viewDir * tbn;\n\n float parallaxLimit = -length(vv.xy) / vv.z;\n parallaxLimit *= heightScale;\n\n vec2 vOffsetDir = normalize(vv.xy);\n vec2 vMaxOffset = vOffsetDir * parallaxLimit;\n\n float factor = pow(1.0 - abs(vv.z), 2.0);\n float nNumSamples = mix(float(minLayers), float(maxLayers), factor);\n float fStepSize = 1.0 / nNumSamples;\n\n float fCurrRayHeight = 1.0;\n vec2 vCurrOffset = vec2(0.0);\n vec2 vLastOffset = vec2(0.0);\n float fLastSampledHeight = 1.0;\n float fCurrSampledHeight = 1.0;\n\n for (int nCurrSample = 0; nCurrSample < 128; nCurrSample++) {\n if (float(nCurrSample) > nNumSamples) break;\n\n fCurrSampledHeight = texture2D(heightMap, uv + vCurrOffset).r;\n if (fCurrSampledHeight > fCurrRayHeight) {\n float delta1 = fCurrSampledHeight - fCurrRayHeight;\n float delta2 = (fCurrRayHeight + fStepSize) - fLastSampledHeight;\n float ratio = delta1 / (delta1 + delta2);\n vCurrOffset = ratio * vLastOffset + (1.0 - ratio) * vCurrOffset;\n break;\n } else {\n fCurrRayHeight -= fStepSize;\n vLastOffset = vCurrOffset;\n vCurrOffset += fStepSize * vMaxOffset;\n fLastSampledHeight = fCurrSampledHeight;\n }\n }\n\n return uv + vCurrOffset;\n }\n "),e.fragmentShader=e.fragmentShader.replace("#include <map_fragment>","\n vec3 pomViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n vec2 uvPOM = vMapUv ;\n if (parallaxType == 1) {\n uvPOM = parallaxOffset(vMapUv, pomViewDir, vNormal);\n } else if (parallaxType == 2) {\n uvPOM = parallaxOcclusion2(vMapUv, pomViewDir, vNormal);\n }\n\n vec4 texelColor = texture2D(map, uvPOM);\n diffuseColor *= texelColor;\n "),e.fragmentShader=e.fragmentShader.replace("#include <normal_fragment_maps>","\n #ifdef USE_NORMALMAP\n // RE-COMPUTE TBN for normal mapping consistency\n vec3 dp1 = dFdx(-vViewPosition);\n vec3 dp2 = dFdy(-vViewPosition);\n vec2 duv1 = dFdx(uvPOM);\n vec2 duv2 = dFdy(uvPOM);\n vec3 dp2perp = cross(dp2, vNormal);\n vec3 dp1perp = cross(vNormal, dp1);\n vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n float invmax = inversesqrt(max(dot(T,T), dot(B,B)));\n mat3 localTBN = mat3(T * invmax, B * invmax, vNormal);\n\n vec3 mapN = texture2D(normalMap, uvPOM).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( localTBN * mapN );\n #endif\n "),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>","\n float roughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, uvPOM );\n // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n roughnessFactor *= texelRoughness.g;\n #endif\n "),e.fragmentShader=e.fragmentShader.replace("#include <metalnesssmap_fragment>","\n float metalnessFactor = metalness;\n #ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, uvPOM );\n // reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n metalnessFactor *= texelMetalness.b;\n #endif\n "),e.fragmentShader=e.fragmentShader.replace("#include <aomap_fragment>","\n #ifdef USE_AOMAP\n\n // reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n float ambientOcclusion = ( texture2D( aoMap, uvPOM ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\n #endif\n\n #endif\n "),this.userData.shader=e}clone(){const e=super.clone();return e.heightMap=this.heightMap,e.heightScale=this.heightScale,e.parallaxType=this.parallaxType,e.minLayers=this.minLayers,e.maxLayers=this.maxLayers,e}}export function applyTiling(e,a){if(null==e||null==a)return e;if(1===a.x&&1===a.y)return e;const t=e.clone();return t.repeat.copy(a),t.needsUpdate=!0,t}function F(e,a){null!=e&&(e instanceof r?e.colorSpace=a:e instanceof S&&null!=e.value&&(e.value.colorSpace=a))}/*
1
+ import{__decorate as e,__metadata as a}from"tslib";import{Color as t,MeshStandardMaterial as n,Texture as r,Vector2 as i}from"three";import{Shader as s}from"../shader.js";import{Parameter as o}from"../parameter.js";import*as p from"three";import{attributes as l,AttributeVec3Node as d,colorToNormal as h,ifDefApply as m,NodeShaderMaterial as u,normalize as v,Sampler2DNode as c,standardMaterial as y,UniformSampler2d as S,uniformFloat as g,uniformVec2 as f,uniformVec3 as M,varying as x,varyingAttributes as C,varyingTransformed as b,vec2 as w,UniformVec3Node as O,UniformFloatNode as R}from"three-shader-graph";import{parallaxOcclusionMapping as L}from"../../shader-nodes/pom.js";import{createPlaceholderTexture as T}from"../../utils/three/placeholder-texture.js";const N=T(),B=new i(1,1);export class StandardShader extends s{constructor(){super(...arguments),this.color=new t("#FFFFFF"),this.map=new S("map",N),this.opacity=1,this.alphaMap=new S("alphaMap",N),this.roughness=1,this.roughnessMap=new S("roughnessMap",N),this.metalness=0,this.metalnessMap=new S("metalnessMap",N),this.lightMap=new S("lightMap",N),this.aoMap=new S("aoMap",N),this.emissiveMap=new S("emissiveMap",N),this.normalMap=new S("normalMap",N),this.normalScale=new i(1,1),this.sheen=0,this.sheenColor=new t("#FFFFFF"),this.sheenColorMap=new S("sheenColorMap",N),this.sheenRoughness=.5,this.sheenRoughnessMap=new S("sheenRoughnessMap",N),this.anisotropyMap=new S("anisotropyMap",N),this.anisotropy=0,this.heightMap=new S("heightMap",N),this.vertexColor=!1,this.uvScale=B}build(){P(this.map,p.SRGBColorSpace),P(this.alphaMap,p.LinearSRGBColorSpace),P(this.roughnessMap,p.LinearSRGBColorSpace),P(this.metalnessMap,p.LinearSRGBColorSpace),P(this.aoMap,p.LinearSRGBColorSpace),P(this.emissiveMap,p.SRGBColorSpace),P(this.normalMap,p.LinearSRGBColorSpace),P(this.sheenColorMap,p.LinearSRGBColorSpace),P(this.sheenRoughnessMap,p.LinearSRGBColorSpace),P(this.anisotropyMap,p.LinearSRGBColorSpace);let e=!1;const a=f("uvScale",this.uvScale??B);let n=C.uv.multiply(a);F(this.heightMap)&&0!==(this.heightScale??.05)&&(n=L(n,this.heightMap,g("heightScale",this.heightScale??.05)));const r=x(new d("particleData"));let s=m("IS_PARTICLE",new R("opacity",this.opacity,void 0,!1),e=>e.multiply(r.x)),o=new O("color",(new p.Vector3).setFromColor(this.color),void 0,!1).rgb;if(F(this.map)){const e=this.map.sample(n);o=o.multiply(e.rgb),s=s.multiply(e.a)}F(this.alphaMap)&&(s=s.multiply(this.alphaMap.sample(n).r)),!0===this.vertexColor&&(o=o.multiply(x(l.color.rgb)));let c=null,S=null;F(this.aoMap)&&(S=g("aoMapIntensity",this.aoMapIntensity??1),c=this.aoMap.sample(n).r);let T=g("roughness",this.roughness??1);F(this.roughnessMap)&&(T=T.multiply(this.roughnessMap.sample(n).g),e=!0);let N=g("metalness",this.metalness??0);F(this.metalnessMap)&&(N=N.multiply(this.metalnessMap.sample(n).b),e=!0);let D=null;F(this.lightMap)&&(D=this.lightMap.sample(n).rgb.multiplyScalar(g("lightMapIntensity",this.lightMapIntensity??1)));let _=M("emissive",(new p.Vector3).setFromColor(this.emissive??new t(0))).rgb;F(this.emissiveMap)&&(_=_.multiply(this.emissiveMap.sample(n).rgb));const I=g("emissiveIntensity",this.emissiveIntensity??1);let E=b.normal;if(F(this.normalMap)){const e=g("normalScale",this.normalScale?.x??1);E=h(this.normalMap.sample(n),e)}let V=null,G=null;if((this.sheen??0)>0){const e=g("sheen",this.sheen??0);V=M("sheenColor",(new p.Vector3).setFromColor(this.sheenColor??new t(16777215))).rgb.multiplyScalar(e),F(this.sheenColorMap)&&(V=V.multiply(this.sheenColorMap.sample(n).rgb)),G=g("sheenRoughness",this.sheenRoughness??.5),F(this.sheenRoughnessMap)&&(G=G.multiply(this.sheenRoughnessMap.sample(n).a))}(this.roughness<1||this.metalness>0)&&(e=!0);let H=null,A=null;if((this.anisotropy??0)>0&&(H=g("anisotropy",this.anisotropy??0),A=f("anisotropyDirection",(U=this.anisotropyRotation??0,new i(Math.cos(U),Math.sin(U)))),F(this.anisotropyMap))){const e=this.anisotropyMap.sample(n),a=v(w(e.r,e.g).multiplyScalar(2).subtract(w(1,1)));A=w(A.x.multiply(a.x).subtract(A.y.multiply(a.y)),A.y.multiply(a.x).add(A.x.multiply(a.y))),H=H.multiply(e.b)}var U;const z=new u({color:y({color:o.rgba(s),roughness:T,metalness:N,ambientOcclusion:c,ambientOcclusionIntensity:S,emissive:_,emissiveIntensity:I,normal:E,bakedLight:D,sheenColor:V,sheenRoughness:G,anisotropy:H,anisotropyDirection:A,specular:e}),opacity:s,roughness:T,normal:E,emissive:_.multiplyScalar(I),envMap:this.envMap});return null!=this.envMap&&(z.uniforms.envMapIntensity={value:this.envMapIntensity??1}),z.vertexColors=!0===this.vertexColor,z}}function F(e){return null!=e&&(!(e instanceof S)||null!=e.value&&e.value!==N)}e([o(),a("design:type",t)],StandardShader.prototype,"color",void 0),e([o({label:"Color Map"}),a("design:type",c)],StandardShader.prototype,"map",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"opacity",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"alphaMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"roughness",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"roughnessMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"metalness",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"metalnessMap",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"lightMap",void 0),e([o(),a("design:type",Number)],StandardShader.prototype,"lightMapIntensity",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"aoMap",void 0),e([o(),a("design:type",Number)],StandardShader.prototype,"aoMapIntensity",void 0),e([o(),a("design:type",t)],StandardShader.prototype,"emissive",void 0),e([o({range:[0,10]}),a("design:type",Number)],StandardShader.prototype,"emissiveIntensity",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"emissiveMap",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"normalMap",void 0),e([o(),a("design:type",i)],StandardShader.prototype,"normalScale",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"sheen",void 0),e([o(),a("design:type",t)],StandardShader.prototype,"sheenColor",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"sheenColorMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"sheenRoughness",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"sheenRoughnessMap",void 0),e([o(),a("design:type",Number)],StandardShader.prototype,"anisotropyRotation",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"anisotropyMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"anisotropy",void 0),e([o(),a("design:type",r)],StandardShader.prototype,"envMap",void 0),e([o({range:[0,1]}),a("design:type",Number)],StandardShader.prototype,"envMapIntensity",void 0),e([o(),a("design:type",c)],StandardShader.prototype,"heightMap",void 0),e([o(),a("design:type",Number)],StandardShader.prototype,"heightScale",void 0),e([o(),a("design:type",Boolean)],StandardShader.prototype,"vertexColor",void 0),e([o(),a("design:type",i)],StandardShader.prototype,"uvScale",void 0);export var ParallaxType;!function(e){e[e.none=0]="none",e[e.offset=1]="offset",e[e.pom=2]="pom"}(ParallaxType||(ParallaxType={}));export class ParallaxStandardMaterial extends n{constructor(e={}){super(e),e.heightMap&&(this.heightMap=e.heightMap),this.heightScale=e.heightScale??.05,this.parallaxType=e.parallaxType??ParallaxType.pom,this.minLayers=e.minLayers??10,this.maxLayers=e.maxLayers??32}onBeforeCompile(e){e.uniforms.heightMap={value:this.heightMap},e.uniforms.heightScale={value:this.heightScale},e.uniforms.minLayers={value:this.minLayers},e.uniforms.maxLayers={value:this.maxLayers},e.uniforms.parallaxType={value:this.parallaxType},e.vertexTangents=!0,e.vertexShader=e.vertexShader.replace("#include <uv_pars_vertex>","\n #include <uv_pars_vertex>\n "),e.vertexShader=e.vertexShader.replace("#include <begin_vertex>","\n #include <begin_vertex>\n "),e.fragmentShader=e.fragmentShader.replace("#include <uv_pars_fragment>","\n #include <uv_pars_fragment>\n uniform sampler2D heightMap;\n uniform float heightScale;\n uniform int minLayers;\n uniform int maxLayers;\n uniform int parallaxType;\n\n vec2 parallaxOffset(vec2 uv, vec3 viewDir, vec3 normal) {\n // Compute TBN in fragment shader using screen-space derivatives\n vec3 dp1 = dFdx(-vViewPosition);\n vec3 dp2 = dFdy(-vViewPosition);\n vec2 duv1 = dFdx(uv);\n vec2 duv2 = dFdy(uv);\n \n vec3 dp2perp = cross(dp2, normal);\n vec3 dp1perp = cross(normal, dp1);\n vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n \n float invmax = inversesqrt(max(dot(T,T), dot(B,B)));\n mat3 tbn = mat3(T * invmax, B * invmax, normal);\n vec3 viewDirTS = -viewDir * tbn;\n\n float h = texture(heightMap, uv).r;\n return uv - (viewDirTS.xy / viewDirTS.z) * (h * heightScale);\n }\n\n vec2 parallaxOcclusion2(vec2 uv, vec3 viewDir, vec3 normal) {\n // Compute TBN in fragment shader using screen-space derivatives\n vec3 dp1 = dFdx(-vViewPosition);\n vec3 dp2 = dFdy(-vViewPosition);\n vec2 duv1 = dFdx(uv);\n vec2 duv2 = dFdy(uv);\n \n vec3 dp2perp = cross(dp2, normal);\n vec3 dp1perp = cross(normal, dp1);\n vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n \n float invmax = inversesqrt(max(dot(T,T), dot(B,B)));\n mat3 tbn = mat3(T * invmax, B * invmax, normal);\n vec3 vv = -viewDir * tbn;\n\n float parallaxLimit = -length(vv.xy) / vv.z;\n parallaxLimit *= heightScale;\n\n vec2 vOffsetDir = normalize(vv.xy);\n vec2 vMaxOffset = vOffsetDir * parallaxLimit;\n\n float factor = pow(1.0 - abs(vv.z), 2.0);\n float nNumSamples = mix(float(minLayers), float(maxLayers), factor);\n float fStepSize = 1.0 / nNumSamples;\n\n float fCurrRayHeight = 1.0;\n vec2 vCurrOffset = vec2(0.0);\n vec2 vLastOffset = vec2(0.0);\n float fLastSampledHeight = 1.0;\n float fCurrSampledHeight = 1.0;\n\n for (int nCurrSample = 0; nCurrSample < 128; nCurrSample++) {\n if (float(nCurrSample) > nNumSamples) break;\n\n fCurrSampledHeight = texture2D(heightMap, uv + vCurrOffset).r;\n if (fCurrSampledHeight > fCurrRayHeight) {\n float delta1 = fCurrSampledHeight - fCurrRayHeight;\n float delta2 = (fCurrRayHeight + fStepSize) - fLastSampledHeight;\n float ratio = delta1 / (delta1 + delta2);\n vCurrOffset = ratio * vLastOffset + (1.0 - ratio) * vCurrOffset;\n break;\n } else {\n fCurrRayHeight -= fStepSize;\n vLastOffset = vCurrOffset;\n vCurrOffset += fStepSize * vMaxOffset;\n fLastSampledHeight = fCurrSampledHeight;\n }\n }\n\n return uv + vCurrOffset;\n }\n "),e.fragmentShader=e.fragmentShader.replace("#include <map_fragment>","\n vec3 pomViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n vec2 uvPOM = vMapUv ;\n if (parallaxType == 1) {\n uvPOM = parallaxOffset(vMapUv, pomViewDir, vNormal);\n } else if (parallaxType == 2) {\n uvPOM = parallaxOcclusion2(vMapUv, pomViewDir, vNormal);\n }\n\n vec4 texelColor = texture2D(map, uvPOM);\n diffuseColor *= texelColor;\n "),e.fragmentShader=e.fragmentShader.replace("#include <normal_fragment_maps>","\n #ifdef USE_NORMALMAP\n // RE-COMPUTE TBN for normal mapping consistency\n vec3 dp1 = dFdx(-vViewPosition);\n vec3 dp2 = dFdy(-vViewPosition);\n vec2 duv1 = dFdx(uvPOM);\n vec2 duv2 = dFdy(uvPOM);\n vec3 dp2perp = cross(dp2, vNormal);\n vec3 dp1perp = cross(vNormal, dp1);\n vec3 T = dp2perp * duv1.x + dp1perp * duv2.x;\n vec3 B = dp2perp * duv1.y + dp1perp * duv2.y;\n float invmax = inversesqrt(max(dot(T,T), dot(B,B)));\n mat3 localTBN = mat3(T * invmax, B * invmax, vNormal);\n\n vec3 mapN = texture2D(normalMap, uvPOM).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( localTBN * mapN );\n #endif\n "),e.fragmentShader=e.fragmentShader.replace("#include <roughnessmap_fragment>","\n float roughnessFactor = roughness;\n #ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, uvPOM );\n // reads channel G, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n roughnessFactor *= texelRoughness.g;\n #endif\n "),e.fragmentShader=e.fragmentShader.replace("#include <metalnesssmap_fragment>","\n float metalnessFactor = metalness;\n #ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, uvPOM );\n // reads channel B, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n metalnessFactor *= texelMetalness.b;\n #endif\n "),e.fragmentShader=e.fragmentShader.replace("#include <aomap_fragment>","\n #ifdef USE_AOMAP\n\n // reads channel R, compatible with a combined OcclusionRoughnessMetallic (RGB) texture\n float ambientOcclusion = ( texture2D( aoMap, uvPOM ).r - 1.0 ) * aoMapIntensity + 1.0;\n\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\n #endif\n\n #endif\n "),this.userData.shader=e}clone(){const e=super.clone();return e.heightMap=this.heightMap,e.heightScale=this.heightScale,e.parallaxType=this.parallaxType,e.minLayers=this.minLayers,e.maxLayers=this.maxLayers,e}}export function applyTiling(e,a){if(null==e||null==a)return e;if(1===a.x&&1===a.y)return e;const t=e.clone();return t.repeat.copy(a),t.needsUpdate=!0,t}function P(e,a){null!=e&&(e instanceof r?e.colorSpace=a:e instanceof S&&null!=e.value&&(e.value.colorSpace=a))}/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
- import{__decorate as e,__metadata as t}from"tslib";import{Color as o,DataTexture as i,RedFormat as s,Texture as a,Vector2 as n}from"three";import{Parameter as r}from"../parameter.js";import{Shader as p}from"../shader.js";import*as l from"three";import{attributes as h,colorToNormal as m,NodeShaderMaterial as y,Sampler2DNode as d,toonMaterial as g,UniformSampler2d as v,uniformFloat as c,uniformVec3 as u,varying as S,varyingAttributes as M,varyingTransformed as b,vec2 as T}from"three-shader-graph";const w=new a;export class ToonShader extends p{constructor(){super(...arguments),this.color=new o("#FFFFFF"),this.opacity=1,this.intensity=1,this.map=new v("map",w),this.lightSteps=[],this.lightMap=new v("lightMap",w),this.normalMap=new v("normalMap",w),this.normalScale=new n(1,1),this.aoMap=new v("aoMap",w),this.alphaMap=new v("alphaMap",w),this.emissiveMap=new v("emissiveMap",w),this.vertexColor=!1,this.uvScale=new n(1,1)}build(){let e;if(null!=this.lightSteps&&this.lightSteps.length>0){const t=new Uint8Array(this.lightSteps.length);for(let e=0;e<t.length;e++)t[e]=255*this.lightSteps[e];e=new i(t,t.length,1,s),e.needsUpdate=!0}const t=function(e,t){if(null==t||1===t.x&&1===t.y)return e;return e.multiply(T(t))}(M.uv,this.uvScale);let a=c("opacity",this.opacity),n=u("color",(new l.Vector3).setFromColor(this.color)).rgb.multiplyScalar(c("intensity",this.intensity));if(f(this.map)){const e=this.map.sample(t);n=n.multiply(e.rgb),a=a.multiply(e.a)}f(this.alphaMap)&&(a=a.multiply(this.alphaMap.sample(t).r)),!0===this.vertexColor&&(n=n.multiply(S(h.color.rgb)));let r=null;f(this.lightMap)&&(r=this.lightMap.sample(t).rgb.multiplyScalar(c("lightMapIntensity",this.lightMapIntensity??1)));let p=b.normal;f(this.normalMap)&&(p=m(this.normalMap.sample(t),c("normalScale",this.normalScale?.x??1)));let d=null;f(this.aoMap)&&(d=this.aoMap.sample(t).r);const v=c("aoMapIntensity",this.aoMapIntensity??1);let w=u("emissive",(new l.Vector3).setFromColor(this.emissive??new o(0))).rgb;f(this.emissiveMap)&&(w=w.multiply(this.emissiveMap.sample(t).rgb));const I=c("emissiveIntensity",this.emissiveIntensity??1),x=new y({color:g({color:n.rgba(a),gradientMap:e,bakedLight:r,normal:p,ambientOcclusion:d,ambientOcclusionIntensity:v,emissive:w,emissiveIntensity:I}),opacity:a,normal:p,emissive:w.multiplyScalar(I)});return x.vertexColors=!0===this.vertexColor,x}}function f(e){return null!=e&&(!(e instanceof v)||null!=e.value&&e.value!==w)}e([r(),t("design:type",o)],ToonShader.prototype,"color",void 0),e([r({range:[0,1]}),t("design:type",Number)],ToonShader.prototype,"opacity",void 0),e([r({range:[0,10]}),t("design:type",Number)],ToonShader.prototype,"intensity",void 0),e([r(),t("design:type",d)],ToonShader.prototype,"map",void 0),e([r({type:Number,array:!0,range:[0,1]}),t("design:type",Array)],ToonShader.prototype,"lightSteps",void 0),e([r(),t("design:type",d)],ToonShader.prototype,"lightMap",void 0),e([r(),t("design:type",Number)],ToonShader.prototype,"lightMapIntensity",void 0),e([r(),t("design:type",d)],ToonShader.prototype,"normalMap",void 0),e([r(),t("design:type",n)],ToonShader.prototype,"normalScale",void 0),e([r(),t("design:type",d)],ToonShader.prototype,"aoMap",void 0),e([r(),t("design:type",Number)],ToonShader.prototype,"aoMapIntensity",void 0),e([r(),t("design:type",d)],ToonShader.prototype,"alphaMap",void 0),e([r(),t("design:type",o)],ToonShader.prototype,"emissive",void 0),e([r({range:[0,10]}),t("design:type",Number)],ToonShader.prototype,"emissiveIntensity",void 0),e([r(),t("design:type",d)],ToonShader.prototype,"emissiveMap",void 0),e([r(),t("design:type",Boolean)],ToonShader.prototype,"vertexColor",void 0),e([r(),t("design:type",n)],ToonShader.prototype,"uvScale",void 0);/*
1
+ import{__decorate as e,__metadata as t}from"tslib";import{Color as o,DataTexture as i,RedFormat as s,Vector2 as r}from"three";import{Parameter as a}from"../parameter.js";import{Shader as p}from"../shader.js";import*as n from"three";import{attributes as l,colorToNormal as h,NodeShaderMaterial as m,Sampler2DNode as y,toonMaterial as d,UniformSampler2d as g,uniformFloat as v,uniformVec3 as c,varying as u,varyingAttributes as S,varyingTransformed as M,vec2 as b}from"three-shader-graph";import{createPlaceholderTexture as T}from"../../utils/three/placeholder-texture.js";const w=T();export class ToonShader extends p{constructor(){super(...arguments),this.color=new o("#FFFFFF"),this.opacity=1,this.intensity=1,this.map=new g("map",w),this.lightSteps=[],this.lightMap=new g("lightMap",w),this.normalMap=new g("normalMap",w),this.normalScale=new r(1,1),this.aoMap=new g("aoMap",w),this.alphaMap=new g("alphaMap",w),this.emissiveMap=new g("emissiveMap",w),this.vertexColor=!1,this.uvScale=new r(1,1)}build(){let e;if(null!=this.lightSteps&&this.lightSteps.length>0){const t=new Uint8Array(this.lightSteps.length);for(let e=0;e<t.length;e++)t[e]=255*this.lightSteps[e];e=new i(t,t.length,1,s),e.needsUpdate=!0}const t=function(e,t){if(null==t||1===t.x&&1===t.y)return e;return e.multiply(b(t))}(S.uv,this.uvScale);let r=v("opacity",this.opacity),a=c("color",(new n.Vector3).setFromColor(this.color)).rgb.multiplyScalar(v("intensity",this.intensity));if(f(this.map)){const e=this.map.sample(t);a=a.multiply(e.rgb),r=r.multiply(e.a)}f(this.alphaMap)&&(r=r.multiply(this.alphaMap.sample(t).r)),!0===this.vertexColor&&(a=a.multiply(u(l.color.rgb)));let p=null;f(this.lightMap)&&(p=this.lightMap.sample(t).rgb.multiplyScalar(v("lightMapIntensity",this.lightMapIntensity??1)));let y=M.normal;f(this.normalMap)&&(y=h(this.normalMap.sample(t),v("normalScale",this.normalScale?.x??1)));let g=null;f(this.aoMap)&&(g=this.aoMap.sample(t).r);const T=v("aoMapIntensity",this.aoMapIntensity??1);let w=c("emissive",(new n.Vector3).setFromColor(this.emissive??new o(0))).rgb;f(this.emissiveMap)&&(w=w.multiply(this.emissiveMap.sample(t).rgb));const I=v("emissiveIntensity",this.emissiveIntensity??1),x=new m({color:d({color:a.rgba(r),gradientMap:e,bakedLight:p,normal:y,ambientOcclusion:g,ambientOcclusionIntensity:T,emissive:w,emissiveIntensity:I}),opacity:r,normal:y,emissive:w.multiplyScalar(I)});return x.vertexColors=!0===this.vertexColor,x}}function f(e){return null!=e&&(!(e instanceof g)||null!=e.value&&e.value!==w)}e([a(),t("design:type",o)],ToonShader.prototype,"color",void 0),e([a({range:[0,1]}),t("design:type",Number)],ToonShader.prototype,"opacity",void 0),e([a({range:[0,10]}),t("design:type",Number)],ToonShader.prototype,"intensity",void 0),e([a(),t("design:type",y)],ToonShader.prototype,"map",void 0),e([a({type:Number,array:!0,range:[0,1]}),t("design:type",Array)],ToonShader.prototype,"lightSteps",void 0),e([a(),t("design:type",y)],ToonShader.prototype,"lightMap",void 0),e([a(),t("design:type",Number)],ToonShader.prototype,"lightMapIntensity",void 0),e([a(),t("design:type",y)],ToonShader.prototype,"normalMap",void 0),e([a(),t("design:type",r)],ToonShader.prototype,"normalScale",void 0),e([a(),t("design:type",y)],ToonShader.prototype,"aoMap",void 0),e([a(),t("design:type",Number)],ToonShader.prototype,"aoMapIntensity",void 0),e([a(),t("design:type",y)],ToonShader.prototype,"alphaMap",void 0),e([a(),t("design:type",o)],ToonShader.prototype,"emissive",void 0),e([a({range:[0,10]}),t("design:type",Number)],ToonShader.prototype,"emissiveIntensity",void 0),e([a(),t("design:type",y)],ToonShader.prototype,"emissiveMap",void 0),e([a(),t("design:type",Boolean)],ToonShader.prototype,"vertexColor",void 0),e([a(),t("design:type",r)],ToonShader.prototype,"uvScale",void 0);/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
- import{__decorate as t,__metadata as e}from"tslib";import{Color as i,Texture as o,Vector2 as p}from"three";import{Shader as a}from"../shader.js";import{Parameter as r}from"../parameter.js";import{attributes as n,NodeShaderMaterial as l,rgba as s,Sampler2DNode as h,UniformSampler2d as y,uniformFloat as d,uniformVec3 as m,varying as u,varyingAttributes as c,vec2 as g}from"three-shader-graph";import*as v from"three";const M=new o;export class UnlitShader extends a{constructor(){super(...arguments),this.color=new i("#FFFFFF"),this.opacity=1,this.intensity=1,this.map=new y("map",M),this.lightMap=new y("lightMap",M),this.aoMap=new y("aoMap",M),this.alphaMap=new y("alphaMap",M),this.vertexColor=!1,this.uvScale=new p(1,1)}build(){const t=function(t,e){if(null==e||1===e.x&&1===e.y)return t;return t.multiply(g(e))}(c.uv,this.uvScale);let e=d("opacity",this.opacity),i=m("color",(new v.Vector3).setFromColor(this.color)).rgb.multiplyScalar(d("intensity",this.intensity));if(S(this.map)){const o=this.map.sample(t);i=i.multiply(o.rgb),e=e.multiply(o.a)}if(S(this.alphaMap)&&(e=e.multiply(this.alphaMap.sample(t).r)),!0===this.vertexColor&&(i=i.multiply(u(n.color.rgb))),S(this.lightMap)&&(i=i.add(this.lightMap.sample(t).rgb.multiplyScalar(d("lightMapIntensity",this.lightMapIntensity??1)))),S(this.aoMap)){const e=this.aoMap.sample(t).r,o=d("aoMapIntensity",this.aoMapIntensity??1);i=i.multiplyScalar(e.subtract(1).multiply(o).add(1))}const o=new l({color:s(i,e),opacity:e,emissive:i,envMap:this.envMap});return o.vertexColors=!0===this.vertexColor,o}}function S(t){return null!=t&&(!(t instanceof y)||null!=t.value&&t.value!==M)}t([r(),e("design:type",i)],UnlitShader.prototype,"color",void 0),t([r({range:[0,1]}),e("design:type",Number)],UnlitShader.prototype,"opacity",void 0),t([r({range:[0,10]}),e("design:type",Number)],UnlitShader.prototype,"intensity",void 0),t([r(),e("design:type",h)],UnlitShader.prototype,"map",void 0),t([r(),e("design:type",h)],UnlitShader.prototype,"lightMap",void 0),t([r(),e("design:type",Number)],UnlitShader.prototype,"lightMapIntensity",void 0),t([r(),e("design:type",h)],UnlitShader.prototype,"aoMap",void 0),t([r(),e("design:type",Number)],UnlitShader.prototype,"aoMapIntensity",void 0),t([r(),e("design:type",h)],UnlitShader.prototype,"alphaMap",void 0),t([r(),e("design:type",o)],UnlitShader.prototype,"envMap",void 0),t([r(),e("design:type",Boolean)],UnlitShader.prototype,"vertexColor",void 0),t([r(),e("design:type",p)],UnlitShader.prototype,"uvScale",void 0);/*
1
+ import{__decorate as t,__metadata as e}from"tslib";import{Color as i,Texture as o,Vector2 as p}from"three";import{Shader as r}from"../shader.js";import{Parameter as a}from"../parameter.js";import{attributes as l,NodeShaderMaterial as n,rgba as s,Sampler2DNode as h,UniformSampler2d as y,uniformFloat as d,uniformVec3 as m,varying as u,varyingAttributes as c,vec2 as g}from"three-shader-graph";import*as v from"three";import{createPlaceholderTexture as M}from"../../utils/three/placeholder-texture.js";const S=M();export class UnlitShader extends r{constructor(){super(...arguments),this.color=new i("#FFFFFF"),this.opacity=1,this.intensity=1,this.map=new y("map",S),this.lightMap=new y("lightMap",S),this.aoMap=new y("aoMap",S),this.alphaMap=new y("alphaMap",S),this.vertexColor=!1,this.uvScale=new p(1,1)}build(){const t=function(t,e){if(null==e||1===e.x&&1===e.y)return t;return t.multiply(g(e))}(c.uv,this.uvScale);let e=d("opacity",this.opacity),i=m("color",(new v.Vector3).setFromColor(this.color)).rgb.multiplyScalar(d("intensity",this.intensity));if(f(this.map)){const o=this.map.sample(t);i=i.multiply(o.rgb),e=e.multiply(o.a)}if(f(this.alphaMap)&&(e=e.multiply(this.alphaMap.sample(t).r)),!0===this.vertexColor&&(i=i.multiply(u(l.color.rgb))),f(this.lightMap)&&(i=i.add(this.lightMap.sample(t).rgb.multiplyScalar(d("lightMapIntensity",this.lightMapIntensity??1)))),f(this.aoMap)){const e=this.aoMap.sample(t).r,o=d("aoMapIntensity",this.aoMapIntensity??1);i=i.multiplyScalar(e.subtract(1).multiply(o).add(1))}const o=new n({color:s(i,e),opacity:e,emissive:i,envMap:this.envMap});return o.vertexColors=!0===this.vertexColor,o}}function f(t){return null!=t&&(!(t instanceof y)||null!=t.value&&t.value!==S)}t([a(),e("design:type",i)],UnlitShader.prototype,"color",void 0),t([a({range:[0,1]}),e("design:type",Number)],UnlitShader.prototype,"opacity",void 0),t([a({range:[0,10]}),e("design:type",Number)],UnlitShader.prototype,"intensity",void 0),t([a(),e("design:type",h)],UnlitShader.prototype,"map",void 0),t([a(),e("design:type",h)],UnlitShader.prototype,"lightMap",void 0),t([a(),e("design:type",Number)],UnlitShader.prototype,"lightMapIntensity",void 0),t([a(),e("design:type",h)],UnlitShader.prototype,"aoMap",void 0),t([a(),e("design:type",Number)],UnlitShader.prototype,"aoMapIntensity",void 0),t([a(),e("design:type",h)],UnlitShader.prototype,"alphaMap",void 0),t([a(),e("design:type",o)],UnlitShader.prototype,"envMap",void 0),t([a(),e("design:type",Boolean)],UnlitShader.prototype,"vertexColor",void 0),t([a(),e("design:type",p)],UnlitShader.prototype,"uvScale",void 0);/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,4 +1,4 @@
1
- import{__decorate as e,__metadata as t}from"tslib";import{Color as r,Texture as o,Vector2 as a}from"three";import{abs as s,attributes as i,float as l,FloatNode as p,max as n,min as y,mix as u,pow as d,rgba as h,SimplexNoiseNode as c,standardMaterial as g,step as L,textureSampler2d as m,varying as v,varyingAttributes as M,vec2 as x,colorToNormal as k,varyingTransformed as f,attributeVec2 as C}from"three-shader-graph";import{edgeDepthEffect as b,fresnelEffect as T,oneMinus as w,sceneColorSampler as S,screenUV as A,timeUniforms as V}from"../shader-nodes/index.js";import{SerializedParamType as F}from"../scene/model.js";import{Parameter as N}from"./parameter.js";export var ColorLayerType;!function(e){e.solid="solid",e.refraction="refraction",e.lighting="lighting",e.texture="texture",e.textureMask="textureMask",e.vertexMask="vertexMask",e.fresnelMask="fresnelMask",e.depthMask="depthMask",e.gradientMask="gradientMask"}(ColorLayerType||(ColorLayerType={}));export const defaultValueColorLayer={enabled:!0,type:ColorLayerType.solid,outputType:"rgba",opacity:1,blendMode:"normal",params:{color:{type:F.Color,value:"#FFFFFF"}}};export const defaultValueMaskLayer={enabled:!0,type:ColorLayerType.textureMask,outputType:"alpha",opacity:1,blendMode:"normal",params:{texture:{type:F.Texture,value:null},channel:{type:F.String,value:"red"}}};const z={normal:(e,t,r)=>u(e,t,r),add:(e,t,r)=>e.add(t.multiplyScalar(r)),multiply:(e,t,r)=>u(e,e.multiply(t),r),screen:(e,t,r)=>u(e,w(w(e).multiply(w(t))),r),overlay:(e,t,r)=>{const o=u(e.multiply(t).multiplyScalar(2),w(l(2).multiplyVec3(w(e)).multiply(w(t))),L(.5,e));return u(e,o.rgb,r)},difference:(e,t,r)=>u(e,s(e.subtract(t)),r),subtract:(e,t,r)=>u(e,e.subtract(t),r)};export const blendModes=Object.keys(z);const B={normal:(e,t,r)=>u(e,t,r),add:(e,t,r)=>e.add(t.multiply(r)),multiply:(e,t,r)=>u(e,e.multiply(t),r),max:(e,t,r)=>u(e,n(e,t),r),min:(e,t,r)=>u(e,y(e,t),r),difference:(e,t,r)=>u(e,s(e.subtract(t)),r),subtract:(e,t,r)=>u(e,e.subtract(t),r)};export const maskBlendModes=Object.keys(B);export class ColorLayer{constructor(){this.layers=[]}static get outputType(){return"rgba"}apply(e){const t=this.output();if(t instanceof p)return h(e.rgb,this.applyMask(e.a));{let a=t;if(null!=this.layers&&(a=this.layers.filter(e=>!1!==e.enabled).reduce((e,t)=>t.apply(e),t)),null==e)return a;const s=z[this.blendMode]??z.normal,i=a.a.multiply(this.opacity),l=s(e.rgb,a.rgb,i);let p=(r=e.a,(o=i).add(r.multiply(w(o))));return h(l,p)}var r,o}applyMask(e){const t=this.output();if(t instanceof p){let r=t;null!=this.layers&&(r=this.layers.filter(e=>!1!==e.enabled).reduce((e,t)=>t.applyMask(e),t));return(B[this.blendMode]??z.normal)(e,r,this.opacity)}return console.error("Can not use non-float layer for mask"),e}init(e,t){}static async decode(e,t){if(console.log("Decode value",e),!isColorLayerSerialized(e))return;const r=new layerTypes[e.type];return r.enabled=e.enabled,r.opacity=e.opacity??1,r.blendMode=e.blendMode,r}output(){return h("white")}}export class SolidColorLayer extends ColorLayer{constructor(){super(...arguments),this.color=new r("white"),this.layers=[]}output(){return h(this.color).multiplyScalar(1.3)}}e([N(),t("design:type",r)],SolidColorLayer.prototype,"color",void 0),e([N({type:ColorLayer,array:!0}),t("design:type",Array)],SolidColorLayer.prototype,"layers",void 0);export class TextureColorLayer extends ColorLayer{constructor(){super(...arguments),this.texture=new o,this.scale=new a(1,1),this.scroll=new a(0,0),this.layers=[]}output(){let e=M.uv;return null!=this.scroll&&this.scroll.lengthSq()>0&&(e=e.add(x(this.scroll).multiplyScalar(V.elapsed))),e=e.multiply(x(this.scale??1)),m(this.texture).sample(e)}}e([N(),t("design:type",o)],TextureColorLayer.prototype,"texture",void 0),e([N(),t("design:type",a)],TextureColorLayer.prototype,"scale",void 0),e([N(),t("design:type",a)],TextureColorLayer.prototype,"scroll",void 0),e([N({type:ColorLayer,array:!0}),t("design:type",Array)],TextureColorLayer.prototype,"layers",void 0);export class RefractionColorLayer extends ColorLayer{constructor(){super(...arguments),this.texture=new o,this.layers=[]}output(){return S.sample(A.addScalar(new c(M.uv).multiply(.2)))}}e([N(),t("design:type",o)],RefractionColorLayer.prototype,"texture",void 0),e([N({type:ColorLayer,array:!0}),t("design:type",Array)],RefractionColorLayer.prototype,"layers",void 0);export class LightingColorLayer extends ColorLayer{constructor(){super(...arguments),this.roughness=1,this.metalness=0}apply(e){const t=M.uv,r=e?.a??l(1);let o=l(this.roughness);null!=this.roughnessMap&&(o=o.multiply(m(this.roughnessMap).sample(t).g));let a=l(this.metalness);null!=this.metalnessMap&&(a=a.multiply(m(this.metalnessMap).sample(t).b));let s=f.normal;null!=this.normalMap&&(s=k(m(this.normalMap).sample(t),this.normalScale));let i=null;null!=this.aoMap&&(i=m(this.aoMap).sample(t).r);let p=null;null!=this.lightMap&&(p=m(this.lightMap).sample(t).rgb);let n=h(this.emissive??"black",r);return null!=this.emissiveMap&&(n=n.multiply(m(this.emissiveMap).sample(t))),g({color:e,emissive:n,emissiveIntensity:l(this.emissiveIntensity??1),metalness:a,roughness:o,normal:s,ambientOcclusion:i,ambientOcclusionIntensity:l(this.aoMapIntensity??1),bakedLight:p?.multiplyScalar(this.lightMapIntensity??1)})}}e([N({range:[0,1]}),t("design:type",Number)],LightingColorLayer.prototype,"roughness",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"roughnessMap",void 0),e([N({range:[0,1]}),t("design:type",Number)],LightingColorLayer.prototype,"metalness",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"metalnessMap",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"lightMap",void 0),e([N(),t("design:type",Number)],LightingColorLayer.prototype,"lightMapIntensity",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"aoMap",void 0),e([N(),t("design:type",Number)],LightingColorLayer.prototype,"aoMapIntensity",void 0),e([N(),t("design:type",r)],LightingColorLayer.prototype,"emissive",void 0),e([N({range:[0,10]}),t("design:type",Number)],LightingColorLayer.prototype,"emissiveIntensity",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"emissiveMap",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"normalMap",void 0),e([N(),t("design:type",p)],LightingColorLayer.prototype,"normalScale",void 0);export class MaskLayer extends ColorLayer{constructor(){super(...arguments),this.power=1,this.invert=!1}static get outputType(){return"float"}output(){let e=this.outputAlpha();return this.invert&&(e=w(e)),null!=this.power&&1!==this.power&&(e=d(e,this.power)),e}outputAlpha(){throw"not implemented"}}const I=["red","green","blue","alpha"];export class TextureMaskLayer extends MaskLayer{constructor(){super(...arguments),this.texture=new o,this.channel="red",this.space="uv",this.flipU=!1,this.flipV=!1,this.scale=new a(1,1),this.scroll=new a(0,0),this.offsetLayers=[],this.offset=new a(1,0),this.power=1,this.invert=!1,this.layers=[]}outputAlpha(){let e=M.uv;switch(this.space??"uv"){case"uv":e=M.uv;break;case"uv1":e=v(C("uv1"));break;case"uv2":e=v(C("uv2"));break;case"uv3":e=v(C("uv3"));break;case"world xz":e=f.worldPosition.xz}if(this.flipU&&(e=x(w(e.x),e.y)),this.flipV&&(e=x(e.x,w(e.y))),null!=this.scroll&&this.scroll.lengthSq()>0&&(e=e.add(x(this.scroll).multiplyScalar(V.elapsed))),null!=this.offsetLayers&&this.offsetLayers.length>0&&null!=this.offset&&this.offset.lengthSq()>0){const t=this.offsetLayers.reduce((e,t)=>t.applyMask(e),l(0));e=e.add(x(this.offset).multiplyScalar(t))}e=e.multiply(x(this.scale??1));return j(m(this.texture).sample(e),this.channel)}}e([N(),t("design:type",o)],TextureMaskLayer.prototype,"texture",void 0),e([N({options:I.map(e=>({name:e,value:e}))}),t("design:type",String)],TextureMaskLayer.prototype,"channel",void 0),e([N({options:["uv","uv1","uv2","uv3","world xz"].map(e=>({name:e,value:e}))}),t("design:type",String)],TextureMaskLayer.prototype,"space",void 0),e([N(),t("design:type",Boolean)],TextureMaskLayer.prototype,"flipU",void 0),e([N(),t("design:type",Boolean)],TextureMaskLayer.prototype,"flipV",void 0),e([N(),t("design:type",a)],TextureMaskLayer.prototype,"scale",void 0),e([N(),t("design:type",a)],TextureMaskLayer.prototype,"scroll",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],TextureMaskLayer.prototype,"offsetLayers",void 0),e([N(),t("design:type",a)],TextureMaskLayer.prototype,"offset",void 0),e([N(),t("design:type",Number)],TextureMaskLayer.prototype,"power",void 0),e([N(),t("design:type",Boolean)],TextureMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],TextureMaskLayer.prototype,"layers",void 0);export class VertexMaskLayer extends MaskLayer{constructor(){super(...arguments),this.channel="red",this.power=1,this.invert=!1,this.layers=[]}outputAlpha(){const e=i.color;return v(j(e,this.channel))}}function j(e,t){switch(t??"red"){case"red":return e.r;case"green":return e.g;case"blue":return e.b;case"alpha":return e.a}}e([N({options:I.map(e=>({name:e,value:e}))}),t("design:type",String)],VertexMaskLayer.prototype,"channel",void 0),e([N(),t("design:type",Number)],VertexMaskLayer.prototype,"power",void 0),e([N(),t("design:type",Boolean)],VertexMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],VertexMaskLayer.prototype,"layers",void 0);export class GradientMaskLayer extends MaskLayer{constructor(){super(...arguments),this.direction="u",this.start=0,this.end=1,this.invert=!1,this.layers=[]}outputAlpha(){return u(l(this.start),l(this.end),function(e){switch(e??"u"){case"u":return M.uv.x;case"v":return M.uv.y;case"x":return M.position.x;case"y":return M.position.y;case"z":return M.position.z}}(this.direction))}}e([N({options:["u","v","x","y","z"].map(e=>({name:e,value:e}))}),t("design:type",String)],GradientMaskLayer.prototype,"direction",void 0),e([N(),t("design:type",Number)],GradientMaskLayer.prototype,"start",void 0),e([N(),t("design:type",Number)],GradientMaskLayer.prototype,"end",void 0),e([N(),t("design:type",Boolean)],GradientMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],GradientMaskLayer.prototype,"layers",void 0);export class FresnelMaskLayer extends MaskLayer{constructor(){super(...arguments),this.power=1,this.invert=!1,this.layers=[]}outputAlpha(){return v(T(1))}}e([N(),t("design:type",Number)],FresnelMaskLayer.prototype,"power",void 0),e([N(),t("design:type",Boolean)],FresnelMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],FresnelMaskLayer.prototype,"layers",void 0);export class DepthMaskLayer extends MaskLayer{constructor(){super(...arguments),this.power=1,this.invert=!1,this.layers=[]}outputAlpha(){return b(1)}}e([N(),t("design:type",Number)],DepthMaskLayer.prototype,"power",void 0),e([N(),t("design:type",Boolean)],DepthMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],DepthMaskLayer.prototype,"layers",void 0);export function isColorLayerSerialized(e){return"object"==typeof e&&null!==e&&"boolean"==typeof e.enabled&&"string"==typeof e.type&&e.outputType&&("object"==typeof e.params||void 0===e.params)}export const layerTypes={[ColorLayerType.solid]:SolidColorLayer,[ColorLayerType.texture]:TextureColorLayer,[ColorLayerType.refraction]:RefractionColorLayer,[ColorLayerType.lighting]:LightingColorLayer,[ColorLayerType.textureMask]:TextureMaskLayer,[ColorLayerType.vertexMask]:VertexMaskLayer,[ColorLayerType.fresnelMask]:FresnelMaskLayer,[ColorLayerType.depthMask]:DepthMaskLayer,[ColorLayerType.gradientMask]:GradientMaskLayer};/*
1
+ import{__decorate as e,__metadata as t}from"tslib";import{Color as r,Texture as o,Vector2 as a}from"three";import{abs as s,attributes as i,float as l,FloatNode as p,max as y,min as n,mix as u,pow as d,rgba as h,SimplexNoiseNode as c,standardMaterial as g,step as L,textureSampler2d as m,varying as v,varyingAttributes as M,vec2 as x,colorToNormal as k,varyingTransformed as f,attributeVec2 as C}from"three-shader-graph";import{edgeDepthEffect as b,fresnelEffect as T,oneMinus as w,sceneColorSampler as S,screenUV as A,timeUniforms as V}from"../shader-nodes/index.js";import{SerializedParamType as F}from"../scene/model.js";import{Parameter as N}from"./parameter.js";import{createPlaceholderTexture as j}from"../utils/three/placeholder-texture.js";export var ColorLayerType;!function(e){e.solid="solid",e.refraction="refraction",e.lighting="lighting",e.texture="texture",e.textureMask="textureMask",e.vertexMask="vertexMask",e.fresnelMask="fresnelMask",e.depthMask="depthMask",e.gradientMask="gradientMask"}(ColorLayerType||(ColorLayerType={}));export const defaultValueColorLayer={enabled:!0,type:ColorLayerType.solid,outputType:"rgba",opacity:1,blendMode:"normal",params:{color:{type:F.Color,value:"#FFFFFF"}}};export const defaultValueMaskLayer={enabled:!0,type:ColorLayerType.textureMask,outputType:"alpha",opacity:1,blendMode:"normal",params:{texture:{type:F.Texture,value:null},channel:{type:F.String,value:"red"}}};const z={normal:(e,t,r)=>u(e,t,r),add:(e,t,r)=>e.add(t.multiplyScalar(r)),multiply:(e,t,r)=>u(e,e.multiply(t),r),screen:(e,t,r)=>u(e,w(w(e).multiply(w(t))),r),overlay:(e,t,r)=>{const o=u(e.multiply(t).multiplyScalar(2),w(l(2).multiplyVec3(w(e)).multiply(w(t))),L(.5,e));return u(e,o.rgb,r)},difference:(e,t,r)=>u(e,s(e.subtract(t)),r),subtract:(e,t,r)=>u(e,e.subtract(t),r)};export const blendModes=Object.keys(z);const B={normal:(e,t,r)=>u(e,t,r),add:(e,t,r)=>e.add(t.multiply(r)),multiply:(e,t,r)=>u(e,e.multiply(t),r),max:(e,t,r)=>u(e,y(e,t),r),min:(e,t,r)=>u(e,n(e,t),r),difference:(e,t,r)=>u(e,s(e.subtract(t)),r),subtract:(e,t,r)=>u(e,e.subtract(t),r)};export const maskBlendModes=Object.keys(B);export class ColorLayer{constructor(){this.layers=[]}static get outputType(){return"rgba"}apply(e){const t=this.output();if(t instanceof p)return h(e.rgb,this.applyMask(e.a));{let a=t;if(null!=this.layers&&(a=this.layers.filter(e=>!1!==e.enabled).reduce((e,t)=>t.apply(e),t)),null==e)return a;const s=z[this.blendMode]??z.normal,i=a.a.multiply(this.opacity),l=s(e.rgb,a.rgb,i);let p=(r=e.a,(o=i).add(r.multiply(w(o))));return h(l,p)}var r,o}applyMask(e){const t=this.output();if(t instanceof p){let r=t;null!=this.layers&&(r=this.layers.filter(e=>!1!==e.enabled).reduce((e,t)=>t.applyMask(e),t));return(B[this.blendMode]??z.normal)(e,r,this.opacity)}return console.error("Can not use non-float layer for mask"),e}init(e,t){}static async decode(e,t){if(console.log("Decode value",e),!isColorLayerSerialized(e))return;const r=new layerTypes[e.type];return r.enabled=e.enabled,r.opacity=e.opacity??1,r.blendMode=e.blendMode,r}output(){return h("white")}}export class SolidColorLayer extends ColorLayer{constructor(){super(...arguments),this.color=new r("white"),this.layers=[]}output(){return h(this.color).multiplyScalar(1.3)}}e([N(),t("design:type",r)],SolidColorLayer.prototype,"color",void 0),e([N({type:ColorLayer,array:!0}),t("design:type",Array)],SolidColorLayer.prototype,"layers",void 0);export class TextureColorLayer extends ColorLayer{constructor(){super(...arguments),this.texture=j(),this.scale=new a(1,1),this.scroll=new a(0,0),this.layers=[]}output(){let e=M.uv;return null!=this.scroll&&this.scroll.lengthSq()>0&&(e=e.add(x(this.scroll).multiplyScalar(V.elapsed))),e=e.multiply(x(this.scale??1)),m(this.texture).sample(e)}}e([N(),t("design:type",o)],TextureColorLayer.prototype,"texture",void 0),e([N(),t("design:type",a)],TextureColorLayer.prototype,"scale",void 0),e([N(),t("design:type",a)],TextureColorLayer.prototype,"scroll",void 0),e([N({type:ColorLayer,array:!0}),t("design:type",Array)],TextureColorLayer.prototype,"layers",void 0);export class RefractionColorLayer extends ColorLayer{constructor(){super(...arguments),this.texture=j(),this.layers=[]}output(){return S.sample(A.addScalar(new c(M.uv).multiply(.2)))}}e([N(),t("design:type",o)],RefractionColorLayer.prototype,"texture",void 0),e([N({type:ColorLayer,array:!0}),t("design:type",Array)],RefractionColorLayer.prototype,"layers",void 0);export class LightingColorLayer extends ColorLayer{constructor(){super(...arguments),this.roughness=1,this.metalness=0}apply(e){const t=M.uv,r=e?.a??l(1);let o=l(this.roughness);null!=this.roughnessMap&&(o=o.multiply(m(this.roughnessMap).sample(t).g));let a=l(this.metalness);null!=this.metalnessMap&&(a=a.multiply(m(this.metalnessMap).sample(t).b));let s=f.normal;null!=this.normalMap&&(s=k(m(this.normalMap).sample(t),this.normalScale));let i=null;null!=this.aoMap&&(i=m(this.aoMap).sample(t).r);let p=null;null!=this.lightMap&&(p=m(this.lightMap).sample(t).rgb);let y=h(this.emissive??"black",r);return null!=this.emissiveMap&&(y=y.multiply(m(this.emissiveMap).sample(t))),g({color:e,emissive:y,emissiveIntensity:l(this.emissiveIntensity??1),metalness:a,roughness:o,normal:s,ambientOcclusion:i,ambientOcclusionIntensity:l(this.aoMapIntensity??1),bakedLight:p?.multiplyScalar(this.lightMapIntensity??1)})}}e([N({range:[0,1]}),t("design:type",Number)],LightingColorLayer.prototype,"roughness",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"roughnessMap",void 0),e([N({range:[0,1]}),t("design:type",Number)],LightingColorLayer.prototype,"metalness",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"metalnessMap",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"lightMap",void 0),e([N(),t("design:type",Number)],LightingColorLayer.prototype,"lightMapIntensity",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"aoMap",void 0),e([N(),t("design:type",Number)],LightingColorLayer.prototype,"aoMapIntensity",void 0),e([N(),t("design:type",r)],LightingColorLayer.prototype,"emissive",void 0),e([N({range:[0,10]}),t("design:type",Number)],LightingColorLayer.prototype,"emissiveIntensity",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"emissiveMap",void 0),e([N(),t("design:type",o)],LightingColorLayer.prototype,"normalMap",void 0),e([N(),t("design:type",p)],LightingColorLayer.prototype,"normalScale",void 0);export class MaskLayer extends ColorLayer{constructor(){super(...arguments),this.power=1,this.invert=!1}static get outputType(){return"float"}output(){let e=this.outputAlpha();return this.invert&&(e=w(e)),null!=this.power&&1!==this.power&&(e=d(e,this.power)),e}outputAlpha(){throw"not implemented"}}const I=["red","green","blue","alpha"];export class TextureMaskLayer extends MaskLayer{constructor(){super(...arguments),this.texture=j(),this.channel="red",this.space="uv",this.flipU=!1,this.flipV=!1,this.scale=new a(1,1),this.scroll=new a(0,0),this.offsetLayers=[],this.offset=new a(1,0),this.power=1,this.invert=!1,this.layers=[]}outputAlpha(){let e=M.uv;switch(this.space??"uv"){case"uv":e=M.uv;break;case"uv1":e=v(C("uv1"));break;case"uv2":e=v(C("uv2"));break;case"uv3":e=v(C("uv3"));break;case"world xz":e=f.worldPosition.xz}if(this.flipU&&(e=x(w(e.x),e.y)),this.flipV&&(e=x(e.x,w(e.y))),null!=this.scroll&&this.scroll.lengthSq()>0&&(e=e.add(x(this.scroll).multiplyScalar(V.elapsed))),null!=this.offsetLayers&&this.offsetLayers.length>0&&null!=this.offset&&this.offset.lengthSq()>0){const t=this.offsetLayers.reduce((e,t)=>t.applyMask(e),l(0));e=e.add(x(this.offset).multiplyScalar(t))}e=e.multiply(x(this.scale??1));return G(m(this.texture).sample(e),this.channel)}}e([N(),t("design:type",o)],TextureMaskLayer.prototype,"texture",void 0),e([N({options:I.map(e=>({name:e,value:e}))}),t("design:type",String)],TextureMaskLayer.prototype,"channel",void 0),e([N({options:["uv","uv1","uv2","uv3","world xz"].map(e=>({name:e,value:e}))}),t("design:type",String)],TextureMaskLayer.prototype,"space",void 0),e([N(),t("design:type",Boolean)],TextureMaskLayer.prototype,"flipU",void 0),e([N(),t("design:type",Boolean)],TextureMaskLayer.prototype,"flipV",void 0),e([N(),t("design:type",a)],TextureMaskLayer.prototype,"scale",void 0),e([N(),t("design:type",a)],TextureMaskLayer.prototype,"scroll",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],TextureMaskLayer.prototype,"offsetLayers",void 0),e([N(),t("design:type",a)],TextureMaskLayer.prototype,"offset",void 0),e([N(),t("design:type",Number)],TextureMaskLayer.prototype,"power",void 0),e([N(),t("design:type",Boolean)],TextureMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],TextureMaskLayer.prototype,"layers",void 0);export class VertexMaskLayer extends MaskLayer{constructor(){super(...arguments),this.channel="red",this.power=1,this.invert=!1,this.layers=[]}outputAlpha(){const e=i.color;return v(G(e,this.channel))}}function G(e,t){switch(t??"red"){case"red":return e.r;case"green":return e.g;case"blue":return e.b;case"alpha":return e.a}}e([N({options:I.map(e=>({name:e,value:e}))}),t("design:type",String)],VertexMaskLayer.prototype,"channel",void 0),e([N(),t("design:type",Number)],VertexMaskLayer.prototype,"power",void 0),e([N(),t("design:type",Boolean)],VertexMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],VertexMaskLayer.prototype,"layers",void 0);export class GradientMaskLayer extends MaskLayer{constructor(){super(...arguments),this.direction="u",this.start=0,this.end=1,this.invert=!1,this.layers=[]}outputAlpha(){return u(l(this.start),l(this.end),function(e){switch(e??"u"){case"u":return M.uv.x;case"v":return M.uv.y;case"x":return M.position.x;case"y":return M.position.y;case"z":return M.position.z}}(this.direction))}}e([N({options:["u","v","x","y","z"].map(e=>({name:e,value:e}))}),t("design:type",String)],GradientMaskLayer.prototype,"direction",void 0),e([N(),t("design:type",Number)],GradientMaskLayer.prototype,"start",void 0),e([N(),t("design:type",Number)],GradientMaskLayer.prototype,"end",void 0),e([N(),t("design:type",Boolean)],GradientMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],GradientMaskLayer.prototype,"layers",void 0);export class FresnelMaskLayer extends MaskLayer{constructor(){super(...arguments),this.power=1,this.invert=!1,this.layers=[]}outputAlpha(){return v(T(1))}}e([N(),t("design:type",Number)],FresnelMaskLayer.prototype,"power",void 0),e([N(),t("design:type",Boolean)],FresnelMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],FresnelMaskLayer.prototype,"layers",void 0);export class DepthMaskLayer extends MaskLayer{constructor(){super(...arguments),this.power=1,this.invert=!1,this.layers=[]}outputAlpha(){return b(1)}}e([N(),t("design:type",Number)],DepthMaskLayer.prototype,"power",void 0),e([N(),t("design:type",Boolean)],DepthMaskLayer.prototype,"invert",void 0),e([N({type:MaskLayer,array:!0}),t("design:type",Array)],DepthMaskLayer.prototype,"layers",void 0);export function isColorLayerSerialized(e){return"object"==typeof e&&null!==e&&"boolean"==typeof e.enabled&&"string"==typeof e.type&&e.outputType&&("object"==typeof e.params||void 0===e.params)}export const layerTypes={[ColorLayerType.solid]:SolidColorLayer,[ColorLayerType.texture]:TextureColorLayer,[ColorLayerType.refraction]:RefractionColorLayer,[ColorLayerType.lighting]:LightingColorLayer,[ColorLayerType.textureMask]:TextureMaskLayer,[ColorLayerType.vertexMask]:VertexMaskLayer,[ColorLayerType.fresnelMask]:FresnelMaskLayer,[ColorLayerType.depthMask]:DepthMaskLayer,[ColorLayerType.gradientMask]:GradientMaskLayer};/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -43,10 +43,12 @@ export declare class ShaderGraphCompiler {
43
43
  private readonly options;
44
44
  private readonly nodesById;
45
45
  private readonly compiled;
46
+ private readonly compiling;
46
47
  constructor(graph: ShaderGraphDocument, options?: ShaderGraphCompileOptions);
47
48
  validate(): void;
48
49
  compile(): ShaderGraphCompileResult;
49
50
  private validateEdges;
51
+ private validateNamedReroutes;
50
52
  private compileOutput;
51
53
  private compilePostProcessOutput;
52
54
  private applyShadingModel;
@@ -60,6 +62,7 @@ export declare class ShaderGraphCompiler {
60
62
  private compileBinaryFunction;
61
63
  private compilePaintedLayerMix;
62
64
  private defaultUV;
65
+ private namedRerouteDeclaration;
63
66
  private input;
64
67
  private optionalInput;
65
68
  private floatInput;