@splinetool/loader 0.9.102 → 0.9.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/SplineLoader.cjs +1 -1
- package/build/SplineLoader.js +1 -1
- package/package.json +1 -1
package/build/SplineLoader.cjs
CHANGED
|
@@ -1081,7 +1081,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
1081
1081
|
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result}, ${c.result} );
|
|
1082
1082
|
}
|
|
1083
1083
|
`),p&&u.push(p.code,`outgoingLight = spe_blend(outgoingLight, ${p.result}, 1.0, SPE_BLENDING_NORMAL);`),a?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${a.result} );`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),r=u.join(`
|
|
1084
|
-
`)}return r}};var Ze=require("three");function Uf(n,t){switch(n.type){case"fresnel":return nS(n,t);case"gradient":return iS(n);case"depth":return sS(n);case"normal":return aS(n);case"noise":return lS(n,t);case"rainbow":return cS(n);case"toon":return uS(n,t);case"outline":return pS(n,t);case"transmission":return dS(n,t);case"color":return oS(n,t)}}function rS(n){return{type:n.type}}function Sr(n){let{alpha:t,mode:e}=n;return{...rS(n),alpha:t,mode:e}}function oS(n,t){return{...Sr(n),color:Ye(n.color,t)}}function nS(n,t){let{bias:e,scale:r,intensity:o,factor:i,color:s}=n;return{...Sr(n),color:Ye(s,t),bias:e,scale:r,intensity:o,factor:i}}function iS(n){let{gradientType:t,smooth:e,colors:r,steps:o,angle:i,offset:s,morph:l}=n;return{...Sr(n),gradientType:t,smooth:e,colors:r.map(c=>new Ze.Vector4(c[0],c[1],c[2],c[3])),num:r.length,steps:o,offset:new Ze.Vector2(...s),morph:new Ze.Vector2(...l),angle:i}}function sS(n){let{gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:s,direction:l,colors:c,steps:p,smooth:a}=n;return{...Sr(n),gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:new Ze.Vector3(...s),direction:l?new Ze.Vector3(...l):new Ze.Vector3(1,0,0),colors:c.map(u=>new Ze.Vector4(u[0],u[1],u[2],u[3])),steps:p,smooth:a}}function aS(n){let{cnormal:t}=n;return{...Sr(n),cnormal:new Ze.Vector3(t[0],t[1],t[2])}}function lS(n,t){return{...Sr(n),scale:n.scale,move:n.move,fA:new Ze.Vector2(...n.fA),fB:new Ze.Vector2(...n.fB),size:new Ze.Vector3(...n.size),distortion:new Ze.Vector2(...n.distortion),colorA:Ye(n.colorA,t),colorB:Ye(n.colorB,t),colorC:Ye(n.colorC,t),colorD:Ye(n.colorD,t),noiseType:n.noiseType}}function cS(n){return{...Sr(n),filmThickness:n.filmThickness,movement:n.movement,wavelengths:new Ze.Vector3(...n.wavelengths),noiseStrength:n.noiseStrength,noiseScale:n.noiseScale,offset:new Ze.Vector3(...n.offset)}}function uS(n,t){return{...Sr(n),positioning:n.positioning,colors:n.colors.map(e=>new Ze.Vector4(e[0],e[1],e[2],e[3])),num:n.colors.length,steps:n.steps,source:new Ze.Vector3(...n.source),isWorldSpace:n.isWorldSpace,noiseStrength:n.noiseStrength,noiseScale:n.noiseScale,shadowColor:Ye(n.shadowColor,t),offset:new Ze.Vector3(...n.offset)}}function pS(n,t){return{...Sr(n),outlineColor:Ye(n.outlineColor,t),contourColor:Ye(n.contourColor,t),outlineWidth:n.outlineWidth,contourWidth:n.contourWidth,outlineThreshold:n.outlineThreshold,contourThreshold:n.contourThreshold,outlineSmoothing:n.outlineSmoothing,contourFrequency:n.contourFrequency,contourDirection:n.contourDirection,positionalLines:n.positionalLines,compensation:n.compensation}}function dS(n,t){return{...Sr(n),thickness:n.thickness,ior:n.ior,roughness:n.roughness}}var io=class extends Je{};var Wf=require("three");var Hf=require("three");var ec=new Map,Bi={url:"head",time:0,data:null,next:null,prev:null},Pn={url:"tail",time:1/0,data:null,next:null,prev:null};Bi.next=Pn;Pn.prev=Bi;var jf=0;function kf(n){if(typeof n=="string")return n;let t=Date.now(),e=ec.get(n);return e===void 0?(e={url:URL.createObjectURL(new Blob([n])),data:n,time:t,next:null,prev:null},ec.set(n,e)):(e.time=t,e.prev.next=e.next,e.next.prev=e.prev),e.prev=Pn.prev,e.next=Pn,Pn.prev.next=e,Pn.prev=e,t-jf>1e3*10&&(jf=t+1e3,setTimeout(()=>{let r=Date.now(),o=Bi.next;for(;o.time<r-1e3*10;)URL.revokeObjectURL(o.url),ec.delete(o.data),o=o.next,o.prev=Bi,Bi.next=o},900)),e.url}var Ln=class{constructor(t,e){this.data=t;this.onImageLoad=e;this.loaded=!1;this.updateSrc(t.data)}updateSrc(t){typeof document>"u"||(this.dispose(),this.loaded=!1,this.img=new Image,this.img.src=kf(t),this.img.onload=()=>{this.loaded=!0;let e=[1e3,1001,1002];for(let r of e){let o=this[r];o&&(o.image=this.img,o.needsUpdate=!0)}this.onImageLoad&&this.onImageLoad()})}getTexture(t){let e=this[t];if(e)return e;{let r=new Hf.Texture(this.img,void 0,t,t);return this.loaded&&(r.needsUpdate=!0),this[t]=r,r}}dispose(){this[1e3]?.dispose(),this[1e3]=void 0,this[1001]?.dispose(),this[1001]=void 0,this[1002]?.dispose(),this[1002]=void 0}};1e3,1001,1002;var Co=class extends Ln{};var so=class extends Le{};var tc={noise:["noiseType"],texture:["projection","axis","side"],displace:["noiseType"],depth:["smooth","isWorldSpace","gradientType","isVector"]},rc={depth:["colors"]};function fS(n,t,e){let r=tc[n.type],o=rc[n.type];if(o!==void 0){let i=n.color;
|
|
1084
|
+
`)}return r}};var Ze=require("three");function Uf(n,t){switch(n.type){case"fresnel":return nS(n,t);case"gradient":return iS(n);case"depth":return sS(n);case"normal":return aS(n);case"noise":return lS(n,t);case"rainbow":return cS(n);case"toon":return uS(n,t);case"outline":return pS(n,t);case"transmission":return dS(n,t);case"color":return oS(n,t)}}function rS(n){return{type:n.type}}function Sr(n){let{alpha:t,mode:e}=n;return{...rS(n),alpha:t,mode:e}}function oS(n,t){return{...Sr(n),color:Ye(n.color,t)}}function nS(n,t){let{bias:e,scale:r,intensity:o,factor:i,color:s}=n;return{...Sr(n),color:Ye(s,t),bias:e,scale:r,intensity:o,factor:i}}function iS(n){let{gradientType:t,smooth:e,colors:r,steps:o,angle:i,offset:s,morph:l}=n;return{...Sr(n),gradientType:t,smooth:e,colors:r.map(c=>new Ze.Vector4(c[0],c[1],c[2],c[3])),num:r.length,steps:o,offset:new Ze.Vector2(...s),morph:new Ze.Vector2(...l),angle:i}}function sS(n){let{gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:s,direction:l,colors:c,steps:p,smooth:a}=n;return{...Sr(n),gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:new Ze.Vector3(...s),direction:l?new Ze.Vector3(...l):new Ze.Vector3(1,0,0),colors:c.map(u=>new Ze.Vector4(u[0],u[1],u[2],u[3])),steps:p,smooth:a}}function aS(n){let{cnormal:t}=n;return{...Sr(n),cnormal:new Ze.Vector3(t[0],t[1],t[2])}}function lS(n,t){return{...Sr(n),scale:n.scale,move:n.move,fA:new Ze.Vector2(...n.fA),fB:new Ze.Vector2(...n.fB),size:new Ze.Vector3(...n.size),distortion:new Ze.Vector2(...n.distortion),colorA:Ye(n.colorA,t),colorB:Ye(n.colorB,t),colorC:Ye(n.colorC,t),colorD:Ye(n.colorD,t),noiseType:n.noiseType}}function cS(n){return{...Sr(n),filmThickness:n.filmThickness,movement:n.movement,wavelengths:new Ze.Vector3(...n.wavelengths),noiseStrength:n.noiseStrength,noiseScale:n.noiseScale,offset:new Ze.Vector3(...n.offset)}}function uS(n,t){return{...Sr(n),positioning:n.positioning,colors:n.colors.map(e=>new Ze.Vector4(e[0],e[1],e[2],e[3])),num:n.colors.length,steps:n.steps,source:new Ze.Vector3(...n.source),isWorldSpace:n.isWorldSpace,noiseStrength:n.noiseStrength,noiseScale:n.noiseScale,shadowColor:Ye(n.shadowColor,t),offset:new Ze.Vector3(...n.offset)}}function pS(n,t){return{...Sr(n),outlineColor:Ye(n.outlineColor,t),contourColor:Ye(n.contourColor,t),outlineWidth:n.outlineWidth,contourWidth:n.contourWidth,outlineThreshold:n.outlineThreshold,contourThreshold:n.contourThreshold,outlineSmoothing:n.outlineSmoothing,contourFrequency:n.contourFrequency,contourDirection:n.contourDirection,positionalLines:n.positionalLines,compensation:n.compensation}}function dS(n,t){return{...Sr(n),thickness:n.thickness,ior:n.ior,roughness:n.roughness}}var io=class extends Je{};var Wf=require("three");var Hf=require("three");var ec=new Map,Bi={url:"head",time:0,data:null,next:null,prev:null},Pn={url:"tail",time:1/0,data:null,next:null,prev:null};Bi.next=Pn;Pn.prev=Bi;var jf=0;function kf(n){if(typeof n=="string")return n;let t=Date.now(),e=ec.get(n);return e===void 0?(e={url:URL.createObjectURL(new Blob([n])),data:n,time:t,next:null,prev:null},ec.set(n,e)):(e.time=t,e.prev.next=e.next,e.next.prev=e.prev),e.prev=Pn.prev,e.next=Pn,Pn.prev.next=e,Pn.prev=e,t-jf>1e3*10&&(jf=t+1e3,setTimeout(()=>{let r=Date.now(),o=Bi.next;for(;o.time<r-1e3*10;)URL.revokeObjectURL(o.url),ec.delete(o.data),o=o.next,o.prev=Bi,Bi.next=o},900)),e.url}var Ln=class{constructor(t,e){this.data=t;this.onImageLoad=e;this.loaded=!1;this.updateSrc(t.data)}updateSrc(t){typeof document>"u"||(this.dispose(),this.loaded=!1,this.img=new Image,this.img.src=kf(t),this.img.onload=()=>{this.loaded=!0;let e=[1e3,1001,1002];for(let r of e){let o=this[r];o&&(o.image=this.img,o.needsUpdate=!0)}this.onImageLoad&&this.onImageLoad()})}getTexture(t){let e=this[t];if(e)return e;{let r=new Hf.Texture(this.img,void 0,t,t);return this.loaded&&(r.needsUpdate=!0),this[t]=r,r}}dispose(){this[1e3]?.dispose(),this[1e3]=void 0,this[1001]?.dispose(),this[1001]=void 0,this[1002]?.dispose(),this[1002]=void 0}};1e3,1001,1002;var Co=class extends Ln{};var so=class extends Le{};var tc={noise:["noiseType"],texture:["projection","axis","side"],displace:["noiseType"],depth:["smooth","isWorldSpace","gradientType","isVector"]},rc={depth:["colors"]};function fS(n,t,e){let r=tc[n.type],o=rc[n.type];if(o!==void 0){let i=n.color;if(o.includes(t)){let s=i[t]?.value?.length;if(s!==void 0&&s!==e.length)return!0}}return r!==void 0?r.includes(t):!1}function oc(n,t,e){let r=e.uniforms[`f${e.id}_texture`];if(!r)return!1;let o=!1,i=n;if("image"in i){let s=i.image,l=t.image(s),c=r;c instanceof Co||c.image.dispose(),c.image=l}if("wrapping"in i){let s=r;s.wrap=i.wrapping}if("repeat"in i||"offset"in i){let s="mat",l=e.uniforms[`f${e.id}_${s}`];"repeat"in i&&(l.repeat=i.repeat),"offset"in i&&(l.offset=i.offset),l.updateMatrix()}return o}function qf(n,t,e,r){let o=!1;for(let[i,s]of Object.entries(n)){if(!i||s===void 0||nc(i,e,r))continue;e.visible=r.visible;let l=e.uniforms[`f${e.id}_${i}`];if(!!l&&!(l instanceof so))switch(o=o||fS(e,i,s),l.constructor){case Ne:if(typeof s=="string"){let c=t.getColor(s);c&&(l.value=c);break}else{let c=s;l.value instanceof io?l.value=new Je(c.r,c.g,c.b,c.a):l.setRGBA(c);break}case Ht:if(typeof s=="string"){let c=t.getColor(s);c&&(l.value=c);break}else{let c=s;l.value instanceof io?l.value=new Je(c.r,c.g,c.b,c.a):l.value.setRGBA(c.r,c.g,c.b,c.a);break}case st:{let c=s;l.value.setX(c[0]),l.value.setY(c[1]);break}case ct:{let c=s;l.value.setX(c[0]),l.value.setY(c[1]),l.value.setZ(c[2]);break}case Ct:{oc(s,t,e);break}case Qt:{l.value=s.map(c=>new Wf.Vector4(...c));break}default:{l.value=s;break}}}return o}var ic=class extends le{constructor(e,r,o){super("v3");this.nodeType="Matcap";this.texture=e,this.alpha=r,this.mode=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,r){if(e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");let o=e.include(ic.Nodes.matcap);e.require("normal"),e.requires.normal=!0;let i=[];return i.push(this.texture.generate(e,"t")),i.push("normal"),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),i.push(this.calpha),e.format(o+"("+i.join(",")+")",this.getType(e),r)}else return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),r)}},Ei=ic;Ei.Nodes=function(){return{matcap:new X(`vec3 matcap(sampler2D matcapTex, vec3 normal, float alpha, int mode, out float calpha) {
|
|
1085
1085
|
vec3 viewDir = normalize( vViewPosition );
|
|
1086
1086
|
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
1087
1087
|
vec3 y = cross( viewDir, x );
|
package/build/SplineLoader.js
CHANGED
|
@@ -1081,7 +1081,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
1081
1081
|
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result}, ${c.result} );
|
|
1082
1082
|
}
|
|
1083
1083
|
`),p&&u.push(p.code,`outgoingLight = spe_blend(outgoingLight, ${p.result}, 1.0, SPE_BLENDING_NORMAL);`),a?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${a.result} );`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),r=u.join(`
|
|
1084
|
-
`)}return r}};import{Vector2 as yi,Vector3 as Tr,Vector4 as Wl}from"three";function $f(n,t){switch(n.type){case"fresnel":return yw(n,t);case"gradient":return xw(n);case"depth":return vw(n);case"normal":return bw(n);case"noise":return Sw(n,t);case"rainbow":return ww(n);case"toon":return _w(n,t);case"outline":return Tw(n,t);case"transmission":return Aw(n,t);case"color":return gw(n,t)}}function hw(n){return{type:n.type}}function ar(n){let{alpha:t,mode:e}=n;return{...hw(n),alpha:t,mode:e}}function gw(n,t){return{...ar(n),color:Fe(n.color,t)}}function yw(n,t){let{bias:e,scale:r,intensity:o,factor:i,color:s}=n;return{...ar(n),color:Fe(s,t),bias:e,scale:r,intensity:o,factor:i}}function xw(n){let{gradientType:t,smooth:e,colors:r,steps:o,angle:i,offset:s,morph:l}=n;return{...ar(n),gradientType:t,smooth:e,colors:r.map(c=>new Wl(c[0],c[1],c[2],c[3])),num:r.length,steps:o,offset:new yi(...s),morph:new yi(...l),angle:i}}function vw(n){let{gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:s,direction:l,colors:c,steps:p,smooth:a}=n;return{...ar(n),gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:new Tr(...s),direction:l?new Tr(...l):new Tr(1,0,0),colors:c.map(u=>new Wl(u[0],u[1],u[2],u[3])),steps:p,smooth:a}}function bw(n){let{cnormal:t}=n;return{...ar(n),cnormal:new Tr(t[0],t[1],t[2])}}function Sw(n,t){return{...ar(n),scale:n.scale,move:n.move,fA:new yi(...n.fA),fB:new yi(...n.fB),size:new Tr(...n.size),distortion:new yi(...n.distortion),colorA:Fe(n.colorA,t),colorB:Fe(n.colorB,t),colorC:Fe(n.colorC,t),colorD:Fe(n.colorD,t),noiseType:n.noiseType}}function ww(n){return{...ar(n),filmThickness:n.filmThickness,movement:n.movement,wavelengths:new Tr(...n.wavelengths),noiseStrength:n.noiseStrength,noiseScale:n.noiseScale,offset:new Tr(...n.offset)}}function _w(n,t){return{...ar(n),positioning:n.positioning,colors:n.colors.map(e=>new Wl(e[0],e[1],e[2],e[3])),num:n.colors.length,steps:n.steps,source:new Tr(...n.source),isWorldSpace:n.isWorldSpace,noiseStrength:n.noiseStrength,noiseScale:n.noiseScale,shadowColor:Fe(n.shadowColor,t),offset:new Tr(...n.offset)}}function Tw(n,t){return{...ar(n),outlineColor:Fe(n.outlineColor,t),contourColor:Fe(n.contourColor,t),outlineWidth:n.outlineWidth,contourWidth:n.contourWidth,outlineThreshold:n.outlineThreshold,contourThreshold:n.contourThreshold,outlineSmoothing:n.outlineSmoothing,contourFrequency:n.contourFrequency,contourDirection:n.contourDirection,positionalLines:n.positionalLines,compensation:n.compensation}}function Aw(n,t){return{...ar(n),thickness:n.thickness,ior:n.ior,roughness:n.roughness}}var Wr=class extends Ue{};import{Vector4 as Cw}from"three";import{Texture as Nw}from"three";var ql=new Map,xi={url:"head",time:0,data:null,next:null,prev:null},un={url:"tail",time:1/0,data:null,next:null,prev:null};xi.next=un;un.prev=xi;var Xf=0;function Yf(n){if(typeof n=="string")return n;let t=Date.now(),e=ql.get(n);return e===void 0?(e={url:URL.createObjectURL(new Blob([n])),data:n,time:t,next:null,prev:null},ql.set(n,e)):(e.time=t,e.prev.next=e.next,e.next.prev=e.prev),e.prev=un.prev,e.next=un,un.prev.next=e,un.prev=e,t-Xf>1e3*10&&(Xf=t+1e3,setTimeout(()=>{let r=Date.now(),o=xi.next;for(;o.time<r-1e3*10;)URL.revokeObjectURL(o.url),ql.delete(o.data),o=o.next,o.prev=xi,xi.next=o},900)),e.url}var pn=class{constructor(t,e){this.data=t;this.onImageLoad=e;this.loaded=!1;this.updateSrc(t.data)}updateSrc(t){typeof document>"u"||(this.dispose(),this.loaded=!1,this.img=new Image,this.img.src=Yf(t),this.img.onload=()=>{this.loaded=!0;let e=[1e3,1001,1002];for(let r of e){let o=this[r];o&&(o.image=this.img,o.needsUpdate=!0)}this.onImageLoad&&this.onImageLoad()})}getTexture(t){let e=this[t];if(e)return e;{let r=new Nw(this.img,void 0,t,t);return this.loaded&&(r.needsUpdate=!0),this[t]=r,r}}dispose(){this[1e3]?.dispose(),this[1e3]=void 0,this[1001]?.dispose(),this[1001]=void 0,this[1002]?.dispose(),this[1002]=void 0}};1e3,1001,1002;var lo=class extends pn{};var qr=class extends Ae{};var $l={noise:["noiseType"],texture:["projection","axis","side"],displace:["noiseType"],depth:["smooth","isWorldSpace","gradientType","isVector"]},Xl={depth:["colors"]};function Pw(n,t,e){let r=$l[n.type],o=Xl[n.type];if(o!==void 0){let i=n.color;
|
|
1084
|
+
`)}return r}};import{Vector2 as yi,Vector3 as Tr,Vector4 as Wl}from"three";function $f(n,t){switch(n.type){case"fresnel":return yw(n,t);case"gradient":return xw(n);case"depth":return vw(n);case"normal":return bw(n);case"noise":return Sw(n,t);case"rainbow":return ww(n);case"toon":return _w(n,t);case"outline":return Tw(n,t);case"transmission":return Aw(n,t);case"color":return gw(n,t)}}function hw(n){return{type:n.type}}function ar(n){let{alpha:t,mode:e}=n;return{...hw(n),alpha:t,mode:e}}function gw(n,t){return{...ar(n),color:Fe(n.color,t)}}function yw(n,t){let{bias:e,scale:r,intensity:o,factor:i,color:s}=n;return{...ar(n),color:Fe(s,t),bias:e,scale:r,intensity:o,factor:i}}function xw(n){let{gradientType:t,smooth:e,colors:r,steps:o,angle:i,offset:s,morph:l}=n;return{...ar(n),gradientType:t,smooth:e,colors:r.map(c=>new Wl(c[0],c[1],c[2],c[3])),num:r.length,steps:o,offset:new yi(...s),morph:new yi(...l),angle:i}}function vw(n){let{gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:s,direction:l,colors:c,steps:p,smooth:a}=n;return{...ar(n),gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:new Tr(...s),direction:l?new Tr(...l):new Tr(1,0,0),colors:c.map(u=>new Wl(u[0],u[1],u[2],u[3])),steps:p,smooth:a}}function bw(n){let{cnormal:t}=n;return{...ar(n),cnormal:new Tr(t[0],t[1],t[2])}}function Sw(n,t){return{...ar(n),scale:n.scale,move:n.move,fA:new yi(...n.fA),fB:new yi(...n.fB),size:new Tr(...n.size),distortion:new yi(...n.distortion),colorA:Fe(n.colorA,t),colorB:Fe(n.colorB,t),colorC:Fe(n.colorC,t),colorD:Fe(n.colorD,t),noiseType:n.noiseType}}function ww(n){return{...ar(n),filmThickness:n.filmThickness,movement:n.movement,wavelengths:new Tr(...n.wavelengths),noiseStrength:n.noiseStrength,noiseScale:n.noiseScale,offset:new Tr(...n.offset)}}function _w(n,t){return{...ar(n),positioning:n.positioning,colors:n.colors.map(e=>new Wl(e[0],e[1],e[2],e[3])),num:n.colors.length,steps:n.steps,source:new Tr(...n.source),isWorldSpace:n.isWorldSpace,noiseStrength:n.noiseStrength,noiseScale:n.noiseScale,shadowColor:Fe(n.shadowColor,t),offset:new Tr(...n.offset)}}function Tw(n,t){return{...ar(n),outlineColor:Fe(n.outlineColor,t),contourColor:Fe(n.contourColor,t),outlineWidth:n.outlineWidth,contourWidth:n.contourWidth,outlineThreshold:n.outlineThreshold,contourThreshold:n.contourThreshold,outlineSmoothing:n.outlineSmoothing,contourFrequency:n.contourFrequency,contourDirection:n.contourDirection,positionalLines:n.positionalLines,compensation:n.compensation}}function Aw(n,t){return{...ar(n),thickness:n.thickness,ior:n.ior,roughness:n.roughness}}var Wr=class extends Ue{};import{Vector4 as Cw}from"three";import{Texture as Nw}from"three";var ql=new Map,xi={url:"head",time:0,data:null,next:null,prev:null},un={url:"tail",time:1/0,data:null,next:null,prev:null};xi.next=un;un.prev=xi;var Xf=0;function Yf(n){if(typeof n=="string")return n;let t=Date.now(),e=ql.get(n);return e===void 0?(e={url:URL.createObjectURL(new Blob([n])),data:n,time:t,next:null,prev:null},ql.set(n,e)):(e.time=t,e.prev.next=e.next,e.next.prev=e.prev),e.prev=un.prev,e.next=un,un.prev.next=e,un.prev=e,t-Xf>1e3*10&&(Xf=t+1e3,setTimeout(()=>{let r=Date.now(),o=xi.next;for(;o.time<r-1e3*10;)URL.revokeObjectURL(o.url),ql.delete(o.data),o=o.next,o.prev=xi,xi.next=o},900)),e.url}var pn=class{constructor(t,e){this.data=t;this.onImageLoad=e;this.loaded=!1;this.updateSrc(t.data)}updateSrc(t){typeof document>"u"||(this.dispose(),this.loaded=!1,this.img=new Image,this.img.src=Yf(t),this.img.onload=()=>{this.loaded=!0;let e=[1e3,1001,1002];for(let r of e){let o=this[r];o&&(o.image=this.img,o.needsUpdate=!0)}this.onImageLoad&&this.onImageLoad()})}getTexture(t){let e=this[t];if(e)return e;{let r=new Nw(this.img,void 0,t,t);return this.loaded&&(r.needsUpdate=!0),this[t]=r,r}}dispose(){this[1e3]?.dispose(),this[1e3]=void 0,this[1001]?.dispose(),this[1001]=void 0,this[1002]?.dispose(),this[1002]=void 0}};1e3,1001,1002;var lo=class extends pn{};var qr=class extends Ae{};var $l={noise:["noiseType"],texture:["projection","axis","side"],displace:["noiseType"],depth:["smooth","isWorldSpace","gradientType","isVector"]},Xl={depth:["colors"]};function Pw(n,t,e){let r=$l[n.type],o=Xl[n.type];if(o!==void 0){let i=n.color;if(o.includes(t)){let s=i[t]?.value?.length;if(s!==void 0&&s!==e.length)return!0}}return r!==void 0?r.includes(t):!1}function Yl(n,t,e){let r=e.uniforms[`f${e.id}_texture`];if(!r)return!1;let o=!1,i=n;if("image"in i){let s=i.image,l=t.image(s),c=r;c instanceof lo||c.image.dispose(),c.image=l}if("wrapping"in i){let s=r;s.wrap=i.wrapping}if("repeat"in i||"offset"in i){let s="mat",l=e.uniforms[`f${e.id}_${s}`];"repeat"in i&&(l.repeat=i.repeat),"offset"in i&&(l.offset=i.offset),l.updateMatrix()}return o}function Kf(n,t,e,r){let o=!1;for(let[i,s]of Object.entries(n)){if(!i||s===void 0||Kl(i,e,r))continue;e.visible=r.visible;let l=e.uniforms[`f${e.id}_${i}`];if(!!l&&!(l instanceof qr))switch(o=o||Pw(e,i,s),l.constructor){case we:if(typeof s=="string"){let c=t.getColor(s);c&&(l.value=c);break}else{let c=s;l.value instanceof Wr?l.value=new Ue(c.r,c.g,c.b,c.a):l.setRGBA(c);break}case It:if(typeof s=="string"){let c=t.getColor(s);c&&(l.value=c);break}else{let c=s;l.value instanceof Wr?l.value=new Ue(c.r,c.g,c.b,c.a):l.value.setRGBA(c.r,c.g,c.b,c.a);break}case Ye:{let c=s;l.value.setX(c[0]),l.value.setY(c[1]);break}case Qe:{let c=s;l.value.setX(c[0]),l.value.setY(c[1]),l.value.setZ(c[2]);break}case ft:{Yl(s,t,e);break}case Rt:{l.value=s.map(c=>new Cw(...c));break}default:{l.value=s;break}}}return o}var Zl=class extends ae{constructor(e,r,o){super("v3");this.nodeType="Matcap";this.texture=e,this.alpha=r,this.mode=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,r){if(e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");let o=e.include(Zl.Nodes.matcap);e.require("normal"),e.requires.normal=!0;let i=[];return i.push(this.texture.generate(e,"t")),i.push("normal"),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),i.push(this.calpha),e.format(o+"("+i.join(",")+")",this.getType(e),r)}else return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),r)}},vi=Zl;vi.Nodes=function(){return{matcap:new X(`vec3 matcap(sampler2D matcapTex, vec3 normal, float alpha, int mode, out float calpha) {
|
|
1085
1085
|
vec3 viewDir = normalize( vViewPosition );
|
|
1086
1086
|
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
1087
1087
|
vec3 y = cross( viewDir, x );
|