@hology/core 0.0.201 → 0.0.202

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 (37) hide show
  1. package/dist/effects/sequence/sequence-actor.d.ts +1 -1
  2. package/dist/effects/sequence/sequence-actor.js +1 -1
  3. package/dist/effects/sequence/sequence-data.d.ts +81 -8
  4. package/dist/effects/sequence/sequence-data.js +1 -1
  5. package/dist/effects/sequence/sequence-definitions.d.ts +3 -2
  6. package/dist/effects/sequence/sequence-definitions.js +1 -1
  7. package/dist/effects/sequence/sequence-ops.js +1 -1
  8. package/dist/effects/sequence/sequence-player.d.ts +39 -2
  9. package/dist/effects/sequence/sequence-player.js +1 -1
  10. package/dist/effects/vfx/initializsers.d.ts +14 -0
  11. package/dist/effects/vfx/initializsers.js +1 -1
  12. package/dist/effects/vfx/vfx-defs.d.ts +12 -1
  13. package/dist/effects/vfx/vfx-defs.js +1 -1
  14. package/dist/effects/vfx/zones.d.ts +3 -1
  15. package/dist/effects/vfx/zones.js +1 -1
  16. package/dist/gameplay/services/asset-loader.d.ts +3 -0
  17. package/dist/gameplay/services/asset-loader.js +1 -1
  18. package/dist/rendering/post-process-effect.d.ts +2 -1
  19. package/dist/rendering/post-process-effect.js +1 -1
  20. package/dist/scene/materializer.js +1 -1
  21. package/dist/shader/graph/compiler.d.ts +6 -1
  22. package/dist/shader/graph/compiler.js +1 -1
  23. package/dist/shader/graph/model.d.ts +3 -2
  24. package/dist/shader/graph/model.js +1 -1
  25. package/dist/shader/graph/registry.js +1 -1
  26. package/dist/shader/parameter.d.ts +1 -0
  27. package/dist/shader/parameter.js +1 -1
  28. package/dist/shader-nodes/curve-sample.d.ts +1 -0
  29. package/dist/shader-nodes/curve-sample.js +1 -1
  30. package/dist/test/sequence-asset-refresh.test.d.ts +2 -0
  31. package/dist/test/sequence-asset-refresh.test.js +4 -0
  32. package/dist/test/sequence-post-process.test.d.ts +2 -0
  33. package/dist/test/sequence-post-process.test.js +4 -0
  34. package/dist/test/sequence-property-parameters.test.js +1 -1
  35. package/dist/test/shader-graph.test.js +1 -1
  36. package/package.json +1 -1
  37. package/tsconfig.tsbuildinfo +1 -1
@@ -1,4 +1,4 @@
1
- import{BackSide as t,Color as e,DoubleSide as a,FrontSide as r,Matrix4 as u,Texture as i,Vector2 as n,Vector3 as o,Vector4 as s}from"three";import{BooleanNode as l,FloatNode as p,Mat4Node as c,NodeShaderMaterial as h,RgbNode as v,RgbaNode as y,Sampler2DNode as d,Texture2dLookupNode as m,UniformFloatNode as f,Vec2Node as g,Vec3Node as b,Vec4Node as x,abs as w,acos as T,asin as I,attributes as S,atan as O,autoVarying as M,bulge as C,bool as N,ceil as E,clamp as U,cos as G,cross as B,degrees as $,distance as k,dot as z,exp as A,exp2 as V,float as j,floor as D,fract as L,inversesqrt as q,colorGradientSampler as F,length as P,LayerMixMode as R,log as W,log2 as Y,mat4 as H,max as J,min as K,mix as Q,mixColorsByLayer as X,particleUniforms as Z,mod as _,normalize as tt,pow as et,radians as at,rgba as rt,rgb as ut,saturate as it,select as nt,sign as ot,sin as st,smoothstep as lt,sqrt as pt,standardMaterial as ct,scaleTransform as ht,step as vt,tan as yt,textureSampler2d as dt,timeUniforms as mt,toonMaterial as ft,translate as gt,transformed as bt,triplanarMapping as xt,twirl as wt,uniformFloat as Tt,uniforms as It,varyingAttributes as St,vec2 as Ot,vec3 as Mt,vec4 as Ct,getPaintedMaterialLayerWeight as Nt}from"../../shader-nodes/index.js";import{SpriteNodeShaderMaterial as Et,getSpritePosition as Ut}from"../sprite-shader.js";import{oneMinus as Gt}from"../../shader-nodes/index.js";import{vectorToRadial as Bt,remap as $t,hueShift as kt,blendColor as zt,desaturateColor as At}from"../../shader-nodes/math.js";import{rectangleFloat as Vt,roundedRectangleFloat as jt}from"../../shader-nodes/shapes.js";import{edgeDepthEffect as Dt,fresnelEffect as Lt,depthFadeEffect as qt}from"../../shader-nodes/effects.js";import{fragmentLinearEyeDepth as Ft,sampleSceneDepth as Pt,sampleSceneLinearEyeDepth as Rt,screenUV as Wt,nearUniformName as Yt,farUniformName as Ht}from"../../shader-nodes/depth.js";import{sampleSceneColor as Jt}from"../../shader-nodes/scene-sample.js";import{decalDiscard as Kt,decalUV as Qt}from"../../shader-nodes/decal.js";import{Trail as Xt,trailUV as Zt}from"../../effects/vfx/trail-renderer.js";import{SimplexNoiseNode as _t,Voronoi2d as te,rotateAxis as ee}from"../../shader-nodes/index.js";import{flipbookUv as ae}from"../../shader-nodes/texture-sequence.js";import{parallaxOcclusionMapping as re}from"../../shader-nodes/pom.js";import{defaultInlineLiteralValueForPort as ue,inlineLiteralTypeForPort as ie,SHADER_GRAPH_NODE_DEFINITIONS as ne}from"./registry.js";import{shaderGraphParameterTypeToValueType as oe}from"./parameters.js";import{varying as se,reflect as le,refract as pe,dFdx as ce,dFdy as he,fwidth as ve}from"three-shader-graph";import{decalNormal as ye}from"../../shader-nodes/decal.js";export class ShaderGraphCompileError extends Error{constructor(t,e,a){super(t),this.nodeId=e,this.port=a,this.name="ShaderGraphCompileError"}}export class ShaderGraphCompiler{constructor(t,e={}){this.graph=t,this.options=e,this.compiled=new Map,this.nodesById=new Map((t.nodes??[]).map(t=>[t.id,t]))}validate(){this.compile()}compile(){if(1!==this.graph.version)throw new ShaderGraphCompileError(`Unsupported shader graph version ${this.graph.version}`);return this.validateEdges(),{output:this.compileOutput(),nodes:this.compiled}}validateEdges(){for(const t of this.graph.edges??[]){if(!this.nodesById.has(t.from.nodeId))throw new ShaderGraphCompileError(`Edge references missing source node "${t.from.nodeId}"`,t.from.nodeId,t.from.port);if(!this.nodesById.has(t.to.nodeId))throw new ShaderGraphCompileError(`Edge references missing target node "${t.to.nodeId}"`,t.to.nodeId,t.to.port)}}compileOutput(){const t=this.graph.outputs?.color,e={color:null!=t?this.toColorOutput(this.resolveOutputBinding(t,"color")):rt("#ffffff",1),transparent:de(this.graph)},a=this.graph.outputs?.opacity;null!=a&&(e.opacity=this.expectType(this.resolveOutputBinding(a,"opacity"),["float"],"opacity").value);const r=this.graph.outputs?.roughness;null!=r&&(e.roughness=this.expectType(this.resolveOutputBinding(r,"roughness"),["float"],"roughness").value);const u=this.graph.outputs?.metalness;null!=u&&(e.metalness=this.floatOutput(u,"metalness"));const i=this.graph.outputs?.normal;null!=i&&(e.normal=this.toVec3Output(this.resolveOutputBinding(i,"normal"),"normal"));const n=this.graph.outputs?.emissive;null!=n&&(e.emissive=this.toVec3Output(this.resolveOutputBinding(n,"emissive"),"emissive"));const o=this.graph.outputs?.ambientOcclusion;null!=o&&(e.ambientOcclusion=this.floatOutput(o,"ambientOcclusion"));const s=this.graph.outputs?.ambientOcclusionIntensity;null!=s&&(e.ambientOcclusionIntensity=this.floatOutput(s,"ambientOcclusionIntensity"));const l=this.graph.outputs?.sheenColor;null!=l&&(e.sheenColor=this.toVec3Output(this.resolveOutputBinding(l,"sheenColor"),"sheenColor"));const p=this.graph.outputs?.sheenRoughness;null!=p&&(e.sheenRoughness=this.floatOutput(p,"sheenRoughness"));const c=this.graph.outputs?.anisotropy;null!=c&&(e.anisotropy=this.floatOutput(c,"anisotropy"));const h=this.graph.outputs?.anisotropyDirection;null!=h&&(e.anisotropyDirection=this.expectType(this.resolveOutputBinding(h,"anisotropyDirection"),["vec2"],"anisotropyDirection").value);const v=this.graph.outputs?.bakedLight;null!=v&&(e.bakedLight=this.toVec3Output(this.resolveOutputBinding(v,"bakedLight"),"bakedLight"));const y=this.graph.outputs?.transform;null!=y&&"decal"!==this.graph.target&&(e.transform=this.toMat4Output(this.resolveOutputBinding(y,"transform"),"transform"));const d=this.graph.outputs?.discard;null!=d&&(e.discard=this.expectType(this.resolveOutputBinding(d,"discard"),["boolean"],"discard").value);const m=this.graph.outputs?.transparent;null!=m&&null!=m.value&&(e.transparent=Boolean(m.value));const f=this.graph.outputs?.alphaTest;return null!=f&&null!=f.value&&(e.alphaTest=Number(f.value)),this.applyShadingModel(e)}applyShadingModel(t){const e=null!=t.opacity?function(t,e){if(t instanceof p)return rt(Mt(t,t,t),e);if(t instanceof g)return rt(Mt(t.x,t.y,0),e);if(t instanceof x)return rt(t.rgb,t.w.multiply(e));return rt(t,e)}(t.color,t.opacity):t.color;switch(this.graph.shadingModel??"standard"){case"standard":{const a={color:be(e),roughness:t.roughness??j(.5),...null!=t.metalness?{metalness:t.metalness}:{},..."decal"===this.graph.target?{normal:tt(se(It.normalMatrix).multiplyVec(ye))}:{},...null!=t.normal?{normal:t.normal}:{},...null!=t.emissive?{emissive:xe(t.emissive)}:{},...null!=t.ambientOcclusion?{ambientOcclusion:t.ambientOcclusion}:{},...null!=t.ambientOcclusionIntensity?{ambientOcclusionIntensity:t.ambientOcclusionIntensity}:{},...null!=t.sheenColor?{sheenColor:t.sheenColor.rgb}:{},...null!=t.sheenRoughness?{sheenRoughness:t.sheenRoughness}:{},...null!=t.anisotropy?{anisotropy:t.anisotropy}:{},...null!=t.anisotropyDirection?{anisotropyDirection:t.anisotropyDirection}:{},...null!=t.bakedLight?{bakedLight:t.bakedLight}:{}};return{...t,color:ct(a)}}case"toon":{const a={color:be(e),...null!=t.normal?{normal:t.normal}:{},...null!=t.emissive?{emissive:xe(t.emissive)}:{},...null!=t.ambientOcclusion?{ambientOcclusion:t.ambientOcclusion}:{},...null!=t.ambientOcclusionIntensity?{ambientOcclusionIntensity:t.ambientOcclusionIntensity}:{},...null!=t.bakedLight?{bakedLight:t.bakedLight}:{}};return{...t,color:ft(a)}}case"unlit":return{...t,color:e}}}compileNode(t){const e=this.compiled.get(t);if(null!=e)return e;const a=this.nodesById.get(t);if(null==a)throw new ShaderGraphCompileError(`Missing shader graph node "${t}"`,t);if(null==ne[a.kind])throw new ShaderGraphCompileError(`Unsupported shader graph node "${a.kind}"`,a.id);const r=this.compileNodeInternal(a);return this.compiled.set(t,r),r}compileNodeInternal(t){switch(t.kind){case"input.parameter":return this.output(t,this.compileParameterNode(t));case"input.slider":return this.output(t,{value:{type:"float",value:j(Ue(Te(t,"value",.5)))}});case"constant.boolean":return this.output(t,{value:{type:"boolean",value:N(Boolean(we(t,"value",!1)))}});case"constant.float":return this.output(t,{value:{type:"float",value:j(Te(t,"value",0))}});case"constant.vec2":return this.output(t,{value:{type:"vec2",value:$e(we(t,"value",[0,0]))}});case"constant.vec3":return this.output(t,{value:{type:"vec3",value:ke(we(t,"value",[0,0,0]))}});case"constant.rgba":return this.output(t,{value:{type:"rgba",value:ze(we(t,"value","#ffffff"),Te(t,"alpha",1))}});case"builtin.uv":{const e=this.defaultUV();return this.output(t,{value:{type:"vec2",value:!0===we(t,"flipY",!1)?Ot(e.x,Gt(e.y)):e},u:{type:"float",value:e.x},v:{type:"float",value:e.y}})}case"builtin.screenUv":return this.output(t,{value:{type:"vec2",value:Wt}});case"builtin.color":{const e=M(S.color);return this.output(t,{value:{type:"rgba",value:e},rgb:{type:"rgb",value:e.rgb},r:{type:"float",value:e.r},g:{type:"float",value:e.g},b:{type:"float",value:e.b},a:{type:"float",value:e.a}})}case"builtin.position":{const e=M(S.position);return this.output(t,{value:{type:"vec3",value:e},x:{type:"float",value:e.x},y:{type:"float",value:e.y},z:{type:"float",value:e.z}})}case"builtin.worldPosition":{const e=M(bt.worldPosition);return this.output(t,{value:{type:"vec3",value:e},x:{type:"float",value:e.x},y:{type:"float",value:e.y},z:{type:"float",value:e.z}})}case"builtin.viewDir":{const e=M(bt.viewDir);return this.output(t,{value:{type:"vec3",value:e},x:{type:"float",value:e.x},y:{type:"float",value:e.y},z:{type:"float",value:e.z}})}case"builtin.normal":{const e=M(S.normal);return this.output(t,{value:{type:"vec3",value:e},x:{type:"float",value:e.x},y:{type:"float",value:e.y},z:{type:"float",value:e.z}})}case"builtin.time":return this.output(t,{value:{type:"float",value:mt.elapsed}});case"builtin.camera":{const e=Tt(Yt),a=Tt(Ht),r=It.cameraPosition;return this.output(t,{position:{type:"vec3",value:r},x:{type:"float",value:r.x},y:{type:"float",value:r.y},z:{type:"float",value:r.z},near:{type:"float",value:e},far:{type:"float",value:a}})}case"builtin.particle":return this.output(t,{energy:{type:"float",value:Z.energy},color:{type:"rgb",value:Z.color},opacity:{type:"float",value:Z.opacity},time:{type:"float",value:Z.time}});case"math.add":case"math.subtract":case"math.multiply":case"math.divide":return this.output(t,{value:this.compileBinaryMath(t)});case"math.oneMinus":{const e=this.expectNumeric(this.input(t,"value"));return this.output(t,{value:{type:e.type,value:Gt(e.value)}})}case"math.abs":return this.output(t,{value:this.compileUnaryMath(t,w)});case"math.sign":return this.output(t,{value:this.compileUnaryMath(t,ot)});case"math.floor":return this.output(t,{value:this.compileUnaryMath(t,D)});case"math.ceil":return this.output(t,{value:this.compileUnaryMath(t,E)});case"math.fract":return this.output(t,{value:this.compileUnaryMath(t,L)});case"math.sin":return this.output(t,{value:this.compileUnaryMath(t,st)});case"math.cos":return this.output(t,{value:this.compileUnaryMath(t,G)});case"math.tan":return this.output(t,{value:this.compileUnaryMath(t,yt)});case"math.asin":return this.output(t,{value:this.compileUnaryMath(t,I)});case"math.acos":return this.output(t,{value:this.compileUnaryMath(t,T)});case"math.atan":return this.output(t,{value:this.compileUnaryMath(t,O)});case"math.radians":return this.output(t,{value:this.compileUnaryMath(t,at)});case"math.degrees":return this.output(t,{value:this.compileUnaryMath(t,$)});case"math.sqrt":return this.output(t,{value:this.compileUnaryMath(t,pt)});case"math.inverseSqrt":return this.output(t,{value:this.compileUnaryMath(t,q)});case"math.exp":return this.output(t,{value:this.compileUnaryMath(t,A)});case"math.exp2":return this.output(t,{value:this.compileUnaryMath(t,V)});case"math.log":return this.output(t,{value:this.compileUnaryMath(t,W)});case"math.log2":return this.output(t,{value:this.compileUnaryMath(t,Y)});case"math.saturate":return this.output(t,{value:this.compileUnaryMath(t,it)});case"math.length":{const e=this.expectNumeric(this.input(t,"value"));return this.output(t,{value:{type:"float",value:P(e.value)}})}case"math.normalize":return this.output(t,{value:this.compileUnaryMath(t,tt)});case"math.clamp":{const e=this.expectNumeric(this.input(t,"value")),a=this.expectNumeric(this.input(t,"min",{type:"float",value:j(0)})),r=this.expectNumeric(this.input(t,"max",{type:"float",value:j(1)}));return this.output(t,{value:{type:e.type,value:U(e.value,a.value,r.value)}})}case"math.min":return this.output(t,{value:this.compileBinaryFunction(t,K)});case"math.max":return this.output(t,{value:this.compileBinaryFunction(t,J)});case"math.pow":return this.output(t,{value:this.compileBinaryFunction(t,et)});case"math.mod":return this.output(t,{value:this.compileBinaryFunction(t,_)});case"math.step":return this.output(t,{value:this.compileBinaryFunction(t,vt,!0)});case"math.smoothstep":{const e=this.expectNumeric(this.input(t,"edge0",{type:"float",value:j(0)})),a=this.expectNumeric(this.input(t,"edge1",{type:"float",value:j(1)})),r=this.expectNumeric(this.input(t,"value"));return this.output(t,{value:{type:r.type,value:lt(e.value,a.value,r.value)}})}case"math.mix":{const e=this.expectNumeric(this.input(t,"a")),a=this.expectNumeric(this.input(t,"b")),r=this.expectNumeric(this.input(t,"t",{type:"float",value:j(.5)})),u=Me(e.type,a.type,t.id);return this.output(t,{value:{type:u,value:Q(e.value,a.value,r.value)}})}case"math.remap":{const e=this.expectType(this.input(t,"value"),["float"],t.id,"value").value,a=this.floatInput(t,"inMin",-1),r=this.floatInput(t,"inMax",1),u=this.floatInput(t,"outMin",0),i=this.floatInput(t,"outMax",1);return this.output(t,{value:{type:"float",value:$t(e,a,r,u,i)}})}case"math.select":{const e=this.boolInput(t,"condition",!1),a=this.expectNumeric(this.input(t,"a")),r=this.expectNumeric(this.input(t,"b")),u=Me(a.type,r.type,t.id);return this.output(t,{value:{type:u,value:nt(e,a.value,r.value)}})}case"math.reflect":{const e=this.expectType(this.input(t,"incident"),["vec2","vec3","vec4","rgb","rgba"],t.id,"incident"),a=this.expectType(this.input(t,"normal"),["vec2","vec3","vec4","rgb","rgba"],t.id,"normal");return this.output(t,{value:{type:e.type,value:le(e.value,a.value)}})}case"math.refract":{const e=this.expectType(this.input(t,"incident"),["vec2","vec3","vec4","rgb","rgba"],t.id,"incident"),a=this.expectType(this.input(t,"normal"),["vec2","vec3","vec4","rgb","rgba"],t.id,"normal"),r=this.floatInput(t,"ior",1.5);return this.output(t,{value:{type:e.type,value:pe(e.value,a.value,r)}})}case"math.derivative":{const e=this.expectNumeric(this.input(t,"value")),a=String(we(t,"mode","fwidth"));let r;return r="dFdx"===a?ce(e.value):"dFdy"===a?he(e.value):ve(e.value),this.output(t,{value:{type:e.type,value:r}})}case"layer.mixPainted":return this.output(t,{value:this.compilePaintedLayerMix(t)});case"math.dot":{const e=this.expectNumeric(this.input(t,"a")),a=this.expectNumeric(this.input(t,"b"));return Me(e.type,a.type,t.id),this.output(t,{value:{type:"float",value:z(e.value,a.value)}})}case"math.distance":{const e=this.expectNumeric(this.input(t,"a")),a=this.expectNumeric(this.input(t,"b"));return Me(e.type,a.type,t.id),this.output(t,{value:{type:"float",value:k(e.value,a.value)}})}case"math.cross":{const e=this.expectType(this.input(t,"a"),["vec3","rgb"],t.id,"a"),a=this.expectType(this.input(t,"b"),["vec3","rgb"],t.id,"b");return this.output(t,{value:{type:"vec3",value:B(e.value,a.value)}})}case"compare.greaterThan":case"compare.greaterThanOrEqual":case"compare.lessThan":case"compare.lessThanOrEqual":case"compare.equal":case"compare.notEqual":return this.output(t,{value:{type:"boolean",value:this.compileComparison(t)}});case"boolean.not":{const e=this.boolInput(t,"value",!1);return this.output(t,{value:{type:"boolean",value:nt(e,N(!1),N(!0))}})}case"boolean.and":return this.output(t,{value:{type:"boolean",value:this.compileBooleanBinary(t,"and")}});case"boolean.or":return this.output(t,{value:{type:"boolean",value:this.compileBooleanBinary(t,"or")}});case"compose.vec2":return this.output(t,{value:{type:"vec2",value:Ot(this.floatInput(t,"x",0),this.floatInput(t,"y",0))}});case"compose.vec3":return this.output(t,{value:{type:"vec3",value:Mt(this.floatInput(t,"x",0),this.floatInput(t,"y",0),this.floatInput(t,"z",0))}});case"compose.rgba":return this.output(t,{value:{type:"rgba",value:Ct(this.floatInput(t,"r",1),this.floatInput(t,"g",1),this.floatInput(t,"b",1),this.floatInput(t,"a",1))}});case"decompose.component":{const e=this.expectNumeric(this.input(t,"value")),a=String(we(t,"component","x"));return this.output(t,{value:{type:"float",value:Ne(e,a,t.id)}})}case"decompose.split":{const e=this.expectNumeric(this.input(t,"value"));return this.output(t,function(t,e){const a={},r=(r,u)=>{a[r]={type:"float",value:Ne(t,u,e)}};switch(t.type){case"vec2":return r("x","x"),r("y","y"),r("u","x"),r("v","y"),a;case"vec3":return r("x","x"),r("y","y"),r("z","z"),a;case"rgb":return r("r","r"),r("g","g"),r("b","b"),r("x","x"),r("y","y"),r("z","z"),a;case"vec4":return r("x","x"),r("y","y"),r("z","z"),r("w","w"),a;case"rgba":return r("r","r"),r("g","g"),r("b","b"),r("a","a"),r("x","x"),r("y","y"),r("z","z"),r("w","w"),a;case"float":return a.x={type:"float",value:t.value},a}}(e,t.id))}case"color.gradient":{const e=this.expectType(this.input(t,"t",{type:"float",value:j(.5)}),["float"],t.id,"t"),a=F(function(t){const e=we(t,"stops",[]);if(!Array.isArray(e))return[];const a=e.map((t,a)=>{if(null==t||"object"!=typeof t||Array.isArray(t))return;const r=t,u="string"==typeof r.color?r.color:"#ffffff";return{position:Ge(r.position,Ae(a,e.length)),color:u,alpha:Ge(r.alpha,1)}}).filter(t=>null!=t);return a.length>0?a:[]}(t)).sample(e.value);return this.output(t,{value:{type:"rgba",value:a}})}case"color.hueShift":{const e=this.expectType(this.input(t,"color"),["rgba","rgb","vec4","vec3"],t.id,"color"),a=e.value,r="rgba"===e.type||"vec4"===e.type?a.rgb??a.xyz:a,u=this.floatInput(t,"shift",0),i=kt(r,u);return"rgba"===e.type||"vec4"===e.type?this.output(t,{value:{type:e.type,value:Ct(i,a.a??a.w)}}):this.output(t,{value:{type:e.type,value:i}})}case"color.blend":{const e=this.expectType(this.input(t,"base"),["rgba","rgb","vec4","vec3"],t.id,"base"),a=this.expectType(this.input(t,"blend"),["rgba","rgb","vec4","vec3"],t.id,"blend"),r=String(we(t,"mode","multiply")),u=e.value,i=a.value,n="rgba"===e.type||"vec4"===e.type?u.rgb??u.xyz:u,o="rgba"===a.type||"vec4"===a.type?i.rgb??i.xyz:i;let s=zt(n,o,r);if("rgba"===a.type||"vec4"===a.type){const t=i.a??i.w;s=Q(n,s,t)}if("rgba"===e.type||"vec4"===e.type){const a=u.a??u.w;return this.output(t,{value:{type:e.type,value:Ct(s,a)}})}return this.output(t,{value:{type:e.type,value:s}})}case"color.desaturate":{const e=this.expectType(this.input(t,"color"),["rgba","rgb","vec4","vec3"],t.id,"color"),a=e.value,r="rgba"===e.type||"vec4"===e.type?a.rgb??a.xyz:a,u=this.floatInput(t,"fraction",1),i=At(r,u);return"rgba"===e.type||"vec4"===e.type?this.output(t,{value:{type:e.type,value:Ct(i,a.a??a.w)}}):this.output(t,{value:{type:e.type,value:i}})}case"texture.sampler2d":{const e=this.input(t,"texture");return this.output(t,{value:this.toSampler(e,t.id)})}case"texture.sample2d":{const e=this.toSampler(this.input(t,"sampler"),t.id),a=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv"),r=e.value.sample(a.value);return this.output(t,{rgba:{type:"rgba",value:r},rgb:{type:"rgb",value:r.rgb},r:{type:"float",value:r.r},g:{type:"float",value:r.g},b:{type:"float",value:r.b},a:{type:"float",value:r.a}})}case"texture.triplanarMapping":{const e=this.input(t,"sampler"),a=this.toSampler(e,t.id),r=this.expectType(this.input(t,"scale",{type:"float",value:j(1)}),["float"],t.id,"scale"),u=this.expectType(this.input(t,"normal",{type:"vec3",value:St.normal}),["vec3"],t.id,"normal"),i=this.expectType(this.input(t,"position",{type:"vec3",value:St.position}),["vec3"],t.id,"position"),n=xt(a.value,r.value,u.value,i.value);return this.output(t,{rgba:{type:"rgba",value:n},rgb:{type:"rgb",value:n.rgb},r:{type:"float",value:n.r},g:{type:"float",value:n.g},b:{type:"float",value:n.b},a:{type:"float",value:n.a}})}case"scene.sampleColor":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:Wt}),["vec2"],t.id,"uv"),a=Jt(e.value);return this.output(t,{rgba:{type:"rgba",value:a},rgb:{type:"rgb",value:a.rgb},r:{type:"float",value:a.r},g:{type:"float",value:a.g},b:{type:"float",value:a.b},a:{type:"float",value:a.a}})}case"scene.sampleDepth":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:Wt}),["vec2"],t.id,"uv");return this.output(t,{depth:{type:"float",value:Pt(e.value)},linearEyeDepth:{type:"float",value:Rt(e.value)}})}case"scene.fragmentDepth":return this.output(t,{linearEyeDepth:{type:"float",value:Ft}});case"transform.translate":{const e=this.expectType(this.input(t,"offset",{type:"vec3",value:Mt(0,0,0)}),["vec3","rgb"],t.id,"offset");return this.output(t,{value:{type:"mat4",value:gt(e.value)}})}case"transform.scale":{const e=this.expectType(this.input(t,"scale",{type:"vec3",value:Mt(1,1,1)}),["vec3","rgb"],t.id,"scale").value;return this.output(t,{value:{type:"mat4",value:ht(e.x,e.y,e.z)}})}case"transform.rotateAxis":{const e=this.expectType(this.input(t,"axis",{type:"vec3",value:Mt(0,1,0)}),["vec3","rgb"],t.id,"axis"),a=this.expectType(this.input(t,"angle",{type:"float",value:j(0)}),["float"],t.id,"angle");return this.output(t,{value:{type:"mat4",value:ee(e.value,a.value)}})}case"uv.rotate":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.expectType(this.input(t,"angle",{type:"float",value:j(0)}),["float"],t.id,"angle").value,r=this.expectType(this.input(t,"center",{type:"vec2",value:Ot(.5,.5)}),["vec2"],t.id,"center").value;return this.output(t,{value:{type:"vec2",value:Ce(e,a,r)}})}case"uv.twirl":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.expectType(this.input(t,"strength",{type:"float",value:j(1)}),["float"],t.id,"strength").value,r=this.expectType(this.input(t,"center",{type:"vec2",value:Ot(.5,.5)}),["vec2"],t.id,"center").value,u=this.expectType(this.input(t,"offset",{type:"vec2",value:Ot(0,0)}),["vec2"],t.id,"offset").value;return this.output(t,{value:{type:"vec2",value:wt(e,a,r,u)}})}case"uv.radial":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=Bt(e.subtractScalar(.5));return this.output(t,{coords:{type:"vec2",value:a.coords},radius:{type:"float",value:a.radius},angle:{type:"float",value:a.angle}})}case"uv.bulge":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.expectType(this.input(t,"center",{type:"vec2",value:Ot(.5,.5)}),["vec2"],t.id,"center").value,r=this.expectType(this.input(t,"power",{type:"float",value:j(1)}),["float"],t.id,"power").value;return this.output(t,{value:{type:"vec2",value:C(e,a,r)}})}case"uv.flipbook":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.floatInput(t,"columns",Te(t,"columns",1)),r=this.floatInput(t,"rows",Te(t,"rows",1)),u=this.floatInput(t,"fps",Te(t,"fps",60)),i=this.expectType(this.input(t,"time",{type:"float",value:mt.elapsed}),["float"],t.id,"time").value,n=String(we(t,"mode","clamp"));return this.output(t,{value:{type:"vec2",value:ae(e,a,r,i,u,n)}})}case"uv.pom":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.input(t,"heightMap"),r=this.toSampler(a,t.id).value,u=this.floatInput(t,"heightScale",.05),i=Te(t,"minLayers",8),n=Te(t,"maxLayers",24);return this.output(t,{value:{type:"vec2",value:re(e,r,u,i,n)}})}case"shape.rectangle":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value;return this.output(t,{value:{type:"float",value:Vt(e,this.floatInput(t,"width",.5),this.floatInput(t,"height",.5))}})}case"shape.roundedRectangle":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value;return this.output(t,{value:{type:"float",value:jt(e,this.floatInput(t,"width",.5),this.floatInput(t,"height",.5),this.floatInput(t,"radius",.1))}})}case"noise.simplex":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.floatInput(t,"scale",8);return this.output(t,{value:{type:"float",value:new _t(e.multiplyScalar(a))}})}case"noise.voronoi2d":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.floatInput(t,"scale",8);return this.output(t,{value:{type:"float",value:new te(e.multiplyScalar(a))}})}case"effect.fresnel":return this.output(t,{value:{type:"float",value:M(Lt(this.floatInput(t,"power",1)))}});case"effect.edgeDepth":{const e=this.floatInput(t,"power",1);return this.output(t,{value:{type:"float",value:Dt(e)}})}case"effect.depthFade":{const e=this.floatInput(t,"distance",1);return this.output(t,{value:{type:"float",value:qt(e)}})}case"util.panner":{const e=this.expectType(this.input(t,"coord",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"coord"),a=this.expectType(this.input(t,"speed",{type:"vec2",value:Ot(0,0)}),["vec2"],t.id,"speed"),r=this.expectType(this.input(t,"tile",{type:"vec2",value:Ot(1,1)}),["vec2"],t.id,"tile"),u=this.expectType(this.input(t,"time",{type:"float",value:mt.elapsed}),["float"],t.id,"time");return this.output(t,{value:{type:"vec2",value:e.value.multiply(r.value).add(a.value.multiplyScalar(u.value))}})}}}compileParameterNode(t){const e=String(we(t,"parameter","")),a=this.graph.parameters?.find(t=>t.name===e||t.id===e);if(null==a)throw new ShaderGraphCompileError(`Parameter "${e}" does not exist`,t.id);const r=oe(a.type),u={type:r,value:Se(this.options.parameters?.[a.name]??a.defaultValue,r,a.name)};if("sampler2d"!==r)return{value:u};const i=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv"),n=u.value.sample(i.value);return{value:{type:"rgba",value:n},rgb:{type:"rgb",value:n.rgb},r:{type:"float",value:n.r},g:{type:"float",value:n.g},b:{type:"float",value:n.b},a:{type:"float",value:n.a},sampler:u}}compileBinaryMath(t){const e=this.expectNumeric(this.input(t,"a")),a=this.expectNumeric(this.input(t,"b")),r=t.kind.split(".")[1];if(e.type===a.type)return{type:e.type,value:Oe(e.value,a.value,r,t.id)};if("float"===e.type&&"float"!==a.type&&"multiply"===r)return{type:a.type,value:Oe(a.value,e.value,r,t.id)};if("float"!==e.type&&"float"===a.type)return{type:e.type,value:Oe(e.value,a.value,r,t.id)};throw new ShaderGraphCompileError(`Cannot ${r} ${e.type} and ${a.type}`,t.id)}compileUnaryMath(t,e){const a=this.expectNumeric(this.input(t,"value"));return{type:a.type,value:e(a.value)}}compileBinaryFunction(t,e,a=!1){const r=this.expectNumeric(this.input(t,"a")),u=this.expectNumeric(this.input(t,"b"));return{type:a&&"float"===u.type?r.type:Me(r.type,u.type,t.id),value:e(r.value,u.value)}}compilePaintedLayerMix(t){const e=this.expectNumeric(this.input(t,"base")),a=[e.value],r=[Nt(0)];let u=e.type;for(let e=1;e<=8;e++){const i=this.optionalInput(t,`layer${e}`);if(null==i)continue;const n=this.expectNumeric(i);u=Me(u,n.type,t.id),a.push(n.value),r.push(Nt(e))}return 1===a.length?e:{type:u,value:X({layerColors:a,layerWeights:r,enableNoise:Boolean(we(t,"enableNoise",!0)),noiseScale:this.floatInput(t,"noiseScale",Te(t,"noiseScale",.1)),noiseAmount:this.floatInput(t,"noiseAmount",Te(t,"noiseAmount",.5)),decay:this.floatInput(t,"softness",Te(t,"softness",.3)),mode:"hard"===String(we(t,"mode","soft"))?R.hard:R.soft})}}defaultUV(){return"trail"===this.graph.target?Zt:"decal"===this.graph.target?Qt:M(S.uv)}input(t,e,a){const r=t.inputs?.[e];if(null!=r)return this.resolveInput(r,t.id,e);const u=(this.graph.edges??[]).find(a=>a.to.nodeId===t.id&&a.to.port===e);if(null!=u)return this.resolveSocket(u.from,t.id,e);if(null!=a)return a;const i=this.inlineLiteralFallback(t,e);if(null!=i)return i;throw new ShaderGraphCompileError(`Missing input "${e}"`,t.id,e)}optionalInput(t,e){const a=t.inputs?.[e];if(null!=a)return this.resolveInput(a,t.id,e);const r=(this.graph.edges??[]).find(a=>a.to.nodeId===t.id&&a.to.port===e);return null!=r?this.resolveSocket(r.from,t.id,e):void 0}floatInput(t,e,a){return this.expectType(this.input(t,e,{type:"float",value:j(a)}),["float"],t.id,e).value}boolInput(t,e,a){return this.expectType(this.input(t,e,{type:"boolean",value:N(a)}),["boolean"],t.id,e).value}compileComparison(t){const e=this.expectType(this.input(t,"a"),["float"],t.id,"a").value,a=this.expectType(this.input(t,"b"),["float"],t.id,"b").value;switch(t.kind){case"compare.greaterThan":return e.gt(a);case"compare.greaterThanOrEqual":return e.gte(a);case"compare.lessThan":return e.lt(a);case"compare.lessThanOrEqual":return e.lte(a);case"compare.equal":return e.equals(a);case"compare.notEqual":return e.notEquals(a)}throw new ShaderGraphCompileError(`Unsupported comparison node "${t.kind}"`,t.id)}compileBooleanBinary(t,e){const a=this.boolInput(t,"a",!1),r=this.boolInput(t,"b",!1);return"and"===e?a.and(r):a.or(r)}resolveOutputBinding(t,e){if(null!=t.input)return this.resolveSocket(t.input,void 0,e);if(void 0!==t.value)return Ie(t.value);throw new ShaderGraphCompileError(`Output "${e}" is missing an input or value`)}floatOutput(t,e){return this.expectType(this.resolveOutputBinding(t,e),["float"],e).value}resolveInput(t,e,a){return function(t){return null!=t.nodeId}(t)?this.resolveSocket(t,e,a):Ie(t.value,t.valueType)}inlineLiteralFallback(t,e){const a=ne[t.kind]?.inputs.find(t=>t.name===e);if(null==a)return;const r=ie(t.kind,a),u=ue(t.kind,a);return null!=r&&void 0!==u?Ie(u,r):void 0}resolveSocket(t,e,a){const r=this.compileNode(t.nodeId).outputs[t.port];if(null==r)throw new ShaderGraphCompileError(`Node "${t.nodeId}" does not have output "${t.port}"`,e??t.nodeId,a??t.port);return r}expectType(t,e,a,r){if(!e.includes(t.type))throw new ShaderGraphCompileError(`Expected ${e.join(" or ")} but got ${t.type}`,a,r);return t}expectNumeric(t){if(!Ee(t.type))throw new ShaderGraphCompileError(`Expected a numeric value but got ${t.type}`);return t}toSampler(t,e){if("sampler2d"===t.type)return t;if("texture2d"===t.type){const a=t.value;if(null==a)throw new ShaderGraphCompileError("Texture input is empty",e);return{type:"sampler2d",value:dt(a)}}throw new ShaderGraphCompileError(`Expected texture2d or sampler2d but got ${t.type}`,e)}toColorOutput(t){switch(t.type){case"float":case"vec2":case"vec3":case"vec4":case"rgb":case"rgba":return t.value;case"boolean":{const e=nt(t.value,j(1),j(0));return rt(Mt(e,e,e),1)}case"mat4":throw new ShaderGraphCompileError("mat4 values cannot be used as color");case"texture2d":case"sampler2d":throw new ShaderGraphCompileError(`${t.type} must be sampled before it can be used as color`)}}toVec3Output(t,e){if("vec3"===t.type||"rgb"===t.type)return t.value;if("vec4"===t.type||"rgba"===t.type)return t.value.xyz;throw new ShaderGraphCompileError(`Output "${e}" expects vec3/rgb but got ${t.type}`)}toMat4Output(t,e){if("mat4"===t.type)return t.value;throw new ShaderGraphCompileError(`Output "${e}" expects mat4 but got ${t.type}`)}output(t,e){return{node:t,outputs:e}}}export function compileShaderGraph(t,e={}){return new ShaderGraphCompiler(t,e).compile()}export function compileShaderGraphPreview(t,e,a={}){if(null==e)return compileShaderGraph(t,a).output;const r=new ShaderGraphCompiler(t,a).compileNode(e),u=Object.values(r.outputs)[0];if(null==u)throw new ShaderGraphCompileError(`Node "${e}" has no previewable output`,e);return{color:fe(u),transparent:"rgba"===u.type||"vec4"===u.type}}export function buildShaderGraphMaterial(t,a={}){const r=null!=a.previewNodeId?compileShaderGraphPreview(t,a.previewNodeId,a):compileShaderGraph(t,a).output;if("sprite"===t.target)return new Et({color:r.color,discard:r.discard,transparent:r.transparent??!0,position:Ut(new f("rotation",0),new f("screenSpaceSize",0)),uniforms:{color:{value:new e(16777215)}}});if("trail"===t.target){const{position:e}=Xt.getTrailShaderNodes(a.trailBillboard??!1),u=new h({...r,position:e});return Xt.applyTrailShaderParameters(u),me(u,t),u}if("decal"===t.target){const e=null!=r.discard?Kt.or(r.discard):Kt,a=new h({...r,transparent:!1,discard:e});return a.userData.isDecal=!0,me(a,t),a}const u=new h({transparent:!1,...r});return me(u,t),u}export function shaderGraphMaterialSideToThree(e){switch(e){case"back":return t;case"double":return a;default:return r}}function de(t){return"decal"!==t.target&&(t.materialOptions?.transparent??"sprite"===t.target)}function me(t,e){"surface"===e.target&&(t.side=shaderGraphMaterialSideToThree(e.materialOptions?.side)),null!=e.materialOptions?.transparent&&(t.transparent=e.materialOptions.transparent),null!=e.materialOptions?.alphaTest&&0===t.alphaTest&&(t.alphaTest=e.materialOptions.alphaTest),null!=e.materialOptions?.bloom&&(t.userData.hasBloom=e.materialOptions.bloom)}function fe(t){switch(t.type){case"float":return ge(t.value);case"vec2":{const e=t.value;return rt(Mt(e.x,e.y,0),1)}case"vec3":case"rgb":return rt(t.value,1);case"vec4":case"rgba":return t.value;case"boolean":return ge(nt(t.value,j(1),j(0)));case"mat4":throw new ShaderGraphCompileError("mat4 values cannot be previewed as color");case"texture2d":case"sampler2d":throw new ShaderGraphCompileError(`${t.type} nodes require a sampled output to preview`)}}function ge(t){return rt(Mt(t,t,t),1)}function be(t){return t instanceof p?Mt(t,t,t).rgb:t instanceof g?Mt(t.x,t.y,0).rgb:t}function xe(t){return t.rgb}function we(t,e,a){const r=t.params?.[e];return void 0===r?a:r}function Te(t,e,a){const r=we(t,e,a);return"number"==typeof r?r:Number(r??a)}function Ie(t,e){if(null!=(a=t)&&"object"==typeof a&&!Array.isArray(a)&&"value"in a)return Ie(t.value,t.valueType??e);var a;const r=e??function(t){if("boolean"==typeof t)return"boolean";if("number"==typeof t)return"float";if(Array.isArray(t))return 2===t.length?"vec2":3===t.length?"vec3":16===t.length?"mat4":"vec4";return"string"==typeof t?"rgb":"float"}(t);return{type:r,value:Se(t,r,"literal")}}function Se(t,a,r){switch(a){case"boolean":return t instanceof l?t:N(Boolean(t));case"float":return t instanceof p?t:j(Ge(t,0));case"vec2":return t instanceof g?t:$e(t);case"vec3":return t instanceof b?t:ke(t);case"vec4":return t instanceof x?t:function(t){const[e,a,r,u]=Be(t,4,1);return Ct(e,a,r,u)}(t);case"mat4":return t instanceof c?t:function(t){if(t instanceof u)return H(t);const e=new u;Array.isArray(t)&&16===t.length&&e.fromArray(t.map(t=>Ge(t,0)));return H(e)}(t);case"rgb":return t instanceof v?t:function(t){if("string"==typeof t||"number"==typeof t||t instanceof e)return ut(t);const[a,r,u]=Be(t,3);return Mt(a,r,u).rgb}(t);case"rgba":return t instanceof y||t instanceof x?t:ze(t);case"texture2d":return t;case"sampler2d":if(function(t){const e=t;return t instanceof d||t instanceof m||"function"==typeof e?.isSampler2D||!0===e?.isSampler2D}(t))return t;if(t instanceof i)return dt(t);throw new ShaderGraphCompileError(`Parameter "${r}" needs a texture value`)}}function Oe(t,e,a,r){const u=`${a}Scalar`;if(e instanceof p&&"function"==typeof t[u])return t[u](e);if("function"==typeof t[a])return t[a](e);throw new ShaderGraphCompileError(`Node does not support ${a}`,r)}function Me(t,e,a){if(t===e)return t;if("rgb"===t&&"vec3"===e||"vec3"===t&&"rgb"===e)return"vec3";if("rgba"===t&&"vec4"===e||"vec4"===t&&"rgba"===e)return"vec4";if("float"===t&&Ee(e))return e;if("float"===e&&Ee(t))return t;throw new ShaderGraphCompileError(`Cannot mix ${t} and ${e}`,a)}function Ce(t,e,a){const r=t.subtract(a),u=st(e),i=G(e);return Ot(i.multiply(r.x).subtract(u.multiply(r.y)).add(a.x),u.multiply(r.x).add(i.multiply(r.y)).add(a.y))}function Ne(t,e,a){const r=t.value["u"===e?"x":"v"===e?"y":e];if(r instanceof p)return r;throw new ShaderGraphCompileError(`Component "${e}" is not available on ${t.type}`,a)}function Ee(t){return"float"===t||"vec2"===t||"vec3"===t||"vec4"===t||"rgb"===t||"rgba"===t}function Ue(t){return Number.isFinite(t)?Math.min(1,Math.max(0,t)):0}function Ge(t,e){if("number"==typeof t)return t;if("string"==typeof t){const a=parseFloat(t);return Number.isFinite(a)?a:e}return"boolean"==typeof t?t?1:0:e}function Be(t,a,r=0){if(Array.isArray(t))return Array.from({length:a},(e,a)=>Ge(t[a],r));if(t instanceof n||t instanceof o||t instanceof s)return Array.from({length:a},(e,a)=>t.toArray()[a]??r);if(t instanceof e){const e=t.toArray();return Array.from({length:a},(t,a)=>e[a]??(3===a?1:r))}if(null!=t&&"object"==typeof t){const e=t,u=["x","y","z","w"];if(u.some(t=>null!=e[t]))return Array.from({length:a},(t,a)=>Ge(e[u[a]],r));const i=["r","g","b","a"];if(i.some(t=>null!=e[t]))return Array.from({length:a},(t,a)=>Ge(e[i[a]],3===a?1:r))}return Array.from({length:a},()=>Ge(t,r))}function $e(t){const[e,a]=Be(t,2);return Ot(e,a)}function ke(t){const[e,a,r]=Be(t,3);return Mt(e,a,r)}function ze(t,a=1){if("string"==typeof t||"number"==typeof t||t instanceof e)return rt(t,a);if(t instanceof b)return rt(t,a);const[r,u,i,n]=Be(t,4,a);return Ct(r,u,i,n)}function Ae(t,e){return e<=1?0:t/(e-1)}/*
1
+ import{BackSide as t,Color as e,DoubleSide as a,FrontSide as r,Matrix4 as u,Texture as i,Vector2 as o,Vector3 as n,Vector4 as s}from"three";import{BooleanNode as l,FloatNode as p,Mat4Node as c,NodeShaderMaterial as h,RgbNode as v,RgbaNode as y,Sampler2DNode as d,Texture2dLookupNode as m,UniformFloatNode as f,Vec2Node as g,Vec3Node as b,Vec4Node as x,abs as w,acos as T,asin as S,attributes as I,atan as O,autoVarying as M,bulge as N,bool as C,ceil as E,clamp as G,colorToNormal as U,cos as B,cross as $,degrees as k,distance as z,dot as P,exp as A,exp2 as j,float as V,floor as D,fract as L,inversesqrt as q,colorGradientSampler as F,curveSampler as R,sampleNamedEasingCurve as _,length as W,LayerMixMode as Y,log as H,log2 as J,mat4 as K,max as Q,min as X,mix as Z,mixColorsByLayer as tt,particleUniforms as et,mod as at,normalize as rt,pow as ut,radians as it,rgba as ot,rgb as nt,saturate as st,select as lt,sign as pt,sin as ct,smoothstep as ht,sqrt as vt,standardMaterial as yt,scaleTransform as dt,step as mt,tan as ft,textureSampler2d as gt,timeUniforms as bt,toonMaterial as xt,translate as wt,transformed as Tt,triplanarMapping as St,twirl as It,uniformFloat as Ot,uniforms as Mt,varyingAttributes as Nt,vec2 as Ct,vec3 as Et,vec4 as Gt,getPaintedMaterialLayerWeight as Ut}from"../../shader-nodes/index.js";import{SpriteNodeShaderMaterial as Bt,getSpritePosition as $t}from"../sprite-shader.js";import{oneMinus as kt}from"../../shader-nodes/index.js";import{vectorToRadial as zt,remap as Pt,hueShift as At,blendColor as jt,desaturateColor as Vt}from"../../shader-nodes/math.js";import{rectangleFloat as Dt,roundedRectangleFloat as Lt}from"../../shader-nodes/shapes.js";import{edgeDepthEffect as qt,fresnelEffect as Ft,depthFadeEffect as Rt}from"../../shader-nodes/effects.js";import{fragmentLinearEyeDepth as _t,sampleSceneDepth as Wt,sampleSceneLinearEyeDepth as Yt,screenUV as Ht,nearUniformName as Jt,farUniformName as Kt}from"../../shader-nodes/depth.js";import{sampleSceneColor as Qt}from"../../shader-nodes/scene-sample.js";import{decalDiscard as Xt,decalUV as Zt}from"../../shader-nodes/decal.js";import{Trail as te,trailUV as ee}from"../../effects/vfx/trail-renderer.js";import{SimplexNoiseNode as ae,Voronoi2d as re,rotateAxis as ue}from"../../shader-nodes/index.js";import{flipbookUv as ie}from"../../shader-nodes/texture-sequence.js";import{parallaxOcclusionMapping as oe}from"../../shader-nodes/pom.js";import{defaultInlineLiteralValueForPort as ne,inlineLiteralTypeForPort as se,SHADER_GRAPH_NODE_DEFINITIONS as le}from"./registry.js";import{shaderGraphParameterTypeToValueType as pe}from"./parameters.js";import{varying as ce,reflect as he,refract as ve,dFdx as ye,dFdy as de,fwidth as me}from"three-shader-graph";import{decalNormal as fe}from"../../shader-nodes/decal.js";import{Curve2 as ge}from"../../utils/curve.js";export class ShaderGraphCompileError extends Error{constructor(t,e,a){super(t),this.nodeId=e,this.port=a,this.name="ShaderGraphCompileError"}}export const shaderGraphPostProcessWeightUniformName="hology_post_process_weight";export class ShaderGraphCompiler{constructor(t,e={}){this.graph=t,this.options=e,this.compiled=new Map,this.nodesById=new Map((t.nodes??[]).map(t=>[t.id,t]))}validate(){this.compile()}compile(){if(1!==this.graph.version)throw new ShaderGraphCompileError(`Unsupported shader graph version ${this.graph.version}`);return this.validateEdges(),{output:this.compileOutput(),nodes:this.compiled}}validateEdges(){for(const t of this.graph.edges??[]){if(!this.nodesById.has(t.from.nodeId))throw new ShaderGraphCompileError(`Edge references missing source node "${t.from.nodeId}"`,t.from.nodeId,t.from.port);if(!this.nodesById.has(t.to.nodeId))throw new ShaderGraphCompileError(`Edge references missing target node "${t.to.nodeId}"`,t.to.nodeId,t.to.port)}}compileOutput(){if("postProcess"===this.graph.target)return this.compilePostProcessOutput();const t=this.graph.outputs?.color,e={color:null!=t?this.toColorOutput(this.resolveOutputBinding(t,"color")):ot("#ffffff",1),transparent:xe(this.graph)},a=this.graph.outputs?.opacity;null!=a&&(e.opacity=this.expectType(this.resolveOutputBinding(a,"opacity"),["float"],"opacity").value);const r=this.graph.outputs?.roughness;null!=r&&(e.roughness=this.expectType(this.resolveOutputBinding(r,"roughness"),["float"],"roughness").value);const u=this.graph.outputs?.metalness;null!=u&&(e.metalness=this.floatOutput(u,"metalness"));const i=this.graph.outputs?.normal;null!=i&&(e.normal=this.toVec3Output(this.resolveOutputBinding(i,"normal"),"normal"));const o=this.graph.outputs?.emissive;null!=o&&(e.emissive=this.toVec3Output(this.resolveOutputBinding(o,"emissive"),"emissive"));const n=this.graph.outputs?.ambientOcclusion;null!=n&&(e.ambientOcclusion=this.floatOutput(n,"ambientOcclusion"));const s=this.graph.outputs?.ambientOcclusionIntensity;null!=s&&(e.ambientOcclusionIntensity=this.floatOutput(s,"ambientOcclusionIntensity"));const l=this.graph.outputs?.sheenColor;null!=l&&(e.sheenColor=this.toVec3Output(this.resolveOutputBinding(l,"sheenColor"),"sheenColor"));const p=this.graph.outputs?.sheenRoughness;null!=p&&(e.sheenRoughness=this.floatOutput(p,"sheenRoughness"));const c=this.graph.outputs?.anisotropy;null!=c&&(e.anisotropy=this.floatOutput(c,"anisotropy"));const h=this.graph.outputs?.anisotropyDirection;null!=h&&(e.anisotropyDirection=this.expectType(this.resolveOutputBinding(h,"anisotropyDirection"),["vec2"],"anisotropyDirection").value);const v=this.graph.outputs?.bakedLight;null!=v&&(e.bakedLight=this.toVec3Output(this.resolveOutputBinding(v,"bakedLight"),"bakedLight"));const y=this.graph.outputs?.transform;null!=y&&"decal"!==this.graph.target&&(e.transform=this.toMat4Output(this.resolveOutputBinding(y,"transform"),"transform"));const d=this.graph.outputs?.discard;null!=d&&(e.discard=this.expectType(this.resolveOutputBinding(d,"discard"),["boolean"],"discard").value);const m=this.graph.outputs?.transparent;null!=m&&null!=m.value&&(e.transparent=Boolean(m.value));const f=this.graph.outputs?.alphaTest;return null!=f&&null!=f.value&&(e.alphaTest=Number(f.value)),this.applyShadingModel(e)}compilePostProcessOutput(){const t=this.graph.outputs?.color,e=null!=t?this.toColorOutput(this.resolveOutputBinding(t,"color")):Qt(Ht),a=this.graph.outputs?.opacity;return be(e,null!=a?this.expectType(this.resolveOutputBinding(a,"opacity"),["float"],"opacity").value:void 0)}applyShadingModel(t){const e=null!=t.opacity?function(t,e){if(t instanceof p)return ot(Et(t,t,t),e);if(t instanceof g)return ot(Et(t.x,t.y,0),e);if(t instanceof x)return ot(t.rgb,t.w.multiply(e));return ot(t,e)}(t.color,t.opacity):t.color;switch(this.graph.shadingModel??"standard"){case"standard":{const a={color:Ie(e),roughness:t.roughness??V(.5),...null!=t.metalness?{metalness:t.metalness}:{},..."decal"===this.graph.target?{normal:rt(ce(Mt.normalMatrix).multiplyVec(fe))}:{},...null!=t.normal?{normal:t.normal}:{},...null!=t.emissive?{emissive:Oe(t.emissive)}:{},...null!=t.ambientOcclusion?{ambientOcclusion:t.ambientOcclusion}:{},...null!=t.ambientOcclusionIntensity?{ambientOcclusionIntensity:t.ambientOcclusionIntensity}:{},...null!=t.sheenColor?{sheenColor:t.sheenColor.rgb}:{},...null!=t.sheenRoughness?{sheenRoughness:t.sheenRoughness}:{},...null!=t.anisotropy?{anisotropy:t.anisotropy}:{},...null!=t.anisotropyDirection?{anisotropyDirection:t.anisotropyDirection}:{},...null!=t.bakedLight?{bakedLight:t.bakedLight}:{}};return{...t,color:yt(a)}}case"toon":{const a={color:Ie(e),...null!=t.normal?{normal:t.normal}:{},...null!=t.emissive?{emissive:Oe(t.emissive)}:{},...null!=t.ambientOcclusion?{ambientOcclusion:t.ambientOcclusion}:{},...null!=t.ambientOcclusionIntensity?{ambientOcclusionIntensity:t.ambientOcclusionIntensity}:{},...null!=t.bakedLight?{bakedLight:t.bakedLight}:{}};return{...t,color:xt(a)}}case"unlit":return{...t,color:e}}}compileNode(t){const e=this.compiled.get(t);if(null!=e)return e;const a=this.nodesById.get(t);if(null==a)throw new ShaderGraphCompileError(`Missing shader graph node "${t}"`,t);if(null==le[a.kind])throw new ShaderGraphCompileError(`Unsupported shader graph node "${a.kind}"`,a.id);const r=this.compileNodeInternal(a);return this.compiled.set(t,r),r}compileNodeInternal(t){switch(t.kind){case"input.parameter":return this.output(t,this.compileParameterNode(t));case"input.slider":return this.output(t,{value:{type:"float",value:V(ze(Ne(t,"value",.5)))}});case"constant.boolean":return this.output(t,{value:{type:"boolean",value:C(Boolean(Me(t,"value",!1)))}});case"constant.float":return this.output(t,{value:{type:"float",value:V(Ne(t,"value",0))}});case"constant.vec2":return this.output(t,{value:{type:"vec2",value:je(Me(t,"value",[0,0]))}});case"constant.vec3":return this.output(t,{value:{type:"vec3",value:Ve(Me(t,"value",[0,0,0]))}});case"constant.rgba":return this.output(t,{value:{type:"rgba",value:De(Me(t,"value","#ffffff"),Ne(t,"alpha",1))}});case"builtin.uv":{const e=this.defaultUV();return this.output(t,{value:{type:"vec2",value:!0===Me(t,"flipY",!1)?Ct(e.x,kt(e.y)):e},u:{type:"float",value:e.x},v:{type:"float",value:e.y}})}case"builtin.screenUv":return this.output(t,{value:{type:"vec2",value:Ht}});case"builtin.color":{const e=M(I.color);return this.output(t,{value:{type:"rgba",value:e},rgb:{type:"rgb",value:e.rgb},r:{type:"float",value:e.r},g:{type:"float",value:e.g},b:{type:"float",value:e.b},a:{type:"float",value:e.a}})}case"builtin.position":{const e=M(I.position);return this.output(t,{value:{type:"vec3",value:e},x:{type:"float",value:e.x},y:{type:"float",value:e.y},z:{type:"float",value:e.z}})}case"builtin.worldPosition":{const e=M(Tt.worldPosition);return this.output(t,{value:{type:"vec3",value:e},x:{type:"float",value:e.x},y:{type:"float",value:e.y},z:{type:"float",value:e.z}})}case"builtin.viewDir":{const e=M(Tt.viewDir);return this.output(t,{value:{type:"vec3",value:e},x:{type:"float",value:e.x},y:{type:"float",value:e.y},z:{type:"float",value:e.z}})}case"builtin.normal":{const e=M(I.normal);return this.output(t,{value:{type:"vec3",value:e},x:{type:"float",value:e.x},y:{type:"float",value:e.y},z:{type:"float",value:e.z}})}case"builtin.time":return this.output(t,{value:{type:"float",value:bt.elapsed}});case"builtin.camera":{const e=Ot(Jt),a=Ot(Kt),r=Mt.cameraPosition;return this.output(t,{position:{type:"vec3",value:r},x:{type:"float",value:r.x},y:{type:"float",value:r.y},z:{type:"float",value:r.z},near:{type:"float",value:e},far:{type:"float",value:a}})}case"builtin.particle":return this.output(t,{energy:{type:"float",value:et.energy},color:{type:"rgb",value:et.color},opacity:{type:"float",value:et.opacity},time:{type:"float",value:et.time}});case"math.add":case"math.subtract":case"math.multiply":case"math.divide":return this.output(t,{value:this.compileBinaryMath(t)});case"math.oneMinus":{const e=this.expectNumeric(this.input(t,"value"));return this.output(t,{value:{type:e.type,value:kt(e.value)}})}case"math.abs":return this.output(t,{value:this.compileUnaryMath(t,w)});case"math.sign":return this.output(t,{value:this.compileUnaryMath(t,pt)});case"math.floor":return this.output(t,{value:this.compileUnaryMath(t,D)});case"math.ceil":return this.output(t,{value:this.compileUnaryMath(t,E)});case"math.fract":return this.output(t,{value:this.compileUnaryMath(t,L)});case"math.sin":return this.output(t,{value:this.compileUnaryMath(t,ct)});case"math.cos":return this.output(t,{value:this.compileUnaryMath(t,B)});case"math.tan":return this.output(t,{value:this.compileUnaryMath(t,ft)});case"math.asin":return this.output(t,{value:this.compileUnaryMath(t,S)});case"math.acos":return this.output(t,{value:this.compileUnaryMath(t,T)});case"math.atan":return this.output(t,{value:this.compileUnaryMath(t,O)});case"math.radians":return this.output(t,{value:this.compileUnaryMath(t,it)});case"math.degrees":return this.output(t,{value:this.compileUnaryMath(t,k)});case"math.sqrt":return this.output(t,{value:this.compileUnaryMath(t,vt)});case"math.inverseSqrt":return this.output(t,{value:this.compileUnaryMath(t,q)});case"math.exp":return this.output(t,{value:this.compileUnaryMath(t,A)});case"math.exp2":return this.output(t,{value:this.compileUnaryMath(t,j)});case"math.log":return this.output(t,{value:this.compileUnaryMath(t,H)});case"math.log2":return this.output(t,{value:this.compileUnaryMath(t,J)});case"math.saturate":return this.output(t,{value:this.compileUnaryMath(t,st)});case"math.length":{const e=this.expectNumeric(this.input(t,"value"));return this.output(t,{value:{type:"float",value:W(e.value)}})}case"math.normalize":return this.output(t,{value:this.compileUnaryMath(t,rt)});case"math.clamp":{const e=this.expectNumeric(this.input(t,"value")),a=this.expectNumeric(this.input(t,"min",{type:"float",value:V(0)})),r=this.expectNumeric(this.input(t,"max",{type:"float",value:V(1)}));return this.output(t,{value:{type:e.type,value:G(e.value,a.value,r.value)}})}case"math.min":return this.output(t,{value:this.compileBinaryFunction(t,X)});case"math.max":return this.output(t,{value:this.compileBinaryFunction(t,Q)});case"math.pow":return this.output(t,{value:this.compileBinaryFunction(t,ut)});case"math.mod":return this.output(t,{value:this.compileBinaryFunction(t,at)});case"math.step":return this.output(t,{value:this.compileBinaryFunction(t,mt,!0)});case"math.smoothstep":{const e=this.expectNumeric(this.input(t,"edge0",{type:"float",value:V(0)})),a=this.expectNumeric(this.input(t,"edge1",{type:"float",value:V(1)})),r=this.expectNumeric(this.input(t,"value"));return this.output(t,{value:{type:r.type,value:ht(e.value,a.value,r.value)}})}case"math.mix":{const e=this.expectNumeric(this.input(t,"a")),a=this.expectNumeric(this.input(t,"b")),r=this.expectNumeric(this.input(t,"t",{type:"float",value:V(.5)})),u=Ue(e.type,a.type,t.id);return this.output(t,{value:{type:u,value:Z(e.value,a.value,r.value)}})}case"math.remap":{const e=this.expectType(this.input(t,"value"),["float"],t.id,"value").value,a=this.floatInput(t,"inMin",-1),r=this.floatInput(t,"inMax",1),u=this.floatInput(t,"outMin",0),i=this.floatInput(t,"outMax",1);return this.output(t,{value:{type:"float",value:Pt(e,a,r,u,i)}})}case"math.select":{const e=this.boolInput(t,"condition",!1),a=this.expectNumeric(this.input(t,"a")),r=this.expectNumeric(this.input(t,"b")),u=Ue(a.type,r.type,t.id);return this.output(t,{value:{type:u,value:lt(e,a.value,r.value)}})}case"math.reflect":{const e=this.expectType(this.input(t,"incident"),["vec2","vec3","vec4","rgb","rgba"],t.id,"incident"),a=this.expectType(this.input(t,"normal"),["vec2","vec3","vec4","rgb","rgba"],t.id,"normal");return this.output(t,{value:{type:e.type,value:he(e.value,a.value)}})}case"math.refract":{const e=this.expectType(this.input(t,"incident"),["vec2","vec3","vec4","rgb","rgba"],t.id,"incident"),a=this.expectType(this.input(t,"normal"),["vec2","vec3","vec4","rgb","rgba"],t.id,"normal"),r=this.floatInput(t,"ior",1.5);return this.output(t,{value:{type:e.type,value:ve(e.value,a.value,r)}})}case"math.derivative":{const e=this.expectNumeric(this.input(t,"value")),a=String(Me(t,"mode","fwidth"));let r;return r="dFdx"===a?ye(e.value):"dFdy"===a?de(e.value):me(e.value),this.output(t,{value:{type:e.type,value:r}})}case"layer.mixPainted":return this.output(t,{value:this.compilePaintedLayerMix(t)});case"math.dot":{const e=this.expectNumeric(this.input(t,"a")),a=this.expectNumeric(this.input(t,"b"));return Ue(e.type,a.type,t.id),this.output(t,{value:{type:"float",value:P(e.value,a.value)}})}case"math.distance":{const e=this.expectNumeric(this.input(t,"a")),a=this.expectNumeric(this.input(t,"b"));return Ue(e.type,a.type,t.id),this.output(t,{value:{type:"float",value:z(e.value,a.value)}})}case"math.cross":{const e=this.expectType(this.input(t,"a"),["vec3","rgb"],t.id,"a"),a=this.expectType(this.input(t,"b"),["vec3","rgb"],t.id,"b");return this.output(t,{value:{type:"vec3",value:$(e.value,a.value)}})}case"compare.greaterThan":case"compare.greaterThanOrEqual":case"compare.lessThan":case"compare.lessThanOrEqual":case"compare.equal":case"compare.notEqual":return this.output(t,{value:{type:"boolean",value:this.compileComparison(t)}});case"boolean.not":{const e=this.boolInput(t,"value",!1);return this.output(t,{value:{type:"boolean",value:lt(e,C(!1),C(!0))}})}case"boolean.and":return this.output(t,{value:{type:"boolean",value:this.compileBooleanBinary(t,"and")}});case"boolean.or":return this.output(t,{value:{type:"boolean",value:this.compileBooleanBinary(t,"or")}});case"compose.vec2":return this.output(t,{value:{type:"vec2",value:Ct(this.floatInput(t,"x",0),this.floatInput(t,"y",0))}});case"compose.vec3":return this.output(t,{value:{type:"vec3",value:Et(this.floatInput(t,"x",0),this.floatInput(t,"y",0),this.floatInput(t,"z",0))}});case"compose.rgba":return this.output(t,{value:{type:"rgba",value:Gt(this.floatInput(t,"r",1),this.floatInput(t,"g",1),this.floatInput(t,"b",1),this.floatInput(t,"a",1))}});case"decompose.component":{const e=this.expectNumeric(this.input(t,"value")),a=String(Me(t,"component","x"));return this.output(t,{value:{type:"float",value:$e(e,a,t.id)}})}case"decompose.split":{const e=this.expectNumeric(this.input(t,"value"));return this.output(t,function(t,e){const a={},r=(r,u)=>{a[r]={type:"float",value:$e(t,u,e)}};switch(t.type){case"vec2":return r("x","x"),r("y","y"),r("u","x"),r("v","y"),a;case"vec3":return r("x","x"),r("y","y"),r("z","z"),a;case"rgb":return r("r","r"),r("g","g"),r("b","b"),r("x","x"),r("y","y"),r("z","z"),a;case"vec4":return r("x","x"),r("y","y"),r("z","z"),r("w","w"),a;case"rgba":return r("r","r"),r("g","g"),r("b","b"),r("a","a"),r("x","x"),r("y","y"),r("z","z"),r("w","w"),a;case"float":return a.x={type:"float",value:t.value},a}}(e,t.id))}case"color.gradient":{const e=this.expectType(this.input(t,"t",{type:"float",value:V(.5)}),["float"],t.id,"t"),a=F(function(t){const e=Me(t,"stops",[]);if(!Array.isArray(e))return[];const a=e.map((t,a)=>{if(null==t||"object"!=typeof t||Array.isArray(t))return;const r=t,u="string"==typeof r.color?r.color:"#ffffff";return{position:Pe(r.position,Le(a,e.length)),color:u,alpha:Pe(r.alpha,1)}}).filter(t=>null!=t);return a.length>0?a:[]}(t)).sample(e.value);return this.output(t,{value:{type:"rgba",value:a}})}case"utility.curve":{const e=this.expectType(this.input(t,"t",{type:"float",value:V(.5)}),["float"],t.id,"t"),a=Me(t,"curve","Linear"),r=_(a,e.value)??R(ge.decode(a)).sample(e.value);return this.output(t,{value:{type:"float",value:r}})}case"color.hueShift":{const e=this.expectType(this.input(t,"color"),["rgba","rgb","vec4","vec3"],t.id,"color"),a=e.value,r="rgba"===e.type||"vec4"===e.type?a.rgb??a.xyz:a,u=this.floatInput(t,"shift",0),i=At(r,u);return"rgba"===e.type||"vec4"===e.type?this.output(t,{value:{type:e.type,value:Gt(i,a.a??a.w)}}):this.output(t,{value:{type:e.type,value:i}})}case"color.blend":{const e=this.expectType(this.input(t,"base"),["rgba","rgb","vec4","vec3"],t.id,"base"),a=this.expectType(this.input(t,"blend"),["rgba","rgb","vec4","vec3"],t.id,"blend"),r=String(Me(t,"mode","multiply")),u=e.value,i=a.value,o="rgba"===e.type||"vec4"===e.type?u.rgb??u.xyz:u,n="rgba"===a.type||"vec4"===a.type?i.rgb??i.xyz:i;let s=jt(o,n,r);if("rgba"===a.type||"vec4"===a.type){const t=i.a??i.w;s=Z(o,s,t)}if("rgba"===e.type||"vec4"===e.type){const a=u.a??u.w;return this.output(t,{value:{type:e.type,value:Gt(s,a)}})}return this.output(t,{value:{type:e.type,value:s}})}case"color.desaturate":{const e=this.expectType(this.input(t,"color"),["rgba","rgb","vec4","vec3"],t.id,"color"),a=e.value,r="rgba"===e.type||"vec4"===e.type?a.rgb??a.xyz:a,u=this.floatInput(t,"fraction",1),i=Vt(r,u);return"rgba"===e.type||"vec4"===e.type?this.output(t,{value:{type:e.type,value:Gt(i,a.a??a.w)}}):this.output(t,{value:{type:e.type,value:i}})}case"color.unpackNormal":{const e=this.expectType(this.input(t,"color"),["vec3","vec4","rgb","rgba"],t.id,"color"),a=this.floatInput(t,"scale",1),r=this.optionalInput(t,"normal");return this.output(t,{value:{type:"vec3",value:U(e.value,a,r?this.expectType(r,["vec3"],t.id,"normal").value:void 0)}})}case"texture.sampler2d":{const e=this.input(t,"texture");return this.output(t,{value:this.toSampler(e,t.id)})}case"texture.sample2d":{const e=this.toSampler(this.input(t,"sampler"),t.id),a=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv"),r=e.value.sample(a.value);return this.output(t,{rgba:{type:"rgba",value:r},rgb:{type:"rgb",value:r.rgb},r:{type:"float",value:r.r},g:{type:"float",value:r.g},b:{type:"float",value:r.b},a:{type:"float",value:r.a}})}case"texture.triplanarMapping":{const e=this.input(t,"sampler"),a=this.toSampler(e,t.id),r=this.expectType(this.input(t,"scale",{type:"float",value:V(1)}),["float"],t.id,"scale"),u=this.expectType(this.input(t,"normal",{type:"vec3",value:Nt.normal}),["vec3"],t.id,"normal"),i=this.expectType(this.input(t,"position",{type:"vec3",value:Nt.position}),["vec3"],t.id,"position"),o=St(a.value,r.value,u.value,i.value);return this.output(t,{rgba:{type:"rgba",value:o},rgb:{type:"rgb",value:o.rgb},r:{type:"float",value:o.r},g:{type:"float",value:o.g},b:{type:"float",value:o.b},a:{type:"float",value:o.a}})}case"scene.sampleColor":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:Ht}),["vec2"],t.id,"uv"),a=Qt(e.value);return this.output(t,{rgba:{type:"rgba",value:a},rgb:{type:"rgb",value:a.rgb},r:{type:"float",value:a.r},g:{type:"float",value:a.g},b:{type:"float",value:a.b},a:{type:"float",value:a.a}})}case"scene.sampleDepth":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:Ht}),["vec2"],t.id,"uv");return this.output(t,{depth:{type:"float",value:Wt(e.value)},linearEyeDepth:{type:"float",value:Yt(e.value)}})}case"scene.fragmentDepth":return this.output(t,{linearEyeDepth:{type:"float",value:_t}});case"transform.translate":{const e=this.expectType(this.input(t,"offset",{type:"vec3",value:Et(0,0,0)}),["vec3","rgb"],t.id,"offset");return this.output(t,{value:{type:"mat4",value:wt(e.value)}})}case"transform.scale":{const e=this.expectType(this.input(t,"scale",{type:"vec3",value:Et(1,1,1)}),["vec3","rgb"],t.id,"scale").value;return this.output(t,{value:{type:"mat4",value:dt(e.x,e.y,e.z)}})}case"transform.rotateAxis":{const e=this.expectType(this.input(t,"axis",{type:"vec3",value:Et(0,1,0)}),["vec3","rgb"],t.id,"axis"),a=this.expectType(this.input(t,"angle",{type:"float",value:V(0)}),["float"],t.id,"angle");return this.output(t,{value:{type:"mat4",value:ue(e.value,a.value)}})}case"uv.rotate":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.expectType(this.input(t,"angle",{type:"float",value:V(0)}),["float"],t.id,"angle").value,r=this.expectType(this.input(t,"center",{type:"vec2",value:Ct(.5,.5)}),["vec2"],t.id,"center").value;return this.output(t,{value:{type:"vec2",value:Be(e,a,r)}})}case"uv.twirl":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.expectType(this.input(t,"strength",{type:"float",value:V(1)}),["float"],t.id,"strength").value,r=this.expectType(this.input(t,"center",{type:"vec2",value:Ct(.5,.5)}),["vec2"],t.id,"center").value,u=this.expectType(this.input(t,"offset",{type:"vec2",value:Ct(0,0)}),["vec2"],t.id,"offset").value;return this.output(t,{value:{type:"vec2",value:It(e,a,r,u)}})}case"uv.radial":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=zt(e.subtractScalar(.5));return this.output(t,{coords:{type:"vec2",value:a.coords},radius:{type:"float",value:a.radius},angle:{type:"float",value:a.angle}})}case"uv.bulge":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.expectType(this.input(t,"center",{type:"vec2",value:Ct(.5,.5)}),["vec2"],t.id,"center").value,r=this.expectType(this.input(t,"power",{type:"float",value:V(1)}),["float"],t.id,"power").value;return this.output(t,{value:{type:"vec2",value:N(e,a,r)}})}case"uv.flipbook":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.floatInput(t,"columns",Ne(t,"columns",1)),r=this.floatInput(t,"rows",Ne(t,"rows",1)),u=this.floatInput(t,"fps",Ne(t,"fps",60)),i=this.expectType(this.input(t,"time",{type:"float",value:bt.elapsed}),["float"],t.id,"time").value,o=String(Me(t,"mode","clamp"));return this.output(t,{value:{type:"vec2",value:ie(e,a,r,i,u,o)}})}case"uv.pom":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.input(t,"heightMap"),r=this.toSampler(a,t.id).value,u=this.floatInput(t,"heightScale",.05),i=Ne(t,"minLayers",8),o=Ne(t,"maxLayers",24);return this.output(t,{value:{type:"vec2",value:oe(e,r,u,i,o)}})}case"shape.rectangle":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value;return this.output(t,{value:{type:"float",value:Dt(e,this.floatInput(t,"width",.5),this.floatInput(t,"height",.5))}})}case"shape.roundedRectangle":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value;return this.output(t,{value:{type:"float",value:Lt(e,this.floatInput(t,"width",.5),this.floatInput(t,"height",.5),this.floatInput(t,"radius",.1))}})}case"noise.simplex":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.floatInput(t,"scale",8);return this.output(t,{value:{type:"float",value:new ae(e.multiplyScalar(a))}})}case"noise.voronoi2d":{const e=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv").value,a=this.floatInput(t,"scale",8);return this.output(t,{value:{type:"float",value:new re(e.multiplyScalar(a))}})}case"effect.fresnel":return this.output(t,{value:{type:"float",value:M(Ft(this.floatInput(t,"power",1)))}});case"effect.edgeDepth":{const e=this.floatInput(t,"power",1);return this.output(t,{value:{type:"float",value:qt(e)}})}case"effect.depthFade":{const e=this.floatInput(t,"distance",1);return this.output(t,{value:{type:"float",value:Rt(e)}})}case"util.panner":{const e=this.expectType(this.input(t,"coord",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"coord"),a=this.expectType(this.input(t,"speed",{type:"vec2",value:Ct(0,0)}),["vec2"],t.id,"speed"),r=this.expectType(this.input(t,"tile",{type:"vec2",value:Ct(1,1)}),["vec2"],t.id,"tile"),u=this.expectType(this.input(t,"time",{type:"float",value:bt.elapsed}),["float"],t.id,"time");return this.output(t,{value:{type:"vec2",value:e.value.multiply(r.value).add(a.value.multiplyScalar(u.value))}})}}}compileParameterNode(t){const e=String(Me(t,"parameter","")),a=this.graph.parameters?.find(t=>t.name===e||t.id===e);if(null==a)throw new ShaderGraphCompileError(`Parameter "${e}" does not exist`,t.id);const r=pe(a.type),u={type:r,value:Ee(this.options.parameters?.[a.name]??a.defaultValue,r,a.name)};if("sampler2d"!==r)return{value:u};const i=this.expectType(this.input(t,"uv",{type:"vec2",value:this.defaultUV()}),["vec2"],t.id,"uv"),o=u.value.sample(i.value);return{value:{type:"rgba",value:o},rgb:{type:"rgb",value:o.rgb},r:{type:"float",value:o.r},g:{type:"float",value:o.g},b:{type:"float",value:o.b},a:{type:"float",value:o.a},sampler:u}}compileBinaryMath(t){const e=this.expectNumeric(this.input(t,"a")),a=this.expectNumeric(this.input(t,"b")),r=t.kind.split(".")[1];if(e.type===a.type)return{type:e.type,value:Ge(e.value,a.value,r,t.id)};if("float"===e.type&&"float"!==a.type&&"multiply"===r)return{type:a.type,value:Ge(a.value,e.value,r,t.id)};if("float"!==e.type&&"float"===a.type)return{type:e.type,value:Ge(e.value,a.value,r,t.id)};throw new ShaderGraphCompileError(`Cannot ${r} ${e.type} and ${a.type}`,t.id)}compileUnaryMath(t,e){const a=this.expectNumeric(this.input(t,"value"));return{type:a.type,value:e(a.value)}}compileBinaryFunction(t,e,a=!1){const r=this.expectNumeric(this.input(t,"a")),u=this.expectNumeric(this.input(t,"b"));return{type:a&&"float"===u.type?r.type:Ue(r.type,u.type,t.id),value:e(r.value,u.value)}}compilePaintedLayerMix(t){const e=this.expectNumeric(this.input(t,"base")),a=[e.value],r=[Ut(0)];let u=e.type;for(let e=1;e<=8;e++){const i=this.optionalInput(t,`layer${e}`);if(null==i)continue;const o=this.expectNumeric(i);u=Ue(u,o.type,t.id),a.push(o.value),r.push(Ut(e))}return 1===a.length?e:{type:u,value:tt({layerColors:a,layerWeights:r,enableNoise:Boolean(Me(t,"enableNoise",!0)),noiseScale:this.floatInput(t,"noiseScale",Ne(t,"noiseScale",.1)),noiseAmount:this.floatInput(t,"noiseAmount",Ne(t,"noiseAmount",.5)),decay:this.floatInput(t,"softness",Ne(t,"softness",.3)),mode:"hard"===String(Me(t,"mode","soft"))?Y.hard:Y.soft})}}defaultUV(){return"trail"===this.graph.target?ee:"decal"===this.graph.target?Zt:M(I.uv)}input(t,e,a){const r=t.inputs?.[e];if(null!=r)return this.resolveInput(r,t.id,e);const u=(this.graph.edges??[]).find(a=>a.to.nodeId===t.id&&a.to.port===e);if(null!=u)return this.resolveSocket(u.from,t.id,e);if(null!=a)return a;const i=this.inlineLiteralFallback(t,e);if(null!=i)return i;throw new ShaderGraphCompileError(`Missing input "${e}"`,t.id,e)}optionalInput(t,e){const a=t.inputs?.[e];if(null!=a)return this.resolveInput(a,t.id,e);const r=(this.graph.edges??[]).find(a=>a.to.nodeId===t.id&&a.to.port===e);return null!=r?this.resolveSocket(r.from,t.id,e):void 0}floatInput(t,e,a){return this.expectType(this.input(t,e,{type:"float",value:V(a)}),["float"],t.id,e).value}boolInput(t,e,a){return this.expectType(this.input(t,e,{type:"boolean",value:C(a)}),["boolean"],t.id,e).value}compileComparison(t){const e=this.expectType(this.input(t,"a"),["float"],t.id,"a").value,a=this.expectType(this.input(t,"b"),["float"],t.id,"b").value;switch(t.kind){case"compare.greaterThan":return e.gt(a);case"compare.greaterThanOrEqual":return e.gte(a);case"compare.lessThan":return e.lt(a);case"compare.lessThanOrEqual":return e.lte(a);case"compare.equal":return e.equals(a);case"compare.notEqual":return e.notEquals(a)}throw new ShaderGraphCompileError(`Unsupported comparison node "${t.kind}"`,t.id)}compileBooleanBinary(t,e){const a=this.boolInput(t,"a",!1),r=this.boolInput(t,"b",!1);return"and"===e?a.and(r):a.or(r)}resolveOutputBinding(t,e){if(null!=t.input)return this.resolveSocket(t.input,void 0,e);if(void 0!==t.value)return Ce(t.value);throw new ShaderGraphCompileError(`Output "${e}" is missing an input or value`)}floatOutput(t,e){return this.expectType(this.resolveOutputBinding(t,e),["float"],e).value}resolveInput(t,e,a){return function(t){return null!=t.nodeId}(t)?this.resolveSocket(t,e,a):Ce(t.value,t.valueType)}inlineLiteralFallback(t,e){const a=le[t.kind]?.inputs.find(t=>t.name===e);if(null==a)return;const r=se(t.kind,a),u=ne(t.kind,a);return null!=r&&void 0!==u?Ce(u,r):void 0}resolveSocket(t,e,a){const r=this.compileNode(t.nodeId).outputs[t.port];if(null==r)throw new ShaderGraphCompileError(`Node "${t.nodeId}" does not have output "${t.port}"`,e??t.nodeId,a??t.port);return r}expectType(t,e,a,r){if(!e.includes(t.type))throw new ShaderGraphCompileError(`Expected ${e.join(" or ")} but got ${t.type}`,a,r);return t}expectNumeric(t){if(!ke(t.type))throw new ShaderGraphCompileError(`Expected a numeric value but got ${t.type}`);return t}toSampler(t,e){if("sampler2d"===t.type)return t;if("texture2d"===t.type){const a=t.value;if(null==a)throw new ShaderGraphCompileError("Texture input is empty",e);return{type:"sampler2d",value:gt(a)}}throw new ShaderGraphCompileError(`Expected texture2d or sampler2d but got ${t.type}`,e)}toColorOutput(t){switch(t.type){case"float":case"vec2":case"vec3":case"vec4":case"rgb":case"rgba":return t.value;case"boolean":{const e=lt(t.value,V(1),V(0));return ot(Et(e,e,e),1)}case"mat4":throw new ShaderGraphCompileError("mat4 values cannot be used as color");case"texture2d":case"sampler2d":throw new ShaderGraphCompileError(`${t.type} must be sampled before it can be used as color`)}}toVec3Output(t,e){if("vec3"===t.type||"rgb"===t.type)return t.value;if("vec4"===t.type||"rgba"===t.type)return t.value.xyz;throw new ShaderGraphCompileError(`Output "${e}" expects vec3/rgb but got ${t.type}`)}toMat4Output(t,e){if("mat4"===t.type)return t.value;throw new ShaderGraphCompileError(`Output "${e}" expects mat4 but got ${t.type}`)}output(t,e){return{node:t,outputs:e}}}export function compileShaderGraph(t,e={}){return new ShaderGraphCompiler(t,e).compile()}export function compileShaderGraphPreview(t,e,a={}){if(null==e)return compileShaderGraph(t,a).output;const r=new ShaderGraphCompiler(t,a).compileNode(e),u=Object.values(r.outputs)[0];if(null==u)throw new ShaderGraphCompileError(`Node "${e}" has no previewable output`,e);return{color:Te(u),transparent:"rgba"===u.type||"vec4"===u.type}}export function buildShaderGraphMaterial(t,a={}){if("postProcess"===t.target)return buildShaderGraphPostProcessMaterial(t,a);const r=null!=a.previewNodeId?compileShaderGraphPreview(t,a.previewNodeId,a):compileShaderGraph(t,a).output;if("sprite"===t.target)return new Bt({color:r.color,discard:r.discard,transparent:r.transparent??!0,position:$t(new f("rotation",0),new f("screenSpaceSize",0)),uniforms:{color:{value:new e(16777215)}}});if("trail"===t.target){const{position:e}=te.getTrailShaderNodes(a.trailBillboard??!1),u=new h({...r,position:e});return te.applyTrailShaderParameters(u),we(u,t),u}if("decal"===t.target){const e=null!=r.discard?Xt.or(r.discard):Xt,a=new h({...r,transparent:!1,discard:e});return a.userData.isDecal=!0,we(a,t),a}const u=new h({transparent:!1,...r});return we(u,t),u}export function buildShaderGraphPostProcessMaterial(t,e={}){const a=null!=e.previewNodeId?be(compileShaderGraphPreview(t,e.previewNodeId,e).color):compileShaderGraph(t,e).output,r=new h({color:a.color,transparent:!1,fog:!1,lights:!1,outputEncoding:!1});return r.depthWrite=!1,r.depthTest=!1,r.toneMapped=!1,r.userData.isPostProcessShaderGraph=!0,r}function be(t,e){const a=Qt(Ht),r=Ot("hology_post_process_weight",1),u=st(null!=e?r.multiply(e):r);return{color:Z(a,t,u),transparent:!1,...null!=e?{opacity:e}:{}}}export function shaderGraphMaterialSideToThree(e){switch(e){case"back":return t;case"double":return a;default:return r}}function xe(t){return"decal"!==t.target&&(t.materialOptions?.transparent??"sprite"===t.target)}function we(t,e){"surface"===e.target&&(t.side=shaderGraphMaterialSideToThree(e.materialOptions?.side)),null!=e.materialOptions?.transparent&&(t.transparent=e.materialOptions.transparent),null!=e.materialOptions?.alphaTest&&0===t.alphaTest&&(t.alphaTest=e.materialOptions.alphaTest),null!=e.materialOptions?.bloom&&(t.userData.hasBloom=e.materialOptions.bloom)}function Te(t){switch(t.type){case"float":return Se(t.value);case"vec2":{const e=t.value;return ot(Et(e.x,e.y,0),1)}case"vec3":case"rgb":return ot(t.value,1);case"vec4":case"rgba":return t.value;case"boolean":return Se(lt(t.value,V(1),V(0)));case"mat4":throw new ShaderGraphCompileError("mat4 values cannot be previewed as color");case"texture2d":case"sampler2d":throw new ShaderGraphCompileError(`${t.type} nodes require a sampled output to preview`)}}function Se(t){return ot(Et(t,t,t),1)}function Ie(t){return t instanceof p?Et(t,t,t).rgb:t instanceof g?Et(t.x,t.y,0).rgb:t}function Oe(t){return t.rgb}function Me(t,e,a){const r=t.params?.[e];return void 0===r?a:r}function Ne(t,e,a){const r=Me(t,e,a);return"number"==typeof r?r:Number(r??a)}function Ce(t,e){if(null!=(a=t)&&"object"==typeof a&&!Array.isArray(a)&&"value"in a)return Ce(t.value,t.valueType??e);var a;const r=e??function(t){if("boolean"==typeof t)return"boolean";if("number"==typeof t)return"float";if(Array.isArray(t))return 2===t.length?"vec2":3===t.length?"vec3":16===t.length?"mat4":"vec4";return"string"==typeof t?"rgb":"float"}(t);return{type:r,value:Ee(t,r,"literal")}}function Ee(t,a,r){switch(a){case"boolean":return t instanceof l?t:C(Boolean(t));case"float":return t instanceof p?t:V(Pe(t,0));case"vec2":return t instanceof g?t:je(t);case"vec3":return t instanceof b?t:Ve(t);case"vec4":return t instanceof x?t:function(t){const[e,a,r,u]=Ae(t,4,1);return Gt(e,a,r,u)}(t);case"mat4":return t instanceof c?t:function(t){if(t instanceof u)return K(t);const e=new u;Array.isArray(t)&&16===t.length&&e.fromArray(t.map(t=>Pe(t,0)));return K(e)}(t);case"rgb":return t instanceof v?t:function(t){if("string"==typeof t||"number"==typeof t||t instanceof e)return nt(t);const[a,r,u]=Ae(t,3);return Et(a,r,u).rgb}(t);case"rgba":return t instanceof y||t instanceof x?t:De(t);case"texture2d":return t;case"sampler2d":if(function(t){const e=t;return t instanceof d||t instanceof m||"function"==typeof e?.isSampler2D||!0===e?.isSampler2D}(t))return t;if(t instanceof i)return gt(t);throw new ShaderGraphCompileError(`Parameter "${r}" needs a texture value`)}}function Ge(t,e,a,r){const u=`${a}Scalar`;if(e instanceof p&&"function"==typeof t[u])return t[u](e);if("function"==typeof t[a])return t[a](e);throw new ShaderGraphCompileError(`Node does not support ${a}`,r)}function Ue(t,e,a){if(t===e)return t;if("rgb"===t&&"vec3"===e||"vec3"===t&&"rgb"===e)return"vec3";if("rgba"===t&&"vec4"===e||"vec4"===t&&"rgba"===e)return"vec4";if("float"===t&&ke(e))return e;if("float"===e&&ke(t))return t;throw new ShaderGraphCompileError(`Cannot mix ${t} and ${e}`,a)}function Be(t,e,a){const r=t.subtract(a),u=ct(e),i=B(e);return Ct(i.multiply(r.x).subtract(u.multiply(r.y)).add(a.x),u.multiply(r.x).add(i.multiply(r.y)).add(a.y))}function $e(t,e,a){const r=t.value["u"===e?"x":"v"===e?"y":e];if(r instanceof p)return r;throw new ShaderGraphCompileError(`Component "${e}" is not available on ${t.type}`,a)}function ke(t){return"float"===t||"vec2"===t||"vec3"===t||"vec4"===t||"rgb"===t||"rgba"===t}function ze(t){return Number.isFinite(t)?Math.min(1,Math.max(0,t)):0}function Pe(t,e){if("number"==typeof t)return t;if("string"==typeof t){const a=parseFloat(t);return Number.isFinite(a)?a:e}return"boolean"==typeof t?t?1:0:e}function Ae(t,a,r=0){if(Array.isArray(t))return Array.from({length:a},(e,a)=>Pe(t[a],r));if(t instanceof o||t instanceof n||t instanceof s)return Array.from({length:a},(e,a)=>t.toArray()[a]??r);if(t instanceof e){const e=t.toArray();return Array.from({length:a},(t,a)=>e[a]??(3===a?1:r))}if(null!=t&&"object"==typeof t){const e=t,u=["x","y","z","w"];if(u.some(t=>null!=e[t]))return Array.from({length:a},(t,a)=>Pe(e[u[a]],r));const i=["r","g","b","a"];if(i.some(t=>null!=e[t]))return Array.from({length:a},(t,a)=>Pe(e[i[a]],3===a?1:r))}return Array.from({length:a},()=>Pe(t,r))}function je(t){const[e,a]=Ae(t,2);return Ct(e,a)}function Ve(t){const[e,a,r]=Ae(t,3);return Et(e,a,r)}function De(t,a=1){if("string"==typeof t||"number"==typeof t||t instanceof e)return ot(t,a);if(t instanceof b)return ot(t,a);const[r,u,i,o]=Ae(t,4,a);return Gt(r,u,i,o)}function Le(t,e){return e<=1?0:t/(e-1)}/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,10 +1,10 @@
1
- export type ShaderGraphTarget = 'surface' | 'sprite' | 'decal' | 'trail';
1
+ export type ShaderGraphTarget = 'surface' | 'sprite' | 'decal' | 'trail' | 'postProcess';
2
2
  export type ShaderGraphShadingModel = 'standard' | 'toon' | 'unlit';
3
3
  export type ShaderGraphMaterialSide = 'front' | 'back' | 'double';
4
4
  export type ShaderGraphValueType = 'boolean' | 'float' | 'vec2' | 'vec3' | 'vec4' | 'mat4' | 'rgb' | 'rgba' | 'texture2d' | 'sampler2d';
5
5
  export declare const ShaderGraphParameterTypes: readonly ["float", "boolean", "vec2", "vec3", "vec4", "color", "texture"];
6
6
  export type ShaderGraphParameterType = (typeof ShaderGraphParameterTypes)[number];
7
- export type ShaderGraphNodeKind = 'input.parameter' | 'input.slider' | 'constant.boolean' | 'constant.float' | 'constant.vec2' | 'constant.vec3' | 'constant.rgba' | 'builtin.uv' | 'builtin.screenUv' | 'builtin.color' | 'builtin.position' | 'builtin.worldPosition' | 'builtin.normal' | 'builtin.time' | 'builtin.camera' | 'builtin.particle' | 'math.add' | 'math.subtract' | 'math.multiply' | 'math.divide' | 'math.oneMinus' | 'math.abs' | 'math.sign' | 'math.floor' | 'math.ceil' | 'math.fract' | 'math.sin' | 'math.cos' | 'math.tan' | 'math.asin' | 'math.acos' | 'math.atan' | 'math.radians' | 'math.degrees' | 'math.sqrt' | 'math.inverseSqrt' | 'math.exp' | 'math.exp2' | 'math.log' | 'math.log2' | 'math.saturate' | 'math.length' | 'math.normalize' | 'math.clamp' | 'math.min' | 'math.max' | 'math.pow' | 'math.mod' | 'math.step' | 'math.smoothstep' | 'math.mix' | 'math.select' | 'layer.mixPainted' | 'math.dot' | 'math.distance' | 'math.cross' | 'compare.greaterThan' | 'compare.greaterThanOrEqual' | 'compare.lessThan' | 'compare.lessThanOrEqual' | 'compare.equal' | 'compare.notEqual' | 'boolean.not' | 'boolean.and' | 'boolean.or' | 'compose.vec2' | 'compose.vec3' | 'compose.rgba' | 'decompose.component' | 'decompose.split' | 'texture.sampler2d' | 'texture.sample2d' | 'texture.triplanarMapping' | 'scene.sampleColor' | 'scene.sampleDepth' | 'scene.fragmentDepth' | 'color.gradient' | 'transform.translate' | 'transform.scale' | 'transform.rotateAxis' | 'uv.rotate' | 'uv.twirl' | 'uv.radial' | 'uv.bulge' | 'shape.rectangle' | 'shape.roundedRectangle' | 'noise.simplex' | 'noise.voronoi2d' | 'effect.fresnel' | 'effect.edgeDepth' | 'effect.depthFade' | 'util.panner' | 'uv.flipbook' | 'math.remap' | 'color.hueShift' | 'color.blend' | 'color.blend' | 'color.desaturate' | 'builtin.viewDir' | 'uv.pom' | 'math.reflect' | 'math.refract' | 'math.derivative';
7
+ export type ShaderGraphNodeKind = 'input.parameter' | 'input.slider' | 'constant.boolean' | 'constant.float' | 'constant.vec2' | 'constant.vec3' | 'constant.rgba' | 'builtin.uv' | 'builtin.screenUv' | 'builtin.color' | 'builtin.position' | 'builtin.worldPosition' | 'builtin.normal' | 'builtin.time' | 'builtin.camera' | 'builtin.particle' | 'math.add' | 'math.subtract' | 'math.multiply' | 'math.divide' | 'math.oneMinus' | 'math.abs' | 'math.sign' | 'math.floor' | 'math.ceil' | 'math.fract' | 'math.sin' | 'math.cos' | 'math.tan' | 'math.asin' | 'math.acos' | 'math.atan' | 'math.radians' | 'math.degrees' | 'math.sqrt' | 'math.inverseSqrt' | 'math.exp' | 'math.exp2' | 'math.log' | 'math.log2' | 'math.saturate' | 'math.length' | 'math.normalize' | 'math.clamp' | 'math.min' | 'math.max' | 'math.pow' | 'math.mod' | 'math.step' | 'math.smoothstep' | 'math.mix' | 'math.select' | 'layer.mixPainted' | 'math.dot' | 'math.distance' | 'math.cross' | 'compare.greaterThan' | 'compare.greaterThanOrEqual' | 'compare.lessThan' | 'compare.lessThanOrEqual' | 'compare.equal' | 'compare.notEqual' | 'boolean.not' | 'boolean.and' | 'boolean.or' | 'compose.vec2' | 'compose.vec3' | 'compose.rgba' | 'decompose.component' | 'decompose.split' | 'texture.sampler2d' | 'texture.sample2d' | 'texture.triplanarMapping' | 'scene.sampleColor' | 'scene.sampleDepth' | 'scene.fragmentDepth' | 'color.gradient' | 'utility.curve' | 'transform.translate' | 'transform.scale' | 'transform.rotateAxis' | 'uv.rotate' | 'uv.twirl' | 'uv.radial' | 'uv.bulge' | 'shape.rectangle' | 'shape.roundedRectangle' | 'noise.simplex' | 'noise.voronoi2d' | 'effect.fresnel' | 'effect.edgeDepth' | 'effect.depthFade' | 'util.panner' | 'uv.flipbook' | 'math.remap' | 'color.hueShift' | 'color.blend' | 'color.blend' | 'color.desaturate' | 'builtin.viewDir' | 'uv.pom' | 'math.reflect' | 'math.refract' | 'math.derivative' | 'color.unpackNormal';
8
8
  export type ShaderGraphSerializableValue = null | boolean | number | string | ShaderGraphSerializableValue[] | {
9
9
  [key: string]: ShaderGraphSerializableValue;
10
10
  };
@@ -77,5 +77,6 @@ export type ShaderGraphMaterialReference = {
77
77
  graph: ShaderGraphDocument;
78
78
  };
79
79
  export declare function createDefaultShaderGraphDocument(target?: ShaderGraphTarget): ShaderGraphDocument;
80
+ export declare function createDefaultPostProcessShaderGraphDocument(): ShaderGraphDocument;
80
81
  export declare function createDefaultVfxShaderGraphDocument(target?: ShaderGraphTarget): ShaderGraphDocument;
81
82
  //# sourceMappingURL=model.d.ts.map
@@ -1,4 +1,4 @@
1
- export const ShaderGraphParameterTypes=["float","boolean","vec2","vec3","vec4","color","texture"];export function createDefaultShaderGraphDocument(e="surface"){return{version:1,target:e,shadingModel:"standard",parameters:[{id:"base-color",name:"baseColor",type:"color",defaultValue:"#ffffff"}],nodes:[{id:"base-color",kind:"input.parameter",label:"Parameter",params:{parameter:"baseColor"}}],edges:[],outputs:{color:{input:{nodeId:"base-color",port:"value"}}},layout:{nodes:{"base-color":{x:80,y:80}}}}}export function createDefaultVfxShaderGraphDocument(e="sprite"){return{version:1,target:e,shadingModel:"unlit",parameters:[{id:"base-color",name:"baseColor",type:"color",defaultValue:"#ffffff"}],nodes:[{id:"base-color",kind:"input.parameter",label:"Parameter",params:{parameter:"baseColor"}},{id:"particle",kind:"builtin.particle",label:"Particle"},{id:"particle-color",kind:"math.multiply",label:"Multiply"}],edges:[{id:"base-color-to-particle-color",from:{nodeId:"base-color",port:"value"},to:{nodeId:"particle-color",port:"a"}},{id:"particle-color-to-particle-color",from:{nodeId:"particle",port:"color"},to:{nodeId:"particle-color",port:"b"}}],outputs:{color:{input:{nodeId:"particle-color",port:"value"}},opacity:{input:{nodeId:"particle",port:"opacity"}}},layout:{nodes:{"base-color":{x:80,y:80},particle:{x:80,y:260},"particle-color":{x:340,y:160}},groups:[]}}}/*
1
+ export const ShaderGraphParameterTypes=["float","boolean","vec2","vec3","vec4","color","texture"];export function createDefaultShaderGraphDocument(e="surface"){return"postProcess"===e?createDefaultPostProcessShaderGraphDocument():{version:1,target:e,shadingModel:"standard",parameters:[{id:"base-color",name:"baseColor",type:"color",defaultValue:"#ffffff"}],nodes:[{id:"base-color",kind:"input.parameter",label:"Parameter",params:{parameter:"baseColor"}}],edges:[],outputs:{color:{input:{nodeId:"base-color",port:"value"}}},layout:{nodes:{"base-color":{x:80,y:80}}}}}export function createDefaultPostProcessShaderGraphDocument(){return{version:1,target:"postProcess",shadingModel:"unlit",parameters:[],nodes:[{id:"screen-uv",kind:"builtin.screenUv",label:"Screen UV"},{id:"scene-color",kind:"scene.sampleColor",label:"Sample Scene Color"}],edges:[{id:"screen-uv-to-scene-color",from:{nodeId:"screen-uv",port:"value"},to:{nodeId:"scene-color",port:"uv"}}],outputs:{color:{input:{nodeId:"scene-color",port:"rgba"}}},layout:{nodes:{"screen-uv":{x:80,y:80},"scene-color":{x:340,y:80}},groups:[]}}}export function createDefaultVfxShaderGraphDocument(e="sprite"){return{version:1,target:e,shadingModel:"unlit",parameters:[{id:"base-color",name:"baseColor",type:"color",defaultValue:"#ffffff"}],nodes:[{id:"base-color",kind:"input.parameter",label:"Parameter",params:{parameter:"baseColor"}},{id:"particle",kind:"builtin.particle",label:"Particle"},{id:"particle-color",kind:"math.multiply",label:"Multiply"}],edges:[{id:"base-color-to-particle-color",from:{nodeId:"base-color",port:"value"},to:{nodeId:"particle-color",port:"a"}},{id:"particle-color-to-particle-color",from:{nodeId:"particle",port:"color"},to:{nodeId:"particle-color",port:"b"}}],outputs:{color:{input:{nodeId:"particle-color",port:"value"}},opacity:{input:{nodeId:"particle",port:"opacity"}}},layout:{nodes:{"base-color":{x:80,y:80},particle:{x:80,y:260},"particle-color":{x:340,y:160}},groups:[]}}}/*
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 const SHADER_GRAPH_NODE_DEFINITIONS={"input.parameter":{kind:"input.parameter",label:"Parameter",category:"Inputs",inputs:[],outputs:[{name:"value",type:"dynamic"}]},"input.slider":{kind:"input.slider",label:"Slider",category:"Inputs",inputs:[],outputs:[{name:"value",type:"float"}]},"constant.boolean":{kind:"constant.boolean",label:"Boolean",category:"Inputs",inputs:[],outputs:[{name:"value",type:"boolean"}]},"constant.float":{kind:"constant.float",label:"Float",category:"Inputs",inputs:[],outputs:[{name:"value",type:"float"}]},"constant.vec2":{kind:"constant.vec2",label:"Vec2",category:"Inputs",inputs:[],outputs:[{name:"value",type:"vec2"}]},"constant.vec3":{kind:"constant.vec3",label:"Vec3",category:"Inputs",inputs:[],outputs:[{name:"value",type:"vec3"}]},"constant.rgba":{kind:"constant.rgba",label:"Color",category:"Inputs",inputs:[],outputs:[{name:"value",type:"rgba"}]},"builtin.uv":{kind:"builtin.uv",label:"UV",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec2"},{name:"u",type:"float"},{name:"v",type:"float"}]},"builtin.screenUv":{kind:"builtin.screenUv",label:"Screen UV",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec2"}]},"builtin.color":{kind:"builtin.color",label:"Color Attribute",category:"Attributes",inputs:[],outputs:[{name:"value",type:"rgba"},{name:"rgb",type:"rgb"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"}]},"builtin.position":{kind:"builtin.position",label:"Position Attribute",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]},"builtin.worldPosition":{kind:"builtin.worldPosition",label:"World Position",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]},"builtin.normal":{kind:"builtin.normal",label:"Normal Attribute",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]},"builtin.particle":{kind:"builtin.particle",label:"Particle",category:"Attributes",inputs:[],outputs:[{name:"energy",type:"float"},{name:"color",type:"rgb"},{name:"opacity",type:"float"},{name:"time",type:"float"}]},"builtin.time":{kind:"builtin.time",label:"Time",category:"Inputs",inputs:[],outputs:[{name:"value",type:"float"}]},"builtin.viewDir":{kind:"builtin.viewDir",label:"View Direction",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]},"builtin.camera":{kind:"builtin.camera",label:"Camera",category:"Inputs",inputs:[],outputs:[{name:"position",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"},{name:"near",type:"float"},{name:"far",type:"float"}]},"math.add":{kind:"math.add",label:"Add",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.subtract":{kind:"math.subtract",label:"Subtract",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.multiply":{kind:"math.multiply",label:"Multiply",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.divide":{kind:"math.divide",label:"Divide",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.oneMinus":{kind:"math.oneMinus",label:"One Minus",category:"Math",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.abs":e("math.abs","Abs","Math"),"math.sign":e("math.sign","Sign","Math"),"math.floor":e("math.floor","Floor","Math"),"math.ceil":e("math.ceil","Ceil","Math"),"math.fract":e("math.fract","Fract","Math"),"math.sin":e("math.sin","Sine","Trigonometry"),"math.cos":e("math.cos","Cosine","Trigonometry"),"math.tan":e("math.tan","Tangent","Trigonometry"),"math.asin":e("math.asin","Arc Sine","Trigonometry"),"math.acos":e("math.acos","Arc Cosine","Trigonometry"),"math.atan":e("math.atan","Arc Tangent","Trigonometry"),"math.radians":e("math.radians","Radians","Trigonometry"),"math.degrees":e("math.degrees","Degrees","Trigonometry"),"math.sqrt":e("math.sqrt","Square Root","Math"),"math.inverseSqrt":e("math.inverseSqrt","Inverse Square Root","Math"),"math.exp":e("math.exp","Exp","Math"),"math.exp2":e("math.exp2","Exp2","Math"),"math.log":e("math.log","Log","Math"),"math.log2":e("math.log2","Log2","Math"),"math.saturate":e("math.saturate","Saturate","Math"),"math.length":{kind:"math.length",label:"Length",category:"Vectors",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"float"}]},"math.normalize":e("math.normalize","Normalize","Vectors"),"math.clamp":{kind:"math.clamp",label:"Clamp",category:"Math",inputs:[{name:"value",type:"dynamic"},{name:"min",type:"dynamic",defaultValue:0},{name:"max",type:"dynamic",defaultValue:1}],outputs:[{name:"value",type:"dynamic"}]},"math.min":t("math.min","Min"),"math.max":t("math.max","Max"),"math.pow":t("math.pow","Power"),"math.mod":t("math.mod","Modulo"),"math.step":t("math.step","Step"),"math.smoothstep":{kind:"math.smoothstep",label:"Smoothstep",category:"Math",inputs:[{name:"edge0",type:"dynamic",defaultValue:0},{name:"edge1",type:"dynamic",defaultValue:1},{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.mix":{kind:"math.mix",label:"Mix",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"},{name:"t",type:"dynamic",defaultValue:.5}],outputs:[{name:"value",type:"dynamic"}]},"math.remap":{kind:"math.remap",label:"Remap",category:"Math",inputs:[{name:"value",type:"float"},{name:"inMin",type:"float",defaultValue:-1},{name:"inMax",type:"float",defaultValue:1},{name:"outMin",type:"float",defaultValue:0},{name:"outMax",type:"float",defaultValue:1}],outputs:[{name:"value",type:"float"}]},"math.reflect":{kind:"math.reflect",label:"Reflect",category:"Math",inputs:[{name:"incident",type:"dynamic"},{name:"normal",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.refract":{kind:"math.refract",label:"Refract",category:"Math",inputs:[{name:"incident",type:"dynamic"},{name:"normal",type:"dynamic"},{name:"ior",type:"float",defaultValue:1.5}],outputs:[{name:"value",type:"dynamic"}]},"math.derivative":{kind:"math.derivative",label:"Derivative",category:"Math",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.select":{kind:"math.select",label:"Select",category:"Math",inputs:[{name:"condition",type:"boolean"},{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"layer.mixPainted":{kind:"layer.mixPainted",label:"Mix Painted Layers",category:"Layers",inputs:[{name:"base",type:"dynamic"},...Array.from({length:8},(e,t)=>({name:`layer${t+1}`,label:`Layer ${t+1}`,type:"dynamic",optional:!0})),{name:"softness",type:"float",optional:!0},{name:"noiseScale",label:"Noise Scale",type:"float",optional:!0},{name:"noiseAmount",label:"Noise Amount",type:"float",optional:!0}],outputs:[{name:"value",type:"dynamic"}]},"math.dot":{kind:"math.dot",label:"Dot Product",category:"Vectors",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"float"}]},"math.distance":{kind:"math.distance",label:"Distance",category:"Vectors",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"float"}]},"math.cross":{kind:"math.cross",label:"Cross Product",category:"Vectors",inputs:[{name:"a",type:"vec3"},{name:"b",type:"vec3"}],outputs:[{name:"value",type:"vec3"}]},"compare.greaterThan":a("compare.greaterThan","Greater Than"),"compare.greaterThanOrEqual":a("compare.greaterThanOrEqual","Greater Than Or Equal"),"compare.lessThan":a("compare.lessThan","Less Than"),"compare.lessThanOrEqual":a("compare.lessThanOrEqual","Less Than Or Equal"),"compare.equal":a("compare.equal","Equal"),"compare.notEqual":a("compare.notEqual","Not Equal"),"boolean.not":{kind:"boolean.not",label:"Not",category:"Boolean",inputs:[{name:"value",type:"boolean"}],outputs:[{name:"value",type:"boolean"}]},"boolean.and":n("boolean.and","And"),"boolean.or":n("boolean.or","Or"),"compose.vec2":{kind:"compose.vec2",label:"Compose Vec2",category:"Vectors",inputs:[{name:"x",type:"float"},{name:"y",type:"float"}],outputs:[{name:"value",type:"vec2"}]},"compose.vec3":{kind:"compose.vec3",label:"Compose Vec3",category:"Vectors",inputs:[{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}],outputs:[{name:"value",type:"vec3"}]},"compose.rgba":{kind:"compose.rgba",label:"Compose RGBA",category:"Color",inputs:[{name:"r",type:"float",defaultValue:1},{name:"g",type:"float",defaultValue:1},{name:"b",type:"float",defaultValue:1},{name:"a",type:"float",defaultValue:1}],outputs:[{name:"value",type:"rgba"}]},"decompose.component":{kind:"decompose.component",label:"Component",category:"Vectors",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"float"}]},"decompose.split":{kind:"decompose.split",label:"Split Components",category:"Vectors",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"},{name:"w",type:"float"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"},{name:"u",type:"float"},{name:"v",type:"float"}]},"color.gradient":{kind:"color.gradient",label:"Gradient",category:"Color",inputs:[{name:"t",type:"float",defaultValue:.5}],outputs:[{name:"value",type:"rgba"}]},"color.hueShift":{kind:"color.hueShift",label:"Hue Shift",category:"Color",inputs:[{name:"color",type:"dynamic"},{name:"shift",type:"float"}],outputs:[{name:"value",type:"dynamic"}]},"color.blend":{kind:"color.blend",label:"Blend Colors",category:"Color",inputs:[{name:"base",type:"dynamic"},{name:"blend",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"color.desaturate":{kind:"color.desaturate",label:"Desaturate",category:"Color",inputs:[{name:"color",type:"dynamic"},{name:"fraction",type:"float",defaultValue:1}],outputs:[{name:"value",type:"dynamic"}]},"texture.sampler2d":{kind:"texture.sampler2d",label:"Sampler 2D",category:"Texture",inputs:[{name:"texture",type:"texture2d"}],outputs:[{name:"value",type:"sampler2d"}]},"texture.sample2d":{kind:"texture.sample2d",label:"Sample Texture 2D",category:"Textures",inputs:[{name:"sampler",type:"sampler2d"},{name:"uv",type:"vec2",inlineLiteral:!1}],outputs:[{name:"rgba",type:"rgba"},{name:"rgb",type:"rgb"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"}]},"texture.triplanarMapping":{kind:"texture.triplanarMapping",label:"Triplanar Mapping",category:"Textures",inputs:[{name:"sampler",type:"sampler2d"},{name:"scale",type:"float",defaultValue:1},{name:"normal",type:"vec3",inlineLiteral:!1},{name:"position",type:"vec3",inlineLiteral:!1}],outputs:[{name:"rgba",type:"rgba"},{name:"rgb",type:"rgb"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"}]},"scene.sampleColor":{kind:"scene.sampleColor",label:"Sample Scene Color",category:"Texture",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1}],outputs:[{name:"rgba",type:"rgba"},{name:"rgb",type:"rgb"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"}]},"scene.sampleDepth":{kind:"scene.sampleDepth",label:"Sample Scene Depth",category:"Texture",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1}],outputs:[{name:"depth",type:"float"},{name:"linearEyeDepth",type:"float"}]},"scene.fragmentDepth":{kind:"scene.fragmentDepth",label:"Fragment Depth",category:"Texture",inputs:[],outputs:[{name:"linearEyeDepth",type:"float"}]},"transform.translate":{kind:"transform.translate",label:"Translate",category:"Transform",inputs:[{name:"offset",type:"vec3",defaultValue:[0,0,0]}],outputs:[{name:"value",type:"mat4"}]},"transform.scale":{kind:"transform.scale",label:"Scale",category:"Transform",inputs:[{name:"scale",type:"vec3",defaultValue:[1,1,1]}],outputs:[{name:"value",type:"mat4"}]},"transform.rotateAxis":{kind:"transform.rotateAxis",label:"Rotate Axis",category:"Transform",inputs:[{name:"axis",type:"vec3",defaultValue:[0,1,0]},{name:"angle",type:"float",defaultValue:0}],outputs:[{name:"value",type:"mat4"}]},"uv.rotate":{kind:"uv.rotate",label:"Rotate UV",category:"UV",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"angle",type:"float",defaultValue:0},{name:"center",type:"vec2",optional:!0,defaultValue:[.5,.5]}],outputs:[{name:"value",type:"vec2"}]},"uv.twirl":{kind:"uv.twirl",label:"Twirl UV",category:"UV",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"strength",type:"float",defaultValue:1},{name:"center",type:"vec2",optional:!0,defaultValue:[.5,.5]},{name:"offset",type:"vec2",optional:!0,defaultValue:[0,0]}],outputs:[{name:"value",type:"vec2"}]},"uv.radial":{kind:"uv.radial",label:"Radial UV",category:"UV",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1}],outputs:[{name:"coords",type:"vec2"},{name:"radius",type:"float"},{name:"angle",type:"float"}]},"uv.bulge":{kind:"uv.bulge",label:"Bulge UV",category:"UV",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"center",type:"vec2",optional:!0,defaultValue:[.5,.5]},{name:"power",type:"float",optional:!0,defaultValue:1}],outputs:[{name:"value",type:"vec2"}]},"uv.flipbook":{kind:"uv.flipbook",label:"Flipbook UV",category:"UV",inputs:[{name:"uv",type:"vec2",optional:!0,inlineLiteral:!1},{name:"columns",type:"float",optional:!0,defaultValue:1},{name:"rows",type:"float",optional:!0,defaultValue:1},{name:"fps",type:"float",optional:!0,defaultValue:60},{name:"time",type:"float",optional:!0,inlineLiteral:!1}],outputs:[{name:"value",type:"vec2"}]},"uv.pom":{kind:"uv.pom",label:"Parallax Occlusion",category:"UV",inputs:[{name:"uv",type:"vec2",optional:!0,inlineLiteral:!1},{name:"heightMap",type:"sampler2d"},{name:"heightScale",type:"float",optional:!0,defaultValue:.05}],outputs:[{name:"value",type:"vec2"}]},"shape.rectangle":{kind:"shape.rectangle",label:"Rectangle",category:"Shapes",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"width",type:"float",defaultValue:.5},{name:"height",type:"float",defaultValue:.5}],outputs:[{name:"value",type:"float"}]},"shape.roundedRectangle":{kind:"shape.roundedRectangle",label:"Rounded Rectangle",category:"Shapes",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"width",type:"float",defaultValue:.5},{name:"height",type:"float",defaultValue:.5},{name:"radius",type:"float",defaultValue:.1}],outputs:[{name:"value",type:"float"}]},"noise.simplex":{kind:"noise.simplex",label:"Simplex Noise",category:"Noise",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"scale",type:"float",optional:!0,defaultValue:8}],outputs:[{name:"value",type:"float"}]},"noise.voronoi2d":{kind:"noise.voronoi2d",label:"Voronoi",category:"Noise",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"scale",type:"float",optional:!0,defaultValue:8}],outputs:[{name:"value",type:"float"}]},"effect.fresnel":{kind:"effect.fresnel",label:"Fresnel",category:"Effects",inputs:[{name:"power",type:"float",optional:!0,defaultValue:1}],outputs:[{name:"value",type:"float"}]},"effect.edgeDepth":{kind:"effect.edgeDepth",label:"Edge Depth",category:"Effects",inputs:[{name:"power",type:"float",optional:!0,defaultValue:1}],outputs:[{name:"value",type:"float"}]},"effect.depthFade":{kind:"effect.depthFade",label:"Depth Fade",category:"Effects",inputs:[{name:"distance",type:"float",optional:!0,defaultValue:1}],outputs:[{name:"value",type:"float"}]},"util.panner":{kind:"util.panner",label:"Panner",category:"Utilities",inputs:[{name:"coord",type:"vec2",inlineLiteral:!1},{name:"speed",type:"vec2",defaultValue:[0,0]},{name:"tile",type:"vec2",defaultValue:[1,1]},{name:"time",type:"float",optional:!0,inlineLiteral:!1}],outputs:[{name:"value",type:"vec2"}]}};export const SHADER_GRAPH_NODE_KINDS=Object.keys(SHADER_GRAPH_NODE_DEFINITIONS);function e(e,t,a){return{kind:e,label:t,category:a,inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]}}function t(e,t){return{kind:e,label:t,category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]}}function a(e,t){return{kind:e,label:t,category:"Comparison",inputs:[{name:"a",type:"float"},{name:"b",type:"float"}],outputs:[{name:"value",type:"boolean"}]}}function n(e,t){return{kind:e,label:t,category:"Boolean",inputs:[{name:"a",type:"boolean"},{name:"b",type:"boolean"}],outputs:[{name:"value",type:"boolean"}]}}export function inlineLiteralTypeForPort(e,t){if(!1!==t.inlineLiteral)return"float"===t.type||"vec2"===t.type||"vec3"===t.type||"vec4"===t.type?t.type:"dynamic"===t.type&&function(e){return e.startsWith("math.")&&"math.reflect"!==e&&"math.refract"!==e}(e)?"float":void 0}export function defaultInlineLiteralValueForPort(e,t){const a=inlineLiteralTypeForPort(e,t);if(null!=a){if(void 0!==t.defaultValue)return l(t.defaultValue);if("math.multiply"===e)return 1;switch(a){case"float":return 0;case"vec2":return[0,0];case"vec3":return[0,0,0];case"vec4":return[0,0,0,1]}}}function l(e){return Array.isArray(e)?e.map(e=>l(e)):null!=e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,l(t)])):e}/*
1
+ export const SHADER_GRAPH_NODE_DEFINITIONS={"input.parameter":{kind:"input.parameter",label:"Parameter",category:"Inputs",inputs:[],outputs:[{name:"value",type:"dynamic"}]},"input.slider":{kind:"input.slider",label:"Slider",category:"Inputs",inputs:[],outputs:[{name:"value",type:"float"}]},"constant.boolean":{kind:"constant.boolean",label:"Boolean",category:"Inputs",inputs:[],outputs:[{name:"value",type:"boolean"}]},"constant.float":{kind:"constant.float",label:"Float",category:"Inputs",inputs:[],outputs:[{name:"value",type:"float"}]},"constant.vec2":{kind:"constant.vec2",label:"Vec2",category:"Inputs",inputs:[],outputs:[{name:"value",type:"vec2"}]},"constant.vec3":{kind:"constant.vec3",label:"Vec3",category:"Inputs",inputs:[],outputs:[{name:"value",type:"vec3"}]},"constant.rgba":{kind:"constant.rgba",label:"Color",category:"Inputs",inputs:[],outputs:[{name:"value",type:"rgba"}]},"builtin.uv":{kind:"builtin.uv",label:"UV",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec2"},{name:"u",type:"float"},{name:"v",type:"float"}]},"builtin.screenUv":{kind:"builtin.screenUv",label:"Screen UV",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec2"}]},"builtin.color":{kind:"builtin.color",label:"Color Attribute",category:"Attributes",inputs:[],outputs:[{name:"value",type:"rgba"},{name:"rgb",type:"rgb"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"}]},"builtin.position":{kind:"builtin.position",label:"Position Attribute",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]},"builtin.worldPosition":{kind:"builtin.worldPosition",label:"World Position",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]},"builtin.normal":{kind:"builtin.normal",label:"Normal Attribute",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]},"builtin.particle":{kind:"builtin.particle",label:"Particle",category:"Attributes",inputs:[],outputs:[{name:"energy",type:"float"},{name:"color",type:"rgb"},{name:"opacity",type:"float"},{name:"time",type:"float"}]},"builtin.time":{kind:"builtin.time",label:"Time",category:"Inputs",inputs:[],outputs:[{name:"value",type:"float"}]},"builtin.viewDir":{kind:"builtin.viewDir",label:"View Direction",category:"Attributes",inputs:[],outputs:[{name:"value",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]},"builtin.camera":{kind:"builtin.camera",label:"Camera",category:"Inputs",inputs:[],outputs:[{name:"position",type:"vec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"},{name:"near",type:"float"},{name:"far",type:"float"}]},"math.add":{kind:"math.add",label:"Add",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.subtract":{kind:"math.subtract",label:"Subtract",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.multiply":{kind:"math.multiply",label:"Multiply",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.divide":{kind:"math.divide",label:"Divide",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.oneMinus":{kind:"math.oneMinus",label:"One Minus",category:"Math",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.abs":e("math.abs","Abs","Math"),"math.sign":e("math.sign","Sign","Math"),"math.floor":e("math.floor","Floor","Math"),"math.ceil":e("math.ceil","Ceil","Math"),"math.fract":e("math.fract","Fract","Math"),"math.sin":e("math.sin","Sine","Trigonometry"),"math.cos":e("math.cos","Cosine","Trigonometry"),"math.tan":e("math.tan","Tangent","Trigonometry"),"math.asin":e("math.asin","Arc Sine","Trigonometry"),"math.acos":e("math.acos","Arc Cosine","Trigonometry"),"math.atan":e("math.atan","Arc Tangent","Trigonometry"),"math.radians":e("math.radians","Radians","Trigonometry"),"math.degrees":e("math.degrees","Degrees","Trigonometry"),"math.sqrt":e("math.sqrt","Square Root","Math"),"math.inverseSqrt":e("math.inverseSqrt","Inverse Square Root","Math"),"math.exp":e("math.exp","Exp","Math"),"math.exp2":e("math.exp2","Exp2","Math"),"math.log":e("math.log","Log","Math"),"math.log2":e("math.log2","Log2","Math"),"math.saturate":e("math.saturate","Saturate","Math"),"math.length":{kind:"math.length",label:"Length",category:"Vectors",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"float"}]},"math.normalize":e("math.normalize","Normalize","Vectors"),"math.clamp":{kind:"math.clamp",label:"Clamp",category:"Math",inputs:[{name:"value",type:"dynamic"},{name:"min",type:"dynamic",defaultValue:0},{name:"max",type:"dynamic",defaultValue:1}],outputs:[{name:"value",type:"dynamic"}]},"math.min":t("math.min","Min"),"math.max":t("math.max","Max"),"math.pow":t("math.pow","Power"),"math.mod":t("math.mod","Modulo"),"math.step":t("math.step","Step"),"math.smoothstep":{kind:"math.smoothstep",label:"Smoothstep",category:"Math",inputs:[{name:"edge0",type:"dynamic",defaultValue:0},{name:"edge1",type:"dynamic",defaultValue:1},{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.mix":{kind:"math.mix",label:"Mix",category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"},{name:"t",type:"dynamic",defaultValue:.5}],outputs:[{name:"value",type:"dynamic"}]},"math.remap":{kind:"math.remap",label:"Remap",category:"Math",inputs:[{name:"value",type:"float"},{name:"inMin",type:"float",defaultValue:-1},{name:"inMax",type:"float",defaultValue:1},{name:"outMin",type:"float",defaultValue:0},{name:"outMax",type:"float",defaultValue:1}],outputs:[{name:"value",type:"float"}]},"math.reflect":{kind:"math.reflect",label:"Reflect",category:"Math",inputs:[{name:"incident",type:"dynamic"},{name:"normal",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.refract":{kind:"math.refract",label:"Refract",category:"Math",inputs:[{name:"incident",type:"dynamic"},{name:"normal",type:"dynamic"},{name:"ior",type:"float",defaultValue:1.5}],outputs:[{name:"value",type:"dynamic"}]},"math.derivative":{kind:"math.derivative",label:"Derivative",category:"Math",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"math.select":{kind:"math.select",label:"Select",category:"Math",inputs:[{name:"condition",type:"boolean"},{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"layer.mixPainted":{kind:"layer.mixPainted",label:"Mix Painted Layers",category:"Layers",inputs:[{name:"base",type:"dynamic"},...Array.from({length:8},(e,t)=>({name:`layer${t+1}`,label:`Layer ${t+1}`,type:"dynamic",optional:!0})),{name:"softness",type:"float",optional:!0},{name:"noiseScale",label:"Noise Scale",type:"float",optional:!0},{name:"noiseAmount",label:"Noise Amount",type:"float",optional:!0}],outputs:[{name:"value",type:"dynamic"}]},"math.dot":{kind:"math.dot",label:"Dot Product",category:"Vectors",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"float"}]},"math.distance":{kind:"math.distance",label:"Distance",category:"Vectors",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"float"}]},"math.cross":{kind:"math.cross",label:"Cross Product",category:"Vectors",inputs:[{name:"a",type:"vec3"},{name:"b",type:"vec3"}],outputs:[{name:"value",type:"vec3"}]},"compare.greaterThan":a("compare.greaterThan","Greater Than"),"compare.greaterThanOrEqual":a("compare.greaterThanOrEqual","Greater Than Or Equal"),"compare.lessThan":a("compare.lessThan","Less Than"),"compare.lessThanOrEqual":a("compare.lessThanOrEqual","Less Than Or Equal"),"compare.equal":a("compare.equal","Equal"),"compare.notEqual":a("compare.notEqual","Not Equal"),"boolean.not":{kind:"boolean.not",label:"Not",category:"Boolean",inputs:[{name:"value",type:"boolean"}],outputs:[{name:"value",type:"boolean"}]},"boolean.and":n("boolean.and","And"),"boolean.or":n("boolean.or","Or"),"compose.vec2":{kind:"compose.vec2",label:"Compose Vec2",category:"Vectors",inputs:[{name:"x",type:"float"},{name:"y",type:"float"}],outputs:[{name:"value",type:"vec2"}]},"compose.vec3":{kind:"compose.vec3",label:"Compose Vec3",category:"Vectors",inputs:[{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}],outputs:[{name:"value",type:"vec3"}]},"compose.rgba":{kind:"compose.rgba",label:"Compose RGBA",category:"Color",inputs:[{name:"r",type:"float",defaultValue:1},{name:"g",type:"float",defaultValue:1},{name:"b",type:"float",defaultValue:1},{name:"a",type:"float",defaultValue:1}],outputs:[{name:"value",type:"rgba"}]},"decompose.component":{kind:"decompose.component",label:"Component",category:"Vectors",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"float"}]},"decompose.split":{kind:"decompose.split",label:"Split Components",category:"Vectors",inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"},{name:"w",type:"float"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"},{name:"u",type:"float"},{name:"v",type:"float"}]},"color.gradient":{kind:"color.gradient",label:"Gradient",category:"Color",inputs:[{name:"t",type:"float",defaultValue:.5}],outputs:[{name:"value",type:"rgba"}]},"utility.curve":{kind:"utility.curve",label:"Curve",category:"Utilities",inputs:[{name:"t",type:"float",defaultValue:.5}],outputs:[{name:"value",type:"float"}]},"color.hueShift":{kind:"color.hueShift",label:"Hue Shift",category:"Color",inputs:[{name:"color",type:"dynamic"},{name:"shift",type:"float"}],outputs:[{name:"value",type:"dynamic"}]},"color.blend":{kind:"color.blend",label:"Blend Colors",category:"Color",inputs:[{name:"base",type:"dynamic"},{name:"blend",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]},"color.desaturate":{kind:"color.desaturate",label:"Desaturate",category:"Color",inputs:[{name:"color",type:"dynamic"},{name:"fraction",type:"float",defaultValue:1}],outputs:[{name:"value",type:"dynamic"}]},"color.unpackNormal":{kind:"color.unpackNormal",label:"Unpack Normal",category:"Textures",inputs:[{name:"color",type:"dynamic"},{name:"scale",type:"float",defaultValue:1},{name:"normal",type:"vec3",optional:!0,inlineLiteral:!1}],outputs:[{name:"value",type:"vec3"}]},"texture.sampler2d":{kind:"texture.sampler2d",label:"Sampler 2D",category:"Texture",inputs:[{name:"texture",type:"texture2d"}],outputs:[{name:"value",type:"sampler2d"}]},"texture.sample2d":{kind:"texture.sample2d",label:"Sample Texture 2D",category:"Textures",inputs:[{name:"sampler",type:"sampler2d"},{name:"uv",type:"vec2",inlineLiteral:!1}],outputs:[{name:"rgba",type:"rgba"},{name:"rgb",type:"rgb"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"}]},"texture.triplanarMapping":{kind:"texture.triplanarMapping",label:"Triplanar Mapping",category:"Textures",inputs:[{name:"sampler",type:"sampler2d"},{name:"scale",type:"float",defaultValue:1},{name:"normal",type:"vec3",inlineLiteral:!1},{name:"position",type:"vec3",inlineLiteral:!1}],outputs:[{name:"rgba",type:"rgba"},{name:"rgb",type:"rgb"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"}]},"scene.sampleColor":{kind:"scene.sampleColor",label:"Sample Scene Color",category:"Texture",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1}],outputs:[{name:"rgba",type:"rgba"},{name:"rgb",type:"rgb"},{name:"r",type:"float"},{name:"g",type:"float"},{name:"b",type:"float"},{name:"a",type:"float"}]},"scene.sampleDepth":{kind:"scene.sampleDepth",label:"Sample Scene Depth",category:"Texture",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1}],outputs:[{name:"depth",type:"float"},{name:"linearEyeDepth",type:"float"}]},"scene.fragmentDepth":{kind:"scene.fragmentDepth",label:"Fragment Depth",category:"Texture",inputs:[],outputs:[{name:"linearEyeDepth",type:"float"}]},"transform.translate":{kind:"transform.translate",label:"Translate",category:"Transform",inputs:[{name:"offset",type:"vec3",defaultValue:[0,0,0]}],outputs:[{name:"value",type:"mat4"}]},"transform.scale":{kind:"transform.scale",label:"Scale",category:"Transform",inputs:[{name:"scale",type:"vec3",defaultValue:[1,1,1]}],outputs:[{name:"value",type:"mat4"}]},"transform.rotateAxis":{kind:"transform.rotateAxis",label:"Rotate Axis",category:"Transform",inputs:[{name:"axis",type:"vec3",defaultValue:[0,1,0]},{name:"angle",type:"float",defaultValue:0}],outputs:[{name:"value",type:"mat4"}]},"uv.rotate":{kind:"uv.rotate",label:"Rotate UV",category:"UV",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"angle",type:"float",defaultValue:0},{name:"center",type:"vec2",optional:!0,defaultValue:[.5,.5]}],outputs:[{name:"value",type:"vec2"}]},"uv.twirl":{kind:"uv.twirl",label:"Twirl UV",category:"UV",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"strength",type:"float",defaultValue:1},{name:"center",type:"vec2",optional:!0,defaultValue:[.5,.5]},{name:"offset",type:"vec2",optional:!0,defaultValue:[0,0]}],outputs:[{name:"value",type:"vec2"}]},"uv.radial":{kind:"uv.radial",label:"Radial UV",category:"UV",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1}],outputs:[{name:"coords",type:"vec2"},{name:"radius",type:"float"},{name:"angle",type:"float"}]},"uv.bulge":{kind:"uv.bulge",label:"Bulge UV",category:"UV",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"center",type:"vec2",optional:!0,defaultValue:[.5,.5]},{name:"power",type:"float",optional:!0,defaultValue:1}],outputs:[{name:"value",type:"vec2"}]},"uv.flipbook":{kind:"uv.flipbook",label:"Flipbook UV",category:"UV",inputs:[{name:"uv",type:"vec2",optional:!0,inlineLiteral:!1},{name:"columns",type:"float",optional:!0,defaultValue:1},{name:"rows",type:"float",optional:!0,defaultValue:1},{name:"fps",type:"float",optional:!0,defaultValue:60},{name:"time",type:"float",optional:!0,inlineLiteral:!1}],outputs:[{name:"value",type:"vec2"}]},"uv.pom":{kind:"uv.pom",label:"Parallax Occlusion",category:"UV",inputs:[{name:"uv",type:"vec2",optional:!0,inlineLiteral:!1},{name:"heightMap",type:"sampler2d"},{name:"heightScale",type:"float",optional:!0,defaultValue:.05}],outputs:[{name:"value",type:"vec2"}]},"shape.rectangle":{kind:"shape.rectangle",label:"Rectangle",category:"Shapes",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"width",type:"float",defaultValue:.5},{name:"height",type:"float",defaultValue:.5}],outputs:[{name:"value",type:"float"}]},"shape.roundedRectangle":{kind:"shape.roundedRectangle",label:"Rounded Rectangle",category:"Shapes",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"width",type:"float",defaultValue:.5},{name:"height",type:"float",defaultValue:.5},{name:"radius",type:"float",defaultValue:.1}],outputs:[{name:"value",type:"float"}]},"noise.simplex":{kind:"noise.simplex",label:"Simplex Noise",category:"Noise",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"scale",type:"float",optional:!0,defaultValue:8}],outputs:[{name:"value",type:"float"}]},"noise.voronoi2d":{kind:"noise.voronoi2d",label:"Voronoi",category:"Noise",inputs:[{name:"uv",type:"vec2",inlineLiteral:!1},{name:"scale",type:"float",optional:!0,defaultValue:8}],outputs:[{name:"value",type:"float"}]},"effect.fresnel":{kind:"effect.fresnel",label:"Fresnel",category:"Effects",inputs:[{name:"power",type:"float",optional:!0,defaultValue:1}],outputs:[{name:"value",type:"float"}]},"effect.edgeDepth":{kind:"effect.edgeDepth",label:"Edge Depth",category:"Effects",inputs:[{name:"power",type:"float",optional:!0,defaultValue:1}],outputs:[{name:"value",type:"float"}]},"effect.depthFade":{kind:"effect.depthFade",label:"Depth Fade",category:"Effects",inputs:[{name:"distance",type:"float",optional:!0,defaultValue:1}],outputs:[{name:"value",type:"float"}]},"util.panner":{kind:"util.panner",label:"Panner",category:"Utilities",inputs:[{name:"coord",type:"vec2",inlineLiteral:!1},{name:"speed",type:"vec2",defaultValue:[0,0]},{name:"tile",type:"vec2",defaultValue:[1,1]},{name:"time",type:"float",optional:!0,inlineLiteral:!1}],outputs:[{name:"value",type:"vec2"}]}};export const SHADER_GRAPH_NODE_KINDS=Object.keys(SHADER_GRAPH_NODE_DEFINITIONS);function e(e,t,a){return{kind:e,label:t,category:a,inputs:[{name:"value",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]}}function t(e,t){return{kind:e,label:t,category:"Math",inputs:[{name:"a",type:"dynamic"},{name:"b",type:"dynamic"}],outputs:[{name:"value",type:"dynamic"}]}}function a(e,t){return{kind:e,label:t,category:"Comparison",inputs:[{name:"a",type:"float"},{name:"b",type:"float"}],outputs:[{name:"value",type:"boolean"}]}}function n(e,t){return{kind:e,label:t,category:"Boolean",inputs:[{name:"a",type:"boolean"},{name:"b",type:"boolean"}],outputs:[{name:"value",type:"boolean"}]}}export function inlineLiteralTypeForPort(e,t){if(!1!==t.inlineLiteral)return"float"===t.type||"vec2"===t.type||"vec3"===t.type||"vec4"===t.type?t.type:"dynamic"===t.type&&function(e){return e.startsWith("math.")&&"math.reflect"!==e&&"math.refract"!==e}(e)?"float":void 0}export function defaultInlineLiteralValueForPort(e,t){const a=inlineLiteralTypeForPort(e,t);if(null!=a){if(void 0!==t.defaultValue)return l(t.defaultValue);if("math.multiply"===e)return 1;switch(a){case"float":return 0;case"vec2":return[0,0];case"vec3":return[0,0,0];case"vec4":return[0,0,0,1]}}}function l(e){return Array.isArray(e)?e.map(e=>l(e)):null!=e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,l(t)])):e}/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -60,6 +60,7 @@ export interface PropertyParameter {
60
60
  type: ParameterType;
61
61
  options: ParameterOptions;
62
62
  }
63
+ export declare function shaderParameterUniformName(parameterName: string): string;
63
64
  export declare function Parameter(options?: ParameterOptions): (target: Object, propertyName: string | symbol, index?: unknown) => void;
64
65
  export declare function ParameterCategory(name: string): void;
65
66
  //# sourceMappingURL=parameter.d.ts.map
@@ -1,4 +1,4 @@
1
- import"reflect-metadata";import{reflect as t,decorateProperty as e}from"@plumier/reflect";import{ArrayMap as r}from"../utils/collections.js";Symbol("format");class o{constructor(t){this.options=t,this.isParameterDecorator=!0}}new Map;const a=new r;export function Parameter(t){return function(r,n,c){if(null!=r){a.push(r.constructor,{name:n,options:t??{}});try{e(new o(t))(r,n,c)}catch(t){console.warn("Failed to decorate method ",r,n,c)}}}}export function extractShaderParameters(t){if(null==t)return[];const e=a.get(t).map(({name:e,options:r})=>{const o=Reflect.getMetadata("design:type",t.prototype,e),a=r.type??o,n=Reflect.getMetadata("prefab:type",t.prototype,e);return r.prefabOf??(r.prefabOf=n),r.array=o===Array,{name:e,type:a,options:r}});return[...extractShaderParameters(Object.getPrototypeOf(t)).filter(t=>e.every(e=>e.name!==t.name)),...e]}export function ParameterCategory(t){}/*
1
+ import"reflect-metadata";import{reflect as t,decorateProperty as e}from"@plumier/reflect";import{ArrayMap as r}from"../utils/collections.js";Symbol("format");export function shaderParameterUniformName(t){return`pu_${t}`}class a{constructor(t){this.options=t,this.isParameterDecorator=!0}}new Map;const o=new r;export function Parameter(t){return function(r,n,p){if(null!=r){o.push(r.constructor,{name:n,options:t??{}});try{e(new a(t))(r,n,p)}catch(t){console.warn("Failed to decorate method ",r,n,p)}}}}export function extractShaderParameters(t){if(null==t)return[];const e=o.get(t).map(({name:e,options:r})=>{const a=Reflect.getMetadata("design:type",t.prototype,e),o=r.type??a,n=Reflect.getMetadata("prefab:type",t.prototype,e);return r.prefabOf??(r.prefabOf=n),r.array=a===Array,{name:e,type:o,options:r}});return[...extractShaderParameters(Object.getPrototypeOf(t)).filter(t=>e.every(e=>e.name!==t.name)),...e]}export function ParameterCategory(t){}/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -1,6 +1,7 @@
1
1
  import { FloatNode, Sampler2DNode } from "three-shader-graph";
2
2
  import { Curve2 } from "../utils/curve";
3
3
  export declare function sampleCurve(curve: Curve2, t: FloatNode): FloatNode;
4
+ export declare function sampleNamedEasingCurve(name: unknown, t: FloatNode): FloatNode | undefined;
4
5
  export declare function curveSampler(curve: Curve2, resolution?: number): CurveSampler;
5
6
  export declare class CurveSampler {
6
7
  private sampler;
@@ -1,4 +1,4 @@
1
- import{DataTexture as e,LinearFilter as r,RedFormat as t,UnsignedByteType as n}from"three";import{textureSampler2d as p,vec2 as a}from"three-shader-graph";export function sampleCurve(e,r){return curveSampler(e).sample(r)}export function curveSampler(a,m=64){const o=new Uint8Array(m);for(let e=0;e<m;e++){const r=e/m;o[e]=255*a.getY(r)}const s=new e(o,m,1);s.format=t,s.type=n,s.minFilter=s.magFilter=r,s.needsUpdate=!0;const l=p(s);return new CurveSampler(l)}export class CurveSampler{constructor(e){this.sampler=e}sample(e){return this.sampler.sample(a(e,0)).r}}/*
1
+ import{ClampToEdgeWrapping as t,DataTexture as u,LinearFilter as r,RedFormat as l,UnsignedByteType as a}from"three";import{cos as e,exp as s,float as c,max as n,pow as i,select as p,sin as m,sqrt as y,textureSampler2d as b,vec2 as o}from"three-shader-graph";export function sampleCurve(t,u){return curveSampler(t).sample(u)}export function sampleNamedEasingCurve(t,u){switch(function(t){if("string"!=typeof t)return;return t.startsWith("ease")?t.substring(4):t}(t)){case"Linear":return u;case"InQuad":return d(u);case"OutQuad":return c(1).subtract(d(u.subtract(1)));case"InOutQuad":return p(u.lt(.5),u.multiply(u).multiply(2),c(1).subtract(d(u.multiply(2).subtract(2)).multiply(.5)));case"InCubic":return i(u,c(3));case"OutCubic":return i(u.subtract(1),c(3)).add(1);case"InOutCubic":return p(u.lt(.5),i(u.multiply(2),c(3)).multiply(.5),i(u.multiply(2).subtract(2),c(3)).add(2).multiply(.5));case"InQuart":return i(u,c(4));case"OutQuart":return c(1).subtract(i(u.subtract(1),c(4)));case"InOutQuart":return p(u.lt(.5),i(u.multiply(2),c(4)).multiply(.5),c(1).subtract(i(u.multiply(2).subtract(2),c(4)).multiply(.5)));case"InSine":return c(1).subtract(e(u.multiply(Math.PI/2)));case"OutSine":return m(u.multiply(Math.PI/2));case"InOutSine":return c(.5).multiply(c(1).subtract(e(u.multiply(Math.PI))));case"InExpo":return p(u.equals(0),c(0),i(c(2),u.subtract(1).multiply(10)));case"OutExpo":return p(u.equals(1),c(1),c(1).subtract(i(c(2),u.multiply(-10))));case"InOutExpo":return p(u.equals(0),c(0),p(u.equals(1),c(1),p(u.lt(.5),i(c(2),u.multiply(2).subtract(1).multiply(10)).multiply(.5),c(2).subtract(i(c(2),u.multiply(2).subtract(1).multiply(-10))).multiply(.5))));case"InCirc":return c(1).subtract(y(c(1).subtract(u.multiply(u))));case"OutCirc":return y(c(1).subtract(d(u.subtract(1))));case"InOutCirc":return p(u.lt(.5),c(1).subtract(y(c(1).subtract(d(u.multiply(2))))).multiply(.5),y(c(1).subtract(d(u.multiply(2).subtract(2)))).add(1).multiply(.5));case"InBack":return function(t){const u=1.70158;return t.multiply(t).multiply(t.multiply(u+1).subtract(u))}(u);case"OutBack":return function(t){const u=1.70158,r=t.subtract(1);return r.multiply(r).multiply(r.multiply(u+1).add(u)).add(1)}(u);case"InOutBack":return p(u.lt(.5),function(t){const u=2.5949095,r=t.multiply(2);return r.multiply(r).multiply(r.multiply(u+1).subtract(u)).multiply(.5)}(u),function(t){const u=2.5949095,r=t.multiply(2).subtract(2);return r.multiply(r).multiply(r.multiply(u+1).add(u)).add(2).multiply(.5)}(u));case"Bump":return m(u.multiply(Math.PI));case"BumpSharp":return i(m(u.multiply(Math.PI)),c(2));case"BumpFlat":return n(c(0),c(1).subtract(i(u.multiply(2).subtract(1),c(4))));case"BumpFade":return p(u.lt(.5),i(u.multiply(2),c(3)),i(c(2).multiply(c(1).subtract(u)),c(.5)));case"BumpFall":return p(u.lt(.5),i(u.multiply(2),c(1.5)),i(c(2).multiply(c(1).subtract(u)),c(6)));case"SpikeFade":return s(c(-20).multiply(d(u.subtract(.2)))).multiply(c(1).subtract(u))}}export function curveSampler(e,s=64){const c=Math.max(2,Math.floor(s)),n=new Uint8Array(c);for(let t=0;t<c;t++){const u=t/(c-1);n[t]=255*e.getY(u)}const i=new u(n,c,1);i.format=l,i.type=a,i.minFilter=i.magFilter=r,i.wrapS=t,i.wrapT=t,i.generateMipmaps=!1,i.needsUpdate=!0;const p=b(i);return new CurveSampler(p)}export class CurveSampler{constructor(t){this.sampler=t}sample(t){return this.sampler.sample(o(t,0)).r}}function d(t){return t.multiply(t)}/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sequence-asset-refresh.test.d.ts.map
@@ -0,0 +1,4 @@
1
+ import{describe as e,expect as s,it as t,vi as a}from"vitest";import*as r from"three";import{createSequenceData as n,createSpawnClipInstance as i,createSpawnTrack as o,createVfxClipInstance as c,createVfxTrack as d}from"../effects/sequence/sequence-data.js";import{createDefaultShaderGraphDocument as p}from"../shader/graph/index.js";function f(e){return{clearCacheById:a.fn(),getAsset:a.fn(s=>Promise.resolve(e.get(s)??null))}}function l(e){return{id:e,name:e,type:"shaderGraph",shaderGraph:p()}}a.mock("../gameplay/actors/builtin/index.js",()=>({builtInActors:{},default:{}})),a.mock("../gameplay/actors/index.js",()=>({CharacterAnimationComponent:class{},CharacterMovementComponent:class{}})),a.mock("../effects/vfx/vfx-actor.js",()=>({VfxActor:class{}})),a.mock("../effects/vfx/vfx-param.js",()=>({VisualEffect:class{}})),a.hoisted(()=>{if("undefined"==typeof HTMLCanvasElement)return;const e=new Proxy({},{get:(e,s)=>(s in e||(e[s]=("string"!=typeof s||!s.startsWith("is"))&&a.fn()),e[s]),set:(e,s,t)=>(e[s]=t,!0)});Object.defineProperty(HTMLCanvasElement.prototype,"getContext",{configurable:!0,value:()=>e})}),e("sequence asset refresh",()=>{t("refreshes active VFX clips when their VFX asset uses a changed shader graph",async()=>{const{SequencePlayer:e}=await import("../effects/sequence/sequence-player.js"),t=l("graph-asset"),i=(o="vfx-asset",p=t.id,{id:o,name:o,type:"vfx",vfx:{emitters:[{id:"emitter",name:"Emitter",rate:{type:"once",count:1,delay:0},position:[0,0,0],rotation:[0,0,0],initializers:[],behaviours:[],output:{type:"sprite",space:"local",texture:"",color:"#ffffff",intensity:1,blendingMode:"normal",softness:0,bloom:!1,materialSource:"shaderGraph",shaderGraph:{source:"asset",assetId:p},shaderGraphParams:{}}}]}});var o,p;const h=new Map([t,i].map(e=>[e.id,e])),m=a.fn(),u=a.fn(),v=new e;v.setWorld({scene:new r.Scene,removeActor:u}),v.setVfxService({clearPool:m}),v.setAssetLoader(f(h));const y=n(),w=d(),x=c(i.id,0,1);w.clips.push(x),y.tracks.push(w),v.load(y);const g=`${w.id}-${x.id}-${i.id}`,C={object:new r.Object3D};v.vfxActors.set(g,C),v.activeVfxClips.add(g);const j=await v.refreshAsset(t.id);s(j).toBe(!0),s(m).toHaveBeenCalledWith(i.id),s(u).toHaveBeenCalledWith(C),s(v.vfxActors.has(g)).toBe(!1),s(v.activeVfxClips.has(g)).toBe(!1)}),t("refreshes active spawn clips when their mesh material uses a changed shader graph",async()=>{const{SequencePlayer:e}=await import("../effects/sequence/sequence-player.js"),t=l("graph-asset"),a=(c="material-asset",d=t.id,{id:c,name:c,type:"material",material:{type:"shaderGraph",side:r.FrontSide,params:{},shaderGraph:{source:"asset",assetId:d}}});var c,d;const p=function(e,s){return{id:e,name:e,type:"mesh",materialAssignments:[{color:"#ffffff",materialId:s}]}}("mesh-asset",a.id),h=new Map([t,a,p].map(e=>[e.id,e])),m=new r.Scene,u=new e;u.setWorld({scene:m}),u.setAssetLoader(f(h));const v=n(),y=o(),w=i(0,1);y.spawnType="mesh",y.meshId=p.id,y.clips.push(w),v.tracks.push(y),u.load(v);const x=`${y.id}-${w.id}`,g=new r.Object3D;m.add(g),u.spawnedInstances.set(x,{type:"mesh",instance:g}),u.activeClips.add(x);const C=await u.refreshAsset(t.id);s(C).toBe(!0),s(g.parent).toBeNull(),s(u.spawnedInstances.has(x)).toBe(!1),s(u.activeClips.has(x)).toBe(!1)})});/*
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
+ * See the LICENSE.md file for details.
4
+ */
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sequence-post-process.test.d.ts.map
@@ -0,0 +1,4 @@
1
+ import{describe as e,expect as s,it as t,vi as a}from"vitest";import*as o from"three";import{createPostProcessClipInstance as n,createPostProcessTrack as r,createSequenceData as c}from"../effects/sequence/sequence-data.js";import{createDefaultPostProcessShaderGraphDocument as i,shaderGraphPostProcessWeightUniformName as l}from"../shader/graph/index.js";async function p(e,s){const{SequencePlayer:t}=await import("../effects/sequence/sequence-player.js"),a=new t;return a.setWorld({scene:new o.Scene}),a.setViewController(e),a.setAssetLoader(s),a}function d(e,s,t){const a=c();a.duration=Math.max(2,s+t+.25);const o=r(),i=n(s,t);return i.shaderGraphAssetId=e,o.clips.push(i),a.tracks.push(o),{sequence:a,track:o,clip:i}}function f(e){return{clearCacheById:a.fn(),getShaderGraphByAssetId:a.fn().mockResolvedValue(e),prepareShaderGraphParameters:a.fn().mockResolvedValue({})}}function u(){const e=[],s=a.fn((s,t={})=>{const o={material:s,enabled:t.enabled??!0,priority:t.priority??0,stage:t.stage??"beforeOutput",dispose:a.fn()};return e.push(o),o});return{handles:e,addPostProcessEffect:s,clearCameraShakeContributionsForOwner:a.fn(),releaseCameraOverridesForOwner:a.fn(),pushCameraOverride:a.fn(),setCameraShakeContribution:a.fn()}}function h(e){return e.material.uniforms[l].value}async function m(e=6){for(let s=0;s<e;s++)await Promise.resolve()}a.mock("../gameplay/actors/builtin/index.js",()=>({builtInActors:{},default:{}})),a.mock("../gameplay/actors/index.js",()=>({CharacterAnimationComponent:class{},CharacterMovementComponent:class{}})),a.mock("../effects/vfx/vfx-actor.js",()=>({VfxActor:class{}})),a.mock("../effects/vfx/vfx-param.js",()=>({VisualEffect:class{}})),a.mock("../effects/vfx/vfx-service.js",()=>({VfxService:class{}})),a.hoisted(()=>{if("undefined"==typeof HTMLCanvasElement)return;const e=new Proxy({},{get:(e,s)=>(s in e||(e[s]=("string"!=typeof s||!s.startsWith("is"))&&a.fn()),e[s]),set:(e,s,t)=>(e[s]=t,!0)});Object.defineProperty(HTMLCanvasElement.prototype,"getContext",{configurable:!0,value:()=>e})}),e("sequence post-process tracks",()=>{t("registers active post-process clips with the view controller",async()=>{const e=i(),t=u(),a=await p(t,f(e)),{clip:o,sequence:n}=d("graph-asset",0,1);a.load(n),a.play(),await m(),s(t.addPostProcessEffect).toHaveBeenCalledTimes(1),s(t.addPostProcessEffect).toHaveBeenCalledWith(s.anything(),s.objectContaining({stage:"beforeOutput",priority:0,enabled:!0})),s(t.handles[0].material.uniforms[l]).toBeTruthy(),s(o.shaderGraphAssetId).toBe("graph-asset")}),t("updates post-process blend weight from clip fades",async()=>{const e=i(),t=u(),a=await p(t,f(e)),{clip:o,sequence:n}=d("graph-asset",0,2);o.fadeInDuration=.5,o.fadeOutDuration=.5,a.load(n),a.play(),await m(),a.seek(.25),s(h(t.handles[0])).toBeCloseTo(.5),a.seek(1),s(h(t.handles[0])).toBeCloseTo(1),a.seek(1.75),s(h(t.handles[0])).toBeCloseTo(.5)}),t("disposes post-process handles when clips exit and when stopped",async()=>{const e=i(),t=u(),a=await p(t,f(e)),{sequence:o}=d("graph-asset",0,1);a.load(o),a.play(),await m();const n=t.handles[0];a.seek(1.1),s(n.dispose).toHaveBeenCalledTimes(1),a.seek(.1),await m();const r=t.handles[1];a.stop(),s(r.dispose).toHaveBeenCalledTimes(1)}),t("does not register stale async post-process loads after stop",async()=>{const e=function(){let e;return{promise:new Promise(s=>{e=s}),resolve:e}}(),t=u(),a=await p(t,f(e.promise)),{sequence:o}=d("graph-asset",0,1);a.load(o),a.play(),a.stop(),e.resolve(i()),await m(),s(t.addPostProcessEffect).not.toHaveBeenCalled()})});/*
2
+ * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
+ * See the LICENSE.md file for details.
4
+ */
@@ -1,4 +1,4 @@
1
- import{describe as e,expect as t,it as o}from"vitest";import{Color as r,Euler as a,Vector3 as l}from"three";import{canTrackAddSubTrack as s,createPropertyKeyframe as n,createPropertySubTrack as p,createSpawnTrack as i,evaluateCustomParamValueKeyframes as u,SequencePlayer as y}from"../effects/sequence/index.js";import{SerializedParamType as g}from"../scene/model.js";e("sequence property parameter tracks",()=>{o("allows multiple property sub-tracks on spawn tracks but rejects duplicate property paths",()=>{const e=i(),o=p({propertyPath:"settings.globalGain",propertyType:g.Vector3});t(s(e,"property",{propertyPath:"settings.globalGain"})).toBe(!0),e.subTracks.push(o),t(s(e,"property",{propertyPath:"settings.globalGain"})).toBe(!1),t(s(e,"property",{propertyPath:"settings.globalGamma"})).toBe(!0)}),o("interpolates number, vector, color, and Euler property keyframes",()=>{const e=u([n(0,{type:g.Number,value:0}),n(1,{type:g.Number,value:10})],.5);t(e?.value).toBeCloseTo(5);const o=u([n(0,{type:g.Vector3,value:[0,0,0]}),n(1,{type:g.Vector3,value:[2,4,6]})],.5,{min:0,max:3});t(o?.value).toEqual([1,2,3]);const a=u([n(0,{type:g.Color,value:"#000000"}),n(1,{type:g.Color,value:"#ffffff"})],.5);t(a?.value).toBe(`#${new r("#000000").lerp(new r("#ffffff"),.5).getHexString()}`);const l=u([n(0,{type:g.Euler,value:[0,0,0,"XYZ"]}),n(1,{type:g.Euler,value:[1,2,3,"XYZ"]})],.5);t(l?.value).toEqual([.5,1,1.5,"XYZ"])}),o("uses step evaluation for booleans and options-backed values",()=>{const e=u([n(0,{type:g.Boolean,value:!1}),n(1,{type:g.Boolean,value:!0})],.5,{stepOnly:!0});t(e?.value).toBe(!1);const o=u([n(0,{type:g.Number,value:1}),n(1,{type:g.Number,value:2})],.5,{stepOnly:!0});t(o?.value).toBe(1)}),o("applies nested property paths and restores an original undefined value",()=>{const e={settings:{globalGain:void 0}},o=p({propertyPath:"settings.globalGain",propertyType:g.Vector3}),r=new y;r.applyResolvedPropertyValue(o,e,{type:g.Vector3,value:[1,2,3]}),t(e.settings.globalGain).toBeInstanceOf(l),t(e.settings.globalGain?.toArray()).toEqual([1,2,3]),r.stop(),t(Object.prototype.hasOwnProperty.call(e.settings,"globalGain")).toBe(!0),t(e.settings.globalGain).toBeUndefined()}),o("mutates existing mutable values and restores their original value",()=>{const e=new l(9,8,7),o=new r("#112233"),s=new a(.1,.2,.3,"XYZ"),n={settings:{globalGain:e,colorTint:o,rotation:s}},i=new y;i.applyResolvedPropertyValue(p({propertyPath:"settings.globalGain",propertyType:g.Vector3}),n,{type:g.Vector3,value:[1,2,3]}),i.applyResolvedPropertyValue(p({propertyPath:"settings.colorTint",propertyType:g.Color}),n,{type:g.Color,value:"#ffffff"}),i.applyResolvedPropertyValue(p({propertyPath:"settings.rotation",propertyType:g.Euler}),n,{type:g.Euler,value:[1,2,3,"XYZ"]}),t(n.settings.globalGain).toBe(e),t(n.settings.globalGain.toArray()).toEqual([1,2,3]),t(n.settings.colorTint).toBe(o),t(n.settings.colorTint.getHexString()).toBe("ffffff"),t(n.settings.rotation).toBe(s),t(n.settings.rotation.toArray()).toEqual([1,2,3,"XYZ"]),i.stop(),t(n.settings.globalGain).toBe(e),t(n.settings.globalGain.toArray()).toEqual([9,8,7]),t(n.settings.colorTint).toBe(o),t(n.settings.colorTint.getHexString()).toBe("112233"),t(n.settings.rotation).toBe(s),t(n.settings.rotation.toArray()).toEqual([.1,.2,.3,"XYZ"])})});/*
1
+ import{beforeAll as e,describe as t,expect as a,it as o,vi as r}from"vitest";import{BoxGeometry as s,Color as l,Euler as n,Mesh as i,ShaderMaterial as p,Vector3 as u}from"three";import{createMaterialSubTrack as m,createPropertyKeyframe as c,createPropertySubTrack as y,createSpawnTrack as f}from"../effects/sequence/sequence-data.js";import{canTrackAddSubTrack as v}from"../effects/sequence/sequence-definitions.js";import{evaluateCustomParamValueKeyframes as g}from"../effects/sequence/sequence-value-lane.js";import{SerializedParamType as d}from"../scene/model.js";import{shaderParameterUniformName as b}from"../shader/parameter.js";let B;function T(){return new B}r.mock("../gameplay/actors/builtin/index.js",()=>({builtInActors:{},default:{}})),r.mock("../gameplay/actors/index.js",()=>({CharacterAnimationComponent:class{},CharacterMovementComponent:class{}})),r.mock("../effects/vfx/vfx-actor.js",()=>({VfxActor:class{}})),r.mock("../effects/vfx/vfx-param.js",()=>({VisualEffect:class{}})),r.mock("../effects/vfx/vfx-service.js",()=>({VfxService:class{}})),r.mock("../gameplay/services/render.js",()=>({})),r.hoisted(()=>{if("undefined"==typeof HTMLCanvasElement)return;const e=new Proxy({},{get:(e,t)=>(t in e||(e[t]=r.fn()),e[t]),set:(e,t,a)=>(e[t]=a,!0)});Object.defineProperty(HTMLCanvasElement.prototype,"getContext",{configurable:!0,value:()=>e})}),e(async()=>{const e=await import("../effects/sequence/sequence-player.js");B=e.SequencePlayer},1e4),t("sequence property parameter tracks",()=>{o("allows multiple property sub-tracks on spawn tracks but rejects duplicate property paths",()=>{const e=f(),t=y({propertyPath:"settings.globalGain",propertyType:d.Vector3});a(v(e,"property",{propertyPath:"settings.globalGain"})).toBe(!0),e.subTracks.push(t),a(v(e,"property",{propertyPath:"settings.globalGain"})).toBe(!1),a(v(e,"property",{propertyPath:"settings.globalGamma"})).toBe(!0)}),o("creates material sub-tracks for uniform-backed parameters and rejects duplicates",()=>{const e=f(),t={materialAssetId:"mat-1",parameterName:"dissolveAmount",uniformName:b("dissolveAmount"),uniformType:d.FloatNode,valueType:d.Number,label:"Dissolve Amount",defaultValue:{type:d.Number,value:0}},o=m(t);a(o).toMatchObject({type:"material",materialAssetId:"mat-1",parameterName:"dissolveAmount",uniformName:"pu_dissolveAmount",uniformType:d.FloatNode,valueType:d.Number,label:"Dissolve Amount"}),a(v(e,"material",{material:t})).toBe(!0),e.subTracks.push(o),a(v(e,"material",{material:t})).toBe(!1),a(v(e,"material",{material:{...t,parameterName:"rimPower",uniformName:b("rimPower")}})).toBe(!0)}),o("interpolates number, vector, color, and Euler property keyframes",()=>{const e=g([c(0,{type:d.Number,value:0}),c(1,{type:d.Number,value:10})],.5);a(e?.value).toBeCloseTo(5);const t=g([c(0,{type:d.Vector3,value:[0,0,0]}),c(1,{type:d.Vector3,value:[2,4,6]})],.5,{min:0,max:3});a(t?.value).toEqual([1,2,3]);const o=g([c(0,{type:d.Color,value:"#000000"}),c(1,{type:d.Color,value:"#ffffff"})],.5);a(o?.value).toBe(`#${new l("#000000").lerp(new l("#ffffff"),.5).getHexString()}`);const r=g([c(0,{type:d.Euler,value:[0,0,0,"XYZ"]}),c(1,{type:d.Euler,value:[1,2,3,"XYZ"]})],.5);a(r?.value).toEqual([.5,1,1.5,"XYZ"])}),o("uses step evaluation for booleans and options-backed values",()=>{const e=g([c(0,{type:d.Boolean,value:!1}),c(1,{type:d.Boolean,value:!0})],.5,{stepOnly:!0});a(e?.value).toBe(!1);const t=g([c(0,{type:d.Number,value:1}),c(1,{type:d.Number,value:2})],.5,{stepOnly:!0});a(t?.value).toBe(1)}),o("applies nested property paths and restores an original undefined value",async()=>{const e={settings:{globalGain:void 0}},t=y({propertyPath:"settings.globalGain",propertyType:d.Vector3}),o=await T();o.applyResolvedPropertyValue(t,e,{type:d.Vector3,value:[1,2,3]}),a(e.settings.globalGain).toBeInstanceOf(u),a(e.settings.globalGain?.toArray()).toEqual([1,2,3]),o.stop(),a(Object.prototype.hasOwnProperty.call(e.settings,"globalGain")).toBe(!0),a(e.settings.globalGain).toBeUndefined()}),o("mutates existing mutable values and restores their original value",async()=>{const e=new u(9,8,7),t=new l("#112233"),o=new n(.1,.2,.3,"XYZ"),r={settings:{globalGain:e,colorTint:t,rotation:o}},s=await T();s.applyResolvedPropertyValue(y({propertyPath:"settings.globalGain",propertyType:d.Vector3}),r,{type:d.Vector3,value:[1,2,3]}),s.applyResolvedPropertyValue(y({propertyPath:"settings.colorTint",propertyType:d.Color}),r,{type:d.Color,value:"#ffffff"}),s.applyResolvedPropertyValue(y({propertyPath:"settings.rotation",propertyType:d.Euler}),r,{type:d.Euler,value:[1,2,3,"XYZ"]}),a(r.settings.globalGain).toBe(e),a(r.settings.globalGain.toArray()).toEqual([1,2,3]),a(r.settings.colorTint).toBe(t),a(r.settings.colorTint.getHexString()).toBe("ffffff"),a(r.settings.rotation).toBe(o),a(r.settings.rotation.toArray()).toEqual([1,2,3,"XYZ"]),s.stop(),a(r.settings.globalGain).toBe(e),a(r.settings.globalGain.toArray()).toEqual([9,8,7]),a(r.settings.colorTint).toBe(t),a(r.settings.colorTint.getHexString()).toBe("112233"),a(r.settings.rotation).toBe(o),a(r.settings.rotation.toArray()).toEqual([.1,.2,.3,"XYZ"])}),o("clones matched materials before animating uniforms and restores originals",async()=>{const e=b("dissolveAmount"),t=new p({uniforms:{[e]:{value:0}}});t.userData.assetId="mat-1";const o=new i(new s,t),r=m({materialAssetId:"mat-1",parameterName:"dissolveAmount",uniformName:e,uniformType:d.FloatNode,valueType:d.Number});r.keyframes=[c(0,{type:d.Number,value:0}),c(1,{type:d.Number,value:1})];const l=await T();l.evaluateParameterSubTrack(r,o,.5),a(o.material).not.toBe(t),a(t.uniforms[e].value).toBe(0),a(o.material.uniforms[e].value).toBeCloseTo(.5),l.stop(),a(o.material).toBe(t)}),o("applies color material keyframes to vec3 uniform storage",async()=>{const e=b("rimColor"),t=new p({uniforms:{[e]:{value:new u(0,0,0)}}});t.userData.assetId="mat-1";const o=new i(new s,t),r=m({materialAssetId:"mat-1",parameterName:"rimColor",uniformName:e,uniformType:d.RgbNode,valueType:d.Color});(await T()).applyResolvedMaterialValue(r,o,{type:d.Color,value:"#336699"});const n=o.material.uniforms[e].value,c=new l("#336699");a(n.x).toBeCloseTo(c.r),a(n.y).toBeCloseTo(c.g),a(n.z).toBeCloseTo(c.b)}),o("step-evaluates boolean material keyframes",async()=>{const e=b("enabled"),t=new p({uniforms:{[e]:{value:!1}}});t.userData.assetId="mat-1";const o=new i(new s,t),r=m({materialAssetId:"mat-1",parameterName:"enabled",uniformName:e,uniformType:d.BooleanNode,valueType:d.Boolean});r.keyframes=[c(0,{type:d.Boolean,value:!1}),c(1,{type:d.Boolean,value:!0})];(await T()).evaluateParameterSubTrack(r,o,.5),a(o.material.uniforms[e].value).toBe(!1)})});/*
2
2
  * Copyright (©) 2026 Hology Interactive AB. All rights reserved.
3
3
  * See the LICENSE.md file for details.
4
4
  */