Comparing version
@@ -21,2 +21,3 @@ /** | ||
const If = TSL.If; | ||
const Switch = TSL.Switch; | ||
const Loop = TSL.Loop; | ||
@@ -139,2 +140,4 @@ const NodeShaderStage = TSL.NodeShaderStage; | ||
const debug = TSL.debug; | ||
const decrement = TSL.decrement; | ||
const decrementBefore = TSL.decrementBefore; | ||
const defaultBuildStages = TSL.defaultBuildStages; | ||
@@ -193,2 +196,4 @@ const defaultShaderStages = TSL.defaultShaderStages; | ||
const getViewPosition = TSL.getViewPosition; | ||
const getShadowMaterial = TSL.getShadowMaterial; | ||
const getShadowRenderObjectFunction = TSL.getShadowRenderObjectFunction; | ||
const glsl = TSL.glsl; | ||
@@ -203,2 +208,4 @@ const glslFn = TSL.glslFn; | ||
const hue = TSL.hue; | ||
const increment = TSL.increment; | ||
const incrementBefore = TSL.incrementBefore; | ||
const instance = TSL.instance; | ||
@@ -229,2 +236,3 @@ const instanceIndex = TSL.instanceIndex; | ||
const lightPosition = TSL.lightPosition; | ||
const lightShadowMatrix = TSL.lightShadowMatrix; | ||
const lightTargetDirection = TSL.lightTargetDirection; | ||
@@ -557,2 +565,2 @@ const lightTargetPosition = TSL.lightTargetPosition; | ||
export { BRDF_GGX, BRDF_Lambert, BasicShadowFilter, Break, Const, Continue, DFGApprox, D_GGX, Discard, EPSILON, F_Schlick, Fn, INFINITY, If, Loop, NodeAccess, NodeShaderStage, NodeType, NodeUpdateType, PCFShadowFilter, PCFSoftShadowFilter, PI, PI2, Return, Schlick_to_F0, ScriptableNodeResources, ShaderNode, TBNViewMatrix, VSMShadowFilter, V_GGX_SmithCorrelated, Var, abs, acesFilmicToneMapping, acos, add, addNodeElement, agxToneMapping, all, alphaT, and, anisotropy, anisotropyB, anisotropyT, any, append, array, arrayBuffer, asin, assign, atan, atan2, atomicAdd, atomicAnd, atomicFunc, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, attenuationColor, attenuationDistance, attribute, attributeArray, backgroundBlurriness, backgroundIntensity, backgroundRotation, batch, billboarding, bitAnd, bitNot, bitOr, bitXor, bitangentGeometry, bitangentLocal, bitangentView, bitangentWorld, bitcast, blendBurn, blendColor, blendDodge, blendOverlay, blendScreen, blur, bool, buffer, bufferAttribute, bumpMap, burn, bvec2, bvec3, bvec4, bypass, cache, call, cameraFar, cameraIndex, cameraNear, cameraNormalMatrix, cameraPosition, cameraProjectionMatrix, cameraProjectionMatrixInverse, cameraViewMatrix, cameraWorldMatrix, cbrt, cdl, ceil, checker, cineonToneMapping, clamp, clearcoat, clearcoatRoughness, code, color, colorSpaceToWorking, colorToDirection, compute, computeSkinning, cond, context, convert, convertColorSpace, convertToTexture, cos, cross, cubeTexture, dFdx, dFdy, dashSize, debug, defaultBuildStages, defaultShaderStages, defined, degrees, deltaTime, densityFog, densityFogFactor, depth, depthPass, difference, diffuseColor, directPointLight, directionToColor, dispersion, distance, div, dodge, dot, drawIndex, dynamicBufferAttribute, element, emissive, equal, equals, equirectUV, exp, exp2, expression, faceDirection, faceForward, faceforward, float, floor, fog, fract, frameGroup, frameId, frontFacing, fwidth, gain, gapSize, getConstNodeType, getCurrentStack, getDirection, getDistanceAttenuation, getGeometryRoughness, getNormalFromDepth, getParallaxCorrectNormal, getRoughness, getScreenPosition, getShIrradianceAt, getTextureIndex, getViewPosition, globalId, glsl, glslFn, grayscale, greaterThan, greaterThanEqual, hash, highpModelNormalViewMatrix, highpModelViewMatrix, hue, instance, instanceIndex, instancedArray, instancedBufferAttribute, instancedDynamicBufferAttribute, instancedMesh, int, inverseSqrt, inversesqrt, invocationLocalIndex, invocationSubgroupIndex, ior, iridescence, iridescenceIOR, iridescenceThickness, ivec2, ivec3, ivec4, js, label, length, lengthSq, lessThan, lessThanEqual, lightPosition, lightProjectionUV, lightTargetDirection, lightTargetPosition, lightViewPosition, lightingContext, lights, linearDepth, linearToneMapping, localId, log, log2, logarithmicDepthToViewZ, loop, luminance, mat2, mat3, mat4, matcapUV, materialAO, materialAlphaTest, materialAnisotropy, materialAnisotropyVector, materialAttenuationColor, materialAttenuationDistance, materialClearcoat, materialClearcoatNormal, materialClearcoatRoughness, materialColor, materialDispersion, materialEmissive, materialIOR, materialIridescence, materialIridescenceIOR, materialIridescenceThickness, materialLightMap, materialLineDashOffset, materialLineDashSize, materialLineGapSize, materialLineScale, materialLineWidth, materialMetalness, materialNormal, materialOpacity, materialPointSize, materialReference, materialReflectivity, materialRefractionRatio, materialRotation, materialRoughness, materialSheen, materialSheenRoughness, materialShininess, materialSpecular, materialSpecularColor, materialSpecularIntensity, materialSpecularStrength, materialThickness, materialTransmission, max, maxMipLevel, mediumpModelViewMatrix, metalness, min, mix, mixElement, mod, modInt, modelDirection, modelNormalMatrix, modelPosition, modelRadius, modelScale, modelViewMatrix, modelViewPosition, modelViewProjection, modelWorldMatrix, modelWorldMatrixInverse, morphReference, mrt, mul, mx_aastep, mx_cell_noise_float, mx_contrast, mx_fractal_noise_float, mx_fractal_noise_vec2, mx_fractal_noise_vec3, mx_fractal_noise_vec4, mx_hsvtorgb, mx_noise_float, mx_noise_vec3, mx_noise_vec4, mx_ramplr, mx_ramptb, mx_rgbtohsv, mx_safepower, mx_splitlr, mx_splittb, mx_srgb_texture_to_lin_rec709, mx_transform_uv, mx_worley_noise_float, mx_worley_noise_vec2, mx_worley_noise_vec3, negate, neutralToneMapping, nodeArray, nodeImmutable, nodeObject, nodeObjects, nodeProxy, normalFlat, normalGeometry, normalLocal, normalMap, normalView, normalWorld, normalize, not, notEqual, numWorkgroups, objectDirection, objectGroup, objectPosition, objectRadius, objectScale, objectViewPosition, objectWorldMatrix, oneMinus, or, orthographicDepthToViewZ, oscSawtooth, oscSine, oscSquare, oscTriangle, output, outputStruct, overlay, overloadingFn, parabola, parallaxDirection, parallaxUV, parameter, pass, passTexture, pcurve, perspectiveDepthToViewZ, pmremTexture, pointShadow, pointUV, pointWidth, positionGeometry, positionLocal, positionPrevious, positionView, positionViewDirection, positionWorld, positionWorldDirection, posterize, pow, pow2, pow3, pow4, property, radians, rand, range, rangeFog, rangeFogFactor, reciprocal, reference, referenceBuffer, reflect, reflectVector, reflectView, reflector, refract, refractVector, refractView, reinhardToneMapping, remainder, remap, remapClamp, renderGroup, renderOutput, rendererReference, rotate, rotateUV, roughness, round, rtt, sRGBTransferEOTF, sRGBTransferOETF, sampler, samplerComparison, saturate, saturation, screen, screenCoordinate, screenSize, screenUV, scriptable, scriptableValue, select, setCurrentStack, shaderStages, shadow, shadowPositionWorld, shapeCircle, sharedUniformGroup, sheen, sheenRoughness, shiftLeft, shiftRight, shininess, sign, sin, sinc, skinning, smoothstep, smoothstepElement, specularColor, specularF90, spherizeUV, split, spritesheetUV, sqrt, stack, step, storage, storageBarrier, storageObject, storageTexture, string, struct, sub, subgroupIndex, subgroupSize, tan, tangentGeometry, tangentLocal, tangentView, tangentWorld, temp, texture, texture3D, textureBarrier, textureBicubic, textureCubeUV, textureLoad, textureSize, textureStore, thickness, threshold, time, timerDelta, timerGlobal, timerLocal, toOutputColorSpace, toWorkingColorSpace, toneMapping, toneMappingExposure, toonOutlinePass, transformDirection, transformNormal, transformNormalToView, transformedBentNormalView, transformedBitangentView, transformedBitangentWorld, transformedClearcoatNormalView, transformedNormalView, transformedNormalWorld, transformedTangentView, transformedTangentWorld, transmission, transpose, tri, tri3, triNoise3D, triplanarTexture, triplanarTextures, trunc, tslFn, uint, uniform, uniformArray, uniformGroup, uniforms, userData, uv, uvec2, uvec3, uvec4, varying, varyingProperty, vec2, vec3, vec4, vectorComponents, velocity, vertexColor, vertexIndex, vibrance, viewZToLogarithmicDepth, viewZToOrthographicDepth, viewZToPerspectiveDepth, viewport, viewportBottomLeft, viewportCoordinate, viewportDepthTexture, viewportLinearDepth, viewportMipTexture, viewportResolution, viewportSafeUV, viewportSharedTexture, viewportSize, viewportTexture, viewportTopLeft, viewportUV, wgsl, wgslFn, workgroupArray, workgroupBarrier, workgroupId, workingToColorSpace, xor }; | ||
export { BRDF_GGX, BRDF_Lambert, BasicShadowFilter, Break, Const, Continue, DFGApprox, D_GGX, Discard, EPSILON, F_Schlick, Fn, INFINITY, If, Loop, NodeAccess, NodeShaderStage, NodeType, NodeUpdateType, PCFShadowFilter, PCFSoftShadowFilter, PI, PI2, Return, Schlick_to_F0, ScriptableNodeResources, ShaderNode, Switch, TBNViewMatrix, VSMShadowFilter, V_GGX_SmithCorrelated, Var, abs, acesFilmicToneMapping, acos, add, addNodeElement, agxToneMapping, all, alphaT, and, anisotropy, anisotropyB, anisotropyT, any, append, array, arrayBuffer, asin, assign, atan, atan2, atomicAdd, atomicAnd, atomicFunc, atomicLoad, atomicMax, atomicMin, atomicOr, atomicStore, atomicSub, atomicXor, attenuationColor, attenuationDistance, attribute, attributeArray, backgroundBlurriness, backgroundIntensity, backgroundRotation, batch, billboarding, bitAnd, bitNot, bitOr, bitXor, bitangentGeometry, bitangentLocal, bitangentView, bitangentWorld, bitcast, blendBurn, blendColor, blendDodge, blendOverlay, blendScreen, blur, bool, buffer, bufferAttribute, bumpMap, burn, bvec2, bvec3, bvec4, bypass, cache, call, cameraFar, cameraIndex, cameraNear, cameraNormalMatrix, cameraPosition, cameraProjectionMatrix, cameraProjectionMatrixInverse, cameraViewMatrix, cameraWorldMatrix, cbrt, cdl, ceil, checker, cineonToneMapping, clamp, clearcoat, clearcoatRoughness, code, color, colorSpaceToWorking, colorToDirection, compute, computeSkinning, cond, context, convert, convertColorSpace, convertToTexture, cos, cross, cubeTexture, dFdx, dFdy, dashSize, debug, decrement, decrementBefore, defaultBuildStages, defaultShaderStages, defined, degrees, deltaTime, densityFog, densityFogFactor, depth, depthPass, difference, diffuseColor, directPointLight, directionToColor, dispersion, distance, div, dodge, dot, drawIndex, dynamicBufferAttribute, element, emissive, equal, equals, equirectUV, exp, exp2, expression, faceDirection, faceForward, faceforward, float, floor, fog, fract, frameGroup, frameId, frontFacing, fwidth, gain, gapSize, getConstNodeType, getCurrentStack, getDirection, getDistanceAttenuation, getGeometryRoughness, getNormalFromDepth, getParallaxCorrectNormal, getRoughness, getScreenPosition, getShIrradianceAt, getShadowMaterial, getShadowRenderObjectFunction, getTextureIndex, getViewPosition, globalId, glsl, glslFn, grayscale, greaterThan, greaterThanEqual, hash, highpModelNormalViewMatrix, highpModelViewMatrix, hue, increment, incrementBefore, instance, instanceIndex, instancedArray, instancedBufferAttribute, instancedDynamicBufferAttribute, instancedMesh, int, inverseSqrt, inversesqrt, invocationLocalIndex, invocationSubgroupIndex, ior, iridescence, iridescenceIOR, iridescenceThickness, ivec2, ivec3, ivec4, js, label, length, lengthSq, lessThan, lessThanEqual, lightPosition, lightProjectionUV, lightShadowMatrix, lightTargetDirection, lightTargetPosition, lightViewPosition, lightingContext, lights, linearDepth, linearToneMapping, localId, log, log2, logarithmicDepthToViewZ, loop, luminance, mat2, mat3, mat4, matcapUV, materialAO, materialAlphaTest, materialAnisotropy, materialAnisotropyVector, materialAttenuationColor, materialAttenuationDistance, materialClearcoat, materialClearcoatNormal, materialClearcoatRoughness, materialColor, materialDispersion, materialEmissive, materialIOR, materialIridescence, materialIridescenceIOR, materialIridescenceThickness, materialLightMap, materialLineDashOffset, materialLineDashSize, materialLineGapSize, materialLineScale, materialLineWidth, materialMetalness, materialNormal, materialOpacity, materialPointSize, materialReference, materialReflectivity, materialRefractionRatio, materialRotation, materialRoughness, materialSheen, materialSheenRoughness, materialShininess, materialSpecular, materialSpecularColor, materialSpecularIntensity, materialSpecularStrength, materialThickness, materialTransmission, max, maxMipLevel, mediumpModelViewMatrix, metalness, min, mix, mixElement, mod, modInt, modelDirection, modelNormalMatrix, modelPosition, modelRadius, modelScale, modelViewMatrix, modelViewPosition, modelViewProjection, modelWorldMatrix, modelWorldMatrixInverse, morphReference, mrt, mul, mx_aastep, mx_cell_noise_float, mx_contrast, mx_fractal_noise_float, mx_fractal_noise_vec2, mx_fractal_noise_vec3, mx_fractal_noise_vec4, mx_hsvtorgb, mx_noise_float, mx_noise_vec3, mx_noise_vec4, mx_ramplr, mx_ramptb, mx_rgbtohsv, mx_safepower, mx_splitlr, mx_splittb, mx_srgb_texture_to_lin_rec709, mx_transform_uv, mx_worley_noise_float, mx_worley_noise_vec2, mx_worley_noise_vec3, negate, neutralToneMapping, nodeArray, nodeImmutable, nodeObject, nodeObjects, nodeProxy, normalFlat, normalGeometry, normalLocal, normalMap, normalView, normalWorld, normalize, not, notEqual, numWorkgroups, objectDirection, objectGroup, objectPosition, objectRadius, objectScale, objectViewPosition, objectWorldMatrix, oneMinus, or, orthographicDepthToViewZ, oscSawtooth, oscSine, oscSquare, oscTriangle, output, outputStruct, overlay, overloadingFn, parabola, parallaxDirection, parallaxUV, parameter, pass, passTexture, pcurve, perspectiveDepthToViewZ, pmremTexture, pointShadow, pointUV, pointWidth, positionGeometry, positionLocal, positionPrevious, positionView, positionViewDirection, positionWorld, positionWorldDirection, posterize, pow, pow2, pow3, pow4, property, radians, rand, range, rangeFog, rangeFogFactor, reciprocal, reference, referenceBuffer, reflect, reflectVector, reflectView, reflector, refract, refractVector, refractView, reinhardToneMapping, remainder, remap, remapClamp, renderGroup, renderOutput, rendererReference, rotate, rotateUV, roughness, round, rtt, sRGBTransferEOTF, sRGBTransferOETF, sampler, samplerComparison, saturate, saturation, screen, screenCoordinate, screenSize, screenUV, scriptable, scriptableValue, select, setCurrentStack, shaderStages, shadow, shadowPositionWorld, shapeCircle, sharedUniformGroup, sheen, sheenRoughness, shiftLeft, shiftRight, shininess, sign, sin, sinc, skinning, smoothstep, smoothstepElement, specularColor, specularF90, spherizeUV, split, spritesheetUV, sqrt, stack, step, storage, storageBarrier, storageObject, storageTexture, string, struct, sub, subgroupIndex, subgroupSize, tan, tangentGeometry, tangentLocal, tangentView, tangentWorld, temp, texture, texture3D, textureBarrier, textureBicubic, textureCubeUV, textureLoad, textureSize, textureStore, thickness, threshold, time, timerDelta, timerGlobal, timerLocal, toOutputColorSpace, toWorkingColorSpace, toneMapping, toneMappingExposure, toonOutlinePass, transformDirection, transformNormal, transformNormalToView, transformedBentNormalView, transformedBitangentView, transformedBitangentWorld, transformedClearcoatNormalView, transformedNormalView, transformedNormalWorld, transformedTangentView, transformedTangentWorld, transmission, transpose, tri, tri3, triNoise3D, triplanarTexture, triplanarTextures, trunc, tslFn, uint, uniform, uniformArray, uniformGroup, uniforms, userData, uv, uvec2, uvec3, uvec4, varying, varyingProperty, vec2, vec3, vec4, vectorComponents, velocity, vertexColor, vertexIndex, vibrance, viewZToLogarithmicDepth, viewZToOrthographicDepth, viewZToPerspectiveDepth, viewport, viewportBottomLeft, viewportCoordinate, viewportDepthTexture, viewportLinearDepth, viewportMipTexture, viewportResolution, viewportSafeUV, viewportSharedTexture, viewportSize, viewportTexture, viewportTopLeft, viewportUV, wgsl, wgslFn, workgroupArray, workgroupBarrier, workgroupId, workingToColorSpace, xor }; |
@@ -6,2 +6,2 @@ /** | ||
*/ | ||
import{TSL as e}from"three/webgpu";const t=e.BRDF_GGX,r=e.BRDF_Lambert,a=e.BasicShadowFilter,o=e.Break,i=e.Continue,n=e.DFGApprox,s=e.D_GGX,l=e.Discard,c=e.EPSILON,m=e.F_Schlick,p=e.Fn,d=e.INFINITY,u=e.If,g=e.Loop,h=e.NodeShaderStage,x=e.NodeType,f=e.NodeUpdateType,b=e.NodeAccess,w=e.PCFShadowFilter,v=e.PCFSoftShadowFilter,S=e.PI,T=e.PI2,_=e.Return,V=e.Schlick_to_F0,y=e.ScriptableNodeResources,D=e.ShaderNode,M=e.TBNViewMatrix,F=e.VSMShadowFilter,C=e.V_GGX_SmithCorrelated,I=e.abs,P=e.acesFilmicToneMapping,N=e.acos,R=e.add,B=e.addNodeElement,L=e.agxToneMapping,k=e.all,A=e.alphaT,G=e.and,O=e.anisotropy,W=e.anisotropyB,j=e.anisotropyT,U=e.any,z=e.append,q=e.array,E=e.arrayBuffer,Z=e.asin,X=e.assign,Y=e.atan,H=e.atan2,J=e.atomicAdd,K=e.atomicAnd,Q=e.atomicFunc,$=e.atomicMax,ee=e.atomicMin,te=e.atomicOr,re=e.atomicStore,ae=e.atomicSub,oe=e.atomicXor,ie=e.atomicLoad,ne=e.attenuationColor,se=e.attenuationDistance,le=e.attribute,ce=e.attributeArray,me=e.backgroundBlurriness,pe=e.backgroundIntensity,de=e.backgroundRotation,ue=e.batch,ge=e.billboarding,he=e.bitAnd,xe=e.bitNot,fe=e.bitOr,be=e.bitXor,we=e.bitangentGeometry,ve=e.bitangentLocal,Se=e.bitangentView,Te=e.bitangentWorld,_e=e.bitcast,Ve=e.blendBurn,ye=e.blendColor,De=e.blendDodge,Me=e.blendOverlay,Fe=e.blendScreen,Ce=e.blur,Ie=e.bool,Pe=e.buffer,Ne=e.bufferAttribute,Re=e.bumpMap,Be=e.burn,Le=e.bvec2,ke=e.bvec3,Ae=e.bvec4,Ge=e.bypass,Oe=e.cache,We=e.call,je=e.cameraFar,Ue=e.cameraIndex,ze=e.cameraNear,qe=e.cameraNormalMatrix,Ee=e.cameraPosition,Ze=e.cameraProjectionMatrix,Xe=e.cameraProjectionMatrixInverse,Ye=e.cameraViewMatrix,He=e.cameraWorldMatrix,Je=e.cbrt,Ke=e.cdl,Qe=e.ceil,$e=e.checker,et=e.cineonToneMapping,tt=e.clamp,rt=e.clearcoat,at=e.clearcoatRoughness,ot=e.code,it=e.color,nt=e.colorSpaceToWorking,st=e.colorToDirection,lt=e.compute,ct=e.computeSkinning,mt=e.cond,pt=e.Const,dt=e.context,ut=e.convert,gt=e.convertColorSpace,ht=e.convertToTexture,xt=e.cos,ft=e.cross,bt=e.cubeTexture,wt=e.dFdx,vt=e.dFdy,St=e.dashSize,Tt=e.debug,_t=e.defaultBuildStages,Vt=e.defaultShaderStages,yt=e.defined,Dt=e.degrees,Mt=e.deltaTime,Ft=e.densityFog,Ct=e.densityFogFactor,It=e.depth,Pt=e.depthPass,Nt=e.difference,Rt=e.diffuseColor,Bt=e.directPointLight,Lt=e.directionToColor,kt=e.dispersion,At=e.distance,Gt=e.div,Ot=e.dodge,Wt=e.dot,jt=e.drawIndex,Ut=e.dynamicBufferAttribute,zt=e.element,qt=e.emissive,Et=e.equal,Zt=e.equals,Xt=e.equirectUV,Yt=e.exp,Ht=e.exp2,Jt=e.expression,Kt=e.faceDirection,Qt=e.faceForward,$t=e.faceforward,er=e.float,tr=e.floor,rr=e.fog,ar=e.fract,or=e.frameGroup,ir=e.frameId,nr=e.frontFacing,sr=e.fwidth,lr=e.gain,cr=e.gapSize,mr=e.getConstNodeType,pr=e.getCurrentStack,dr=e.getDirection,ur=e.getDistanceAttenuation,gr=e.getGeometryRoughness,hr=e.getNormalFromDepth,xr=e.getParallaxCorrectNormal,fr=e.getRoughness,br=e.getScreenPosition,wr=e.getShIrradianceAt,vr=e.getTextureIndex,Sr=e.getViewPosition,Tr=e.glsl,_r=e.glslFn,Vr=e.grayscale,yr=e.greaterThan,Dr=e.greaterThanEqual,Mr=e.hash,Fr=e.highpModelNormalViewMatrix,Cr=e.highpModelViewMatrix,Ir=e.hue,Pr=e.instance,Nr=e.instanceIndex,Rr=e.instancedArray,Br=e.instancedBufferAttribute,Lr=e.instancedDynamicBufferAttribute,kr=e.instancedMesh,Ar=e.int,Gr=e.inverseSqrt,Or=e.inversesqrt,Wr=e.invocationLocalIndex,jr=e.invocationSubgroupIndex,Ur=e.ior,zr=e.iridescence,qr=e.iridescenceIOR,Er=e.iridescenceThickness,Zr=e.ivec2,Xr=e.ivec3,Yr=e.ivec4,Hr=e.js,Jr=e.label,Kr=e.length,Qr=e.lengthSq,$r=e.lessThan,ea=e.lessThanEqual,ta=e.lightPosition,ra=e.lightTargetDirection,aa=e.lightTargetPosition,oa=e.lightViewPosition,ia=e.lightingContext,na=e.lights,sa=e.linearDepth,la=e.linearToneMapping,ca=e.localId,ma=e.globalId,pa=e.log,da=e.log2,ua=e.logarithmicDepthToViewZ,ga=e.loop,ha=e.luminance,xa=e.mediumpModelViewMatrix,fa=e.mat2,ba=e.mat3,wa=e.mat4,va=e.matcapUV,Sa=e.materialAO,Ta=e.materialAlphaTest,_a=e.materialAnisotropy,Va=e.materialAnisotropyVector,ya=e.materialAttenuationColor,Da=e.materialAttenuationDistance,Ma=e.materialClearcoat,Fa=e.materialClearcoatNormal,Ca=e.materialClearcoatRoughness,Ia=e.materialColor,Pa=e.materialDispersion,Na=e.materialEmissive,Ra=e.materialIOR,Ba=e.materialIridescence,La=e.materialIridescenceIOR,ka=e.materialIridescenceThickness,Aa=e.materialLightMap,Ga=e.materialLineDashOffset,Oa=e.materialLineDashSize,Wa=e.materialLineGapSize,ja=e.materialLineScale,Ua=e.materialLineWidth,za=e.materialMetalness,qa=e.materialNormal,Ea=e.materialOpacity,Za=e.materialPointSize,Xa=e.materialReference,Ya=e.materialReflectivity,Ha=e.materialRefractionRatio,Ja=e.materialRotation,Ka=e.materialRoughness,Qa=e.materialSheen,$a=e.materialSheenRoughness,eo=e.materialShininess,to=e.materialSpecular,ro=e.materialSpecularColor,ao=e.materialSpecularIntensity,oo=e.materialSpecularStrength,io=e.materialThickness,no=e.materialTransmission,so=e.max,lo=e.maxMipLevel,co=e.metalness,mo=e.min,po=e.mix,uo=e.mixElement,go=e.mod,ho=e.modInt,xo=e.modelDirection,fo=e.modelNormalMatrix,bo=e.modelPosition,wo=e.modelRadius,vo=e.modelScale,So=e.modelViewMatrix,To=e.modelViewPosition,_o=e.modelViewProjection,Vo=e.modelWorldMatrix,yo=e.modelWorldMatrixInverse,Do=e.morphReference,Mo=e.mrt,Fo=e.mul,Co=e.mx_aastep,Io=e.mx_cell_noise_float,Po=e.mx_contrast,No=e.mx_fractal_noise_float,Ro=e.mx_fractal_noise_vec2,Bo=e.mx_fractal_noise_vec3,Lo=e.mx_fractal_noise_vec4,ko=e.mx_hsvtorgb,Ao=e.mx_noise_float,Go=e.mx_noise_vec3,Oo=e.mx_noise_vec4,Wo=e.mx_ramplr,jo=e.mx_ramptb,Uo=e.mx_rgbtohsv,zo=e.mx_safepower,qo=e.mx_splitlr,Eo=e.mx_splittb,Zo=e.mx_srgb_texture_to_lin_rec709,Xo=e.mx_transform_uv,Yo=e.mx_worley_noise_float,Ho=e.mx_worley_noise_vec2,Jo=e.mx_worley_noise_vec3,Ko=e.negate,Qo=e.neutralToneMapping,$o=e.nodeArray,ei=e.nodeImmutable,ti=e.nodeObject,ri=e.nodeObjects,ai=e.nodeProxy,oi=e.normalFlat,ii=e.normalGeometry,ni=e.normalLocal,si=e.normalMap,li=e.normalView,ci=e.normalWorld,mi=e.normalize,pi=e.not,di=e.notEqual,ui=e.numWorkgroups,gi=e.objectDirection,hi=e.objectGroup,xi=e.objectPosition,fi=e.objectRadius,bi=e.objectScale,wi=e.objectViewPosition,vi=e.objectWorldMatrix,Si=e.oneMinus,Ti=e.or,_i=e.orthographicDepthToViewZ,Vi=e.oscSawtooth,yi=e.oscSine,Di=e.oscSquare,Mi=e.oscTriangle,Fi=e.output,Ci=e.outputStruct,Ii=e.overlay,Pi=e.overloadingFn,Ni=e.parabola,Ri=e.parallaxDirection,Bi=e.parallaxUV,Li=e.parameter,ki=e.pass,Ai=e.passTexture,Gi=e.pcurve,Oi=e.perspectiveDepthToViewZ,Wi=e.pmremTexture,ji=e.pointUV,Ui=e.pointWidth,zi=e.positionGeometry,qi=e.positionLocal,Ei=e.positionPrevious,Zi=e.positionView,Xi=e.positionViewDirection,Yi=e.positionWorld,Hi=e.positionWorldDirection,Ji=e.posterize,Ki=e.pow,Qi=e.pow2,$i=e.pow3,en=e.pow4,tn=e.property,rn=e.radians,an=e.rand,on=e.range,nn=e.rangeFog,sn=e.rangeFogFactor,ln=e.reciprocal,cn=e.lightProjectionUV,mn=e.reference,pn=e.referenceBuffer,dn=e.reflect,un=e.reflectVector,gn=e.reflectView,hn=e.reflector,xn=e.refract,fn=e.refractVector,bn=e.refractView,wn=e.reinhardToneMapping,vn=e.remainder,Sn=e.remap,Tn=e.remapClamp,_n=e.renderGroup,Vn=e.renderOutput,yn=e.rendererReference,Dn=e.rotate,Mn=e.rotateUV,Fn=e.roughness,Cn=e.round,In=e.rtt,Pn=e.sRGBTransferEOTF,Nn=e.sRGBTransferOETF,Rn=e.sampler,Bn=e.samplerComparison,Ln=e.saturate,kn=e.saturation,An=e.screen,Gn=e.screenCoordinate,On=e.screenSize,Wn=e.screenUV,jn=e.scriptable,Un=e.scriptableValue,zn=e.select,qn=e.setCurrentStack,En=e.shaderStages,Zn=e.shadow,Xn=e.pointShadow,Yn=e.shadowPositionWorld,Hn=e.sharedUniformGroup,Jn=e.shapeCircle,Kn=e.sheen,Qn=e.sheenRoughness,$n=e.shiftLeft,es=e.shiftRight,ts=e.shininess,rs=e.sign,as=e.sin,os=e.sinc,is=e.skinning,ns=e.smoothstep,ss=e.smoothstepElement,ls=e.specularColor,cs=e.specularF90,ms=e.spherizeUV,ps=e.split,ds=e.spritesheetUV,us=e.sqrt,gs=e.stack,hs=e.step,xs=e.storage,fs=e.storageBarrier,bs=e.storageObject,ws=e.storageTexture,vs=e.string,Ss=e.struct,Ts=e.sub,_s=e.subgroupIndex,Vs=e.subgroupSize,ys=e.tan,Ds=e.tangentGeometry,Ms=e.tangentLocal,Fs=e.tangentView,Cs=e.tangentWorld,Is=e.temp,Ps=e.texture,Ns=e.texture3D,Rs=e.textureBarrier,Bs=e.textureBicubic,Ls=e.textureCubeUV,ks=e.textureLoad,As=e.textureSize,Gs=e.textureStore,Os=e.thickness,Ws=e.threshold,js=e.time,Us=e.timerDelta,zs=e.timerGlobal,qs=e.timerLocal,Es=e.toOutputColorSpace,Zs=e.toWorkingColorSpace,Xs=e.toneMapping,Ys=e.toneMappingExposure,Hs=e.toonOutlinePass,Js=e.transformDirection,Ks=e.transformNormal,Qs=e.transformNormalToView,$s=e.transformedBentNormalView,el=e.transformedBitangentView,tl=e.transformedBitangentWorld,rl=e.transformedClearcoatNormalView,al=e.transformedNormalView,ol=e.transformedNormalWorld,il=e.transformedTangentView,nl=e.transformedTangentWorld,sl=e.transmission,ll=e.transpose,cl=e.tri,ml=e.tri3,pl=e.triNoise3D,dl=e.triplanarTexture,ul=e.triplanarTextures,gl=e.trunc,hl=e.tslFn,xl=e.uint,fl=e.uniform,bl=e.uniformArray,wl=e.uniformGroup,vl=e.uniforms,Sl=e.userData,Tl=e.uv,_l=e.uvec2,Vl=e.uvec3,yl=e.uvec4,Dl=e.Var,Ml=e.varying,Fl=e.varyingProperty,Cl=e.vec2,Il=e.vec3,Pl=e.vec4,Nl=e.vectorComponents,Rl=e.velocity,Bl=e.vertexColor,Ll=e.vertexIndex,kl=e.vibrance,Al=e.viewZToLogarithmicDepth,Gl=e.viewZToOrthographicDepth,Ol=e.viewZToPerspectiveDepth,Wl=e.viewport,jl=e.viewportBottomLeft,Ul=e.viewportCoordinate,zl=e.viewportDepthTexture,ql=e.viewportLinearDepth,El=e.viewportMipTexture,Zl=e.viewportResolution,Xl=e.viewportSafeUV,Yl=e.viewportSharedTexture,Hl=e.viewportSize,Jl=e.viewportTexture,Kl=e.viewportTopLeft,Ql=e.viewportUV,$l=e.wgsl,ec=e.wgslFn,tc=e.workgroupArray,rc=e.workgroupBarrier,ac=e.workgroupId,oc=e.workingToColorSpace,ic=e.xor;export{t as BRDF_GGX,r as BRDF_Lambert,a as BasicShadowFilter,o as Break,pt as Const,i as Continue,n as DFGApprox,s as D_GGX,l as Discard,c as EPSILON,m as F_Schlick,p as Fn,d as INFINITY,u as If,g as Loop,b as NodeAccess,h as NodeShaderStage,x as NodeType,f as NodeUpdateType,w as PCFShadowFilter,v as PCFSoftShadowFilter,S as PI,T as PI2,_ as Return,V as Schlick_to_F0,y as ScriptableNodeResources,D as ShaderNode,M as TBNViewMatrix,F as VSMShadowFilter,C as V_GGX_SmithCorrelated,Dl as Var,I as abs,P as acesFilmicToneMapping,N as acos,R as add,B as addNodeElement,L as agxToneMapping,k as all,A as alphaT,G as and,O as anisotropy,W as anisotropyB,j as anisotropyT,U as any,z as append,q as array,E as arrayBuffer,Z as asin,X as assign,Y as atan,H as atan2,J as atomicAdd,K as atomicAnd,Q as atomicFunc,ie as atomicLoad,$ as atomicMax,ee as atomicMin,te as atomicOr,re as atomicStore,ae as atomicSub,oe as atomicXor,ne as attenuationColor,se as attenuationDistance,le as attribute,ce as attributeArray,me as backgroundBlurriness,pe as backgroundIntensity,de as backgroundRotation,ue as batch,ge as billboarding,he as bitAnd,xe as bitNot,fe as bitOr,be as bitXor,we as bitangentGeometry,ve as bitangentLocal,Se as bitangentView,Te as bitangentWorld,_e as bitcast,Ve as blendBurn,ye as blendColor,De as blendDodge,Me as blendOverlay,Fe as blendScreen,Ce as blur,Ie as bool,Pe as buffer,Ne as bufferAttribute,Re as bumpMap,Be as burn,Le as bvec2,ke as bvec3,Ae as bvec4,Ge as bypass,Oe as cache,We as call,je as cameraFar,Ue as cameraIndex,ze as cameraNear,qe as cameraNormalMatrix,Ee as cameraPosition,Ze as cameraProjectionMatrix,Xe as cameraProjectionMatrixInverse,Ye as cameraViewMatrix,He as cameraWorldMatrix,Je as cbrt,Ke as cdl,Qe as ceil,$e as checker,et as cineonToneMapping,tt as clamp,rt as clearcoat,at as clearcoatRoughness,ot as code,it as color,nt as colorSpaceToWorking,st as colorToDirection,lt as compute,ct as computeSkinning,mt as cond,dt as context,ut as convert,gt as convertColorSpace,ht as convertToTexture,xt as cos,ft as cross,bt as cubeTexture,wt as dFdx,vt as dFdy,St as dashSize,Tt as debug,_t as defaultBuildStages,Vt as defaultShaderStages,yt as defined,Dt as degrees,Mt as deltaTime,Ft as densityFog,Ct as densityFogFactor,It as depth,Pt as depthPass,Nt as difference,Rt as diffuseColor,Bt as directPointLight,Lt as directionToColor,kt as dispersion,At as distance,Gt as div,Ot as dodge,Wt as dot,jt as drawIndex,Ut as dynamicBufferAttribute,zt as element,qt as emissive,Et as equal,Zt as equals,Xt as equirectUV,Yt as exp,Ht as exp2,Jt as expression,Kt as faceDirection,Qt as faceForward,$t as faceforward,er as float,tr as floor,rr as fog,ar as fract,or as frameGroup,ir as frameId,nr as frontFacing,sr as fwidth,lr as gain,cr as gapSize,mr as getConstNodeType,pr as getCurrentStack,dr as getDirection,ur as getDistanceAttenuation,gr as getGeometryRoughness,hr as getNormalFromDepth,xr as getParallaxCorrectNormal,fr as getRoughness,br as getScreenPosition,wr as getShIrradianceAt,vr as getTextureIndex,Sr as getViewPosition,ma as globalId,Tr as glsl,_r as glslFn,Vr as grayscale,yr as greaterThan,Dr as greaterThanEqual,Mr as hash,Fr as highpModelNormalViewMatrix,Cr as highpModelViewMatrix,Ir as hue,Pr as instance,Nr as instanceIndex,Rr as instancedArray,Br as instancedBufferAttribute,Lr as instancedDynamicBufferAttribute,kr as instancedMesh,Ar as int,Gr as inverseSqrt,Or as inversesqrt,Wr as invocationLocalIndex,jr as invocationSubgroupIndex,Ur as ior,zr as iridescence,qr as iridescenceIOR,Er as iridescenceThickness,Zr as ivec2,Xr as ivec3,Yr as ivec4,Hr as js,Jr as label,Kr as length,Qr as lengthSq,$r as lessThan,ea as lessThanEqual,ta as lightPosition,cn as lightProjectionUV,ra as lightTargetDirection,aa as lightTargetPosition,oa as lightViewPosition,ia as lightingContext,na as lights,sa as linearDepth,la as linearToneMapping,ca as localId,pa as log,da as log2,ua as logarithmicDepthToViewZ,ga as loop,ha as luminance,fa as mat2,ba as mat3,wa as mat4,va as matcapUV,Sa as materialAO,Ta as materialAlphaTest,_a as materialAnisotropy,Va as materialAnisotropyVector,ya as materialAttenuationColor,Da as materialAttenuationDistance,Ma as materialClearcoat,Fa as materialClearcoatNormal,Ca as materialClearcoatRoughness,Ia as materialColor,Pa as materialDispersion,Na as materialEmissive,Ra as materialIOR,Ba as materialIridescence,La as materialIridescenceIOR,ka as materialIridescenceThickness,Aa as materialLightMap,Ga as materialLineDashOffset,Oa as materialLineDashSize,Wa as materialLineGapSize,ja as materialLineScale,Ua as materialLineWidth,za as materialMetalness,qa as materialNormal,Ea as materialOpacity,Za as materialPointSize,Xa as materialReference,Ya as materialReflectivity,Ha as materialRefractionRatio,Ja as materialRotation,Ka as materialRoughness,Qa as materialSheen,$a as materialSheenRoughness,eo as materialShininess,to as materialSpecular,ro as materialSpecularColor,ao as materialSpecularIntensity,oo as materialSpecularStrength,io as materialThickness,no as materialTransmission,so as max,lo as maxMipLevel,xa as mediumpModelViewMatrix,co as metalness,mo as min,po as mix,uo as mixElement,go as mod,ho as modInt,xo as modelDirection,fo as modelNormalMatrix,bo as modelPosition,wo as modelRadius,vo as modelScale,So as modelViewMatrix,To as modelViewPosition,_o as modelViewProjection,Vo as modelWorldMatrix,yo as modelWorldMatrixInverse,Do as morphReference,Mo as mrt,Fo as mul,Co as mx_aastep,Io as mx_cell_noise_float,Po as mx_contrast,No as mx_fractal_noise_float,Ro as mx_fractal_noise_vec2,Bo as mx_fractal_noise_vec3,Lo as mx_fractal_noise_vec4,ko as mx_hsvtorgb,Ao as mx_noise_float,Go as mx_noise_vec3,Oo as mx_noise_vec4,Wo as mx_ramplr,jo as mx_ramptb,Uo as mx_rgbtohsv,zo as mx_safepower,qo as mx_splitlr,Eo as mx_splittb,Zo as mx_srgb_texture_to_lin_rec709,Xo as mx_transform_uv,Yo as mx_worley_noise_float,Ho as mx_worley_noise_vec2,Jo as mx_worley_noise_vec3,Ko as negate,Qo as neutralToneMapping,$o as nodeArray,ei as nodeImmutable,ti as nodeObject,ri as nodeObjects,ai as nodeProxy,oi as normalFlat,ii as normalGeometry,ni as normalLocal,si as normalMap,li as normalView,ci as normalWorld,mi as normalize,pi as not,di as notEqual,ui as numWorkgroups,gi as objectDirection,hi as objectGroup,xi as objectPosition,fi as objectRadius,bi as objectScale,wi as objectViewPosition,vi as objectWorldMatrix,Si as oneMinus,Ti as or,_i as orthographicDepthToViewZ,Vi as oscSawtooth,yi as oscSine,Di as oscSquare,Mi as oscTriangle,Fi as output,Ci as outputStruct,Ii as overlay,Pi as overloadingFn,Ni as parabola,Ri as parallaxDirection,Bi as parallaxUV,Li as parameter,ki as pass,Ai as passTexture,Gi as pcurve,Oi as perspectiveDepthToViewZ,Wi as pmremTexture,Xn as pointShadow,ji as pointUV,Ui as pointWidth,zi as positionGeometry,qi as positionLocal,Ei as positionPrevious,Zi as positionView,Xi as positionViewDirection,Yi as positionWorld,Hi as positionWorldDirection,Ji as posterize,Ki as pow,Qi as pow2,$i as pow3,en as pow4,tn as property,rn as radians,an as rand,on as range,nn as rangeFog,sn as rangeFogFactor,ln as reciprocal,mn as reference,pn as referenceBuffer,dn as reflect,un as reflectVector,gn as reflectView,hn as reflector,xn as refract,fn as refractVector,bn as refractView,wn as reinhardToneMapping,vn as remainder,Sn as remap,Tn as remapClamp,_n as renderGroup,Vn as renderOutput,yn as rendererReference,Dn as rotate,Mn as rotateUV,Fn as roughness,Cn as round,In as rtt,Pn as sRGBTransferEOTF,Nn as sRGBTransferOETF,Rn as sampler,Bn as samplerComparison,Ln as saturate,kn as saturation,An as screen,Gn as screenCoordinate,On as screenSize,Wn as screenUV,jn as scriptable,Un as scriptableValue,zn as select,qn as setCurrentStack,En as shaderStages,Zn as shadow,Yn as shadowPositionWorld,Jn as shapeCircle,Hn as sharedUniformGroup,Kn as sheen,Qn as sheenRoughness,$n as shiftLeft,es as shiftRight,ts as shininess,rs as sign,as as sin,os as sinc,is as skinning,ns as smoothstep,ss as smoothstepElement,ls as specularColor,cs as specularF90,ms as spherizeUV,ps as split,ds as spritesheetUV,us as sqrt,gs as stack,hs as step,xs as storage,fs as storageBarrier,bs as storageObject,ws as storageTexture,vs as string,Ss as struct,Ts as sub,_s as subgroupIndex,Vs as subgroupSize,ys as tan,Ds as tangentGeometry,Ms as tangentLocal,Fs as tangentView,Cs as tangentWorld,Is as temp,Ps as texture,Ns as texture3D,Rs as textureBarrier,Bs as textureBicubic,Ls as textureCubeUV,ks as textureLoad,As as textureSize,Gs as textureStore,Os as thickness,Ws as threshold,js as time,Us as timerDelta,zs as timerGlobal,qs as timerLocal,Es as toOutputColorSpace,Zs as toWorkingColorSpace,Xs as toneMapping,Ys as toneMappingExposure,Hs as toonOutlinePass,Js as transformDirection,Ks as transformNormal,Qs as transformNormalToView,$s as transformedBentNormalView,el as transformedBitangentView,tl as transformedBitangentWorld,rl as transformedClearcoatNormalView,al as transformedNormalView,ol as transformedNormalWorld,il as transformedTangentView,nl as transformedTangentWorld,sl as transmission,ll as transpose,cl as tri,ml as tri3,pl as triNoise3D,dl as triplanarTexture,ul as triplanarTextures,gl as trunc,hl as tslFn,xl as uint,fl as uniform,bl as uniformArray,wl as uniformGroup,vl as uniforms,Sl as userData,Tl as uv,_l as uvec2,Vl as uvec3,yl as uvec4,Ml as varying,Fl as varyingProperty,Cl as vec2,Il as vec3,Pl as vec4,Nl as vectorComponents,Rl as velocity,Bl as vertexColor,Ll as vertexIndex,kl as vibrance,Al as viewZToLogarithmicDepth,Gl as viewZToOrthographicDepth,Ol as viewZToPerspectiveDepth,Wl as viewport,jl as viewportBottomLeft,Ul as viewportCoordinate,zl as viewportDepthTexture,ql as viewportLinearDepth,El as viewportMipTexture,Zl as viewportResolution,Xl as viewportSafeUV,Yl as viewportSharedTexture,Hl as viewportSize,Jl as viewportTexture,Kl as viewportTopLeft,Ql as viewportUV,$l as wgsl,ec as wgslFn,tc as workgroupArray,rc as workgroupBarrier,ac as workgroupId,oc as workingToColorSpace,ic as xor}; | ||
import{TSL as e}from"three/webgpu";const t=e.BRDF_GGX,r=e.BRDF_Lambert,a=e.BasicShadowFilter,o=e.Break,i=e.Continue,n=e.DFGApprox,l=e.D_GGX,s=e.Discard,c=e.EPSILON,m=e.F_Schlick,p=e.Fn,d=e.INFINITY,u=e.If,g=e.Switch,h=e.Loop,f=e.NodeShaderStage,x=e.NodeType,b=e.NodeUpdateType,w=e.NodeAccess,v=e.PCFShadowFilter,S=e.PCFSoftShadowFilter,T=e.PI,_=e.PI2,V=e.Return,y=e.Schlick_to_F0,M=e.ScriptableNodeResources,D=e.ShaderNode,F=e.TBNViewMatrix,C=e.VSMShadowFilter,I=e.V_GGX_SmithCorrelated,P=e.abs,R=e.acesFilmicToneMapping,N=e.acos,B=e.add,L=e.addNodeElement,k=e.agxToneMapping,A=e.all,G=e.alphaT,O=e.and,W=e.anisotropy,j=e.anisotropyB,U=e.anisotropyT,z=e.any,q=e.append,E=e.array,Z=e.arrayBuffer,X=e.asin,Y=e.assign,H=e.atan,J=e.atan2,K=e.atomicAdd,Q=e.atomicAnd,$=e.atomicFunc,ee=e.atomicMax,te=e.atomicMin,re=e.atomicOr,ae=e.atomicStore,oe=e.atomicSub,ie=e.atomicXor,ne=e.atomicLoad,le=e.attenuationColor,se=e.attenuationDistance,ce=e.attribute,me=e.attributeArray,pe=e.backgroundBlurriness,de=e.backgroundIntensity,ue=e.backgroundRotation,ge=e.batch,he=e.billboarding,fe=e.bitAnd,xe=e.bitNot,be=e.bitOr,we=e.bitXor,ve=e.bitangentGeometry,Se=e.bitangentLocal,Te=e.bitangentView,_e=e.bitangentWorld,Ve=e.bitcast,ye=e.blendBurn,Me=e.blendColor,De=e.blendDodge,Fe=e.blendOverlay,Ce=e.blendScreen,Ie=e.blur,Pe=e.bool,Re=e.buffer,Ne=e.bufferAttribute,Be=e.bumpMap,Le=e.burn,ke=e.bvec2,Ae=e.bvec3,Ge=e.bvec4,Oe=e.bypass,We=e.cache,je=e.call,Ue=e.cameraFar,ze=e.cameraIndex,qe=e.cameraNear,Ee=e.cameraNormalMatrix,Ze=e.cameraPosition,Xe=e.cameraProjectionMatrix,Ye=e.cameraProjectionMatrixInverse,He=e.cameraViewMatrix,Je=e.cameraWorldMatrix,Ke=e.cbrt,Qe=e.cdl,$e=e.ceil,et=e.checker,tt=e.cineonToneMapping,rt=e.clamp,at=e.clearcoat,ot=e.clearcoatRoughness,it=e.code,nt=e.color,lt=e.colorSpaceToWorking,st=e.colorToDirection,ct=e.compute,mt=e.computeSkinning,pt=e.cond,dt=e.Const,ut=e.context,gt=e.convert,ht=e.convertColorSpace,ft=e.convertToTexture,xt=e.cos,bt=e.cross,wt=e.cubeTexture,vt=e.dFdx,St=e.dFdy,Tt=e.dashSize,_t=e.debug,Vt=e.decrement,yt=e.decrementBefore,Mt=e.defaultBuildStages,Dt=e.defaultShaderStages,Ft=e.defined,Ct=e.degrees,It=e.deltaTime,Pt=e.densityFog,Rt=e.densityFogFactor,Nt=e.depth,Bt=e.depthPass,Lt=e.difference,kt=e.diffuseColor,At=e.directPointLight,Gt=e.directionToColor,Ot=e.dispersion,Wt=e.distance,jt=e.div,Ut=e.dodge,zt=e.dot,qt=e.drawIndex,Et=e.dynamicBufferAttribute,Zt=e.element,Xt=e.emissive,Yt=e.equal,Ht=e.equals,Jt=e.equirectUV,Kt=e.exp,Qt=e.exp2,$t=e.expression,er=e.faceDirection,tr=e.faceForward,rr=e.faceforward,ar=e.float,or=e.floor,ir=e.fog,nr=e.fract,lr=e.frameGroup,sr=e.frameId,cr=e.frontFacing,mr=e.fwidth,pr=e.gain,dr=e.gapSize,ur=e.getConstNodeType,gr=e.getCurrentStack,hr=e.getDirection,fr=e.getDistanceAttenuation,xr=e.getGeometryRoughness,br=e.getNormalFromDepth,wr=e.getParallaxCorrectNormal,vr=e.getRoughness,Sr=e.getScreenPosition,Tr=e.getShIrradianceAt,_r=e.getTextureIndex,Vr=e.getViewPosition,yr=e.getShadowMaterial,Mr=e.getShadowRenderObjectFunction,Dr=e.glsl,Fr=e.glslFn,Cr=e.grayscale,Ir=e.greaterThan,Pr=e.greaterThanEqual,Rr=e.hash,Nr=e.highpModelNormalViewMatrix,Br=e.highpModelViewMatrix,Lr=e.hue,kr=e.increment,Ar=e.incrementBefore,Gr=e.instance,Or=e.instanceIndex,Wr=e.instancedArray,jr=e.instancedBufferAttribute,Ur=e.instancedDynamicBufferAttribute,zr=e.instancedMesh,qr=e.int,Er=e.inverseSqrt,Zr=e.inversesqrt,Xr=e.invocationLocalIndex,Yr=e.invocationSubgroupIndex,Hr=e.ior,Jr=e.iridescence,Kr=e.iridescenceIOR,Qr=e.iridescenceThickness,$r=e.ivec2,ea=e.ivec3,ta=e.ivec4,ra=e.js,aa=e.label,oa=e.length,ia=e.lengthSq,na=e.lessThan,la=e.lessThanEqual,sa=e.lightPosition,ca=e.lightShadowMatrix,ma=e.lightTargetDirection,pa=e.lightTargetPosition,da=e.lightViewPosition,ua=e.lightingContext,ga=e.lights,ha=e.linearDepth,fa=e.linearToneMapping,xa=e.localId,ba=e.globalId,wa=e.log,va=e.log2,Sa=e.logarithmicDepthToViewZ,Ta=e.loop,_a=e.luminance,Va=e.mediumpModelViewMatrix,ya=e.mat2,Ma=e.mat3,Da=e.mat4,Fa=e.matcapUV,Ca=e.materialAO,Ia=e.materialAlphaTest,Pa=e.materialAnisotropy,Ra=e.materialAnisotropyVector,Na=e.materialAttenuationColor,Ba=e.materialAttenuationDistance,La=e.materialClearcoat,ka=e.materialClearcoatNormal,Aa=e.materialClearcoatRoughness,Ga=e.materialColor,Oa=e.materialDispersion,Wa=e.materialEmissive,ja=e.materialIOR,Ua=e.materialIridescence,za=e.materialIridescenceIOR,qa=e.materialIridescenceThickness,Ea=e.materialLightMap,Za=e.materialLineDashOffset,Xa=e.materialLineDashSize,Ya=e.materialLineGapSize,Ha=e.materialLineScale,Ja=e.materialLineWidth,Ka=e.materialMetalness,Qa=e.materialNormal,$a=e.materialOpacity,eo=e.materialPointSize,to=e.materialReference,ro=e.materialReflectivity,ao=e.materialRefractionRatio,oo=e.materialRotation,io=e.materialRoughness,no=e.materialSheen,lo=e.materialSheenRoughness,so=e.materialShininess,co=e.materialSpecular,mo=e.materialSpecularColor,po=e.materialSpecularIntensity,uo=e.materialSpecularStrength,go=e.materialThickness,ho=e.materialTransmission,fo=e.max,xo=e.maxMipLevel,bo=e.metalness,wo=e.min,vo=e.mix,So=e.mixElement,To=e.mod,_o=e.modInt,Vo=e.modelDirection,yo=e.modelNormalMatrix,Mo=e.modelPosition,Do=e.modelRadius,Fo=e.modelScale,Co=e.modelViewMatrix,Io=e.modelViewPosition,Po=e.modelViewProjection,Ro=e.modelWorldMatrix,No=e.modelWorldMatrixInverse,Bo=e.morphReference,Lo=e.mrt,ko=e.mul,Ao=e.mx_aastep,Go=e.mx_cell_noise_float,Oo=e.mx_contrast,Wo=e.mx_fractal_noise_float,jo=e.mx_fractal_noise_vec2,Uo=e.mx_fractal_noise_vec3,zo=e.mx_fractal_noise_vec4,qo=e.mx_hsvtorgb,Eo=e.mx_noise_float,Zo=e.mx_noise_vec3,Xo=e.mx_noise_vec4,Yo=e.mx_ramplr,Ho=e.mx_ramptb,Jo=e.mx_rgbtohsv,Ko=e.mx_safepower,Qo=e.mx_splitlr,$o=e.mx_splittb,ei=e.mx_srgb_texture_to_lin_rec709,ti=e.mx_transform_uv,ri=e.mx_worley_noise_float,ai=e.mx_worley_noise_vec2,oi=e.mx_worley_noise_vec3,ii=e.negate,ni=e.neutralToneMapping,li=e.nodeArray,si=e.nodeImmutable,ci=e.nodeObject,mi=e.nodeObjects,pi=e.nodeProxy,di=e.normalFlat,ui=e.normalGeometry,gi=e.normalLocal,hi=e.normalMap,fi=e.normalView,xi=e.normalWorld,bi=e.normalize,wi=e.not,vi=e.notEqual,Si=e.numWorkgroups,Ti=e.objectDirection,_i=e.objectGroup,Vi=e.objectPosition,yi=e.objectRadius,Mi=e.objectScale,Di=e.objectViewPosition,Fi=e.objectWorldMatrix,Ci=e.oneMinus,Ii=e.or,Pi=e.orthographicDepthToViewZ,Ri=e.oscSawtooth,Ni=e.oscSine,Bi=e.oscSquare,Li=e.oscTriangle,ki=e.output,Ai=e.outputStruct,Gi=e.overlay,Oi=e.overloadingFn,Wi=e.parabola,ji=e.parallaxDirection,Ui=e.parallaxUV,zi=e.parameter,qi=e.pass,Ei=e.passTexture,Zi=e.pcurve,Xi=e.perspectiveDepthToViewZ,Yi=e.pmremTexture,Hi=e.pointUV,Ji=e.pointWidth,Ki=e.positionGeometry,Qi=e.positionLocal,$i=e.positionPrevious,en=e.positionView,tn=e.positionViewDirection,rn=e.positionWorld,an=e.positionWorldDirection,on=e.posterize,nn=e.pow,ln=e.pow2,sn=e.pow3,cn=e.pow4,mn=e.property,pn=e.radians,dn=e.rand,un=e.range,gn=e.rangeFog,hn=e.rangeFogFactor,fn=e.reciprocal,xn=e.lightProjectionUV,bn=e.reference,wn=e.referenceBuffer,vn=e.reflect,Sn=e.reflectVector,Tn=e.reflectView,_n=e.reflector,Vn=e.refract,yn=e.refractVector,Mn=e.refractView,Dn=e.reinhardToneMapping,Fn=e.remainder,Cn=e.remap,In=e.remapClamp,Pn=e.renderGroup,Rn=e.renderOutput,Nn=e.rendererReference,Bn=e.rotate,Ln=e.rotateUV,kn=e.roughness,An=e.round,Gn=e.rtt,On=e.sRGBTransferEOTF,Wn=e.sRGBTransferOETF,jn=e.sampler,Un=e.samplerComparison,zn=e.saturate,qn=e.saturation,En=e.screen,Zn=e.screenCoordinate,Xn=e.screenSize,Yn=e.screenUV,Hn=e.scriptable,Jn=e.scriptableValue,Kn=e.select,Qn=e.setCurrentStack,$n=e.shaderStages,el=e.shadow,tl=e.pointShadow,rl=e.shadowPositionWorld,al=e.sharedUniformGroup,ol=e.shapeCircle,il=e.sheen,nl=e.sheenRoughness,ll=e.shiftLeft,sl=e.shiftRight,cl=e.shininess,ml=e.sign,pl=e.sin,dl=e.sinc,ul=e.skinning,gl=e.smoothstep,hl=e.smoothstepElement,fl=e.specularColor,xl=e.specularF90,bl=e.spherizeUV,wl=e.split,vl=e.spritesheetUV,Sl=e.sqrt,Tl=e.stack,_l=e.step,Vl=e.storage,yl=e.storageBarrier,Ml=e.storageObject,Dl=e.storageTexture,Fl=e.string,Cl=e.struct,Il=e.sub,Pl=e.subgroupIndex,Rl=e.subgroupSize,Nl=e.tan,Bl=e.tangentGeometry,Ll=e.tangentLocal,kl=e.tangentView,Al=e.tangentWorld,Gl=e.temp,Ol=e.texture,Wl=e.texture3D,jl=e.textureBarrier,Ul=e.textureBicubic,zl=e.textureCubeUV,ql=e.textureLoad,El=e.textureSize,Zl=e.textureStore,Xl=e.thickness,Yl=e.threshold,Hl=e.time,Jl=e.timerDelta,Kl=e.timerGlobal,Ql=e.timerLocal,$l=e.toOutputColorSpace,es=e.toWorkingColorSpace,ts=e.toneMapping,rs=e.toneMappingExposure,as=e.toonOutlinePass,os=e.transformDirection,is=e.transformNormal,ns=e.transformNormalToView,ls=e.transformedBentNormalView,ss=e.transformedBitangentView,cs=e.transformedBitangentWorld,ms=e.transformedClearcoatNormalView,ps=e.transformedNormalView,ds=e.transformedNormalWorld,us=e.transformedTangentView,gs=e.transformedTangentWorld,hs=e.transmission,fs=e.transpose,xs=e.tri,bs=e.tri3,ws=e.triNoise3D,vs=e.triplanarTexture,Ss=e.triplanarTextures,Ts=e.trunc,_s=e.tslFn,Vs=e.uint,ys=e.uniform,Ms=e.uniformArray,Ds=e.uniformGroup,Fs=e.uniforms,Cs=e.userData,Is=e.uv,Ps=e.uvec2,Rs=e.uvec3,Ns=e.uvec4,Bs=e.Var,Ls=e.varying,ks=e.varyingProperty,As=e.vec2,Gs=e.vec3,Os=e.vec4,Ws=e.vectorComponents,js=e.velocity,Us=e.vertexColor,zs=e.vertexIndex,qs=e.vibrance,Es=e.viewZToLogarithmicDepth,Zs=e.viewZToOrthographicDepth,Xs=e.viewZToPerspectiveDepth,Ys=e.viewport,Hs=e.viewportBottomLeft,Js=e.viewportCoordinate,Ks=e.viewportDepthTexture,Qs=e.viewportLinearDepth,$s=e.viewportMipTexture,ec=e.viewportResolution,tc=e.viewportSafeUV,rc=e.viewportSharedTexture,ac=e.viewportSize,oc=e.viewportTexture,ic=e.viewportTopLeft,nc=e.viewportUV,lc=e.wgsl,sc=e.wgslFn,cc=e.workgroupArray,mc=e.workgroupBarrier,pc=e.workgroupId,dc=e.workingToColorSpace,uc=e.xor;export{t as BRDF_GGX,r as BRDF_Lambert,a as BasicShadowFilter,o as Break,dt as Const,i as Continue,n as DFGApprox,l as D_GGX,s as Discard,c as EPSILON,m as F_Schlick,p as Fn,d as INFINITY,u as If,h as Loop,w as NodeAccess,f as NodeShaderStage,x as NodeType,b as NodeUpdateType,v as PCFShadowFilter,S as PCFSoftShadowFilter,T as PI,_ as PI2,V as Return,y as Schlick_to_F0,M as ScriptableNodeResources,D as ShaderNode,g as Switch,F as TBNViewMatrix,C as VSMShadowFilter,I as V_GGX_SmithCorrelated,Bs as Var,P as abs,R as acesFilmicToneMapping,N as acos,B as add,L as addNodeElement,k as agxToneMapping,A as all,G as alphaT,O as and,W as anisotropy,j as anisotropyB,U as anisotropyT,z as any,q as append,E as array,Z as arrayBuffer,X as asin,Y as assign,H as atan,J as atan2,K as atomicAdd,Q as atomicAnd,$ as atomicFunc,ne as atomicLoad,ee as atomicMax,te as atomicMin,re as atomicOr,ae as atomicStore,oe as atomicSub,ie as atomicXor,le as attenuationColor,se as attenuationDistance,ce as attribute,me as attributeArray,pe as backgroundBlurriness,de as backgroundIntensity,ue as backgroundRotation,ge as batch,he as billboarding,fe as bitAnd,xe as bitNot,be as bitOr,we as bitXor,ve as bitangentGeometry,Se as bitangentLocal,Te as bitangentView,_e as bitangentWorld,Ve as bitcast,ye as blendBurn,Me as blendColor,De as blendDodge,Fe as blendOverlay,Ce as blendScreen,Ie as blur,Pe as bool,Re as buffer,Ne as bufferAttribute,Be as bumpMap,Le as burn,ke as bvec2,Ae as bvec3,Ge as bvec4,Oe as bypass,We as cache,je as call,Ue as cameraFar,ze as cameraIndex,qe as cameraNear,Ee as cameraNormalMatrix,Ze as cameraPosition,Xe as cameraProjectionMatrix,Ye as cameraProjectionMatrixInverse,He as cameraViewMatrix,Je as cameraWorldMatrix,Ke as cbrt,Qe as cdl,$e as ceil,et as checker,tt as cineonToneMapping,rt as clamp,at as clearcoat,ot as clearcoatRoughness,it as code,nt as color,lt as colorSpaceToWorking,st as colorToDirection,ct as compute,mt as computeSkinning,pt as cond,ut as context,gt as convert,ht as convertColorSpace,ft as convertToTexture,xt as cos,bt as cross,wt as cubeTexture,vt as dFdx,St as dFdy,Tt as dashSize,_t as debug,Vt as decrement,yt as decrementBefore,Mt as defaultBuildStages,Dt as defaultShaderStages,Ft as defined,Ct as degrees,It as deltaTime,Pt as densityFog,Rt as densityFogFactor,Nt as depth,Bt as depthPass,Lt as difference,kt as diffuseColor,At as directPointLight,Gt as directionToColor,Ot as dispersion,Wt as distance,jt as div,Ut as dodge,zt as dot,qt as drawIndex,Et as dynamicBufferAttribute,Zt as element,Xt as emissive,Yt as equal,Ht as equals,Jt as equirectUV,Kt as exp,Qt as exp2,$t as expression,er as faceDirection,tr as faceForward,rr as faceforward,ar as float,or as floor,ir as fog,nr as fract,lr as frameGroup,sr as frameId,cr as frontFacing,mr as fwidth,pr as gain,dr as gapSize,ur as getConstNodeType,gr as getCurrentStack,hr as getDirection,fr as getDistanceAttenuation,xr as getGeometryRoughness,br as getNormalFromDepth,wr as getParallaxCorrectNormal,vr as getRoughness,Sr as getScreenPosition,Tr as getShIrradianceAt,yr as getShadowMaterial,Mr as getShadowRenderObjectFunction,_r as getTextureIndex,Vr as getViewPosition,ba as globalId,Dr as glsl,Fr as glslFn,Cr as grayscale,Ir as greaterThan,Pr as greaterThanEqual,Rr as hash,Nr as highpModelNormalViewMatrix,Br as highpModelViewMatrix,Lr as hue,kr as increment,Ar as incrementBefore,Gr as instance,Or as instanceIndex,Wr as instancedArray,jr as instancedBufferAttribute,Ur as instancedDynamicBufferAttribute,zr as instancedMesh,qr as int,Er as inverseSqrt,Zr as inversesqrt,Xr as invocationLocalIndex,Yr as invocationSubgroupIndex,Hr as ior,Jr as iridescence,Kr as iridescenceIOR,Qr as iridescenceThickness,$r as ivec2,ea as ivec3,ta as ivec4,ra as js,aa as label,oa as length,ia as lengthSq,na as lessThan,la as lessThanEqual,sa as lightPosition,xn as lightProjectionUV,ca as lightShadowMatrix,ma as lightTargetDirection,pa as lightTargetPosition,da as lightViewPosition,ua as lightingContext,ga as lights,ha as linearDepth,fa as linearToneMapping,xa as localId,wa as log,va as log2,Sa as logarithmicDepthToViewZ,Ta as loop,_a as luminance,ya as mat2,Ma as mat3,Da as mat4,Fa as matcapUV,Ca as materialAO,Ia as materialAlphaTest,Pa as materialAnisotropy,Ra as materialAnisotropyVector,Na as materialAttenuationColor,Ba as materialAttenuationDistance,La as materialClearcoat,ka as materialClearcoatNormal,Aa as materialClearcoatRoughness,Ga as materialColor,Oa as materialDispersion,Wa as materialEmissive,ja as materialIOR,Ua as materialIridescence,za as materialIridescenceIOR,qa as materialIridescenceThickness,Ea as materialLightMap,Za as materialLineDashOffset,Xa as materialLineDashSize,Ya as materialLineGapSize,Ha as materialLineScale,Ja as materialLineWidth,Ka as materialMetalness,Qa as materialNormal,$a as materialOpacity,eo as materialPointSize,to as materialReference,ro as materialReflectivity,ao as materialRefractionRatio,oo as materialRotation,io as materialRoughness,no as materialSheen,lo as materialSheenRoughness,so as materialShininess,co as materialSpecular,mo as materialSpecularColor,po as materialSpecularIntensity,uo as materialSpecularStrength,go as materialThickness,ho as materialTransmission,fo as max,xo as maxMipLevel,Va as mediumpModelViewMatrix,bo as metalness,wo as min,vo as mix,So as mixElement,To as mod,_o as modInt,Vo as modelDirection,yo as modelNormalMatrix,Mo as modelPosition,Do as modelRadius,Fo as modelScale,Co as modelViewMatrix,Io as modelViewPosition,Po as modelViewProjection,Ro as modelWorldMatrix,No as modelWorldMatrixInverse,Bo as morphReference,Lo as mrt,ko as mul,Ao as mx_aastep,Go as mx_cell_noise_float,Oo as mx_contrast,Wo as mx_fractal_noise_float,jo as mx_fractal_noise_vec2,Uo as mx_fractal_noise_vec3,zo as mx_fractal_noise_vec4,qo as mx_hsvtorgb,Eo as mx_noise_float,Zo as mx_noise_vec3,Xo as mx_noise_vec4,Yo as mx_ramplr,Ho as mx_ramptb,Jo as mx_rgbtohsv,Ko as mx_safepower,Qo as mx_splitlr,$o as mx_splittb,ei as mx_srgb_texture_to_lin_rec709,ti as mx_transform_uv,ri as mx_worley_noise_float,ai as mx_worley_noise_vec2,oi as mx_worley_noise_vec3,ii as negate,ni as neutralToneMapping,li as nodeArray,si as nodeImmutable,ci as nodeObject,mi as nodeObjects,pi as nodeProxy,di as normalFlat,ui as normalGeometry,gi as normalLocal,hi as normalMap,fi as normalView,xi as normalWorld,bi as normalize,wi as not,vi as notEqual,Si as numWorkgroups,Ti as objectDirection,_i as objectGroup,Vi as objectPosition,yi as objectRadius,Mi as objectScale,Di as objectViewPosition,Fi as objectWorldMatrix,Ci as oneMinus,Ii as or,Pi as orthographicDepthToViewZ,Ri as oscSawtooth,Ni as oscSine,Bi as oscSquare,Li as oscTriangle,ki as output,Ai as outputStruct,Gi as overlay,Oi as overloadingFn,Wi as parabola,ji as parallaxDirection,Ui as parallaxUV,zi as parameter,qi as pass,Ei as passTexture,Zi as pcurve,Xi as perspectiveDepthToViewZ,Yi as pmremTexture,tl as pointShadow,Hi as pointUV,Ji as pointWidth,Ki as positionGeometry,Qi as positionLocal,$i as positionPrevious,en as positionView,tn as positionViewDirection,rn as positionWorld,an as positionWorldDirection,on as posterize,nn as pow,ln as pow2,sn as pow3,cn as pow4,mn as property,pn as radians,dn as rand,un as range,gn as rangeFog,hn as rangeFogFactor,fn as reciprocal,bn as reference,wn as referenceBuffer,vn as reflect,Sn as reflectVector,Tn as reflectView,_n as reflector,Vn as refract,yn as refractVector,Mn as refractView,Dn as reinhardToneMapping,Fn as remainder,Cn as remap,In as remapClamp,Pn as renderGroup,Rn as renderOutput,Nn as rendererReference,Bn as rotate,Ln as rotateUV,kn as roughness,An as round,Gn as rtt,On as sRGBTransferEOTF,Wn as sRGBTransferOETF,jn as sampler,Un as samplerComparison,zn as saturate,qn as saturation,En as screen,Zn as screenCoordinate,Xn as screenSize,Yn as screenUV,Hn as scriptable,Jn as scriptableValue,Kn as select,Qn as setCurrentStack,$n as shaderStages,el as shadow,rl as shadowPositionWorld,ol as shapeCircle,al as sharedUniformGroup,il as sheen,nl as sheenRoughness,ll as shiftLeft,sl as shiftRight,cl as shininess,ml as sign,pl as sin,dl as sinc,ul as skinning,gl as smoothstep,hl as smoothstepElement,fl as specularColor,xl as specularF90,bl as spherizeUV,wl as split,vl as spritesheetUV,Sl as sqrt,Tl as stack,_l as step,Vl as storage,yl as storageBarrier,Ml as storageObject,Dl as storageTexture,Fl as string,Cl as struct,Il as sub,Pl as subgroupIndex,Rl as subgroupSize,Nl as tan,Bl as tangentGeometry,Ll as tangentLocal,kl as tangentView,Al as tangentWorld,Gl as temp,Ol as texture,Wl as texture3D,jl as textureBarrier,Ul as textureBicubic,zl as textureCubeUV,ql as textureLoad,El as textureSize,Zl as textureStore,Xl as thickness,Yl as threshold,Hl as time,Jl as timerDelta,Kl as timerGlobal,Ql as timerLocal,$l as toOutputColorSpace,es as toWorkingColorSpace,ts as toneMapping,rs as toneMappingExposure,as as toonOutlinePass,os as transformDirection,is as transformNormal,ns as transformNormalToView,ls as transformedBentNormalView,ss as transformedBitangentView,cs as transformedBitangentWorld,ms as transformedClearcoatNormalView,ps as transformedNormalView,ds as transformedNormalWorld,us as transformedTangentView,gs as transformedTangentWorld,hs as transmission,fs as transpose,xs as tri,bs as tri3,ws as triNoise3D,vs as triplanarTexture,Ss as triplanarTextures,Ts as trunc,_s as tslFn,Vs as uint,ys as uniform,Ms as uniformArray,Ds as uniformGroup,Fs as uniforms,Cs as userData,Is as uv,Ps as uvec2,Rs as uvec3,Ns as uvec4,Ls as varying,ks as varyingProperty,As as vec2,Gs as vec3,Os as vec4,Ws as vectorComponents,js as velocity,Us as vertexColor,zs as vertexIndex,qs as vibrance,Es as viewZToLogarithmicDepth,Zs as viewZToOrthographicDepth,Xs as viewZToPerspectiveDepth,Ys as viewport,Hs as viewportBottomLeft,Js as viewportCoordinate,Ks as viewportDepthTexture,Qs as viewportLinearDepth,$s as viewportMipTexture,ec as viewportResolution,tc as viewportSafeUV,rc as viewportSharedTexture,ac as viewportSize,oc as viewportTexture,ic as viewportTopLeft,nc as viewportUV,lc as wgsl,sc as wgslFn,cc as workgroupArray,mc as workgroupBarrier,pc as workgroupId,dc as workingToColorSpace,uc as xor}; |
@@ -14,2 +14,3 @@ import { | ||
* @hideconstructor | ||
* @three_import import { AnimationClipCreator } from 'three/addons/animation/AnimationClipCreator.js'; | ||
*/ | ||
@@ -16,0 +17,0 @@ class AnimationClipCreator { |
@@ -16,3 +16,3 @@ import { | ||
const _q = new Quaternion(); | ||
const _quaternion = new Quaternion(); | ||
const _targetPos = new Vector3(); | ||
@@ -33,2 +33,4 @@ const _targetVec = new Vector3(); | ||
* `CCDIKSolver` is designed to work with instances of {@link SkinnedMesh}. | ||
* | ||
* @three_import import { CCDIKSolver } from 'three/addons/animation/CCDIKSolver.js'; | ||
*/ | ||
@@ -197,4 +199,4 @@ class CCDIKSolver { | ||
_q.setFromAxisAngle( _axis, angle ); | ||
link.quaternion.multiply( _q ); | ||
_quaternion.setFromAxisAngle( _axis, angle ); | ||
link.quaternion.multiply( _quaternion ); | ||
@@ -328,2 +330,3 @@ // TODO: re-consider the limitation specification | ||
* @augments Object3D | ||
* @three_import import { CCDIKHelper } from 'three/addons/animation/CCDIKSolver.js'; | ||
*/ | ||
@@ -330,0 +333,0 @@ class CCDIKHelper extends Object3D { |
@@ -5,2 +5,3 @@ /** | ||
* @hideconstructor | ||
* @three_import import WebGL from 'three/addons/capabilities/WebGL.js'; | ||
*/ | ||
@@ -7,0 +8,0 @@ class WebGL { |
@@ -13,2 +13,3 @@ let isAvailable = ( typeof navigator !== 'undefined' && navigator.gpu !== undefined ); | ||
* @hideconstructor | ||
* @three_import import WebGPU from 'three/addons/capabilities/WebGPU.js'; | ||
*/ | ||
@@ -15,0 +16,0 @@ class WebGPU { |
@@ -55,2 +55,3 @@ import { | ||
* @augments Controls | ||
* @three_import import { DragControls } from 'three/addons/controls/DragControls.js'; | ||
*/ | ||
@@ -57,0 +58,0 @@ class DragControls extends Controls { |
@@ -17,2 +17,3 @@ import { | ||
* @augments Controls | ||
* @three_import import { FirstPersonControls } from 'three/addons/controls/FirstPersonControls.js'; | ||
*/ | ||
@@ -19,0 +20,0 @@ class FirstPersonControls extends Controls { |
@@ -24,2 +24,3 @@ import { | ||
* @augments Controls | ||
* @three_import import { FlyControls } from 'three/addons/controls/FlyControls.js'; | ||
*/ | ||
@@ -26,0 +27,0 @@ class FlyControls extends Controls { |
@@ -15,2 +15,3 @@ import { MOUSE, TOUCH } from 'three'; | ||
* @augments OrbitControls | ||
* @three_import import { MapControls } from 'three/addons/controls/MapControls.js'; | ||
*/ | ||
@@ -17,0 +18,0 @@ class MapControls extends OrbitControls { |
@@ -86,2 +86,3 @@ import { | ||
* @augments Controls | ||
* @three_import import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; | ||
*/ | ||
@@ -88,0 +89,0 @@ class OrbitControls extends Controls { |
@@ -34,2 +34,3 @@ import { | ||
const _MOUSE_SENSITIVITY = 0.002; | ||
const _PI_2 = Math.PI / 2; | ||
@@ -59,2 +60,3 @@ | ||
* @augments Controls | ||
* @three_import import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js'; | ||
*/ | ||
@@ -205,3 +207,3 @@ class PointerLockControls extends Controls { | ||
* Activates the pointer lock. | ||
* | ||
* | ||
* @param {boolean} [unadjustedMovement=false] - Disables OS-level adjustment for mouse acceleration, and accesses raw mouse input instead. | ||
@@ -238,4 +240,4 @@ * Setting it to true will disable mouse acceleration. | ||
_euler.y -= event.movementX * 0.002 * this.pointerSpeed; | ||
_euler.x -= event.movementY * 0.002 * this.pointerSpeed; | ||
_euler.y -= event.movementX * _MOUSE_SENSITIVITY * this.pointerSpeed; | ||
_euler.x -= event.movementY * _MOUSE_SENSITIVITY * this.pointerSpeed; | ||
@@ -242,0 +244,0 @@ _euler.x = Math.max( _PI_2 - this.maxPolarAngle, Math.min( _PI_2 - this.minPolarAngle, _euler.x ) ); |
@@ -54,2 +54,3 @@ import { | ||
* @augments Controls | ||
* @three_import import { TrackballControls } from 'three/addons/controls/TrackballControls.js'; | ||
*/ | ||
@@ -56,0 +57,0 @@ class TrackballControls extends Controls { |
@@ -75,2 +75,3 @@ import { | ||
* @augments Controls | ||
* @three_import import { TransformControls } from 'three/addons/controls/TransformControls.js'; | ||
*/ | ||
@@ -77,0 +78,0 @@ class TransformControls extends Controls { |
@@ -28,2 +28,4 @@ import { | ||
* use {@link CSMShadowNode} instead. | ||
* | ||
* @three_import import { CSM } from 'three/addons/csm/CSM.js'; | ||
*/ | ||
@@ -30,0 +32,0 @@ export class CSM { |
@@ -7,2 +7,4 @@ import { Vector3, Matrix4 } from 'three'; | ||
* Represents the frustum of a CSM instance. | ||
* | ||
* @three_import import { CSMFrustum } from 'three/addons/csm/CSMFrustum.js'; | ||
*/ | ||
@@ -9,0 +11,0 @@ class CSMFrustum { |
@@ -19,2 +19,3 @@ import { | ||
* @augments Group | ||
* @three_import import { CSMHelper } from 'three/addons/csm/CSMHelper.js'; | ||
*/ | ||
@@ -21,0 +22,0 @@ class CSMHelper extends Group { |
import { ShaderChunk } from 'three'; | ||
/** @module CSMShader */ | ||
/** | ||
* @module CSMShader | ||
* @three_import import { CSMShader } from 'three/addons/csm/CSMShader.js'; | ||
*/ | ||
@@ -5,0 +8,0 @@ /** |
@@ -45,2 +45,3 @@ import { | ||
* @augments ShadowBaseNode | ||
* @three_import import { CSMShadowNode } from 'three/addons/csm/CSMShadowNode.js'; | ||
*/ | ||
@@ -47,0 +48,0 @@ class CSMShadowNode extends ShadowBaseNode { |
@@ -20,2 +20,3 @@ import { | ||
* @augments Curve | ||
* @three_import import { GrannyKnot } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -51,2 +52,3 @@ class GrannyKnot extends Curve { | ||
* @augments Curve | ||
* @three_import import { HeartCurve } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -101,2 +103,3 @@ class HeartCurve extends Curve { | ||
* @augments Curve | ||
* @three_import import { VivianiCurve } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -152,2 +155,3 @@ class VivianiCurve extends Curve { | ||
* @augments Curve | ||
* @three_import import { KnotCurve } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -186,2 +190,3 @@ class KnotCurve extends Curve { | ||
* @augments Curve | ||
* @three_import import { HelixCurve } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -220,2 +225,3 @@ class HelixCurve extends Curve { | ||
* @augments Curve | ||
* @three_import import { TrefoilKnot } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -270,2 +276,3 @@ class TrefoilKnot extends Curve { | ||
* @augments Curve | ||
* @three_import import { TorusKnot } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -323,2 +330,3 @@ class TorusKnot extends Curve { | ||
* @augments Curve | ||
* @three_import import { CinquefoilKnot } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -376,2 +384,3 @@ class CinquefoilKnot extends Curve { | ||
* @augments Curve | ||
* @three_import import { TrefoilPolynomialKnot } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -433,2 +442,3 @@ class TrefoilPolynomialKnot extends Curve { | ||
* @augments Curve | ||
* @three_import import { FigureEightPolynomialKnot } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -483,2 +493,3 @@ class FigureEightPolynomialKnot extends Curve { | ||
* @augments Curve | ||
* @three_import import { DecoratedTorusKnot4a } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -533,2 +544,3 @@ class DecoratedTorusKnot4a extends Curve { | ||
* @augments Curve | ||
* @three_import import { DecoratedTorusKnot4b } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -583,2 +595,3 @@ class DecoratedTorusKnot4b extends Curve { | ||
* @augments Curve | ||
* @three_import import { DecoratedTorusKnot5a } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -633,2 +646,3 @@ class DecoratedTorusKnot5a extends Curve { | ||
* @augments Curve | ||
* @three_import import { DecoratedTorusKnot5c } from 'three/addons/curves/CurveExtras.js'; | ||
*/ | ||
@@ -635,0 +649,0 @@ class DecoratedTorusKnot5c extends Curve { |
@@ -14,2 +14,3 @@ import { | ||
* @augments Curve | ||
* @three_import import { NURBSCurve } from 'three/addons/curves/NURBSCurve.js'; | ||
*/ | ||
@@ -16,0 +17,0 @@ class NURBSCurve extends Curve { |
@@ -10,2 +10,4 @@ import { | ||
* Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. | ||
* | ||
* @three_import import { NURBSSurface } from 'three/addons/curves/NURBSSurface.js'; | ||
*/ | ||
@@ -12,0 +14,0 @@ class NURBSSurface { |
@@ -6,3 +6,6 @@ import { | ||
/** @module NURBSUtils */ | ||
/** | ||
* @module NURBSUtils | ||
* @three_import import * as NURBSUtils from 'three/addons/curves/NURBSUtils.js'; | ||
*/ | ||
@@ -9,0 +12,0 @@ /** |
@@ -10,2 +10,4 @@ import { | ||
* Implementation is based on `(x, y [, z=0 [, w=1]])` control points with `w=weight`. | ||
* | ||
* @three_import import { NURBSVolume } from 'three/addons/curves/NURBSVolume.js'; | ||
*/ | ||
@@ -12,0 +14,0 @@ class NURBSVolume { |
@@ -17,2 +17,4 @@ import { | ||
* When using {@link WebGPURenderer}, use {@link AnaglyphPassNode}. | ||
* | ||
* @three_import import { AnaglyphEffect } from 'three/addons/effects/AnaglyphEffect.js'; | ||
*/ | ||
@@ -19,0 +21,0 @@ class AnaglyphEffect { |
@@ -5,2 +5,4 @@ /** | ||
* The ASCII generation is based on [jsascii]{@link https://github.com/hassadee/jsascii/blob/master/jsascii.js}. | ||
* | ||
* @three_import import { AsciiEffect } from 'three/addons/effects/AsciiEffect.js'; | ||
*/ | ||
@@ -7,0 +9,0 @@ class AsciiEffect { |
@@ -24,2 +24,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { OutlineEffect } from 'three/addons/effects/OutlineEffect.js'; | ||
*/ | ||
@@ -26,0 +28,0 @@ class OutlineEffect { |
@@ -16,2 +16,4 @@ import { | ||
* When using {@link WebGPURenderer}, use {@link ParallaxBarrierPassNode}. | ||
* | ||
* @three_import import { ParallaxBarrierEffect } from 'three/addons/effects/ParallaxBarrierEffect.js'; | ||
*/ | ||
@@ -18,0 +20,0 @@ class ParallaxBarrierEffect { |
@@ -11,2 +11,4 @@ import { | ||
* Reference: [Reflective Prism]{@link http://www.instructables.com/id/Reflective-Prism/?ALLSTEPS} | ||
* | ||
* @three_import import { PeppersGhostEffect } from 'three/addons/effects/PeppersGhostEffect.js'; | ||
*/ | ||
@@ -13,0 +15,0 @@ class PeppersGhostEffect { |
@@ -11,2 +11,4 @@ import { | ||
* When using {@link WebGPURenderer}, use {@link StereoPassNode}. | ||
* | ||
* @three_import import { StereoEffect } from 'three/addons/effects/StereoEffect.js'; | ||
*/ | ||
@@ -13,0 +15,0 @@ class StereoEffect { |
@@ -29,2 +29,3 @@ import { | ||
* @augments Scene | ||
* @three_import import { DebugEnvironment } from 'three/addons/environments/DebugEnvironment.js'; | ||
*/ | ||
@@ -31,0 +32,0 @@ class DebugEnvironment extends Scene { |
import { | ||
BackSide, | ||
BoxGeometry, | ||
InstancedMesh, | ||
Mesh, | ||
@@ -9,2 +10,3 @@ MeshBasicMaterial, | ||
Scene, | ||
Object3D, | ||
} from 'three'; | ||
@@ -30,2 +32,3 @@ | ||
* @augments Scene | ||
* @three_import import { RoomEnvironment } from 'three/addons/environments/RoomEnvironment.js'; | ||
*/ | ||
@@ -53,39 +56,50 @@ class RoomEnvironment extends Scene { | ||
const box1 = new Mesh( geometry, boxMaterial ); | ||
box1.position.set( - 10.906, 2.009, 1.846 ); | ||
box1.rotation.set( 0, - 0.195, 0 ); | ||
box1.scale.set( 2.328, 7.905, 4.651 ); | ||
this.add( box1 ); | ||
const boxes = new InstancedMesh( geometry, boxMaterial, 6 ); | ||
const transform = new Object3D(); | ||
const box2 = new Mesh( geometry, boxMaterial ); | ||
box2.position.set( - 5.607, - 0.754, - 0.758 ); | ||
box2.rotation.set( 0, 0.994, 0 ); | ||
box2.scale.set( 1.970, 1.534, 3.955 ); | ||
this.add( box2 ); | ||
// box1 | ||
transform.position.set( - 10.906, 2.009, 1.846 ); | ||
transform.rotation.set( 0, - 0.195, 0 ); | ||
transform.scale.set( 2.328, 7.905, 4.651 ); | ||
transform.updateMatrix(); | ||
boxes.setMatrixAt( 0, transform.matrix ); | ||
const box3 = new Mesh( geometry, boxMaterial ); | ||
box3.position.set( 6.167, 0.857, 7.803 ); | ||
box3.rotation.set( 0, 0.561, 0 ); | ||
box3.scale.set( 3.927, 6.285, 3.687 ); | ||
this.add( box3 ); | ||
// box2 | ||
transform.position.set( - 5.607, - 0.754, - 0.758 ); | ||
transform.rotation.set( 0, 0.994, 0 ); | ||
transform.scale.set( 1.970, 1.534, 3.955 ); | ||
transform.updateMatrix(); | ||
boxes.setMatrixAt( 1, transform.matrix ); | ||
const box4 = new Mesh( geometry, boxMaterial ); | ||
box4.position.set( - 2.017, 0.018, 6.124 ); | ||
box4.rotation.set( 0, 0.333, 0 ); | ||
box4.scale.set( 2.002, 4.566, 2.064 ); | ||
this.add( box4 ); | ||
// box3 | ||
transform.position.set( 6.167, 0.857, 7.803 ); | ||
transform.rotation.set( 0, 0.561, 0 ); | ||
transform.scale.set( 3.927, 6.285, 3.687 ); | ||
transform.updateMatrix(); | ||
boxes.setMatrixAt( 2, transform.matrix ); | ||
const box5 = new Mesh( geometry, boxMaterial ); | ||
box5.position.set( 2.291, - 0.756, - 2.621 ); | ||
box5.rotation.set( 0, - 0.286, 0 ); | ||
box5.scale.set( 1.546, 1.552, 1.496 ); | ||
this.add( box5 ); | ||
// box4 | ||
transform.position.set( - 2.017, 0.018, 6.124 ); | ||
transform.rotation.set( 0, 0.333, 0 ); | ||
transform.scale.set( 2.002, 4.566, 2.064 ); | ||
transform.updateMatrix(); | ||
boxes.setMatrixAt( 3, transform.matrix ); | ||
const box6 = new Mesh( geometry, boxMaterial ); | ||
box6.position.set( - 2.193, - 0.369, - 5.547 ); | ||
box6.rotation.set( 0, 0.516, 0 ); | ||
box6.scale.set( 3.875, 3.487, 2.986 ); | ||
this.add( box6 ); | ||
// box5 | ||
transform.position.set( 2.291, - 0.756, - 2.621 ); | ||
transform.rotation.set( 0, - 0.286, 0 ); | ||
transform.scale.set( 1.546, 1.552, 1.496 ); | ||
transform.updateMatrix(); | ||
boxes.setMatrixAt( 4, transform.matrix ); | ||
// box6 | ||
transform.position.set( - 2.193, - 0.369, - 5.547 ); | ||
transform.rotation.set( 0, 0.516, 0 ); | ||
transform.scale.set( 3.875, 3.487, 2.986 ); | ||
transform.updateMatrix(); | ||
boxes.setMatrixAt( 5, transform.matrix ); | ||
this.add( boxes ); | ||
// -x right | ||
@@ -92,0 +106,0 @@ const light1 = new Mesh( geometry, createAreaLightMaterial( 50 ) ); |
@@ -22,2 +22,4 @@ import { Color, ColorManagement, SRGBColorSpace } from 'three'; | ||
* ``` | ||
* | ||
* @three_import import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js'; | ||
*/ | ||
@@ -31,3 +33,3 @@ class DRACOExporter { | ||
* @param {DRACOExporter~Options} options - The export options. | ||
* @return {ArrayBuffer} The exported Draco. | ||
* @return {Int8Array} The exported Draco. | ||
*/ | ||
@@ -34,0 +36,0 @@ parse( object, options = {} ) { |
@@ -29,2 +29,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { EXRExporter } from 'three/addons/exporters/EXRExporter.js'; | ||
*/ | ||
@@ -31,0 +33,0 @@ class EXRExporter { |
@@ -137,2 +137,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { KTX2Exporter } from 'three/addons/exporters/KTX2Exporter.js'; | ||
*/ | ||
@@ -139,0 +141,0 @@ export class KTX2Exporter { |
@@ -19,2 +19,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { OBJExporter } from 'three/addons/exporters/OBJExporter.js'; | ||
*/ | ||
@@ -21,0 +23,0 @@ class OBJExporter { |
@@ -21,2 +21,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { PLYExporter } from 'three/addons/exporters/PLYExporter.js'; | ||
*/ | ||
@@ -23,0 +25,0 @@ class PLYExporter { |
@@ -15,2 +15,4 @@ import { Vector3 } from 'three'; | ||
* ``` | ||
* | ||
* @three_import import { STLExporter } from 'three/addons/exporters/STLExporter.js'; | ||
*/ | ||
@@ -17,0 +19,0 @@ class STLExporter { |
@@ -19,2 +19,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { USDZExporter } from 'three/addons/exporters/USDZExporter.js'; | ||
*/ | ||
@@ -21,0 +23,0 @@ class USDZExporter { |
@@ -17,2 +17,3 @@ import { | ||
* @augments BufferGeometry | ||
* @three_import import { BoxLineGeometry } from 'three/addons/geometries/BoxLineGeometry.js'; | ||
*/ | ||
@@ -19,0 +20,0 @@ class BoxLineGeometry extends BufferGeometry { |
@@ -19,2 +19,3 @@ import { | ||
* @augments BufferGeometry | ||
* @three_import import { ConvexGeometry } from 'three/addons/geometries/ConvexGeometry.js'; | ||
*/ | ||
@@ -21,0 +22,0 @@ class ConvexGeometry extends BufferGeometry { |
@@ -28,2 +28,3 @@ import { | ||
* @augments BufferGeometry | ||
* @three_import import { DecalGeometry } from 'three/addons/geometries/DecalGeometry.js'; | ||
*/ | ||
@@ -30,0 +31,0 @@ class DecalGeometry extends BufferGeometry { |
/** @module ParametricFunctions */ | ||
/** | ||
* @module ParametricFunctions | ||
* @three_import import * as ParametricFunctions from 'three/addons/geometries/ParametricFunctions.js'; | ||
*/ | ||
@@ -4,0 +7,0 @@ /** |
@@ -20,2 +20,3 @@ import { | ||
* @augments BufferGeometry | ||
* @three_import import { ParametricGeometry } from 'three/addons/geometries/ParametricGeometry.js'; | ||
*/ | ||
@@ -22,0 +23,0 @@ class ParametricGeometry extends BufferGeometry { |
@@ -52,2 +52,3 @@ import { | ||
* @augments BoxGeometry | ||
* @three_import import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js'; | ||
*/ | ||
@@ -54,0 +55,0 @@ class RoundedBoxGeometry extends BoxGeometry { |
@@ -29,2 +29,3 @@ import { | ||
* @augments BufferGeometry | ||
* @three_import import { TeapotGeometry } from 'three/addons/geometries/TeapotGeometry.js'; | ||
*/ | ||
@@ -31,0 +32,0 @@ class TeapotGeometry extends BufferGeometry { |
@@ -26,2 +26,3 @@ import { | ||
* @augments ExtrudeGeometry | ||
* @three_import import { TextGeometry } from 'three/addons/geometries/TextGeometry.js'; | ||
*/ | ||
@@ -28,0 +29,0 @@ class TextGeometry extends ExtrudeGeometry { |
@@ -19,2 +19,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelper.js'; | ||
*/ | ||
@@ -21,0 +22,0 @@ class LightProbeHelper extends Mesh { |
@@ -21,2 +21,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { LightProbeHelper } from 'three/addons/helpers/LightProbeHelperGPU.js'; | ||
*/ | ||
@@ -23,0 +24,0 @@ class LightProbeHelper extends Mesh { |
@@ -17,2 +17,3 @@ import { | ||
* @augments LineSegments | ||
* @three_import import { OctreeHelper } from 'three/addons/helpers/OctreeHelper.js'; | ||
*/ | ||
@@ -19,0 +20,0 @@ class OctreeHelper extends LineSegments { |
@@ -24,2 +24,3 @@ import { | ||
* @augments Line | ||
* @three_import import { PositionalAudioHelper } from 'three/addons/helpers/PositionalAudioHelper.js'; | ||
*/ | ||
@@ -26,0 +27,0 @@ class PositionalAudioHelper extends Line { |
@@ -23,2 +23,3 @@ import { | ||
* @augments Line | ||
* @three_import import { RectAreaLightHelper } from 'three/addons/helpers/RectAreaLightHelper.js'; | ||
*/ | ||
@@ -25,0 +26,0 @@ class RectAreaLightHelper extends Line { |
@@ -21,2 +21,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { TextureHelper } from 'three/addons/helpers/TextureHelper.js'; | ||
*/ | ||
@@ -23,0 +24,0 @@ class TextureHelper extends Mesh { |
@@ -23,2 +23,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { TextureHelper } from 'three/addons/helpers/TextureHelperGPU.js'; | ||
*/ | ||
@@ -25,0 +26,0 @@ class TextureHelper extends Mesh { |
@@ -30,2 +30,3 @@ import { | ||
* @augments LineSegments | ||
* @three_import import { VertexNormalsHelper } from 'three/addons/helpers/VertexNormalsHelper.js'; | ||
*/ | ||
@@ -32,0 +33,0 @@ class VertexNormalsHelper extends LineSegments { |
@@ -23,2 +23,3 @@ import { | ||
* @augments LineSegments | ||
* @three_import import { VertexTangentsHelper } from 'three/addons/helpers/VertexTangentsHelper.js'; | ||
*/ | ||
@@ -25,0 +26,0 @@ class VertexTangentsHelper extends LineSegments { |
@@ -29,2 +29,3 @@ import { | ||
* @augments Object3D | ||
* @three_import import { ViewHelper } from 'three/addons/helpers/ViewHelper.js'; | ||
*/ | ||
@@ -31,0 +32,0 @@ class ViewHelper extends Object3D { |
@@ -26,2 +26,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { HTMLMesh } from 'three/addons/interactive/HTMLMesh.js'; | ||
*/ | ||
@@ -28,0 +29,0 @@ class HTMLMesh extends Mesh { |
@@ -37,2 +37,3 @@ import { | ||
* @augments Group | ||
* @three_import import { InteractiveGroup } from 'three/addons/interactive/InteractiveGroup.js'; | ||
*/ | ||
@@ -39,0 +40,0 @@ class InteractiveGroup extends Group { |
@@ -40,2 +40,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { SelectionBox } from 'three/addons/interactive/SelectionBox.js'; | ||
*/ | ||
@@ -42,0 +44,0 @@ class SelectionBox { |
@@ -7,2 +7,4 @@ import { Vector2 } from 'three'; | ||
* It visualizes the current selection box with a `div` container element. | ||
* | ||
* @three_import import { SelectionHelper } from 'three/addons/interactive/SelectionHelper.js'; | ||
*/ | ||
@@ -9,0 +11,0 @@ class SelectionHelper { |
@@ -14,2 +14,3 @@ import { Lighting } from 'three/webgpu'; | ||
* @augments Lighting | ||
* @three_import import { TiledLighting } from 'three/addons/lighting/TiledLighting.js'; | ||
*/ | ||
@@ -16,0 +17,0 @@ export class TiledLighting extends Lighting { |
@@ -18,2 +18,3 @@ import { | ||
* @hideconstructor | ||
* @three_import import { LightProbeGenerator } from 'three/addons/lights/LightProbeGenerator.js'; | ||
*/ | ||
@@ -20,0 +21,0 @@ class LightProbeGenerator { |
@@ -15,2 +15,3 @@ import { UniformsLib } from 'three'; | ||
* @hideconstructor | ||
* @three_import import { RectAreaLightUniformsLib } from 'three/addons/lights/RectAreaLightUniformsLib.js'; | ||
*/ | ||
@@ -17,0 +18,0 @@ class RectAreaLightUniformsLib { |
@@ -27,2 +27,3 @@ import { LineSegments2 } from '../lines/LineSegments2.js'; | ||
* @augments LineSegments2 | ||
* @three_import import { Line2 } from 'three/addons/lines/Line2.js'; | ||
*/ | ||
@@ -29,0 +30,0 @@ class Line2 extends LineSegments2 { |
@@ -20,2 +20,3 @@ import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js'; | ||
* @augments LineSegmentsGeometry | ||
* @three_import import { LineLineGeometry2 } from 'three/addons/lines/LineGeometry.js'; | ||
*/ | ||
@@ -22,0 +23,0 @@ class LineGeometry extends LineSegmentsGeometry { |
@@ -416,2 +416,3 @@ import { | ||
* @augments ShaderMaterial | ||
* @three_import import { LineMaterial } from 'three/addons/lines/LineMaterial.js'; | ||
*/ | ||
@@ -418,0 +419,0 @@ class LineMaterial extends ShaderMaterial { |
@@ -249,2 +249,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { LineSegments2 } from 'three/addons/lines/LineSegments2.js'; | ||
*/ | ||
@@ -251,0 +252,0 @@ class LineSegments2 extends Mesh { |
@@ -21,2 +21,3 @@ import { | ||
* @augments InstancedBufferGeometry | ||
* @three_import import { LineSegmentsGeometry } from 'three/addons/lines/LineSegmentsGeometry.js'; | ||
*/ | ||
@@ -23,0 +24,0 @@ class LineSegmentsGeometry extends InstancedBufferGeometry { |
@@ -17,2 +17,3 @@ import { Line2NodeMaterial } from 'three/webgpu'; | ||
* @augments LineSegments2 | ||
* @three_import import { Line2 } from 'three/addons/lines/webgpu/Line2.js'; | ||
*/ | ||
@@ -19,0 +20,0 @@ class Line2 extends LineSegments2 { |
@@ -97,5 +97,6 @@ import { | ||
const projectionMatrix = camera.projectionMatrix; | ||
const resolution = lineSegments.resolution; | ||
const matrixWorld = lineSegments.matrixWorld; | ||
const resolution = lineSegments._resolution; | ||
const geometry = lineSegments.geometry; | ||
@@ -238,2 +239,3 @@ const instanceStart = geometry.attributes.instanceStart; | ||
* @augments Mesh | ||
* @three_import import { LineSegments2 } from 'three/addons/lines/webgpu/LineSegments2.js'; | ||
*/ | ||
@@ -240,0 +242,0 @@ class LineSegments2 extends Mesh { |
@@ -21,2 +21,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { Wireframe } from 'three/addons/lines/webgpu/Wireframe.js'; | ||
*/ | ||
@@ -23,0 +24,0 @@ class Wireframe extends Mesh { |
@@ -30,2 +30,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { Wireframe } from 'three/addons/lines/Wireframe.js'; | ||
*/ | ||
@@ -32,0 +33,0 @@ class Wireframe extends Mesh { |
@@ -17,2 +17,3 @@ import { | ||
* @augments LineSegmentsGeometry | ||
* @three_import import { WireframeGeometry2 } from 'three/addons/lines/WireframeGeometry2.js'; | ||
*/ | ||
@@ -19,0 +20,0 @@ class WireframeGeometry2 extends LineSegmentsGeometry { |
@@ -51,2 +51,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { Rhino3dmLoader } from 'three/addons/loaders/3DMLoader.js'; | ||
*/ | ||
@@ -53,0 +54,0 @@ class Rhino3dmLoader extends Loader { |
@@ -51,2 +51,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { ThreeMFLoader } from 'three/addons/loaders/3MFLoader.js'; | ||
*/ | ||
@@ -53,0 +54,0 @@ class ThreeMFLoader extends Loader { |
@@ -27,2 +27,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { AMFLoader } from 'three/addons/loaders/AMFLoader.js'; | ||
*/ | ||
@@ -29,0 +30,0 @@ class AMFLoader extends Loader { |
@@ -34,2 +34,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { BVHLoader } from 'three/addons/loaders/BVHLoader.js'; | ||
*/ | ||
@@ -36,0 +37,0 @@ class BVHLoader extends Loader { |
@@ -23,2 +23,3 @@ import { | ||
* @augments CompressedTextureLoader | ||
* @three_import import { DDSLoader } from 'three/addons/loaders/DDSLoader.js'; | ||
*/ | ||
@@ -25,0 +26,0 @@ class DDSLoader extends CompressedTextureLoader { |
@@ -44,2 +44,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { DRACOLoader } from 'three/addons/loaders/DRACOLoader.js'; | ||
*/ | ||
@@ -46,0 +47,0 @@ class DRACOLoader extends Loader { |
@@ -95,2 +95,3 @@ import { | ||
* @augments DataTextureLoader | ||
* @three_import import { EXRLoader } from 'three/addons/loaders/EXRLoader.js'; | ||
*/ | ||
@@ -97,0 +98,0 @@ class EXRLoader extends DataTextureLoader { |
@@ -18,2 +18,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { FontLoader } from 'three/addons/loaders/FontLoader.js'; | ||
*/ | ||
@@ -20,0 +21,0 @@ class FontLoader extends Loader { |
@@ -23,2 +23,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { GCodeLoader } from 'three/addons/loaders/GCodeLoader.js'; | ||
*/ | ||
@@ -25,0 +26,0 @@ class GCodeLoader extends Loader { |
@@ -26,2 +26,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { HDRCubeTextureLoader } from 'three/addons/loaders/HDRCubeTextureLoader.js'; | ||
*/ | ||
@@ -28,0 +29,0 @@ class HDRCubeTextureLoader extends Loader { |
@@ -28,2 +28,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { IESLoader } from 'three/addons/loaders/IESLoader.js'; | ||
*/ | ||
@@ -30,0 +31,0 @@ class IESLoader extends Loader { |
@@ -21,2 +21,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { KMZLoader } from 'three/addons/loaders/KMZLoader.js'; | ||
*/ | ||
@@ -23,0 +24,0 @@ class KMZLoader extends Loader { |
@@ -93,2 +93,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js'; | ||
*/ | ||
@@ -95,0 +96,0 @@ class KTX2Loader extends Loader { |
@@ -20,2 +20,3 @@ import { | ||
* @augments CompressedTextureLoader | ||
* @three_import import { KTXLoader } from 'three/addons/loaders/KTXLoader.js'; | ||
*/ | ||
@@ -22,0 +23,0 @@ class KTXLoader extends CompressedTextureLoader { |
@@ -1779,2 +1779,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { LDrawLoader } from 'three/addons/loaders/LDrawLoader.js'; | ||
*/ | ||
@@ -2084,3 +2085,3 @@ class LDrawLoader extends Loader { | ||
// see if we can get the final material from from the "getMaterial" function which will attempt to | ||
// see if we can get the final material from the "getMaterial" function which will attempt to | ||
// parse the "direct" colors | ||
@@ -2087,0 +2088,0 @@ material = loader.getMaterial( colorCode ); |
@@ -32,2 +32,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { LottieLoader } from 'three/addons/loaders/LottieLoader.js'; | ||
*/ | ||
@@ -37,2 +38,16 @@ class LottieLoader extends Loader { | ||
/** | ||
* Constructs a new Lottie loader. | ||
* | ||
* @deprecated The loader has been deprecated and will be removed with r186. Use lottie-web instead and create your animated texture manually. | ||
* @param {LoadingManager} [manager] - The loading manager. | ||
*/ | ||
constructor( manager ) { | ||
super( manager ); | ||
console.warn( 'THREE.LottieLoader: The loader has been deprecated and will be removed with r186. Use lottie-web instead and create your animated texture manually.' ); | ||
} | ||
/** | ||
* Sets the texture quality. | ||
@@ -39,0 +54,0 @@ * |
@@ -24,2 +24,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { LUT3dlLoader } from 'three/addons/loaders/LUT3dlLoader.js'; | ||
*/ | ||
@@ -26,0 +27,0 @@ export class LUT3dlLoader extends Loader { |
@@ -23,2 +23,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { LUTCubeLoader } from 'three/addons/loaders/LUTCubeLoader.js'; | ||
*/ | ||
@@ -25,0 +26,0 @@ export class LUTCubeLoader extends Loader { |
@@ -20,2 +20,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { LUTImageLoader } from 'three/addons/loaders/LUTImageLoader.js'; | ||
*/ | ||
@@ -22,0 +23,0 @@ export class LUTImageLoader extends Loader { |
@@ -89,3 +89,3 @@ /** | ||
var topForm = this.reader.getIDTag(); | ||
const topForm = this.reader.getIDTag(); | ||
@@ -99,3 +99,3 @@ if ( topForm !== 'FORM' ) { | ||
var length = this.reader.getUint32(); | ||
const length = this.reader.getUint32(); | ||
@@ -105,3 +105,3 @@ this.debugger.dataOffset = this.reader.offset; | ||
var type = this.reader.getIDTag(); | ||
const type = this.reader.getIDTag(); | ||
@@ -135,3 +135,3 @@ if ( type === 'LWO2' ) { | ||
var type = this.reader.getIDTag(); | ||
const type = this.reader.getIDTag(); | ||
@@ -357,5 +357,5 @@ switch ( type ) { | ||
var name = this.reader.getString(); | ||
const name = this.reader.getString(); | ||
var surface = { | ||
const surface = { | ||
attributes: {}, // LWO2 style non-node attributes will go here | ||
@@ -380,5 +380,5 @@ connections: {}, | ||
var name = this.reader.getString(); | ||
const name = this.reader.getString(); | ||
var surface = { | ||
const surface = { | ||
attributes: {}, // LWO2 style non-node attributes will go here | ||
@@ -407,5 +407,5 @@ connections: {}, | ||
this.reader.skip( 8 ); // NRNM + length | ||
var name = this.reader.getString(); | ||
const name = this.reader.getString(); | ||
var node = { | ||
const node = { | ||
name: name | ||
@@ -435,3 +435,3 @@ }; | ||
this.reader.skip( 8 ); // NAME + length | ||
var name = this.reader.getString(); | ||
const name = this.reader.getString(); | ||
this.currentForm = this.currentNode.attributes; | ||
@@ -449,3 +449,3 @@ | ||
var valueType = this.reader.getString(); | ||
const valueType = this.reader.getString(); | ||
@@ -492,3 +492,3 @@ if ( valueType === 'double' ) { | ||
var map = {}; | ||
const map = {}; | ||
this.currentForm.maps.push( map ); | ||
@@ -554,3 +554,3 @@ this.currentForm = map; | ||
var tag = this.reader.getIDTag(); | ||
const tag = this.reader.getIDTag(); | ||
@@ -576,3 +576,3 @@ // inside surface node | ||
var texture = { | ||
const texture = { | ||
index: this.reader.getUint32() | ||
@@ -587,3 +587,3 @@ }; | ||
var texture = { | ||
const texture = { | ||
index: this.reader.getUint32(), | ||
@@ -596,4 +596,4 @@ fileName: '' | ||
var tag = this.reader.getIDTag(); | ||
var n_length = this.reader.getUint16(); | ||
const tag = this.reader.getIDTag(); | ||
const n_length = this.reader.getUint16(); | ||
if ( tag === 'STIL' ) { | ||
@@ -628,3 +628,3 @@ | ||
var endOffset = this.reader.offset + length - 4; | ||
const endOffset = this.reader.offset + length - 4; | ||
this.reader.skip( 8 ); | ||
@@ -640,3 +640,3 @@ | ||
var endOffset = this.reader.offset + length - 4; | ||
const endOffset = this.reader.offset + length - 4; | ||
this.reader.skip( 8 ); | ||
@@ -670,6 +670,6 @@ | ||
var number = this.reader.getUint16(); | ||
var flags = this.reader.getUint16(); // If the least significant bit of flags is set, the layer is hidden. | ||
var pivot = this.reader.getFloat32Array( 3 ); // Note: this seems to be superfluous, as the geometry is translated when pivot is present | ||
var layer = { | ||
const number = this.reader.getUint16(); | ||
const flags = this.reader.getUint16(); // If the least significant bit of flags is set, the layer is hidden. | ||
const pivot = this.reader.getFloat32Array( 3 ); // Note: this seems to be superfluous, as the geometry is translated when pivot is present | ||
const layer = { | ||
number: number, | ||
@@ -684,3 +684,3 @@ flags: flags, // If the least significant bit of flags is set, the layer is hidden. | ||
var parsedLength = 16 + stringOffset( this.currentLayer.name ); // index ( 2 ) + flags( 2 ) + pivot( 12 ) + stringlength | ||
const parsedLength = 16 + stringOffset( this.currentLayer.name ); // index ( 2 ) + flags( 2 ) + pivot( 12 ) + stringlength | ||
@@ -698,3 +698,3 @@ // if we have not reached then end of the layer block, there must be a parent defined | ||
this.currentPoints = []; | ||
for ( var i = 0; i < length / 4; i += 3 ) { | ||
for ( let i = 0; i < length / 4; i += 3 ) { | ||
@@ -720,5 +720,5 @@ // x -> -x to match three.js right handed coords | ||
var finalOffset = this.reader.offset + length; | ||
const finalOffset = this.reader.offset + length; | ||
var channelName = this.reader.getString(); | ||
const channelName = this.reader.getString(); | ||
@@ -736,8 +736,8 @@ if ( this.reader.offset === finalOffset ) { | ||
var type = this.reader.getIDTag(); | ||
const type = this.reader.getIDTag(); | ||
this.reader.getUint16(); // dimension | ||
var name = this.reader.getString(); | ||
const name = this.reader.getString(); | ||
var remainingLength = length - 6 - stringOffset( name ); | ||
const remainingLength = length - 6 - stringOffset( name ); | ||
@@ -773,5 +773,5 @@ switch ( type ) { | ||
var uvIndices = []; | ||
var polyIndices = []; | ||
var uvs = []; | ||
const uvIndices = []; | ||
const polyIndices = []; | ||
const uvs = []; | ||
@@ -813,4 +813,4 @@ while ( this.reader.offset < finalOffset ) { | ||
var indices = []; | ||
var points = []; | ||
const indices = []; | ||
const points = []; | ||
@@ -841,23 +841,23 @@ type = ( type === 'MORF' ) ? 'relative' : 'absolute'; | ||
var finalOffset = this.reader.offset + length; | ||
var type = this.reader.getIDTag(); | ||
const finalOffset = this.reader.offset + length; | ||
const type = this.reader.getIDTag(); | ||
var indices = []; | ||
const indices = []; | ||
// hold a list of polygon sizes, to be split up later | ||
var polygonDimensions = []; | ||
const polygonDimensions = []; | ||
while ( this.reader.offset < finalOffset ) { | ||
var numverts = this.reader.getUint16(); | ||
let numverts = this.reader.getUint16(); | ||
//var flags = numverts & 64512; // 6 high order bits are flags - ignoring for now | ||
//const flags = numverts & 64512; // 6 high order bits are flags - ignoring for now | ||
numverts = numverts & 1023; // remaining ten low order bits are vertex num | ||
polygonDimensions.push( numverts ); | ||
for ( var j = 0; j < numverts; j ++ ) indices.push( this.reader.getVariableLengthIndex() ); | ||
for ( let j = 0; j < numverts; j ++ ) indices.push( this.reader.getVariableLengthIndex() ); | ||
} | ||
var geometryData = { | ||
const geometryData = { | ||
type: type, | ||
@@ -889,4 +889,4 @@ vertexIndices: indices, | ||
var finalOffset = this.reader.offset + length; | ||
var type = this.reader.getIDTag(); | ||
const finalOffset = this.reader.offset + length; | ||
const type = this.reader.getIDTag(); | ||
if ( type === 'SURF' ) this.parseMaterialIndices( finalOffset ); | ||
@@ -908,4 +908,4 @@ else { //PART, SMGP, COLR not supported | ||
var polygonIndex = this.reader.getVariableLengthIndex(); | ||
var materialIndex = this.reader.getUint16(); | ||
const polygonIndex = this.reader.getVariableLengthIndex(); | ||
const materialIndex = this.reader.getUint16(); | ||
@@ -925,3 +925,3 @@ this.currentLayer.geometry.materialIndices.push( polygonIndex, materialIndex ); | ||
var data = this.reader.getString( length ); | ||
const data = this.reader.getString( length ); | ||
@@ -981,3 +981,3 @@ this.currentForm[ blockID ] = data; | ||
var value = this.dv.getUint8( this.offset ); | ||
const value = this.dv.getUint8( this.offset ); | ||
this.offset += 1; | ||
@@ -990,3 +990,3 @@ return value; | ||
var value = this.dv.getUint16( this.offset ); | ||
const value = this.dv.getUint16( this.offset ); | ||
this.offset += 2; | ||
@@ -999,3 +999,3 @@ return value; | ||
var value = this.dv.getInt32( this.offset, false ); | ||
const value = this.dv.getInt32( this.offset, false ); | ||
this.offset += 4; | ||
@@ -1008,3 +1008,3 @@ return value; | ||
var value = this.dv.getUint32( this.offset, false ); | ||
const value = this.dv.getUint32( this.offset, false ); | ||
this.offset += 4; | ||
@@ -1017,6 +1017,4 @@ return value; | ||
var low, high; | ||
high = this.getUint32(); | ||
low = this.getUint32(); | ||
const low = this.getUint32(); | ||
const high = this.getUint32(); | ||
return high * 0x100000000 + low; | ||
@@ -1028,3 +1026,3 @@ | ||
var value = this.dv.getFloat32( this.offset, false ); | ||
const value = this.dv.getFloat32( this.offset, false ); | ||
this.offset += 4; | ||
@@ -1037,5 +1035,5 @@ return value; | ||
var a = []; | ||
const a = []; | ||
for ( var i = 0; i < size; i ++ ) { | ||
for ( let i = 0; i < size; i ++ ) { | ||
@@ -1052,3 +1050,3 @@ a.push( this.getFloat32() ); | ||
var value = this.dv.getFloat64( this.offset, this.littleEndian ); | ||
const value = this.dv.getFloat64( this.offset, this.littleEndian ); | ||
this.offset += 8; | ||
@@ -1061,5 +1059,5 @@ return value; | ||
var a = []; | ||
const a = []; | ||
for ( var i = 0; i < size; i ++ ) { | ||
for ( let i = 0; i < size; i ++ ) { | ||
@@ -1082,3 +1080,3 @@ a.push( this.getFloat64() ); | ||
var firstByte = this.getUint8(); | ||
const firstByte = this.getUint8(); | ||
@@ -1139,3 +1137,3 @@ if ( firstByte === 255 ) { | ||
var a = this.getString( size ); | ||
let a = this.getString( size ); | ||
a = a.split( '\0' ); | ||
@@ -1159,3 +1157,11 @@ | ||
this.formList = []; | ||
this.offset = 0; | ||
this.node = 0; // 0 = FORM, 1 = CHUNK, 2 = SUBNODE | ||
this.nodeID = 'FORM'; | ||
this.dataOffset = 0; | ||
this.length = 0; | ||
this.skipped = false; | ||
} | ||
@@ -1173,3 +1179,3 @@ | ||
var nodeType; | ||
let nodeType; | ||
@@ -1217,3 +1223,3 @@ switch ( this.node ) { | ||
for ( var i = this.formList.length - 1; i >= 0; i -- ) { | ||
for ( let i = this.formList.length - 1; i >= 0; i -- ) { | ||
@@ -1236,8 +1242,2 @@ if ( this.offset >= this.formList[ i ] ) { | ||
function isEven( num ) { | ||
return num % 2; | ||
} | ||
// calculate the length of the string in the buffer | ||
@@ -1247,3 +1247,3 @@ // this will be string.length + nullbyte + optional padbyte to make the length even | ||
return string.length + 1 + ( isEven( string.length + 1 ) ? 1 : 0 ); | ||
return string.length + 1 + ( ( string.length + 1 ) % 2 ); | ||
@@ -1250,0 +1250,0 @@ } |
@@ -1,14 +0,1 @@ | ||
/** | ||
* @version 1.1.1 | ||
* | ||
* @desc Load files in LWO3 and LWO2 format on Three.js | ||
* | ||
* LWO3 format specification: | ||
* https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo3.html | ||
* | ||
* LWO2 format specification: | ||
* https://static.lightwave3d.com/sdk/2019/html/filefmts/lwo2.html | ||
* | ||
**/ | ||
import { | ||
@@ -64,2 +51,3 @@ AddOperation, | ||
* @augments Loader | ||
* @three_import import { LWOLoader } from 'three/addons/loaders/LWOLoader.js'; | ||
*/ | ||
@@ -66,0 +54,0 @@ class LWOLoader extends Loader { |
@@ -159,2 +159,3 @@ import { FileLoader, Loader, TextureLoader, RepeatWrapping, MeshBasicNodeMaterial, MeshPhysicalNodeMaterial } from 'three/webgpu'; | ||
* @augments Loader | ||
* @three_import import { MaterialXLoader } from 'three/addons/loaders/MaterialXLoader.js'; | ||
*/ | ||
@@ -161,0 +162,0 @@ class MaterialXLoader extends Loader { |
@@ -108,2 +108,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { MD2Loader } from 'three/addons/loaders/MD2Loader.js'; | ||
*/ | ||
@@ -110,0 +111,0 @@ class MD2Loader extends Loader { |
@@ -43,2 +43,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { MDDLoader } from 'three/addons/loaders/MDDLoader.js'; | ||
*/ | ||
@@ -45,0 +46,0 @@ class MDDLoader extends Loader { |
@@ -32,2 +32,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { MTLLoader } from 'three/addons/loaders/MTLLoader.js'; | ||
*/ | ||
@@ -34,0 +35,0 @@ class MTLLoader extends Loader { |
@@ -19,2 +19,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { NRRDLoader } from 'three/addons/loaders/NRRDLoader.js'; | ||
*/ | ||
@@ -21,0 +22,0 @@ class NRRDLoader extends Loader { |
@@ -451,2 +451,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; | ||
*/ | ||
@@ -453,0 +454,0 @@ class OBJLoader extends Loader { |
@@ -33,2 +33,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { PCDLoader } from 'three/addons/loaders/PCDLoader.js'; | ||
*/ | ||
@@ -35,0 +36,0 @@ class PCDLoader extends Loader { |
@@ -26,2 +26,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { PDBLoader } from 'three/addons/loaders/PDBLoader.js'; | ||
*/ | ||
@@ -28,0 +29,0 @@ class PDBLoader extends Loader { |
@@ -26,2 +26,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { PLYLoader } from 'three/addons/loaders/PLYLoader.js'; | ||
*/ | ||
@@ -28,0 +29,0 @@ class PLYLoader extends Loader { |
@@ -20,2 +20,3 @@ import { | ||
* @augments CompressedTextureLoader | ||
* @three_import import { PVRLoader } from 'three/addons/loaders/PVRLoader.js'; | ||
*/ | ||
@@ -22,0 +23,0 @@ class PVRLoader extends CompressedTextureLoader { |
@@ -22,2 +22,3 @@ import { | ||
* @augments DataTextureLoader | ||
* @three_import import { RGBELoader } from 'three/addons/loaders/RGBELoader.js'; | ||
*/ | ||
@@ -24,0 +25,0 @@ class RGBELoader extends DataTextureLoader { |
@@ -21,2 +21,3 @@ import { | ||
* @augments DataTextureLoader | ||
* @three_import import { RGBMLoader } from 'three/addons/loaders/RGBMLoader.js'; | ||
*/ | ||
@@ -23,0 +24,0 @@ class RGBMLoader extends DataTextureLoader { |
@@ -52,2 +52,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { STLLoader } from 'three/addons/loaders/STLLoader.js'; | ||
*/ | ||
@@ -54,0 +55,0 @@ class STLLoader extends Loader { |
@@ -29,2 +29,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { TDSLoader } from 'three/addons/loaders/TDSLoader.js'; | ||
*/ | ||
@@ -31,0 +32,0 @@ class TDSLoader extends Loader { |
@@ -16,2 +16,3 @@ import { | ||
* @augments DataTextureLoader | ||
* @three_import import { TGALoader } from 'three/addons/loaders/TGALoader.js'; | ||
*/ | ||
@@ -18,0 +19,0 @@ class TGALoader extends DataTextureLoader { |
@@ -19,2 +19,3 @@ import { | ||
* @augments DataTextureLoader | ||
* @three_import import { TIFFLoader } from 'three/addons/loaders/TIFFLoader.js'; | ||
*/ | ||
@@ -21,0 +22,0 @@ class TIFFLoader extends DataTextureLoader { |
@@ -20,2 +20,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { TTFLoader } from 'three/addons/loaders/TTFLoader.js'; | ||
*/ | ||
@@ -22,0 +23,0 @@ class TTFLoader extends Loader { |
@@ -65,2 +65,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { UltraHDRLoader } from 'three/addons/loaders/UltraHDRLoader.js'; | ||
*/ | ||
@@ -67,0 +68,0 @@ class UltraHDRLoader extends Loader { |
@@ -131,2 +131,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { USDZLoader } from 'three/addons/loaders/USDZLoader.js'; | ||
*/ | ||
@@ -133,0 +134,0 @@ class USDZLoader extends Loader { |
@@ -33,2 +33,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { VOXLoader } from 'three/addons/loaders/VOXLoader.js'; | ||
*/ | ||
@@ -35,0 +36,0 @@ class VOXLoader extends Loader { |
@@ -29,2 +29,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { VTKLoader } from 'three/addons/loaders/VTKLoader.js'; | ||
*/ | ||
@@ -31,0 +32,0 @@ class VTKLoader extends Loader { |
@@ -29,2 +29,3 @@ import { | ||
* @augments Loader | ||
* @three_import import { XYZLoader } from 'three/addons/loaders/XYZLoader.js'; | ||
*/ | ||
@@ -31,0 +32,0 @@ class XYZLoader extends Loader { |
@@ -15,2 +15,3 @@ import { | ||
* @augments ShaderMaterial | ||
* @three_import import { LDrawConditionalLineMaterial } from 'three/addons/materials/LDrawConditionalLineMaterial.js'; | ||
*/ | ||
@@ -17,0 +18,0 @@ class LDrawConditionalLineMaterial extends ShaderMaterial { |
@@ -11,2 +11,3 @@ import { Color } from 'three'; | ||
* @augments NodeMaterial | ||
* @three_import import { LDrawConditionalLineMaterial } from 'three/addons/materials/LDrawConditionalLineMaterial.js'; | ||
*/ | ||
@@ -13,0 +14,0 @@ class LDrawConditionalLineMaterial extends NodeMaterial { |
@@ -26,2 +26,3 @@ import { MeshPhysicalMaterial } from 'three'; | ||
* @augments MeshPhysicalMaterial | ||
* @three_import import { MeshPostProcessingMaterial } from 'three/addons/materials/MeshPostProcessingMaterial.js'; | ||
*/ | ||
@@ -28,0 +29,0 @@ class MeshPostProcessingMaterial extends MeshPhysicalMaterial { |
@@ -10,2 +10,4 @@ import { | ||
* Capsules are often used as bounding volumes (next to AABBs and bounding spheres). | ||
* | ||
* @three_import import { Capsule } from 'three/addons/math/Capsule.js'; | ||
*/ | ||
@@ -12,0 +14,0 @@ class Capsule { |
@@ -9,2 +9,3 @@ import { MathUtils } from 'three'; | ||
* @hideconstructor | ||
* @three_import import { ColorConverter } from 'three/addons/math/ColorConverter.js'; | ||
*/ | ||
@@ -11,0 +12,0 @@ class ColorConverter { |
@@ -23,2 +23,4 @@ import { | ||
* by Mauricio Poppe. | ||
* | ||
* @three_import import { ConvexHull } from 'three/addons/math/ConvexHull.js'; | ||
*/ | ||
@@ -25,0 +27,0 @@ class ConvexHull { |
@@ -0,1 +1,5 @@ | ||
import { MathUtils } from 'three'; | ||
const { lerp } = MathUtils; | ||
const _p = [ 151, 160, 137, 91, 90, 15, 131, 13, 201, 95, 96, 53, 194, 233, 7, 225, 140, 36, 103, 30, 69, 142, 8, 99, 37, 240, 21, 10, | ||
@@ -24,8 +28,2 @@ 23, 190, 6, 148, 247, 120, 234, 75, 0, 26, 197, 62, 94, 252, 219, 203, 117, 35, 11, 32, 57, 177, 33, 88, 237, 149, 56, 87, | ||
function lerp( t, a, b ) { | ||
return a + t * ( b - a ); | ||
} | ||
function grad( hash, x, y, z ) { | ||
@@ -44,2 +42,4 @@ | ||
* by Ken Perlin, 2002. | ||
* | ||
* @three_import import { ImprovedNoise } from 'three/addons/math/ImprovedNoise.js'; | ||
*/ | ||
@@ -72,10 +72,15 @@ class ImprovedNoise { | ||
return lerp( w, lerp( v, lerp( u, grad( _p[ AA ], x, y, z ), | ||
grad( _p[ BA ], xMinus1, y, z ) ), | ||
lerp( u, grad( _p[ AB ], x, yMinus1, z ), | ||
grad( _p[ BB ], xMinus1, yMinus1, z ) ) ), | ||
lerp( v, lerp( u, grad( _p[ AA + 1 ], x, y, zMinus1 ), | ||
grad( _p[ BA + 1 ], xMinus1, y, zMinus1 ) ), | ||
lerp( u, grad( _p[ AB + 1 ], x, yMinus1, zMinus1 ), | ||
grad( _p[ BB + 1 ], xMinus1, yMinus1, zMinus1 ) ) ) ); | ||
return lerp( | ||
lerp( | ||
lerp( grad( _p[ AA ], x, y, z ), grad( _p[ BA ], xMinus1, y, z ), u ), | ||
lerp( grad( _p[ AB ], x, yMinus1, z ), grad( _p[ BB ], xMinus1, yMinus1, z ), u ), | ||
v | ||
), | ||
lerp( | ||
lerp( grad( _p[ AA + 1 ], x, y, zMinus1 ), grad( _p[ BA + 1 ], xMinus1, y, zMinus1 ), u ), | ||
lerp( grad( _p[ AB + 1 ], x, yMinus1, zMinus1 ), grad( _p[ BB + 1 ], xMinus1, yMinus1, zMinus1 ), u ), | ||
v | ||
), | ||
w | ||
); | ||
@@ -82,0 +87,0 @@ } |
@@ -15,2 +15,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { Lut } from 'three/addons/math/Lut.js'; | ||
*/ | ||
@@ -17,0 +19,0 @@ class Lut { |
@@ -43,2 +43,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { MeshSurfaceSampler } from 'three/addons/math/MeshSurfaceSampler.js'; | ||
*/ | ||
@@ -45,0 +47,0 @@ class MeshSurfaceSampler { |
@@ -42,2 +42,4 @@ import { | ||
* Represents an oriented bounding box (OBB) in 3D space. | ||
* | ||
* @three_import import { OBB } from 'three/addons/math/OBB.js'; | ||
*/ | ||
@@ -44,0 +46,0 @@ class OBB { |
@@ -99,2 +99,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { Octree } from 'three/addons/math/Octree.js'; | ||
*/ | ||
@@ -101,0 +103,0 @@ class Octree { |
@@ -6,2 +6,4 @@ /** | ||
* by Stefan Gustavson, 2005. | ||
* | ||
* @three_import import { SimplexNoise } from 'three/addons/math/SimplexNoise.js'; | ||
*/ | ||
@@ -8,0 +10,0 @@ class SimplexNoise { |
@@ -27,3 +27,5 @@ import { | ||
* Use with caution and read the code when using with other libs. | ||
*/ | ||
* | ||
* @three_import import { ConvexObjectBreaker } from 'three/addons/misc/ConvexObjectBreaker.js'; | ||
*/ | ||
class ConvexObjectBreaker { | ||
@@ -30,0 +32,0 @@ |
@@ -101,2 +101,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { GPUComputationRenderer } from 'three/addons/misc/GPUComputationRenderer.js'; | ||
*/ | ||
@@ -103,0 +105,0 @@ class GPUComputationRenderer { |
@@ -22,2 +22,3 @@ import { | ||
* @augments Object3D | ||
* @three_import import { Gyroscope } from 'three/addons/misc/Gyroscope.js'; | ||
*/ | ||
@@ -24,0 +25,0 @@ class Gyroscope extends Object3D { |
@@ -16,2 +16,4 @@ import { | ||
* character assets. | ||
* | ||
* @three_import import { MD2Character } from 'three/addons/misc/MD2Character.js'; | ||
*/ | ||
@@ -18,0 +20,0 @@ class MD2Character { |
@@ -16,2 +16,4 @@ import { | ||
* character assets. It provides a larger API compared to {@link MD2Character}. | ||
* | ||
* @three_import import { MD2CharacterComplex } from 'three/addons/misc/MD2CharacterComplex.js'; | ||
*/ | ||
@@ -82,3 +84,3 @@ class MD2CharacterComplex { | ||
/** | ||
* The character's front decceleration. | ||
* The character's front deceleration. | ||
* | ||
@@ -88,3 +90,3 @@ * @type {number} | ||
*/ | ||
this.frontDecceleration = 600; | ||
this.frontDeceleration = 600; | ||
@@ -690,3 +692,3 @@ /** | ||
const k = exponentialEaseOut( this.speed / this.maxSpeed ); | ||
this.speed = MathUtils.clamp( this.speed - k * delta * this.frontDecceleration, 0, this.maxSpeed ); | ||
this.speed = MathUtils.clamp( this.speed - k * delta * this.frontDeceleration, 0, this.maxSpeed ); | ||
@@ -693,0 +695,0 @@ } else { |
@@ -13,2 +13,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { MorphAnimMesh } from 'three/addons/misc/MorphAnimMesh.js'; | ||
*/ | ||
@@ -15,0 +16,0 @@ class MorphAnimMesh extends Mesh { |
@@ -13,2 +13,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { MorphBlendMesh } from 'three/addons/misc/MorphBlendMesh.js'; | ||
*/ | ||
@@ -15,0 +16,0 @@ class MorphBlendMesh extends Mesh { |
@@ -19,2 +19,4 @@ import { DoubleSide, FloatType, HalfFloatType, Mesh, MeshBasicMaterial, MeshPhongMaterial, PlaneGeometry, Scene, WebGLRenderTarget } from 'three'; | ||
* When using {@link WebGPURenderer}, import from `ProgressiveLightMapGPU.js`. | ||
* | ||
* @three_import import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMap.js'; | ||
*/ | ||
@@ -21,0 +23,0 @@ class ProgressiveLightMap { |
@@ -21,2 +21,4 @@ import { DoubleSide, FloatType, HalfFloatType, PlaneGeometry, Mesh, RenderTarget, Scene, MeshPhongNodeMaterial, NodeMaterial } from 'three/webgpu'; | ||
* When using {@link WebGLRenderer}, import from `ProgressiveLightMap.js`. | ||
* | ||
* @three_import import { ProgressiveLightMap } from 'three/addons/misc/ProgressiveLightMapGPU.js'; | ||
*/ | ||
@@ -23,0 +25,0 @@ class ProgressiveLightMap { |
@@ -15,2 +15,3 @@ import { | ||
* @augments BufferGeometry | ||
* @three_import import { RollerCoasterGeometry } from 'three/addons/misc/RollerCoaster.js'; | ||
*/ | ||
@@ -241,2 +242,3 @@ class RollerCoasterGeometry extends BufferGeometry { | ||
* @augments BufferGeometry | ||
* @three_import import { RollerCoasterLiftersGeometry } from 'three/addons/misc/RollerCoaster.js'; | ||
*/ | ||
@@ -429,2 +431,3 @@ class RollerCoasterLiftersGeometry extends BufferGeometry { | ||
* @augments BufferGeometry | ||
* @three_import import { RollerCoasterShadowGeometry } from 'three/addons/misc/RollerCoaster.js'; | ||
*/ | ||
@@ -513,2 +516,3 @@ class RollerCoasterShadowGeometry extends BufferGeometry { | ||
* @augments BufferGeometry | ||
* @three_import import { SkyGeometry } from 'three/addons/misc/RollerCoaster.js'; | ||
*/ | ||
@@ -555,2 +559,3 @@ class SkyGeometry extends BufferGeometry { | ||
* @augments BufferGeometry | ||
* @three_import import { TreesGeometry } from 'three/addons/misc/RollerCoaster.js'; | ||
*/ | ||
@@ -557,0 +562,0 @@ class TreesGeometry extends BufferGeometry { |
@@ -14,2 +14,4 @@ /** | ||
* ``` | ||
* | ||
* @three_import import { Timer } from 'three/addons/misc/Timer.js'; | ||
*/ | ||
@@ -16,0 +18,0 @@ class Timer { |
@@ -24,2 +24,3 @@ import { | ||
* @class | ||
* @three_import import { TubePainter } from 'three/addons/misc/TubePainter.js'; | ||
*/ | ||
@@ -26,0 +27,0 @@ function TubePainter() { |
@@ -11,2 +11,4 @@ import { | ||
* It contains a volume of data and information about it. For now it only handles 3 dimensional data. | ||
* | ||
* @three_import import { Volume } from 'three/addons/misc/Volume.js'; | ||
*/ | ||
@@ -13,0 +15,0 @@ class Volume { |
@@ -16,2 +16,3 @@ import { | ||
* @see {@link Volume} | ||
* @three_import import { VolumeSlice } from 'three/addons/misc/VolumeSlice.js'; | ||
*/ | ||
@@ -18,0 +19,0 @@ class VolumeSlice { |
@@ -206,2 +206,4 @@ // Original src: https://github.com/zz85/threejs-path-flow | ||
* import the class from `CurveModifierGPU.js`. | ||
* | ||
* @three_import import { Flow } from 'three/addons/modifiers/CurveModifier.js'; | ||
*/ | ||
@@ -300,2 +302,3 @@ export class Flow { | ||
* @augments Flow | ||
* @three_import import { InstancedFlow } from 'three/addons/modifiers/CurveModifier.js'; | ||
*/ | ||
@@ -302,0 +305,0 @@ export class InstancedFlow extends Flow { |
@@ -167,2 +167,4 @@ // Original src: https://github.com/zz85/threejs-path-flow | ||
* import the class from `CurveModifier.js`. | ||
* | ||
* @three_import import { Flow } from 'three/addons/modifiers/CurveModifierGPU.js'; | ||
*/ | ||
@@ -169,0 +171,0 @@ export class Flow { |
@@ -20,2 +20,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { EdgeSplitModifier } from 'three/addons/modifiers/EdgeSplitModifier.js'; | ||
*/ | ||
@@ -22,0 +24,0 @@ class EdgeSplitModifier { |
@@ -24,2 +24,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { SimplifyModifier } from 'three/addons/modifiers/SimplifyModifier.js'; | ||
*/ | ||
@@ -26,0 +28,0 @@ class SimplifyModifier { |
@@ -17,2 +17,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { TessellateModifier } from 'three/addons/modifiers/TessellateModifier.js'; | ||
*/ | ||
@@ -19,0 +21,0 @@ class TessellateModifier { |
@@ -18,2 +18,3 @@ import { Mesh, MeshBasicMaterial, SphereGeometry, Vector3 } from 'three'; | ||
* @augments Mesh | ||
* @three_import import { GroundedSkybox } from 'three/addons/objects/GroundedSkybox.js'; | ||
*/ | ||
@@ -20,0 +21,0 @@ class GroundedSkybox extends Mesh { |
@@ -36,2 +36,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { Lensflare } from 'three/addons/objects/Lensflare.js'; | ||
*/ | ||
@@ -342,2 +343,4 @@ class Lensflare extends Mesh { | ||
* Represents a single flare that can be added to a {@link Lensflare} container. | ||
* | ||
* @three_import import { LensflareElement } from 'three/addons/objects/Lensflare.js'; | ||
*/ | ||
@@ -344,0 +347,0 @@ class LensflareElement { |
@@ -39,2 +39,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { LensflareMesh } from 'three/addons/objects/LensflareMesh.js'; | ||
*/ | ||
@@ -41,0 +42,0 @@ class LensflareMesh extends Mesh { |
@@ -15,2 +15,4 @@ import { | ||
* Port of: {@link http://webglsamples.org/blob/blob.html} | ||
* | ||
* @three_import import { MarchingCubes } from 'three/addons/objects/MarchingCubes.js'; | ||
*/ | ||
@@ -17,0 +19,0 @@ class MarchingCubes extends Mesh { |
@@ -35,2 +35,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { Reflector } from 'three/addons/objects/Reflector.js'; | ||
*/ | ||
@@ -37,0 +38,0 @@ class Reflector extends Mesh { |
@@ -22,2 +22,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { ReflectorForSSRPass } from 'three/addons/objects/ReflectorForSSRPass.js'; | ||
*/ | ||
@@ -24,0 +25,0 @@ class ReflectorForSSRPass extends Mesh { |
@@ -36,2 +36,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { Refractor } from 'three/addons/objects/Refractor.js'; | ||
*/ | ||
@@ -38,0 +39,0 @@ class Refractor extends Mesh { |
@@ -26,2 +26,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { ShadowMesh } from 'three/addons/objects/ShadowMesh.js'; | ||
*/ | ||
@@ -28,0 +29,0 @@ class ShadowMesh extends Mesh { |
@@ -30,3 +30,4 @@ import { | ||
* @augments Mesh | ||
*/ | ||
* @three_import import { Sky } from 'three/addons/objects/Sky.js'; | ||
*/ | ||
class Sky extends Mesh { | ||
@@ -33,0 +34,0 @@ |
@@ -30,3 +30,4 @@ import { | ||
* @augments Mesh | ||
*/ | ||
* @three_import import { SkyMesh } from 'three/addons/objects/SkyMesh.js'; | ||
*/ | ||
class SkyMesh extends Mesh { | ||
@@ -33,0 +34,0 @@ |
@@ -29,2 +29,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { Water } from 'three/addons/objects/Water.js'; | ||
*/ | ||
@@ -31,0 +32,0 @@ class Water extends Mesh { |
@@ -31,2 +31,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { Water } from 'three/addons/objects/Water2.js'; | ||
*/ | ||
@@ -33,0 +34,0 @@ class Water extends Mesh { |
@@ -27,2 +27,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { WaterMesh } from 'three/addons/objects/Water2Mesh.js'; | ||
*/ | ||
@@ -40,2 +41,3 @@ class WaterMesh extends Mesh { | ||
const material = new NodeMaterial(); | ||
material.transparent = true; | ||
@@ -53,3 +55,3 @@ super( geometry, material ); | ||
material.fragmentNode = new WaterNode( options, this ); | ||
material.colorNode = new WaterNode( options, this ); | ||
@@ -56,0 +58,0 @@ } |
@@ -23,2 +23,3 @@ import { | ||
* @augments Mesh | ||
* @three_import import { WaterMesh } from 'three/addons/objects/WaterMesh.js'; | ||
*/ | ||
@@ -156,3 +157,3 @@ class WaterMesh extends Mesh { | ||
material.shadowPositionNode = positionWorld.add( distortion ); | ||
material.receivedShadowPositionNode = positionWorld.add( distortion ); | ||
@@ -159,0 +160,0 @@ material.setupOutgoingLight = () => diffuseColor.rgb; // backwards compatibility |
@@ -15,2 +15,3 @@ /** | ||
* @hideconstructor | ||
* @three_import import { AmmoPhysics } from 'three/addons/physics/AmmoPhysics.js'; | ||
*/ | ||
@@ -17,0 +18,0 @@ async function AmmoPhysics() { |
@@ -72,2 +72,3 @@ import { Clock, Vector3, Quaternion, Matrix4 } from 'three'; | ||
* @hideconstructor | ||
* @three_import import { JoltPhysics } from 'three/addons/physics/JoltPhysics.js'; | ||
*/ | ||
@@ -74,0 +75,0 @@ async function JoltPhysics() { |
@@ -31,2 +31,16 @@ import { Clock, Vector3, Quaternion, Matrix4 } from 'three'; | ||
} else if ( geometry.type === 'CylinderGeometry' ) { | ||
const radius = parameters.radiusBottom !== undefined ? parameters.radiusBottom : 0.5; | ||
const length = parameters.height !== undefined ? parameters.height : 0.5; | ||
return RAPIER.ColliderDesc.cylinder( length / 2, radius ); | ||
} else if ( geometry.type === 'CapsuleGeometry' ) { | ||
const radius = parameters.radius !== undefined ? parameters.radius : 0.5; | ||
const length = parameters.height !== undefined ? parameters.height : 0.5; | ||
return RAPIER.ColliderDesc.capsule( length / 2, radius ); | ||
} else if ( geometry.type === 'BufferGeometry' ) { | ||
@@ -70,2 +84,3 @@ | ||
* @hideconstructor | ||
* @three_import import { RapierPhysics } from 'three/addons/physics/RapierPhysics.js'; | ||
*/ | ||
@@ -126,2 +141,6 @@ async function RapierPhysics() { | ||
if ( ! mesh.userData.physics ) mesh.userData.physics = {}; | ||
mesh.userData.physics.body = body; | ||
if ( mass > 0 ) { | ||
@@ -196,2 +215,20 @@ | ||
function addHeightfield( mesh, width, depth, heights, scale ) { | ||
const shape = RAPIER.ColliderDesc.heightfield( width, depth, heights, scale ); | ||
const bodyDesc = RAPIER.RigidBodyDesc.fixed(); | ||
bodyDesc.setTranslation( mesh.position.x, mesh.position.y, mesh.position.z ); | ||
bodyDesc.setRotation( mesh.quaternion ); | ||
const body = world.createRigidBody( bodyDesc ); | ||
world.createCollider( shape, body ); | ||
if ( ! mesh.userData.physics ) mesh.userData.physics = {}; | ||
mesh.userData.physics.body = body; | ||
return body; | ||
} | ||
// | ||
@@ -249,2 +286,4 @@ | ||
return { | ||
RAPIER, | ||
world, | ||
/** | ||
@@ -296,3 +335,21 @@ * Adds the given scene to this physics simulation. Only meshes with a | ||
*/ | ||
setMeshVelocity: setMeshVelocity | ||
setMeshVelocity: setMeshVelocity, | ||
/** | ||
* Adds a heightfield terrain to the physics simulation. | ||
* | ||
* @method | ||
* @name RapierPhysics#addHeightfield | ||
* @param {Mesh} mesh - The Three.js mesh representing the terrain. | ||
* @param {number} width - The number of vertices along the width (x-axis) of the heightfield. | ||
* @param {number} depth - The number of vertices along the depth (z-axis) of the heightfield. | ||
* @param {Float32Array} heights - Array of height values for each vertex in the heightfield. | ||
* @param {Object} scale - Scale factors for the heightfield dimensions. | ||
* @param {number} scale.x - Scale factor for width. | ||
* @param {number} scale.y - Scale factor for height. | ||
* @param {number} scale.z - Scale factor for depth. | ||
* @returns {RigidBody} The created Rapier rigid body for the heightfield. | ||
*/ | ||
addHeightfield: addHeightfield | ||
}; | ||
@@ -299,0 +356,0 @@ |
@@ -22,2 +22,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { AfterimagePass } from 'three/addons/postprocessing/AfterimagePass.js'; | ||
*/ | ||
@@ -24,0 +25,0 @@ class AfterimagePass extends Pass { |
@@ -24,2 +24,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { BloomPass } from 'three/addons/postprocessing/BloomPass.js'; | ||
*/ | ||
@@ -26,0 +27,0 @@ class BloomPass extends Pass { |
@@ -28,2 +28,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { BokehPass } from 'three/addons/postprocessing/BokehPass.js'; | ||
*/ | ||
@@ -30,0 +31,0 @@ class BokehPass extends Pass { |
@@ -16,2 +16,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { ClearPass } from 'three/addons/postprocessing/ClearPass.js'; | ||
*/ | ||
@@ -18,0 +19,0 @@ class ClearPass extends Pass { |
@@ -24,2 +24,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { CubeTexturePass } from 'three/addons/postprocessing/CubeTexturePass.js'; | ||
*/ | ||
@@ -26,0 +27,0 @@ class CubeTexturePass extends Pass { |
@@ -17,2 +17,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { DotScreenPass } from 'three/addons/postprocessing/DotScreenPass.js'; | ||
*/ | ||
@@ -19,0 +20,0 @@ class DotScreenPass extends Pass { |
@@ -39,2 +39,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js'; | ||
*/ | ||
@@ -123,3 +125,3 @@ class EffectComposer { | ||
/** | ||
* The intenral clock for managing time data. | ||
* The internal clock for managing time data. | ||
* | ||
@@ -190,3 +192,3 @@ * @private | ||
* @param {number} passIndex - The pass index. | ||
* @return {boolean} Whether the the pass for the given index is the last pass in the pass chain. | ||
* @return {boolean} Whether the pass for the given index is the last pass in the pass chain. | ||
*/ | ||
@@ -193,0 +195,0 @@ isLastEnabledPass( passIndex ) { |
@@ -17,2 +17,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { FilmPass } from 'three/addons/postprocessing/FilmPass.js'; | ||
*/ | ||
@@ -19,0 +20,0 @@ class FilmPass extends Pass { |
@@ -21,2 +21,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { GlitchPass } from 'three/addons/postprocessing/GlitchPass.js'; | ||
*/ | ||
@@ -54,3 +55,3 @@ class GlitchPass extends Pass { | ||
/** | ||
* Whether to noticeably increase the effect instensity or not. | ||
* Whether to noticeably increase the effect intensity or not. | ||
* | ||
@@ -57,0 +58,0 @@ * @type {boolean} |
@@ -41,2 +41,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { GTAOPass } from 'three/addons/postprocessing/GTAOPass.js'; | ||
*/ | ||
@@ -370,3 +371,3 @@ class GTAOPass extends Pass { | ||
/** | ||
* Updates the GTAO material from the given paramter object. | ||
* Updates the GTAO material from the given parameter object. | ||
* | ||
@@ -425,3 +426,3 @@ * @param {Object} parameters - The GTAO material parameters. | ||
/** | ||
* Updates the Denoise material from the given paramter object. | ||
* Updates the Denoise material from the given parameter object. | ||
* | ||
@@ -428,0 +429,0 @@ * @param {Object} parameters - The denoise parameters. |
@@ -29,2 +29,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { HalftonePass } from 'three/addons/postprocessing/HalftonePass.js'; | ||
*/ | ||
@@ -31,0 +32,0 @@ class HalftonePass extends Pass { |
@@ -68,2 +68,3 @@ import { ShaderPass } from './ShaderPass.js'; | ||
* @augments ShaderPass | ||
* @three_import import { LUTPass } from 'three/addons/postprocessing/LUTPass.js'; | ||
*/ | ||
@@ -70,0 +71,0 @@ class LUTPass extends ShaderPass { |
@@ -15,2 +15,3 @@ import { Pass } from './Pass.js'; | ||
* @augments Pass | ||
* @three_import import { MaskPass } from 'three/addons/postprocessing/MaskPass.js'; | ||
*/ | ||
@@ -17,0 +18,0 @@ class MaskPass extends Pass { |
@@ -29,2 +29,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { OutlinePass } from 'three/addons/postprocessing/OutlinePass.js'; | ||
*/ | ||
@@ -561,3 +562,4 @@ class OutlinePass extends Pass { | ||
vertexShader: | ||
`#include <morphtarget_pars_vertex> | ||
`#include <batching_pars_vertex> | ||
#include <morphtarget_pars_vertex> | ||
#include <skinning_pars_vertex> | ||
@@ -571,2 +573,3 @@ | ||
#include <batching_vertex> | ||
#include <skinbase_vertex> | ||
@@ -573,0 +576,0 @@ #include <begin_vertex> |
@@ -31,2 +31,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { OutputPass } from 'three/addons/postprocessing/OutputPass.js'; | ||
*/ | ||
@@ -33,0 +34,0 @@ class OutputPass extends Pass { |
@@ -14,2 +14,3 @@ import { | ||
* @abstract | ||
* @three_import import { Pass } from 'three/addons/postprocessing/Pass.js'; | ||
*/ | ||
@@ -136,2 +137,3 @@ class Pass { | ||
* @augments Mesh | ||
* @three_import import { FullScreenQuad } from 'three/addons/postprocessing/Pass.js'; | ||
*/ | ||
@@ -138,0 +140,0 @@ class FullScreenQuad { |
@@ -16,2 +16,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { RenderPass } from 'three/addons/postprocessing/RenderPass.js'; | ||
*/ | ||
@@ -18,0 +19,0 @@ class RenderPass extends Pass { |
@@ -22,2 +22,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { RenderPixelatedPass } from 'three/addons/postprocessing/RenderPixelatedPass.js'; | ||
*/ | ||
@@ -24,0 +25,0 @@ class RenderPixelatedPass extends Pass { |
@@ -19,2 +19,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { RenderTransitionPass } from 'three/addons/postprocessing/RenderTransitionPass.js'; | ||
*/ | ||
@@ -86,3 +87,3 @@ class RenderTransitionPass extends Pass { | ||
* | ||
* @param {boolenumberan} value - The transition factor. | ||
* @param {boolean|number} value - The transition factor. | ||
*/ | ||
@@ -121,3 +122,3 @@ setTransition( value ) { | ||
* | ||
* @param {boolenumberan} value - The threshold value. | ||
* @param {boolean|number} value - The threshold value. | ||
*/ | ||
@@ -124,0 +125,0 @@ setTextureThreshold( value ) { |
@@ -36,2 +36,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { SAOPass } from 'three/addons/postprocessing/SAOPass.js'; | ||
*/ | ||
@@ -86,3 +87,3 @@ class SAOPass extends Pass { | ||
/** | ||
* The SAO paramter. | ||
* The SAO parameter. | ||
* | ||
@@ -89,0 +90,0 @@ * @type {Object} |
@@ -20,2 +20,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { SavePass } from 'three/addons/postprocessing/SavePass.js'; | ||
*/ | ||
@@ -22,0 +23,0 @@ class SavePass extends Pass { |
@@ -18,2 +18,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js'; | ||
*/ | ||
@@ -20,0 +21,0 @@ class ShaderPass extends Pass { |
@@ -15,3 +15,3 @@ import { | ||
* A pass for applying SMAA. Unlike {@link FXAAPass}, `SMAAPass` operates in | ||
* `linar-srgb` so this pass must be executed before {@link OutputPass}. | ||
* `linear-srgb` so this pass must be executed before {@link OutputPass}. | ||
* | ||
@@ -24,2 +24,3 @@ * ```js | ||
* @augments Pass | ||
* @three_import import { SMAAPass } from 'three/addons/postprocessing/SMAAPass.js'; | ||
*/ | ||
@@ -26,0 +27,0 @@ class SMAAPass extends Pass { |
@@ -24,2 +24,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { SSAARenderPass } from 'three/addons/postprocessing/SSAARenderPass.js'; | ||
*/ | ||
@@ -26,0 +27,0 @@ class SSAARenderPass extends Pass { |
@@ -42,2 +42,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { SSAOPass } from 'three/addons/postprocessing/SSAOPass.js'; | ||
*/ | ||
@@ -44,0 +45,0 @@ class SSAOPass extends Pass { |
@@ -37,2 +37,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { SSRPass } from 'three/addons/postprocessing/SSRPass.js'; | ||
*/ | ||
@@ -104,3 +105,3 @@ class SSRPass extends Pass { | ||
/** | ||
* The opactiy. | ||
* The opacity. | ||
* | ||
@@ -226,3 +227,3 @@ * @type {number} | ||
/** | ||
* Whether to use distance attenutation or not. | ||
* Whether to use distance attenuation or not. | ||
* | ||
@@ -229,0 +230,0 @@ * @name SSRPass#distanceAttenuation |
@@ -23,2 +23,3 @@ import { | ||
* @augments SSAARenderPass | ||
* @three_import import { TAARenderPass } from 'three/addons/postprocessing/TAARenderPass.js'; | ||
*/ | ||
@@ -25,0 +26,0 @@ class TAARenderPass extends SSAARenderPass { |
@@ -20,2 +20,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { TexturePass } from 'three/addons/postprocessing/TexturePass.js'; | ||
*/ | ||
@@ -22,0 +23,0 @@ class TexturePass extends Pass { |
@@ -34,2 +34,3 @@ import { | ||
* @augments Pass | ||
* @three_import import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js'; | ||
*/ | ||
@@ -36,0 +37,0 @@ class UnrealBloomPass extends Pass { |
@@ -12,2 +12,3 @@ import { | ||
* @augments Object3D | ||
* @three_import import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js'; | ||
*/ | ||
@@ -107,2 +108,4 @@ class CSS2DObject extends Object3D { | ||
* `CSS2DRenderer` only supports 100% browser and display zoom. | ||
* | ||
* @three_import import { CSS2DRenderer } from 'three/addons/renderers/CSS2DRenderer.js'; | ||
*/ | ||
@@ -109,0 +112,0 @@ class CSS2DRenderer { |
@@ -18,2 +18,3 @@ import { | ||
* @augments Object3D | ||
* @three_import import { CSS3DObject } from 'three/addons/renderers/CSS3DRenderer.js'; | ||
*/ | ||
@@ -90,2 +91,3 @@ class CSS3DObject extends Object3D { | ||
* @augments CSS3DObject | ||
* @three_import import { CSS3DSprite } from 'three/addons/renderers/CSS3DRenderer.js'; | ||
*/ | ||
@@ -153,2 +155,4 @@ class CSS3DSprite extends CSS3DObject { | ||
* 3D objects ({@link CSS3DObject} or {@link CSS3DSprite}) and then added to the scene graph. | ||
* | ||
* @three_import import { CSS3DRenderer } from 'three/addons/renderers/CSS3DRenderer.js'; | ||
*/ | ||
@@ -155,0 +159,0 @@ class CSS3DRenderer { |
@@ -127,2 +127,4 @@ import { | ||
* and was previously used by the legacy `CanvasRenderer`. | ||
* | ||
* @three_import import { Projector } from 'three/addons/renderers/Projector.js'; | ||
*/ | ||
@@ -129,0 +131,0 @@ class Projector { |
@@ -22,2 +22,3 @@ import { | ||
* @augments Object3D | ||
* @three_import import { SVGObject } from 'three/addons/renderers/SVGRenderer.js'; | ||
*/ | ||
@@ -73,2 +74,4 @@ class SVGObject extends Object3D { | ||
* - No shadow support. | ||
* | ||
* @three_import import { SVGRenderer } from 'three/addons/renderers/SVGRenderer.js'; | ||
*/ | ||
@@ -75,0 +78,0 @@ class SVGRenderer { |
@@ -1,2 +0,5 @@ | ||
/** @module ACESFilmicToneMappingShader */ | ||
/** | ||
* @module ACESFilmicToneMappingShader | ||
* @three_import import { ACESFilmicToneMappingShader } from 'three/addons/shaders/ACESFilmicToneMappingShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module AfterimageShader */ | ||
/** | ||
* @module AfterimageShader | ||
* @three_import import { AfterimageShader } from 'three/addons/shaders/AfterimageShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module BasicShader */ | ||
/** | ||
* @module BasicShader | ||
* @three_import import { BasicShader } from 'three/addons/shaders/BasicShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
/** @module BleachBypassShader */ | ||
/** | ||
* @module BleachBypassShader | ||
* @three_import import { BleachBypassShader } from 'three/addons/shaders/BleachBypassShader.js'; | ||
*/ | ||
@@ -4,0 +7,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module BlendShader */ | ||
/** | ||
* @module BlendShader | ||
* @three_import import { BlendShader } from 'three/addons/shaders/BlendShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module BokehShader */ | ||
/** | ||
* @module BokehShader | ||
* @three_import import { BokehShader } from 'three/addons/shaders/BokehShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module BokehShader2 */ | ||
/** | ||
* @module BokehShader2 | ||
* @three_import import { BokehShader, BokehDepthShader } from 'three/addons/shaders/BokehShader2.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module BrightnessContrastShader */ | ||
/** | ||
* @module BrightnessContrastShader | ||
* @three_import import { BrightnessContrastShader } from 'three/addons/shaders/BrightnessContrastShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module ColorCorrectionShader */ | ||
/** | ||
* @module ColorCorrectionShader | ||
* @three_import import { ColorCorrectionShader } from 'three/addons/shaders/ColorCorrectionShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module ColorifyShader */ | ||
/** | ||
* @module ColorifyShader | ||
* @three_import import { ColorifyShader } from 'three/addons/shaders/ColorifyShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module ConvolutionShader */ | ||
/** | ||
* @module ConvolutionShader | ||
* @three_import import { ConvolutionShader } from 'three/addons/shaders/ConvolutionShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module CopyShader */ | ||
/** | ||
* @module CopyShader | ||
* @three_import import { CopyShader } from 'three/addons/shaders/CopyShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module DepthLimitedBlurShader */ | ||
/** | ||
* @module DepthLimitedBlurShader | ||
* @three_import import { DepthLimitedBlurShader, BlurShaderUtils } from 'three/addons/shaders/DepthLimitedBlurShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module DigitalGlitch */ | ||
/** | ||
* @module DigitalGlitch | ||
* @three_import import { DigitalGlitch } from 'three/addons/shaders/DigitalGlitch.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module DOFMipMapShader */ | ||
/** | ||
* @module DOFMipMapShader | ||
* @three_import import { DOFMipMapShader } from 'three/addons/shaders/DOFMipMapShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module DotScreenShader */ | ||
/** | ||
* @module DotScreenShader | ||
* @three_import import { DotScreenShader } from 'three/addons/shaders/DotScreenShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module ExposureShader */ | ||
/** | ||
* @module ExposureShader | ||
* @three_import import { ExposureShader } from 'three/addons/shaders/ExposureShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module FilmShader */ | ||
/** | ||
* @module FilmShader | ||
* @three_import import { FilmShader } from 'three/addons/shaders/FilmShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module FocusShader */ | ||
/** | ||
* @module FocusShader | ||
* @three_import import { FocusShader } from 'three/addons/shaders/FocusShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module FreiChenShader */ | ||
/** | ||
* @module FreiChenShader | ||
* @three_import import { FreiChenShader } from 'three/addons/shaders/FreiChenShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module FXAAShader */ | ||
/** | ||
* @module FXAAShader | ||
* @three_import import { FXAAShader } from 'three/addons/shaders/FXAAShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module GammaCorrectionShader */ | ||
/** | ||
* @module GammaCorrectionShader | ||
* @three_import import { GammaCorrectionShader } from 'three/addons/shaders/GammaCorrectionShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -6,3 +6,6 @@ import { | ||
/** @module GodRaysShader */ | ||
/** | ||
* @module GodRaysShader | ||
* @three_import import * as GodRaysShader from 'three/addons/shaders/GodRaysShader.js'; | ||
*/ | ||
@@ -9,0 +12,0 @@ /** |
@@ -9,3 +9,6 @@ import { | ||
/** @module GTAOShader */ | ||
/** | ||
* @module GTAOShader | ||
* @three_import import { GTAOShader } from 'three/addons/shaders/GTAOShader.js'; | ||
*/ | ||
@@ -12,0 +15,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module HalftoneShader */ | ||
/** | ||
* @module HalftoneShader | ||
* @three_import import { HalftoneShader } from 'three/addons/shaders/HalftoneShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module HorizontalBlurShader */ | ||
/** | ||
* @module HorizontalBlurShader | ||
* @three_import import { HorizontalBlurShader } from 'three/addons/shaders/HorizontalBlurShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module HorizontalTiltShiftShader */ | ||
/** | ||
* @module HorizontalTiltShiftShader | ||
* @three_import import { HorizontalTiltShiftShader } from 'three/addons/shaders/HorizontalTiltShiftShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module HueSaturationShader */ | ||
/** | ||
* @module HueSaturationShader | ||
* @three_import import { HueSaturationShader } from 'three/addons/shaders/HueSaturationShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module KaleidoShader */ | ||
/** | ||
* @module KaleidoShader | ||
* @three_import import { KaleidoShader } from 'three/addons/shaders/KaleidoShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module LuminosityHighPassShader */ | ||
/** | ||
* @module LuminosityHighPassShader | ||
* @three_import import { LuminosityHighPassShader } from 'three/addons/shaders/LuminosityHighPassShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module LuminosityShader */ | ||
/** | ||
* @module LuminosityShader | ||
* @three_import import { LuminosityShader } from 'three/addons/shaders/LuminosityShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module MirrorShader */ | ||
/** | ||
* @module MirrorShader | ||
* @three_import import { MirrorShader } from 'three/addons/shaders/MirrorShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module NormalMapShader */ | ||
/** | ||
* @module NormalMapShader | ||
* @three_import import { NormalMapShader } from 'three/addons/shaders/NormalMapShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module OutputShader */ | ||
/** | ||
* @module OutputShader | ||
* @three_import import { OutputShader } from 'three/addons/shaders/OutputShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -7,3 +7,6 @@ import { | ||
/** @module PoissonDenoiseShader */ | ||
/** | ||
* @module PoissonDenoiseShader | ||
* @three_import import { PoissonDenoiseShader } from 'three/addons/shaders/PoissonDenoiseShader.js'; | ||
*/ | ||
@@ -10,0 +13,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module RGBShiftShader */ | ||
/** | ||
* @module RGBShiftShader | ||
* @three_import import { RGBShiftShader } from 'three/addons/shaders/RGBShiftShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -6,3 +6,6 @@ import { | ||
/** @module SAOShader */ | ||
/** | ||
* @module SAOShader | ||
* @three_import import { SAOShader } from 'three/addons/shaders/SAOShader.js'; | ||
*/ | ||
@@ -9,0 +12,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module SepiaShader */ | ||
/** | ||
* @module SepiaShader | ||
* @three_import import { SepiaShader } from 'three/addons/shaders/SepiaShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -13,2 +13,3 @@ import { | ||
* @module SMAAShader | ||
* @three_import import { SMAAShader } from 'three/addons/shaders/SMAAShader.js'; | ||
*/ | ||
@@ -15,0 +16,0 @@ |
@@ -5,3 +5,6 @@ import { | ||
/** @module SobelOperatorShader */ | ||
/** | ||
* @module SobelOperatorShader | ||
* @three_import import { SobelOperatorShader } from 'three/addons/shaders/SobelOperatorShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -6,3 +6,6 @@ import { | ||
/** @module SSAOShader */ | ||
/** | ||
* @module SSAOShader | ||
* @three_import import { SSAOShader } from 'three/addons/shaders/SSAOShader.js'; | ||
*/ | ||
@@ -9,0 +12,0 @@ /** |
@@ -14,2 +14,3 @@ import { | ||
* @module SSRShader | ||
* @three_import import * as SSRShader from 'three/addons/shaders/SSRShader.js'; | ||
*/ | ||
@@ -16,0 +17,0 @@ |
@@ -17,3 +17,6 @@ import { | ||
/** @module SubsurfaceScatteringShader */ | ||
/** | ||
* @module SubsurfaceScatteringShader | ||
* @three_import import { SubsurfaceScatteringShader } from 'three/addons/shaders/SubsurfaceScatteringShader.js'; | ||
*/ | ||
@@ -20,0 +23,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module TriangleBlurShader */ | ||
/** | ||
* @module TriangleBlurShader | ||
* @three_import import { TriangleBlurShader } from 'three/addons/shaders/TriangleBlurShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -10,3 +10,4 @@ import { | ||
* @module TriangleBlurShader | ||
* */ | ||
* @three_import import * as ToonShader from 'three/addons/shaders/ToonShader.js'; | ||
*/ | ||
@@ -13,0 +14,0 @@ /** |
@@ -5,3 +5,6 @@ import { | ||
/** @module TriangleBlurShader */ | ||
/** | ||
* @module TriangleBlurShader | ||
* @three_import import { TriangleBlurShader } from 'three/addons/shaders/TriangleBlurShader.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module UnpackDepthRGBAShader */ | ||
/** | ||
* @module UnpackDepthRGBAShader | ||
* @three_import import { UnpackDepthRGBAShader } from 'three/addons/shaders/UnpackDepthRGBAShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -7,3 +7,6 @@ import { | ||
/** @module VelocityShader */ | ||
/** | ||
* @module VelocityShader | ||
* @three_import import { VelocityShader } from 'three/addons/shaders/VelocityShader.js'; | ||
*/ | ||
@@ -10,0 +13,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module VerticalBlurShader */ | ||
/** | ||
* @module VerticalBlurShader | ||
* @three_import import { VerticalBlurShader } from 'three/addons/shaders/VerticalBlurShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module VerticalTiltShiftShader */ | ||
/** | ||
* @module VerticalTiltShiftShader | ||
* @three_import import { VerticalTiltShiftShader } from 'three/addons/shaders/VerticalTiltShiftShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -1,2 +0,5 @@ | ||
/** @module VignetteShader */ | ||
/** | ||
* @module VignetteShader | ||
* @three_import import { VignetteShader } from 'three/addons/shaders/VignetteShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
@@ -6,3 +6,6 @@ import { | ||
/** @module VolumeShader */ | ||
/** | ||
* @module VolumeShader | ||
* @three_import import { VolumeRenderShader1 } from 'three/addons/shaders/VolumeShader.js'; | ||
*/ | ||
@@ -267,3 +270,3 @@ /** | ||
{ | ||
// Get light direction (make sure to prevent zero devision) | ||
// Get light direction (make sure to prevent zero division) | ||
vec3 L = normalize(view_ray); //lightDirs[i]; | ||
@@ -270,0 +273,0 @@ float lightEnabled = float( length(L) > 0.0 ); |
@@ -1,2 +0,5 @@ | ||
/** @module WaterRefractionShader */ | ||
/** | ||
* @module WaterRefractionShader | ||
* @three_import import { WaterRefractionShader } from 'three/addons/shaders/WaterRefractionShader.js'; | ||
*/ | ||
@@ -3,0 +6,0 @@ /** |
/** | ||
* Utility class for generating a flakes texture image. This image might be used | ||
* as a normal map to produce a car paint like effect. | ||
* | ||
* @three_import import { FlakesTexture } from 'three/addons/textures/FlakesTexture.js'; | ||
*/ | ||
@@ -5,0 +7,0 @@ class FlakesTexture { |
@@ -417,3 +417,2 @@ import { Program, FunctionDeclaration, For, AccessorElements, Ternary, Varying, DynamicElement, StaticElement, FunctionParameter, Unary, Conditional, VariableDeclaration, Operator, Number, String, FunctionCall, Return, Accessor, Uniform, Discard } from './AST.js'; | ||
// unary operators (after) | ||
@@ -898,3 +897,3 @@ | ||
if ( token.isLiteral ) { | ||
if ( token.isLiteral || token.isOperator ) { | ||
@@ -901,0 +900,0 @@ if ( token.str === 'const' ) { |
@@ -7,2 +7,4 @@ /** | ||
* current to the new node-based material system. | ||
* | ||
* @three_import import Transpiler from 'three/addons/transpiler/Transpiler.js'; | ||
*/ | ||
@@ -9,0 +11,0 @@ class Transpiler { |
@@ -18,2 +18,3 @@ import { REVISION } from 'three/webgpu'; | ||
'==': 'equal', | ||
'!=': 'notEqual', | ||
'&&': 'and', | ||
@@ -64,2 +65,4 @@ '||': 'or', | ||
this._currentVariable = null; | ||
this._currentProperties = {}; | ||
@@ -325,6 +328,19 @@ this._lastStatement = null; | ||
if ( node.after === false && ( node.type === '++' || node.type === '--' ) ) { | ||
if ( node.type === '++' || node.type === '--' ) { | ||
type += 'Before'; | ||
if ( this._currentVariable === null ) { | ||
// optimize increment/decrement operator | ||
// to avoid creating a new variable | ||
node.after = false; | ||
} | ||
if ( node.after === false ) { | ||
type += 'Before'; | ||
} | ||
} | ||
@@ -456,3 +472,2 @@ | ||
const condition = node.condition.type; | ||
const update = node.afterthought.type; | ||
@@ -462,4 +477,27 @@ const nameParam = name !== 'i' ? `, name: '${ name }'` : ''; | ||
const conditionParam = condition !== '<' ? `, condition: '${ condition }'` : ''; | ||
const updateParam = update !== '++' ? `, update: '${ update }'` : ''; | ||
let updateParam = ''; | ||
if ( node.afterthought.isUnary ) { | ||
if ( node.afterthought.type !== '++' ) { | ||
updateParam = `, update: '${ node.afterthought.type }'`; | ||
} | ||
} else if ( node.afterthought.isOperator ) { | ||
if ( node.afterthought.right.isAccessor || node.afterthought.right.isNumber ) { | ||
updateParam = `, update: ${ this.emitExpression( node.afterthought.right ) }`; | ||
} else { | ||
updateParam = `, update: ( { i } ) => ${ this.emitExpression( node.afterthought ) }`; | ||
} | ||
} | ||
let loopStr = `Loop( { start: ${ start }, end: ${ end + nameParam + typeParam + conditionParam + updateParam } }, ( { ${ name } } ) => {\n\n`; | ||
@@ -483,4 +521,6 @@ | ||
( condition && condition.left.isAccessor && condition.left.property === initialization.name ) && | ||
( afterthought && afterthought.isUnary ) && | ||
( initialization.name === afterthought.expression.property ) | ||
( afterthought && ( | ||
( afterthought.isUnary && ( initialization.name === afterthought.expression.property ) ) || | ||
( afterthought.isOperator && ( initialization.name === afterthought.left.property ) ) | ||
) ) | ||
) { | ||
@@ -505,3 +545,3 @@ | ||
let forStr = '{\n\n' + this.tab + initialization + ';\n\n'; | ||
forStr += `${ this.tab }While( ${ condition }, () => {\n\n`; | ||
forStr += `${ this.tab }Loop( ${ condition }, () => {\n\n`; | ||
@@ -518,3 +558,3 @@ forStr += this.emitBody( node.body ) + '\n\n'; | ||
this.imports.add( 'While' ); | ||
this.imports.add( 'Loop' ); | ||
@@ -529,2 +569,4 @@ return forStr; | ||
this._currentVariable = node; | ||
const valueStr = value ? this.emitExpression( value ) : ''; | ||
@@ -567,2 +609,4 @@ | ||
this._currentVariable = null; | ||
return varStr; | ||
@@ -569,0 +613,0 @@ |
@@ -13,2 +13,3 @@ import { RenderTarget, Vector2, QuadMesh, NodeMaterial, RendererUtils, TempNode, NodeUpdateType } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { afterImage } from 'three/addons/tsl/display/AfterImageNode.js'; | ||
*/ | ||
@@ -147,2 +148,3 @@ class AfterImageNode extends TempNode { | ||
// comp | ||
_quadMeshComp.material = this._materialComposed; | ||
@@ -207,5 +209,2 @@ renderer.setRenderTarget( this._compRT ); | ||
materialComposed.fragmentNode = afterImg(); | ||
_quadMeshComp.material = materialComposed; | ||
// | ||
@@ -212,0 +211,0 @@ |
@@ -9,2 +9,3 @@ import { Matrix3, NodeMaterial } from 'three/webgpu'; | ||
* @augments StereoCompositePassNode | ||
* @three_import import { anaglyphPass } from 'three/addons/tsl/display/AnaglyphPassNode.js'; | ||
*/ | ||
@@ -11,0 +12,0 @@ class AnaglyphPassNode extends StereoCompositePassNode { |
@@ -12,2 +12,3 @@ import { RenderTarget, Vector2, TempNode, QuadMesh, NodeMaterial, RendererUtils } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { anamorphic } from 'three/addons/tsl/display/AnamorphicNode.js'; | ||
*/ | ||
@@ -26,7 +27,7 @@ class AnamorphicNode extends TempNode { | ||
* @param {TextureNode} textureNode - The texture node that represents the input of the effect. | ||
* @param {Node<float>} tresholdNode - The threshold is one option to control the intensity and size of the effect. | ||
* @param {Node<float>} thresholdNode - The threshold is one option to control the intensity and size of the effect. | ||
* @param {Node<float>} scaleNode - Defines the vertical scale of the flares. | ||
* @param {number} samples - More samples result in larger flares and a more expensive runtime behavior. | ||
*/ | ||
constructor( textureNode, tresholdNode, scaleNode, samples ) { | ||
constructor( textureNode, thresholdNode, scaleNode, samples ) { | ||
@@ -47,3 +48,3 @@ super( 'vec4' ); | ||
*/ | ||
this.tresholdNode = tresholdNode; | ||
this.thresholdNode = thresholdNode; | ||
@@ -208,3 +209,3 @@ /** | ||
const color = sampleTexture( uv ); | ||
const pass = threshold( color, this.tresholdNode ).mul( softness ); | ||
const pass = threshold( color, this.thresholdNode ).mul( softness ); | ||
@@ -211,0 +212,0 @@ total.addAssign( pass ); |
@@ -43,2 +43,3 @@ import { HalfFloatType, RenderTarget, Vector2, Vector3, TempNode, QuadMesh, NodeMaterial, RendererUtils, NodeUpdateType } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { bloom } from 'three/addons/tsl/display/BloomNode.js'; | ||
*/ | ||
@@ -45,0 +46,0 @@ class BloomNode extends TempNode { |
import { DataTexture, RepeatWrapping, Vector2, Vector3, TempNode } from 'three/webgpu'; | ||
import { texture, getNormalFromDepth, getViewPosition, convertToTexture, nodeObject, Fn, float, NodeUpdateType, uv, uniform, Loop, luminance, vec2, vec3, vec4, uniformArray, int, dot, max, pow, abs, If, textureSize, sin, cos, mat2, PI } from 'three/tsl'; | ||
import { texture, getNormalFromDepth, getViewPosition, convertToTexture, nodeObject, Fn, float, NodeUpdateType, uv, uniform, Loop, luminance, vec2, vec3, vec4, uniformArray, int, dot, max, pow, abs, If, textureSize, sin, cos, mat2, PI, property } from 'three/tsl'; | ||
import { SimplexNoise } from '../../math/SimplexNoise.js'; | ||
@@ -14,2 +14,3 @@ | ||
* @augments TempNode | ||
* @three_import import { denoise } from 'three/addons/tsl/display/DenoiseNode.js'; | ||
*/ | ||
@@ -190,55 +191,54 @@ class DenoiseNode extends TempNode { | ||
const texel = sampleTexture( uvNode ).toVar(); | ||
const result = property( 'vec4' ); | ||
If( depth.greaterThanEqual( 1.0 ).or( dot( viewNormal, viewNormal ).equal( 0.0 ) ), () => { | ||
return texel; | ||
result.assign( texel ); | ||
} ); | ||
} ).Else( () => { | ||
const center = vec3( texel.rgb ).toVar(); | ||
const center = vec3( texel.rgb ); | ||
const viewPosition = getViewPosition( uvNode, depth, this._cameraProjectionMatrixInverse ).toVar(); | ||
const viewPosition = getViewPosition( uvNode, depth, this._cameraProjectionMatrixInverse ).toConst(); | ||
const noiseResolution = textureSize( this.noiseNode, 0 ); | ||
let noiseUv = vec2( uvNode.x, uvNode.y.oneMinus() ); | ||
noiseUv = noiseUv.mul( this._resolution.div( noiseResolution ) ); | ||
const noiseTexel = sampleNoise( noiseUv ).toVar(); | ||
const noiseResolution = textureSize( this.noiseNode, 0 ); | ||
let noiseUv = vec2( uvNode.x, uvNode.y.oneMinus() ); | ||
noiseUv = noiseUv.mul( this._resolution.div( noiseResolution ) ); | ||
const noiseTexel = sampleNoise( noiseUv ).toVar(); | ||
const x = sin( noiseTexel.element( this.index.mod( 4 ).mul( 2 ).mul( PI ) ) ).toVar(); | ||
const y = cos( noiseTexel.element( this.index.mod( 4 ).mul( 2 ).mul( PI ) ) ).toVar(); | ||
const x = sin( noiseTexel.element( this.index.mod( 4 ).mul( 2 ).mul( PI ) ) ); | ||
const y = cos( noiseTexel.element( this.index.mod( 4 ).mul( 2 ).mul( PI ) ) ); | ||
const noiseVec = vec2( x, y ).toVar(); | ||
const rotationMatrix = mat2( noiseVec.x, noiseVec.y.negate(), noiseVec.x, noiseVec.y ).toVar(); | ||
const noiseVec = vec2( x, y ); | ||
const rotationMatrix = mat2( noiseVec.x, noiseVec.y.negate(), noiseVec.x, noiseVec.y ); | ||
const totalWeight = float( 1.0 ).toVar(); | ||
const denoised = vec3( texel.rgb ).toVar(); | ||
const totalWeight = float( 1.0 ).toVar(); | ||
const denoised = vec3( texel.rgb ).toVar(); | ||
Loop( { start: int( 0 ), end: int( 16 ), type: 'int', condition: '<' }, ( { i } ) => { | ||
Loop( { start: int( 0 ), end: int( 16 ), type: 'int', condition: '<' }, ( { i } ) => { | ||
const sampleDir = this._sampleVectors.element( i ).toVar(); | ||
const offset = rotationMatrix.mul( sampleDir.xy.mul( float( 1.0 ).add( sampleDir.z.mul( this.radius.sub( 1 ) ) ) ) ).div( this._resolution ).toVar(); | ||
const sampleUv = uvNode.add( offset ).toVar(); | ||
const sampleDir = this._sampleVectors.element( i ); | ||
const offset = rotationMatrix.mul( sampleDir.xy.mul( float( 1.0 ).add( sampleDir.z.mul( this.radius.sub( 1 ) ) ) ) ).div( this._resolution ); | ||
const sampleUv = uvNode.add( offset ); | ||
const result = denoiseSample( center, viewNormal, viewPosition, sampleUv ); | ||
const sampleResult = denoiseSample( center, viewNormal, viewPosition, sampleUv ); | ||
denoised.addAssign( result.xyz ); | ||
totalWeight.addAssign( result.w ); | ||
denoised.addAssign( sampleResult.xyz ); | ||
totalWeight.addAssign( sampleResult.w ); | ||
} ); | ||
} ); | ||
If( totalWeight.greaterThan( float( 0 ) ), () => { | ||
If( totalWeight.greaterThan( float( 0 ) ), () => { | ||
denoised.divAssign( totalWeight ); | ||
denoised.divAssign( totalWeight ); | ||
} ); | ||
result.assign( vec4( denoised, texel.a ) ); | ||
} ); | ||
return vec4( denoised, texel.a ); | ||
return result; | ||
} ).setLayout( { | ||
name: 'denoise', | ||
type: 'vec4', | ||
inputs: [ | ||
{ name: 'uv', type: 'vec2' } | ||
] | ||
} ); | ||
}/*, { uv: 'vec2', return: 'vec4' }*/ ); | ||
@@ -245,0 +245,0 @@ const output = Fn( () => { |
@@ -8,2 +8,3 @@ import { TempNode, NodeUpdateType } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { dof } from 'three/addons/tsl/display/DepthOfFieldNode.js'; | ||
*/ | ||
@@ -10,0 +11,0 @@ class DepthOfFieldNode extends TempNode { |
@@ -8,2 +8,3 @@ import { TempNode } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { dotScreen } from 'three/addons/tsl/display/DotScreenNode.js'; | ||
*/ | ||
@@ -10,0 +11,0 @@ class DotScreenNode extends TempNode { |
@@ -8,2 +8,3 @@ import { TempNode } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { film } from 'three/addons/tsl/display/FilmNode.js'; | ||
*/ | ||
@@ -10,0 +11,0 @@ class FilmNode extends TempNode { |
@@ -9,2 +9,3 @@ import { Vector2, TempNode } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { fxaa } from 'three/addons/tsl/display/FXAANode.js'; | ||
*/ | ||
@@ -11,0 +12,0 @@ class FXAANode extends TempNode { |
@@ -38,2 +38,3 @@ import { RenderTarget, Vector2, NodeMaterial, RendererUtils, QuadMesh, TempNode, NodeUpdateType } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { gaussianBlur, premultipliedGaussianBlur } from 'three/addons/tsl/display/GaussianBlurNode.js'; | ||
*/ | ||
@@ -40,0 +41,0 @@ class GaussianBlurNode extends TempNode { |
@@ -32,2 +32,3 @@ import { DataTexture, RenderTarget, RepeatWrapping, Vector2, Vector3, TempNode, QuadMesh, NodeMaterial, RendererUtils } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { ao } from 'three/addons/tsl/display/GTAONode.js'; | ||
*/ | ||
@@ -34,0 +35,0 @@ class GTAONode extends TempNode { |
@@ -8,3 +8,2 @@ import { float, Fn, vec2, uv, sin, rand, degrees, cos, Loop, vec4 } from 'three/tsl'; | ||
* | ||
* @tsl | ||
* @function | ||
@@ -11,0 +10,0 @@ * @param {Node<vec4>} textureNode - The texture node that should be blurred. |
@@ -17,2 +17,3 @@ import { RenderTarget, Vector2, TempNode, NodeUpdateType, QuadMesh, RendererUtils, NodeMaterial } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { lensflare } from 'three/addons/tsl/display/LensflareNode.js'; | ||
*/ | ||
@@ -19,0 +20,0 @@ class LensflareNode extends TempNode { |
@@ -8,2 +8,3 @@ import { TempNode } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { lut3D } from 'three/addons/tsl/display/Lut3DNode.js'; | ||
*/ | ||
@@ -10,0 +11,0 @@ class Lut3DNode extends TempNode { |
@@ -43,2 +43,3 @@ import { DepthTexture, FloatType, RenderTarget, Vector2, TempNode, QuadMesh, NodeMaterial, RendererUtils, NodeUpdateType } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { outline } from 'three/addons/tsl/display/OutlineNode.js'; | ||
*/ | ||
@@ -45,0 +46,0 @@ class OutlineNode extends TempNode { |
@@ -9,2 +9,3 @@ import { NodeMaterial } from 'three/webgpu'; | ||
* @augments StereoCompositePassNode | ||
* @three_import import { parallaxBarrierPass } from 'three/addons/tsl/display/ParallaxBarrierPassNode.js'; | ||
*/ | ||
@@ -11,0 +12,0 @@ class ParallaxBarrierPassNode extends StereoCompositePassNode { |
@@ -222,2 +222,3 @@ import { NearestFilter, Vector4, TempNode, NodeUpdateType, PassNode } from 'three/webgpu'; | ||
* @augments PassNode | ||
* @three_import import { pixelationPass } from 'three/addons/tsl/display/PixelationPassNode.js'; | ||
*/ | ||
@@ -224,0 +225,0 @@ class PixelationPassNode extends PassNode { |
@@ -9,2 +9,3 @@ import { TempNode } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { rgbShift } from 'three/addons/tsl/display/RGBShiftNode.js'; | ||
*/ | ||
@@ -11,0 +12,0 @@ class RGBShiftNode extends TempNode { |
@@ -10,2 +10,3 @@ import { Vector2, TempNode, NodeUpdateType } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { sobel } from 'three/addons/tsl/display/SobelOperatorNode.js'; | ||
*/ | ||
@@ -12,0 +13,0 @@ class SobelOperatorNode extends TempNode { |
@@ -18,2 +18,3 @@ import { AdditiveBlending, Color, Vector2, RendererUtils, PassNode, QuadMesh, NodeMaterial } from 'three/webgpu'; | ||
* @augments PassNode | ||
* @three_import import { ssaaPass } from 'three/addons/tsl/display/SSAAPassNode.js'; | ||
*/ | ||
@@ -117,3 +118,3 @@ class SSAAPassNode extends PassNode { | ||
_rendererState = RendererUtils.resetRendererAndSceneState( renderer, scene, _rendererState ); | ||
_rendererState = RendererUtils.resetRendererState( renderer, _rendererState ); | ||
@@ -234,3 +235,3 @@ // | ||
RendererUtils.restoreRendererAndSceneState( renderer, scene, _rendererState ); | ||
RendererUtils.restoreRendererState( renderer, _rendererState ); | ||
@@ -237,0 +238,0 @@ } |
@@ -14,2 +14,3 @@ import { NearestFilter, RenderTarget, Vector2, RendererUtils, QuadMesh, TempNode, NodeMaterial, NodeUpdateType } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { ssr } from 'three/addons/tsl/display/SSRNode.js'; | ||
*/ | ||
@@ -16,0 +17,0 @@ class SSRNode extends TempNode { |
@@ -18,2 +18,3 @@ import { RenderTarget, StereoCamera, HalfFloatType, LinearFilter, NearestFilter, Vector2, PassNode, QuadMesh, RendererUtils } from 'three/webgpu'; | ||
* @augments PassNode | ||
* @three_import import { StereoCompositePassNode } from 'three/addons/tsl/display/StereoCompositePassNode.js'; | ||
*/ | ||
@@ -20,0 +21,0 @@ class StereoCompositePassNode extends PassNode { |
@@ -12,2 +12,3 @@ import { StereoCamera, Vector2, PassNode, RendererUtils } from 'three/webgpu'; | ||
* @augments PassNode | ||
* @three_import import { stereoPass } from 'three/addons/tsl/display/StereoPassNode.js'; | ||
*/ | ||
@@ -14,0 +15,0 @@ class StereoPassNode extends PassNode { |
@@ -20,2 +20,3 @@ import { Color, Vector2, NearestFilter, Matrix4, RendererUtils, PassNode, QuadMesh, NodeMaterial } from 'three/webgpu'; | ||
* @augments PassNode | ||
* @three_import import { traaPass } from 'three/addons/tsl/display/TRAAPassNode.js'; | ||
*/ | ||
@@ -157,3 +158,3 @@ class TRAAPassNode extends PassNode { | ||
_rendererState = RendererUtils.resetRendererAndSceneState( renderer, scene, _rendererState ); | ||
_rendererState = RendererUtils.resetRendererState( renderer, _rendererState ); | ||
@@ -296,3 +297,3 @@ // | ||
RendererUtils.restoreRendererAndSceneState( renderer, scene, _rendererState ); | ||
RendererUtils.restoreRendererState( renderer, _rendererState ); | ||
@@ -299,0 +300,0 @@ } |
@@ -8,2 +8,3 @@ import { TempNode } from 'three/webgpu'; | ||
* @augments TempNode | ||
* @three_import import { transition } from 'three/addons/tsl/display/TransitionNode.js'; | ||
*/ | ||
@@ -10,0 +11,0 @@ class TransitionNode extends TempNode { |
@@ -43,2 +43,3 @@ import { DataTexture, FloatType, RGBAFormat, Vector2, Vector3, LightsNode, NodeUpdateType } from 'three/webgpu'; | ||
* @augments LightsNode | ||
* @three_import import { tiledLights } from 'three/addons/tsl/lighting/TiledLightsNode.js'; | ||
*/ | ||
@@ -237,4 +238,4 @@ class TiledLightsNode extends LightsNode { | ||
// force declaration order, before of the loop | ||
lightingModel.directDiffuse.append(); | ||
lightingModel.directSpecular.append(); | ||
lightingModel.directDiffuse.toStack(); | ||
lightingModel.directSpecular.toStack(); | ||
@@ -266,3 +267,3 @@ super.setupLights( builder, lightNodes ); | ||
} )().append(); | ||
}, 'void' )(); | ||
@@ -269,0 +270,0 @@ } |
import { TextureLoader } from 'three'; | ||
import { Fn, int, ivec2, textureLoad } from 'three/tsl'; | ||
/** @module Bayer */ | ||
/** | ||
* @module Bayer | ||
* @three_import import { bayer16 } from 'three/addons/tsl/math/Bayer.js'; | ||
*/ | ||
@@ -6,0 +9,0 @@ let bayer16Texture = null; |
import { varying, vec4, modelWorldMatrixInverse, cameraPosition, positionGeometry, float, Fn, Loop, max, min, vec2, vec3 } from 'three/tsl'; | ||
/** @module Raymarching */ | ||
/** | ||
* @module Raymarching | ||
* @three_import import { RaymarchingBox } from 'three/addons/tsl/utils/Raymarching.js'; | ||
*/ | ||
@@ -53,3 +56,3 @@ const hitBox = /*@__PURE__*/ Fn( ( { orig, dir } ) => { | ||
const inc = vec3( rayDir.abs().reciprocal() ).toVar(); | ||
const delta = float( min( inc.x, min( inc.y, inc.z ) ) ).toVar( 'rayDelta' ); // used 'rayDelta' name in loop | ||
const delta = float( min( inc.x, min( inc.y, inc.z ) ) ).toVar(); | ||
@@ -60,3 +63,3 @@ delta.divAssign( float( steps ) ); | ||
Loop( { type: 'float', start: bounds.x, end: bounds.y, update: '+= rayDelta' }, () => { | ||
Loop( { type: 'float', start: bounds.x, end: bounds.y, update: delta }, () => { | ||
@@ -63,0 +66,0 @@ callback( { positionRay } ); |
@@ -14,3 +14,6 @@ import { | ||
/** @module BufferGeometryUtils */ | ||
/** | ||
* @module BufferGeometryUtils | ||
* @three_import import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js'; | ||
*/ | ||
@@ -17,0 +20,0 @@ /** |
@@ -7,3 +7,6 @@ import { | ||
/** @module CameraUtils */ | ||
/** | ||
* @module CameraUtils | ||
* @three_import import * as CameraUtils from 'three/addons/utils/CameraUtils.js'; | ||
*/ | ||
@@ -10,0 +13,0 @@ const _va = /*@__PURE__*/ new Vector3(), // from pe to pa |
@@ -8,3 +8,6 @@ import { | ||
/** @module GeometryCompressionUtils */ | ||
/** | ||
* @module GeometryCompressionUtils | ||
* @three_import import * as GeometryCompressionUtils from 'three/addons/utils/GeometryCompressionUtils.js'; | ||
*/ | ||
@@ -11,0 +14,0 @@ // Octahedron and Quantization encodings based on work by: https://github.com/tsherif/mesh-quantization-example |
import { Vector3 } from 'three'; | ||
/** @module GeometryUtils */ | ||
/** | ||
* @module GeometryUtils | ||
* @three_import import * as GeometryUtils from 'three/addons/utils/GeometryUtils.js'; | ||
*/ | ||
@@ -5,0 +8,0 @@ /** |
@@ -14,2 +14,4 @@ import { | ||
* Utility class for LDraw models. | ||
* | ||
* @three_import import { LDrawUtils } from 'three/addons/utils/LDrawUtils.js'; | ||
*/ | ||
@@ -16,0 +18,0 @@ class LDrawUtils { |
@@ -7,2 +7,4 @@ import * as THREE from 'three'; | ||
* is an experimental attempt to implement auto-batching in three.js. | ||
* | ||
* @three_import import { SceneOptimizer } from 'three/addons/utils/SceneOptimizer.js'; | ||
*/ | ||
@@ -9,0 +11,0 @@ class SceneOptimizer { |
@@ -13,3 +13,6 @@ import { | ||
/** @module SceneUtils */ | ||
/** | ||
* @module SceneUtils | ||
* @three_import import * as SceneUtils from 'three/addons/utils/SceneUtils.js'; | ||
*/ | ||
@@ -16,0 +19,0 @@ const _color = /*@__PURE__*/new Color(); |
@@ -30,2 +30,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewer.js'; | ||
*/ | ||
@@ -32,0 +34,0 @@ class ShadowMapViewer { |
@@ -30,2 +30,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { ShadowMapViewer } from 'three/addons/utils/ShadowMapViewerGPU.js'; | ||
*/ | ||
@@ -32,0 +34,0 @@ class ShadowMapViewer { |
@@ -12,3 +12,6 @@ import { | ||
/** @module SkeletonUtils */ | ||
/** | ||
* @module SkeletonUtils | ||
* @three_import import * as SkeletonUtils from 'three/addons/utils/SkeletonUtils.js'; | ||
*/ | ||
@@ -15,0 +18,0 @@ function getBoneName( bone, options ) { |
/** @module SortUtils */ | ||
/** | ||
* @module SortUtils | ||
* @three_import import * as SortUtils from 'three/addons/utils/SortUtils.js'; | ||
*/ | ||
@@ -4,0 +7,0 @@ const POWER = 3; |
@@ -5,3 +5,6 @@ import { | ||
/** @module UVsDebug */ | ||
/** | ||
* @module UVsDebug | ||
* @three_import import { UVsDebug } from 'three/addons/utils/UVsDebug.js'; | ||
*/ | ||
@@ -8,0 +11,0 @@ /** |
@@ -13,3 +13,6 @@ import { | ||
/** @module WebGLTextureUtils */ | ||
/** | ||
* @module WebGLTextureUtils | ||
* @three_import import * as WebGLTextureUtils from 'three/addons/utils/WebGLTextureUtils.js'; | ||
*/ | ||
@@ -16,0 +19,0 @@ let _renderer; |
@@ -9,3 +9,6 @@ import { | ||
/** @module WebGPUTextureUtils */ | ||
/** | ||
* @module WebGPUTextureUtils | ||
* @three_import import * as WebGPUTextureUtils from 'three/addons/utils/WebGPUTextureUtils.js'; | ||
*/ | ||
@@ -12,0 +15,0 @@ let _renderer; |
/** | ||
* A simple pool for managing Web Workers. | ||
* | ||
* @three_import import { WorkerPool } from 'three/addons/utils/WorkerPool.js'; | ||
*/ | ||
@@ -4,0 +6,0 @@ export class WorkerPool { |
@@ -11,2 +11,3 @@ /** | ||
* @hideconstructor | ||
* @three_import import { ARButton } from 'three/addons/webxr/ARButton.js'; | ||
*/ | ||
@@ -13,0 +14,0 @@ class ARButton { |
@@ -11,2 +11,3 @@ import { Object3D, Sphere, Box3 } from 'three'; | ||
* @augments Object3D | ||
* @three_import import { OculusHandModel } from 'three/addons/webxr/OculusHandModel.js'; | ||
*/ | ||
@@ -13,0 +14,0 @@ class OculusHandModel extends Object3D { |
@@ -26,2 +26,3 @@ import { BufferGeometry, Float32BufferAttribute, Matrix4, Mesh, MeshBasicMaterial, Object3D, Raycaster, SphereGeometry, Vector3 } from 'three'; | ||
* @augments Object3D | ||
* @three_import import { OculusHandPointerModel } from 'three/addons/webxr/OculusHandPointerModel.js'; | ||
*/ | ||
@@ -28,0 +29,0 @@ class OculusHandPointerModel extends Object3D { |
import { DoubleSide, Mesh, MeshBasicMaterial, PlaneGeometry, Texture } from 'three'; | ||
/** @module Text2D */ | ||
/** | ||
* @module Text2D | ||
* @three_import import * as Text2D from 'three/addons/webxr/Text2D.js'; | ||
*/ | ||
@@ -5,0 +8,0 @@ /** |
@@ -11,2 +11,3 @@ /** | ||
* @hideconstructor | ||
* @three_import import { VRButton } from 'three/addons/webxr/VRButton.js'; | ||
*/ | ||
@@ -13,0 +14,0 @@ class VRButton { |
@@ -15,2 +15,3 @@ /** | ||
* @hideconstructor | ||
* @three_import import { XRButton } from 'three/addons/webxr/XRButton.js'; | ||
*/ | ||
@@ -17,0 +18,0 @@ class XRButton { |
@@ -258,2 +258,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { XRControllerModelFactory } from 'three/addons/webxr/XRControllerModelFactory.js'; | ||
*/ | ||
@@ -260,0 +262,0 @@ class XRControllerModelFactory { |
@@ -141,2 +141,3 @@ import { | ||
* @augments Group | ||
* @three_import import { XREstimatedLight } from 'three/addons/webxr/XREstimatedLight.js'; | ||
*/ | ||
@@ -143,0 +144,0 @@ export class XREstimatedLight extends Group { |
@@ -9,2 +9,4 @@ import { GLTFLoader } from '../loaders/GLTFLoader.js'; | ||
* custom asset. | ||
* | ||
* @three_import import { XRHandMeshModel } from 'three/addons/webxr/XRHandMeshModel.js'; | ||
*/ | ||
@@ -11,0 +13,0 @@ class XRHandMeshModel { |
@@ -93,2 +93,4 @@ import { | ||
* ``` | ||
* | ||
* @three_import import { XRHandModelFactory } from 'three/addons/webxr/XRHandModelFactory.js'; | ||
*/ | ||
@@ -95,0 +97,0 @@ class XRHandModelFactory { |
@@ -18,2 +18,4 @@ import { | ||
* with sphere or box primitives according to the selected `primitive` option. | ||
* | ||
* @three_import import { XRHandPrimitiveModel } from 'three/addons/webxr/XRHandPrimitiveModel.js'; | ||
*/ | ||
@@ -20,0 +22,0 @@ class XRHandPrimitiveModel { |
@@ -20,2 +20,3 @@ import { | ||
* @augments Object3D | ||
* @three_import import { XRPlanes } from 'three/addons/webxr/XRPlanes.js'; | ||
*/ | ||
@@ -22,0 +23,0 @@ class XRPlanes extends Object3D { |
{ | ||
"name": "three", | ||
"version": "0.175.0", | ||
"version": "0.176.0", | ||
"description": "JavaScript 3D library", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -35,2 +35,11 @@ import { PerspectiveCamera } from './PerspectiveCamera.js'; | ||
/** | ||
* Whether this camera is used with multiview rendering or not. | ||
* | ||
* @type {boolean} | ||
* @readonly | ||
* @default false | ||
*/ | ||
this.isMultiViewCamera = false; | ||
/** | ||
* An array of perspective sub cameras. | ||
@@ -41,3 +50,2 @@ * | ||
this.cameras = array; | ||
this.index = 0; | ||
@@ -44,0 +52,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export const REVISION = '175'; | ||
export const REVISION = '176'; | ||
@@ -749,21 +749,2 @@ /** | ||
/** | ||
* reads each element as a single luminance component. This is then converted to a floating point, | ||
* clamped to the range `[0,1]`, and then assembled into an RGBA element by placing the luminance value | ||
* in the red, green and blue channels, and attaching 1.0 to the alpha channel. | ||
* | ||
* @type {number} | ||
* @constant | ||
*/ | ||
export const LuminanceFormat = 1024; | ||
/** | ||
* Reads each element as a luminance/alpha double. The same process occurs as for the `LuminanceFormat`, | ||
* except that the alpha channel may have values other than `1.0`. | ||
* | ||
* @type {number} | ||
* @constant | ||
*/ | ||
export const LuminanceAlphaFormat = 1025; | ||
/** | ||
* Reads each element as a single depth value, converts it to floating point, and clamps to the range `[0,1]`. | ||
@@ -1614,2 +1595,28 @@ * | ||
/** | ||
* Represents mouse buttons and interaction types in context of controls. | ||
* | ||
* @type {ConstantsInterpolationSamplingType} | ||
* @constant | ||
*/ | ||
export const InterpolationSamplingType = { | ||
PERSPECTIVE: 'perspective', | ||
LINEAR: 'linear', | ||
FLAT: 'flat' | ||
}; | ||
/** | ||
* Represents the different interpolation sampling modes. | ||
* | ||
* @type {ConstantsInterpolationSamplingMode} | ||
* @constant | ||
*/ | ||
export const InterpolationSamplingMode = { | ||
NORMAL: 'normal', | ||
CENTROID: 'centroid', | ||
SAMPLE: 'sample', | ||
FLAT_FIRST: 'flat first', | ||
FLAT_EITHER: 'flat either' | ||
}; | ||
/** | ||
* This type represents mouse buttons and interaction types in context of controls. | ||
@@ -1643,1 +1650,21 @@ * | ||
**/ | ||
/** | ||
* Represents the different interpolation sampling types. | ||
* | ||
* @typedef {Object} ConstantsInterpolationSamplingType | ||
* @property {string} PERSPECTIVE - Perspective-correct interpolation. | ||
* @property {string} LINEAR - Linear interpolation. | ||
* @property {string} FLAT - Flat interpolation. | ||
*/ | ||
/** | ||
* Represents the different interpolation sampling modes. | ||
* | ||
* @typedef {Object} ConstantsInterpolationSamplingMode | ||
* @property {string} NORMAL - Normal sampling mode. | ||
* @property {string} CENTROID - Centroid sampling mode. | ||
* @property {string} SAMPLE - Sample-specific sampling mode. | ||
* @property {string} FLAT_FIRST - Flat interpolation using the first vertex. | ||
* @property {string} FLAT_EITHER - Flat interpolation using either vertex. | ||
*/ |
@@ -844,3 +844,3 @@ import { Vector3 } from '../math/Vector3.js'; | ||
* | ||
* This class automatically converts to to and from FP16 since `Float16Array` is not | ||
* This class automatically converts to and from FP16 since `Float16Array` is not | ||
* natively supported in JavaScript. | ||
@@ -847,0 +847,0 @@ * |
@@ -1297,14 +1297,22 @@ import { Quaternion } from '../math/Quaternion.js'; | ||
object.visibility = this._visibility; | ||
object.active = this._active; | ||
object.bounds = this._bounds.map( bound => ( { | ||
boxInitialized: bound.boxInitialized, | ||
boxMin: bound.box.min.toArray(), | ||
boxMax: bound.box.max.toArray(), | ||
sphereInitialized: bound.sphereInitialized, | ||
sphereRadius: bound.sphere.radius, | ||
sphereCenter: bound.sphere.center.toArray() | ||
object.geometryInfo = this._geometryInfo.map( info => ( { | ||
...info, | ||
boundingBox: info.boundingBox ? { | ||
min: info.boundingBox.min.toArray(), | ||
max: info.boundingBox.max.toArray() | ||
} : undefined, | ||
boundingSphere: info.boundingSphere ? { | ||
radius: info.boundingSphere.radius, | ||
center: info.boundingSphere.center.toArray() | ||
} : undefined | ||
} ) ); | ||
object.instanceInfo = this._instanceInfo.map( info => ( { ...info } ) ); | ||
object.availableInstanceIds = this._availableInstanceIds.slice(); | ||
object.availableGeometryIds = this._availableGeometryIds.slice(); | ||
object.nextIndexStart = this._nextIndexStart; | ||
object.nextVertexStart = this._nextVertexStart; | ||
object.geometryCount = this._geometryCount; | ||
object.maxInstanceCount = this._maxInstanceCount; | ||
@@ -1315,13 +1323,18 @@ object.maxVertexCount = this._maxVertexCount; | ||
object.geometryInitialized = this._geometryInitialized; | ||
object.geometryCount = this._geometryCount; | ||
object.matricesTexture = this._matricesTexture.toJSON( meta ); | ||
if ( this._colorsTexture !== null ) object.colorsTexture = this._colorsTexture.toJSON( meta ); | ||
object.indirectTexture = this._indirectTexture.toJSON( meta ); | ||
if ( this._colorsTexture !== null ) { | ||
object.colorsTexture = this._colorsTexture.toJSON( meta ); | ||
} | ||
if ( this.boundingSphere !== null ) { | ||
object.boundingSphere = { | ||
center: object.boundingSphere.center.toArray(), | ||
radius: object.boundingSphere.radius | ||
center: this.boundingSphere.center.toArray(), | ||
radius: this.boundingSphere.radius | ||
}; | ||
@@ -1334,4 +1347,4 @@ | ||
object.boundingBox = { | ||
min: object.boundingBox.min.toArray(), | ||
max: object.boundingBox.max.toArray() | ||
min: this.boundingBox.min.toArray(), | ||
max: this.boundingBox.max.toArray() | ||
}; | ||
@@ -1338,0 +1351,0 @@ |
@@ -38,2 +38,3 @@ import { EventDispatcher } from './EventDispatcher.js'; | ||
* @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`. | ||
* @property {boolean} [multiview=false] - Whether this target is used for multiview rendering. | ||
*/ | ||
@@ -83,3 +84,3 @@ | ||
*/ | ||
this.depth = 1; | ||
this.depth = options.depth ? options.depth : 1; | ||
@@ -112,3 +113,3 @@ /** | ||
const image = { width: width, height: height, depth: 1 }; | ||
const image = { width: width, height: height, depth: this.depth }; | ||
@@ -125,3 +126,4 @@ options = Object.assign( { | ||
samples: 0, | ||
count: 1 | ||
count: 1, | ||
multiview: false | ||
}, options ); | ||
@@ -184,3 +186,4 @@ | ||
this._depthTexture = options.depthTexture; | ||
this._depthTexture = null; | ||
this.depthTexture = options.depthTexture; | ||
@@ -197,2 +200,10 @@ /** | ||
/** | ||
* Whether to this target is used in multiview rendering. | ||
* | ||
* @type {boolean} | ||
* @default false | ||
*/ | ||
this.multiview = options.multiview; | ||
} | ||
@@ -199,0 +210,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { AlphaFormat, LuminanceFormat, LuminanceAlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type } from '../constants.js'; | ||
import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type } from '../constants.js'; | ||
@@ -109,6 +109,2 @@ /** | ||
return width * height; | ||
case LuminanceFormat: | ||
return width * height; | ||
case LuminanceAlphaFormat: | ||
return width * height * 2; | ||
case RedFormat: | ||
@@ -115,0 +111,0 @@ return ( ( width * height ) / typeByteLength.components ) * typeByteLength.byteLength; |
@@ -1,9 +0,10 @@ | ||
import { Path } from '../extras/core/Path.js'; | ||
import { LatheGeometry } from './LatheGeometry.js'; | ||
import { BufferGeometry } from '../core/BufferGeometry.js'; | ||
import { Float32BufferAttribute } from '../core/BufferAttribute.js'; | ||
import { Vector3 } from '../math/Vector3.js'; | ||
/** | ||
* A geometry class for a capsule with given radii and height. It is constructed using a lathe. | ||
* A geometry class for representing a capsule. | ||
* | ||
* ```js | ||
* const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8 ); | ||
* const geometry = new THREE.CapsuleGeometry( 1, 1, 4, 8, 1 ); | ||
* const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } ); | ||
@@ -14,5 +15,5 @@ * const capsule = new THREE.Mesh( geometry, material ); | ||
* | ||
* @augments LatheGeometry | ||
* @augments BufferGeometry | ||
*/ | ||
class CapsuleGeometry extends LatheGeometry { | ||
class CapsuleGeometry extends BufferGeometry { | ||
@@ -23,14 +24,11 @@ /** | ||
* @param {number} [radius=1] - Radius of the capsule. | ||
* @param {number} [length=1] - Length of the middle section. | ||
* @param {number} [capSegments=4] - Number of curve segments used to build the caps. | ||
* @param {number} [radialSegments=8] - Number of segmented faces around the circumference of the capsule. | ||
* @param {number} [height=1] - Height of the middle section. | ||
* @param {number} [capSegments=4] - Number of curve segments used to build each cap. | ||
* @param {number} [radialSegments=8] - Number of segmented faces around the circumference of the capsule. Must be an integer >= 3. | ||
* @param {number} [heightSegments=1] - Number of rows of faces along the height of the middle section. Must be an integer >= 1. | ||
*/ | ||
constructor( radius = 1, length = 1, capSegments = 4, radialSegments = 8 ) { | ||
constructor( radius = 1, height = 1, capSegments = 4, radialSegments = 8, heightSegments = 1 ) { | ||
const path = new Path(); | ||
path.absarc( 0, - length / 2, radius, Math.PI * 1.5, 0 ); | ||
path.absarc( 0, length / 2, radius, 0, Math.PI * 0.5 ); | ||
super(); | ||
super( path.getPoints( capSegments ), radialSegments ); | ||
this.type = 'CapsuleGeometry'; | ||
@@ -47,9 +45,161 @@ | ||
radius: radius, | ||
length: length, | ||
height: height, | ||
capSegments: capSegments, | ||
radialSegments: radialSegments, | ||
heightSegments: heightSegments, | ||
}; | ||
height = Math.max( 0, height ); | ||
capSegments = Math.max( 1, Math.floor( capSegments ) ); | ||
radialSegments = Math.max( 3, Math.floor( radialSegments ) ); | ||
heightSegments = Math.max( 1, Math.floor( heightSegments ) ); | ||
// buffers | ||
const indices = []; | ||
const vertices = []; | ||
const normals = []; | ||
const uvs = []; | ||
// helper variables | ||
const halfHeight = height / 2; | ||
const capArcLength = ( Math.PI / 2 ) * radius; | ||
const cylinderPartLength = height; | ||
const totalArcLength = 2 * capArcLength + cylinderPartLength; | ||
const numVerticalSegments = capSegments * 2 + heightSegments; | ||
const verticesPerRow = radialSegments + 1; | ||
const normal = new Vector3(); | ||
const vertex = new Vector3(); | ||
// generate vertices, normals, and uvs | ||
for ( let iy = 0; iy <= numVerticalSegments; iy ++ ) { | ||
let currentArcLength = 0; | ||
let profileY = 0; | ||
let profileRadius = 0; | ||
let normalYComponent = 0; | ||
if ( iy <= capSegments ) { | ||
// bottom cap | ||
const segmentProgress = iy / capSegments; | ||
const angle = ( segmentProgress * Math.PI ) / 2; | ||
profileY = - halfHeight - radius * Math.cos( angle ); | ||
profileRadius = radius * Math.sin( angle ); | ||
normalYComponent = - radius * Math.cos( angle ); | ||
currentArcLength = segmentProgress * capArcLength; | ||
} else if ( iy <= capSegments + heightSegments ) { | ||
// middle section | ||
const segmentProgress = ( iy - capSegments ) / heightSegments; | ||
profileY = - halfHeight + segmentProgress * height; | ||
profileRadius = radius; | ||
normalYComponent = 0; | ||
currentArcLength = capArcLength + segmentProgress * cylinderPartLength; | ||
} else { | ||
// top cap | ||
const segmentProgress = | ||
( iy - capSegments - heightSegments ) / capSegments; | ||
const angle = ( segmentProgress * Math.PI ) / 2; | ||
profileY = halfHeight + radius * Math.sin( angle ); | ||
profileRadius = radius * Math.cos( angle ); | ||
normalYComponent = radius * Math.sin( angle ); | ||
currentArcLength = | ||
capArcLength + cylinderPartLength + segmentProgress * capArcLength; | ||
} | ||
const v = Math.max( 0, Math.min( 1, currentArcLength / totalArcLength ) ); | ||
// special case for the poles | ||
let uOffset = 0; | ||
if ( iy === 0 ) { | ||
uOffset = 0.5 / radialSegments; | ||
} else if ( iy === numVerticalSegments ) { | ||
uOffset = - 0.5 / radialSegments; | ||
} | ||
for ( let ix = 0; ix <= radialSegments; ix ++ ) { | ||
const u = ix / radialSegments; | ||
const theta = u * Math.PI * 2; | ||
const sinTheta = Math.sin( theta ); | ||
const cosTheta = Math.cos( theta ); | ||
// vertex | ||
vertex.x = - profileRadius * cosTheta; | ||
vertex.y = profileY; | ||
vertex.z = profileRadius * sinTheta; | ||
vertices.push( vertex.x, vertex.y, vertex.z ); | ||
// normal | ||
normal.set( | ||
- profileRadius * cosTheta, | ||
normalYComponent, | ||
profileRadius * sinTheta | ||
); | ||
normal.normalize(); | ||
normals.push( normal.x, normal.y, normal.z ); | ||
// uv | ||
uvs.push( u + uOffset, v ); | ||
} | ||
if ( iy > 0 ) { | ||
const prevIndexRow = ( iy - 1 ) * verticesPerRow; | ||
for ( let ix = 0; ix < radialSegments; ix ++ ) { | ||
const i1 = prevIndexRow + ix; | ||
const i2 = prevIndexRow + ix + 1; | ||
const i3 = iy * verticesPerRow + ix; | ||
const i4 = iy * verticesPerRow + ix + 1; | ||
indices.push( i1, i2, i3 ); | ||
indices.push( i2, i4, i3 ); | ||
} | ||
} | ||
} | ||
// build geometry | ||
this.setIndex( indices ); | ||
this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) ); | ||
this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) ); | ||
this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) ); | ||
} | ||
copy( source ) { | ||
super.copy( source ); | ||
this.parameters = Object.assign( {}, source.parameters ); | ||
return this; | ||
} | ||
/** | ||
@@ -64,3 +214,3 @@ * Factory method for creating an instance of this class from the given | ||
return new CapsuleGeometry( data.radius, data.length, data.capSegments, data.radialSegments ); | ||
return new CapsuleGeometry( data.radius, data.height, data.capSegments, data.radialSegments, data.heightSegments ); | ||
@@ -67,0 +217,0 @@ } |
@@ -187,4 +187,4 @@ import { BufferGeometry } from '../core/BufferGeometry.js'; | ||
); | ||
const thesholdSqScaled = THRESHOLD_SQ * scalingFactorSqrt * scalingFactorSqrt; | ||
if ( distSq <= thesholdSqScaled ) { | ||
const thresholdSqScaled = THRESHOLD_SQ * scalingFactorSqrt * scalingFactorSqrt; | ||
if ( distSq <= thresholdSqScaled ) { | ||
@@ -397,50 +397,60 @@ points.splice( currentIndex, 1 ); | ||
const contractedContourVertices = []; | ||
const expandedHoleVertices = []; | ||
let faces; | ||
// Loop bevelSegments, 1 for the front, 1 for the back | ||
if ( bevelSegments === 0 ) { | ||
for ( let b = 0; b < bevelSegments; b ++ ) { | ||
faces = ShapeUtils.triangulateShape( contour, holes ); | ||
//for ( b = bevelSegments; b > 0; b -- ) { | ||
} else { | ||
const t = b / bevelSegments; | ||
const z = bevelThickness * Math.cos( t * Math.PI / 2 ); | ||
const bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset; | ||
const contractedContourVertices = []; | ||
const expandedHoleVertices = []; | ||
// contract shape | ||
// Loop bevelSegments, 1 for the front, 1 for the back | ||
for ( let i = 0, il = contour.length; i < il; i ++ ) { | ||
for ( let b = 0; b < bevelSegments; b ++ ) { | ||
const vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); | ||
//for ( b = bevelSegments; b > 0; b -- ) { | ||
v( vert.x, vert.y, - z ); | ||
if ( t == 0 ) contractedContourVertices.push( vert ); | ||
const t = b / bevelSegments; | ||
const z = bevelThickness * Math.cos( t * Math.PI / 2 ); | ||
const bs = bevelSize * Math.sin( t * Math.PI / 2 ) + bevelOffset; | ||
} | ||
// contract shape | ||
// expand holes | ||
for ( let i = 0, il = contour.length; i < il; i ++ ) { | ||
for ( let h = 0, hl = numHoles; h < hl; h ++ ) { | ||
const vert = scalePt2( contour[ i ], contourMovements[ i ], bs ); | ||
const ahole = holes[ h ]; | ||
oneHoleMovements = holesMovements[ h ]; | ||
const oneHoleVertices = []; | ||
for ( let i = 0, il = ahole.length; i < il; i ++ ) { | ||
v( vert.x, vert.y, - z ); | ||
if ( t === 0 ) contractedContourVertices.push( vert ); | ||
const vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); | ||
} | ||
v( vert.x, vert.y, - z ); | ||
if ( t == 0 ) oneHoleVertices.push( vert ); | ||
// expand holes | ||
for ( let h = 0, hl = numHoles; h < hl; h ++ ) { | ||
const ahole = holes[ h ]; | ||
oneHoleMovements = holesMovements[ h ]; | ||
const oneHoleVertices = []; | ||
for ( let i = 0, il = ahole.length; i < il; i ++ ) { | ||
const vert = scalePt2( ahole[ i ], oneHoleMovements[ i ], bs ); | ||
v( vert.x, vert.y, - z ); | ||
if ( t === 0 ) oneHoleVertices.push( vert ); | ||
} | ||
if ( t === 0 ) expandedHoleVertices.push( oneHoleVertices ); | ||
} | ||
if ( t == 0 ) expandedHoleVertices.push( oneHoleVertices ); | ||
} | ||
faces = ShapeUtils.triangulateShape( contractedContourVertices, expandedHoleVertices ); | ||
} | ||
const faces = ShapeUtils.triangulateShape( contractedContourVertices, expandedHoleVertices ); | ||
const flen = faces.length; | ||
@@ -447,0 +457,0 @@ |
import { Float32BufferAttribute } from '../core/BufferAttribute.js'; | ||
import { BufferGeometry } from '../core/BufferGeometry.js'; | ||
import { Object3D } from '../core/Object3D.js'; | ||
import { CylinderGeometry } from '../geometries/CylinderGeometry.js'; | ||
import { ConeGeometry } from '../geometries/ConeGeometry.js'; | ||
import { MeshBasicMaterial } from '../materials/MeshBasicMaterial.js'; | ||
@@ -56,3 +56,3 @@ import { LineBasicMaterial } from '../materials/LineBasicMaterial.js'; | ||
_coneGeometry = new CylinderGeometry( 0, 0.5, 1, 5, 1 ); | ||
_coneGeometry = new ConeGeometry( 0.5, 1, 5, 1 ); | ||
_coneGeometry.translate( 0, - 0.5, 0 ); | ||
@@ -59,0 +59,0 @@ |
@@ -6,2 +6,3 @@ import { Matrix4 } from '../math/Matrix4.js'; | ||
import { Frustum } from '../math/Frustum.js'; | ||
import { UnsignedByteType } from '../constants.js'; | ||
@@ -100,2 +101,10 @@ const _projScreenMatrix = /*@__PURE__*/ new Matrix4(); | ||
/** | ||
* The type of shadow texture. The default is `UnsignedByteType`. | ||
* | ||
* @type {number} | ||
* @default UnsignedByteType | ||
*/ | ||
this.mapType = UnsignedByteType; | ||
/** | ||
* The depth map generated using the internal camera; a location beyond a | ||
@@ -271,2 +280,7 @@ * pixel's depth is in shadow. Computed internally during rendering. | ||
this.autoUpdate = source.autoUpdate; | ||
this.needsUpdate = source.needsUpdate; | ||
this.normalBias = source.normalBias; | ||
this.blurSamples = source.blurSamples; | ||
this.mapSize.copy( source.mapSize ); | ||
@@ -273,0 +287,0 @@ |
@@ -41,3 +41,3 @@ import NodeLoader from './NodeLoader.js'; | ||
* @private | ||
* @type {?Object} | ||
* @type {?Object[]} | ||
*/ | ||
@@ -96,3 +96,3 @@ this._nodesJSON = null; | ||
* | ||
* @param {Object} json - The JSON definition | ||
* @param {Object[]} json - The JSON definition | ||
* @param {Object<string,Texture>} textures - The texture library. | ||
@@ -99,0 +99,0 @@ * @return {Object<string,Node>}. The parsed nodes. |
@@ -976,24 +976,38 @@ import { | ||
object._visibility = data.visibility; | ||
object._active = data.active; | ||
object._bounds = data.bounds.map( bound => { | ||
object._geometryInfo = data.geometryInfo.map( info => { | ||
const box = new Box3(); | ||
box.min.fromArray( bound.boxMin ); | ||
box.max.fromArray( bound.boxMax ); | ||
let box = null; | ||
let sphere = null; | ||
if ( info.boundingBox !== undefined ) { | ||
const sphere = new Sphere(); | ||
sphere.radius = bound.sphereRadius; | ||
sphere.center.fromArray( bound.sphereCenter ); | ||
box = new Box3(); | ||
box.min.fromArray( info.boundingBox.min ); | ||
box.max.fromArray( info.boundingBox.max ); | ||
} | ||
if ( info.boundingSphere !== undefined ) { | ||
sphere = new Sphere(); | ||
sphere.radius = info.boundingSphere.radius; | ||
sphere.center.fromArray( info.boundingSphere.center ); | ||
} | ||
return { | ||
boxInitialized: bound.boxInitialized, | ||
box: box, | ||
sphereInitialized: bound.sphereInitialized, | ||
sphere: sphere | ||
...info, | ||
boundingBox: box, | ||
boundingSphere: sphere | ||
}; | ||
} ); | ||
object._instanceInfo = data.instanceInfo; | ||
object._availableInstanceIds = data._availableInstanceIds; | ||
object._availableGeometryIds = data._availableGeometryIds; | ||
object._nextIndexStart = data.nextIndexStart; | ||
object._nextVertexStart = data.nextVertexStart; | ||
object._geometryCount = data.geometryCount; | ||
object._maxInstanceCount = data.maxInstanceCount; | ||
@@ -1004,7 +1018,29 @@ object._maxVertexCount = data.maxVertexCount; | ||
object._geometryInitialized = data.geometryInitialized; | ||
object._geometryCount = data.geometryCount; | ||
object._matricesTexture = getTexture( data.matricesTexture.uuid ); | ||
if ( data.colorsTexture !== undefined ) object._colorsTexture = getTexture( data.colorsTexture.uuid ); | ||
object._indirectTexture = getTexture( data.indirectTexture.uuid ); | ||
if ( data.colorsTexture !== undefined ) { | ||
object._colorsTexture = getTexture( data.colorsTexture.uuid ); | ||
} | ||
if ( data.boundingSphere !== undefined ) { | ||
object.boundingSphere = new Sphere(); | ||
object.boundingSphere.center.fromArray( data.boundingSphere.center ); | ||
object.boundingSphere.radius = data.boundingSphere.radius; | ||
} | ||
if ( data.boundingBox !== undefined ) { | ||
object.boundingBox = new Box3(); | ||
object.boundingBox.min.fromArray( data.boundingBox.min ); | ||
object.boundingBox.max.fromArray( data.boundingBox.max ); | ||
} | ||
break; | ||
@@ -1011,0 +1047,0 @@ |
@@ -1000,10 +1000,4 @@ import { Color } from '../math/Color.js'; | ||
onBuild( /* shaderobject, renderer */ ) { | ||
console.warn( 'Material: onBuild() has been removed.' ); // @deprecated, r166 | ||
} | ||
} | ||
export { Material }; |
@@ -130,2 +130,16 @@ const refreshUniforms = [ | ||
/** | ||
* Returns `true` if the current rendering produces motion vectors. | ||
* | ||
* @param {Renderer} renderer - The renderer. | ||
* @return {boolean} Whether the current rendering produces motion vectors or not. | ||
*/ | ||
needsVelocity( renderer ) { | ||
const mrt = renderer.getMRT(); | ||
return ( mrt !== null && mrt.has( 'velocity' ) ); | ||
} | ||
/** | ||
* Returns monitoring data for the given render object. | ||
@@ -233,3 +247,3 @@ * | ||
if ( builder.renderer.nodes.modelViewMatrix !== null || builder.renderer.nodes.modelNormalViewMatrix !== null ) | ||
if ( builder.renderer.overrideNodes.modelViewMatrix !== null || builder.renderer.overrideNodes.modelNormalViewMatrix !== null ) | ||
return true; | ||
@@ -484,3 +498,3 @@ | ||
if ( this.hasNode || this.hasAnimation || this.firstInitialization( renderObject ) ) | ||
if ( this.hasNode || this.hasAnimation || this.firstInitialization( renderObject ) || this.needsVelocity( nodeFrame.renderer ) ) | ||
return true; | ||
@@ -487,0 +501,0 @@ |
@@ -5,3 +5,2 @@ import { Material } from '../Material.js'; | ||
import { getNodeChildren, getCacheKey } from '../../nodes/core/NodeUtils.js'; | ||
import { attribute } from '../../nodes/core/AttributeNode.js'; | ||
import { output, diffuseColor, emissive, varyingProperty } from '../../nodes/core/PropertyNode.js'; | ||
@@ -28,2 +27,3 @@ import { materialAlphaTest, materialColor, materialOpacity, materialEmissive, materialNormal, materialLightMap, materialAO } from '../../nodes/accessors/MaterialNode.js'; | ||
import { modelViewMatrix } from '../../nodes/accessors/ModelNode.js'; | ||
import { vertexColor } from '../../nodes/accessors/VertexColorNode.js'; | ||
@@ -193,3 +193,3 @@ /** | ||
/** | ||
* This node can be used to to implement a variety of filter-like effects. The idea is | ||
* This node can be used to implement a variety of filter-like effects. The idea is | ||
* to store the current rendering into a texture e.g. via `viewportSharedTexture()`, use it | ||
@@ -284,5 +284,14 @@ * to create an arbitrary effect and then assign the node composition to this property. | ||
*/ | ||
this.shadowPositionNode = null; | ||
this.receivedShadowPositionNode = null; | ||
/** | ||
* Allows to overwrite the geometry position used for shadow map projection which | ||
* is by default {@link positionLocal}, the vertex position in local space. | ||
* | ||
* @type {?Node<float>} | ||
* @default null | ||
*/ | ||
this.castShadowPositionNode = null; | ||
/** | ||
* This node can be used to influence how an object using this node material | ||
@@ -369,2 +378,22 @@ * receive shadows. | ||
// Deprecated properties | ||
Object.defineProperty( this, 'shadowPositionNode', { // @deprecated, r176 | ||
get: () => { | ||
return this.receivedShadowPositionNode; | ||
}, | ||
set: ( value ) => { | ||
console.warn( 'THREE.NodeMaterial: ".shadowPositionNode" was renamed to ".receivedShadowPositionNode".' ); | ||
this.receivedShadowPositionNode = value; | ||
} | ||
} ); | ||
} | ||
@@ -640,3 +669,3 @@ | ||
depth.assign( depthNode ).append(); | ||
depth.assign( depthNode ).toStack(); | ||
@@ -702,3 +731,3 @@ } | ||
morphReference( object ).append(); | ||
morphReference( object ).toStack(); | ||
@@ -709,3 +738,3 @@ } | ||
skinning( object ).append(); | ||
skinning( object ).toStack(); | ||
@@ -726,3 +755,3 @@ } | ||
batch( object ).append(); | ||
batch( object ).toStack(); | ||
@@ -733,3 +762,3 @@ } | ||
instancedMesh( object ).append(); | ||
instancedMesh( object ).toStack(); | ||
@@ -762,3 +791,3 @@ } | ||
colorNode = vec4( colorNode.xyz.mul( attribute( 'color', 'vec3' ) ), colorNode.a ); | ||
colorNode = colorNode.mul( vertexColor() ); | ||
@@ -1179,3 +1208,4 @@ } | ||
this.depthNode = source.depthNode; | ||
this.shadowPositionNode = source.shadowPositionNode; | ||
this.receivedShadowPositionNode = source.receivedShadowPositionNode; | ||
this.castShadowPositionNode = source.castShadowPositionNode; | ||
this.receivedShadowNode = source.receivedShadowNode; | ||
@@ -1182,0 +1212,0 @@ this.castShadowNode = source.castShadowNode; |
import { varying } from '../core/VaryingNode.js'; | ||
import { Fn } from '../tsl/TSLCore.js'; | ||
import { cameraViewMatrix } from './Camera.js'; | ||
@@ -6,4 +7,25 @@ import { normalGeometry, normalLocal, normalView, normalWorld, transformedNormalView } from './Normal.js'; | ||
const getBitangent = ( crossNormalTangent ) => crossNormalTangent.mul( tangentGeometry.w ).xyz; | ||
/** | ||
* Returns the bitangent node and assigns it to a varying if the material is not flat shaded. | ||
* | ||
* @tsl | ||
* @private | ||
* @param {Node<vec3>} crossNormalTangent - The cross product of the normal and tangent vectors. | ||
* @param {string} varyingName - The name of the varying to assign the bitangent to. | ||
* @returns {Node<vec3>} The bitangent node. | ||
*/ | ||
const getBitangent = /*@__PURE__*/ Fn( ( [ crossNormalTangent, varyingName ], builder ) => { | ||
let bitangent = crossNormalTangent.mul( tangentGeometry.w ).xyz; | ||
if ( builder.material.flatShading !== true ) { | ||
bitangent = varying( crossNormalTangent, varyingName ); | ||
} | ||
return bitangent; | ||
} ).once(); | ||
/** | ||
@@ -15,3 +37,3 @@ * TSL object that represents the bitangent attribute of the current rendered object. | ||
*/ | ||
export const bitangentGeometry = /*@__PURE__*/ varying( getBitangent( normalGeometry.cross( tangentGeometry ) ), 'v_bitangentGeometry' ).normalize().toVar( 'bitangentGeometry' ); | ||
export const bitangentGeometry = /*@__PURE__*/ getBitangent( normalGeometry.cross( tangentGeometry ), 'v_bitangentGeometry' ).normalize().toVar( 'bitangentGeometry' ); | ||
@@ -24,3 +46,3 @@ /** | ||
*/ | ||
export const bitangentLocal = /*@__PURE__*/ varying( getBitangent( normalLocal.cross( tangentLocal ) ), 'v_bitangentLocal' ).normalize().toVar( 'bitangentLocal' ); | ||
export const bitangentLocal = /*@__PURE__*/ getBitangent( normalLocal.cross( tangentLocal ), 'v_bitangentLocal' ).normalize().toVar( 'bitangentLocal' ); | ||
@@ -31,5 +53,5 @@ /** | ||
* @tsl | ||
* @type {Node<vec4>} | ||
* @type {Node<vec3>} | ||
*/ | ||
export const bitangentView = /*@__PURE__*/ varying( getBitangent( normalView.cross( tangentView ) ), 'v_bitangentView' ).normalize().toVar( 'bitangentView' ); | ||
export const bitangentView = getBitangent( normalView.cross( tangentView ), 'v_bitangentView' ).normalize().toVar( 'bitangentView' ); | ||
@@ -40,5 +62,5 @@ /** | ||
* @tsl | ||
* @type {Node<vec4>} | ||
* @type {Node<vec3>} | ||
*/ | ||
export const bitangentWorld = /*@__PURE__*/ varying( getBitangent( normalWorld.cross( tangentWorld ) ), 'v_bitangentWorld' ).normalize().toVar( 'bitangentWorld' ); | ||
export const bitangentWorld = /*@__PURE__*/ getBitangent( normalWorld.cross( tangentWorld ), 'v_bitangentWorld' ).normalize().toVar( 'bitangentWorld' ); | ||
@@ -49,5 +71,5 @@ /** | ||
* @tsl | ||
* @type {Node<vec4>} | ||
* @type {Node<vec3>} | ||
*/ | ||
export const transformedBitangentView = /*@__PURE__*/ getBitangent( transformedNormalView.cross( transformedTangentView ) ).normalize().toVar( 'transformedBitangentView' ); | ||
export const transformedBitangentView = /*@__PURE__*/ getBitangent( transformedNormalView.cross( transformedTangentView ), 'v_transformedBitangentView' ).normalize().toVar( 'transformedBitangentView' ); | ||
@@ -54,0 +76,0 @@ /** |
@@ -6,2 +6,3 @@ import { uniform } from '../core/UniformNode.js'; | ||
import { uniformArray } from './UniformArrayNode.js'; | ||
import { builtin } from './BuiltinNode.js'; | ||
@@ -14,3 +15,3 @@ /** | ||
*/ | ||
export const cameraIndex = /*@__PURE__*/ uniform( 0, 'uint' ).setGroup( sharedUniformGroup( 'cameraIndex' ) ).toVarying( 'v_cameraIndex' ); | ||
export const cameraIndex = /*@__PURE__*/ uniform( 0, 'uint' ).label( 'u_cameraIndex' ).setGroup( sharedUniformGroup( 'cameraIndex' ) ).toVarying( 'v_cameraIndex' ); | ||
@@ -55,3 +56,3 @@ /** | ||
cameraProjectionMatrix = cameraProjectionMatrices.element( cameraIndex ).toVar( 'cameraProjectionMatrix' ); | ||
cameraProjectionMatrix = cameraProjectionMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toVar( 'cameraProjectionMatrix' ); | ||
@@ -74,4 +75,30 @@ } else { | ||
*/ | ||
export const cameraProjectionMatrixInverse = /*@__PURE__*/ uniform( 'mat4' ).label( 'cameraProjectionMatrixInverse' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrixInverse ); | ||
export const cameraProjectionMatrixInverse = /*@__PURE__*/ ( Fn( ( { camera } ) => { | ||
let cameraProjectionMatrixInverse; | ||
if ( camera.isArrayCamera && camera.cameras.length > 0 ) { | ||
const matrices = []; | ||
for ( const subCamera of camera.cameras ) { | ||
matrices.push( subCamera.projectionMatrixInverse ); | ||
} | ||
const cameraProjectionMatricesInverse = uniformArray( matrices ).setGroup( renderGroup ).label( 'cameraProjectionMatricesInverse' ); | ||
cameraProjectionMatrixInverse = cameraProjectionMatricesInverse.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toVar( 'cameraProjectionMatrixInverse' ); | ||
} else { | ||
cameraProjectionMatrixInverse = uniform( 'mat4' ).label( 'cameraProjectionMatrixInverse' ).setGroup( renderGroup ).onRenderUpdate( ( { camera } ) => camera.projectionMatrixInverse ); | ||
} | ||
return cameraProjectionMatrixInverse; | ||
} ).once() )(); | ||
/** | ||
@@ -99,3 +126,3 @@ * TSL object that represents the view matrix of the camera used for the current render. | ||
cameraViewMatrix = cameraViewMatrices.element( cameraIndex ).toVar( 'cameraViewMatrix' ); | ||
cameraViewMatrix = cameraViewMatrices.element( camera.isMultiViewCamera ? builtin( 'gl_ViewID_OVR' ) : cameraIndex ).toVar( 'cameraViewMatrix' ); | ||
@@ -102,0 +129,0 @@ } else { |
@@ -36,5 +36,5 @@ import Node from '../core/Node.js'; | ||
* @param {InstancedBufferAttribute} instanceMatrix - Instanced buffer attribute representing the instance transformations. | ||
* @param {InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors. | ||
* @param {?InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors. | ||
*/ | ||
constructor( count, instanceMatrix, instanceColor ) { | ||
constructor( count, instanceMatrix, instanceColor = null ) { | ||
@@ -75,2 +75,3 @@ super( 'void' ); | ||
* @type {?Node} | ||
* @default null | ||
*/ | ||
@@ -222,5 +223,5 @@ this.instanceColorNode = null; | ||
* @param {InstancedBufferAttribute} instanceMatrix - Instanced buffer attribute representing the instance transformations. | ||
* @param {InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors. | ||
* @param {?InstancedBufferAttribute} instanceColor - Instanced buffer attribute representing the instance colors. | ||
* @returns {InstanceNode} | ||
*/ | ||
export const instance = /*@__PURE__*/ nodeProxy( InstanceNode ).setParameterLength( 3 ); | ||
export const instance = /*@__PURE__*/ nodeProxy( InstanceNode ).setParameterLength( 2, 3 ); |
@@ -126,3 +126,3 @@ import Object3DNode from './Object3DNode.js'; | ||
return builder.renderer.nodes.modelViewMatrix || mediumpModelViewMatrix; | ||
return builder.renderer.overrideNodes.modelViewMatrix || mediumpModelViewMatrix; | ||
@@ -129,0 +129,0 @@ } ).once() )().toVar( 'modelViewMatrix' ); |
@@ -74,4 +74,16 @@ import { attribute } from '../core/AttributeNode.js'; | ||
*/ | ||
export const normalWorld = /*@__PURE__*/ varying( normalView.transformDirection( cameraViewMatrix ), 'v_normalWorld' ).normalize().toVar( 'normalWorld' ); | ||
export const normalWorld = /*@__PURE__*/ ( Fn( ( builder ) => { | ||
let normal = normalView.transformDirection( cameraViewMatrix ); | ||
if ( builder.material.flatShading !== true ) { | ||
normal = varying( normal, 'v_normalWorld' ); | ||
} | ||
return normal; | ||
}, 'vec3' ).once() )().normalize().toVar( 'normalWorld' ); | ||
/** | ||
@@ -87,6 +99,10 @@ * TSL object that represents the transformed vertex normal in view space of the current rendered object. | ||
return builder.context.setupNormal().context( { getUV: null } ); | ||
let node = builder.context.setupNormal().context( { getUV: null } ); | ||
}, 'vec3' ).once() )().mul( faceDirection ).toVar( 'transformedNormalView' ); | ||
if ( builder.material.flatShading !== true ) node = node.mul( faceDirection ); | ||
return node; | ||
}, 'vec3' ).once() )().toVar( 'transformedNormalView' ); | ||
/** | ||
@@ -110,6 +126,10 @@ * TSL object that represents the transformed vertex normal in world space of the current rendered object. | ||
return builder.context.setupClearcoatNormal().context( { getUV: null } ); | ||
let node = builder.context.setupClearcoatNormal().context( { getUV: null } ); | ||
}, 'vec3' ).once() )().mul( faceDirection ).toVar( 'transformedClearcoatNormalView' ); | ||
if ( builder.material.flatShading !== true ) node = node.mul( faceDirection ); | ||
return node; | ||
}, 'vec3' ).once() )().toVar( 'transformedClearcoatNormalView' ); | ||
/** | ||
@@ -145,3 +165,3 @@ * Transforms the normal with the given matrix. | ||
const modelNormalViewMatrix = builder.renderer.nodes.modelNormalViewMatrix; | ||
const modelNormalViewMatrix = builder.renderer.overrideNodes.modelNormalViewMatrix; | ||
@@ -148,0 +168,0 @@ if ( modelNormalViewMatrix !== null ) { |
@@ -297,3 +297,3 @@ import Node from '../core/Node.js'; | ||
/** | ||
* Overwritten to to update the internal uniform value. | ||
* Overwritten to update the internal uniform value. | ||
* | ||
@@ -300,0 +300,0 @@ * @param {NodeFrame} frame - A reference to the current node frame. |
@@ -348,3 +348,3 @@ import Node from '../core/Node.js'; | ||
/** | ||
* Overwritten to to update the internal uniform value. | ||
* Overwritten to update the internal uniform value. | ||
* | ||
@@ -351,0 +351,0 @@ * @param {NodeFrame} frame - A reference to the current node frame. |
@@ -181,3 +181,3 @@ import Node from '../core/Node.js'; | ||
/** | ||
* Transforms the given vertex normal via skinning. | ||
* Computes the transformed/skinned vertex position of the previous frame. | ||
* | ||
@@ -204,3 +204,4 @@ * @param {NodeBuilder} builder - The current node builder. | ||
/** | ||
* Returns `true` if bone matrices from the previous frame are required. | ||
* Returns `true` if bone matrices from the previous frame are required. Relevant | ||
* when computing motion vectors with {@link VelocityNode}. | ||
* | ||
@@ -207,0 +208,0 @@ * @param {NodeBuilder} builder - The current node builder. |
@@ -63,2 +63,8 @@ import BufferNode from './BufferNode.js'; | ||
if ( value.isStorageBufferAttribute || value.isStorageInstancedBufferAttribute ) { | ||
bufferCount = value.count; | ||
} | ||
} else if ( bufferType === null && ( value.isStorageBufferAttribute || value.isStorageInstancedBufferAttribute ) ) { | ||
@@ -65,0 +71,0 @@ |
@@ -227,3 +227,3 @@ import TextureNode from './TextureNode.js'; | ||
if ( storeNode !== null ) node.append(); | ||
if ( storeNode !== null ) node.toStack(); | ||
@@ -230,0 +230,0 @@ return node; |
@@ -269,3 +269,3 @@ import UniformNode, { uniform } from '../core/UniformNode.js'; | ||
this.updateMatrix = value; | ||
this.updateType = value ? NodeUpdateType.RENDER : NodeUpdateType.NONE; | ||
this.updateType = value ? NodeUpdateType.OBJECT : NodeUpdateType.NONE; | ||
@@ -332,3 +332,3 @@ return this; | ||
uvNode = builder.context.getUV( this ); | ||
uvNode = builder.context.getUV( this, builder ); | ||
@@ -569,3 +569,3 @@ } | ||
if ( map && map.generateMipmaps === false || map.minFilter === NearestFilter || map.magFilter === NearestFilter ) { | ||
if ( textureNode.generateMipmaps === false && ( map && map.generateMipmaps === false || map.minFilter === NearestFilter || map.magFilter === NearestFilter ) ) { | ||
@@ -726,2 +726,5 @@ console.warn( 'THREE.TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture.' ); | ||
newNode.sampler = this.sampler; | ||
newNode.depthNode = this.depthNode; | ||
newNode.compareNode = this.compareNode; | ||
newNode.gradNode = this.gradNode; | ||
@@ -728,0 +731,0 @@ return newNode; |
@@ -208,2 +208,3 @@ import TempNode from '../core/TempNode.js'; | ||
objectData[ index ] = matrix = new Matrix4(); | ||
objectData[ index ].copy( object.matrixWorld ); | ||
@@ -210,0 +211,0 @@ } |
@@ -21,5 +21,5 @@ import AttributeNode from '../core/AttributeNode.js'; | ||
* | ||
* @param {number} [index=0] - The attribute index. | ||
* @param {number} index - The attribute index. | ||
*/ | ||
constructor( index = 0 ) { | ||
constructor( index ) { | ||
@@ -108,5 +108,5 @@ super( null, 'vec4' ); | ||
* @function | ||
* @param {number} index - The attribute index. | ||
* @param {number} [index=0] - The attribute index. | ||
* @returns {VertexColorNode} | ||
*/ | ||
export const vertexColor = ( index ) => nodeObject( new VertexColorNode( index ) ); | ||
export const vertexColor = ( index = 0 ) => nodeObject( new VertexColorNode( index ) ); |
@@ -164,5 +164,5 @@ import Node from './Node.js'; | ||
* @param {string} name - The name of the attribute. | ||
* @param {string} [nodeType] - The node type. | ||
* @param {?string} [nodeType=null] - The node type. | ||
* @returns {AttributeNode} | ||
*/ | ||
export const attribute = ( name, nodeType ) => nodeObject( new AttributeNode( name, nodeType ) ); | ||
export const attribute = ( name, nodeType = null ) => nodeObject( new AttributeNode( name, nodeType ) ); |
@@ -91,2 +91,10 @@ import { NodeUpdateType } from './constants.js'; | ||
/** | ||
* Create a list of parents for this node during the build process. | ||
* | ||
* @type {boolean} | ||
* @default false | ||
*/ | ||
this.parents = false; | ||
/** | ||
* This flag can be used for type testing. | ||
@@ -590,8 +598,10 @@ * | ||
/** | ||
* This method performs the build of a node. The behavior of this method as well as its return value depend | ||
* on the current build stage (setup, analyze or generate). | ||
* This method performs the build of a node. The behavior and return value depend on the current build stage: | ||
* - **setup**: Prepares the node and its children for the build process. This process can also create new nodes. Returns the node itself or a variant. | ||
* - **analyze**: Analyzes the node hierarchy for optimizations in the code generation stage. Returns `null`. | ||
* - **generate**: Generates the shader code for the node. Returns the generated shader string. | ||
* | ||
* @param {NodeBuilder} builder - The current node builder. | ||
* @param {?string} output - Can be used to define the output type. | ||
* @return {?string} When this method is executed in the setup or analyze stage, `null` is returned. In the generate stage, the generated shader string. | ||
* @param {?string} [output=null] - Can be used to define the output type. | ||
* @return {Node|string|null} The result of the build process, depending on the build stage. | ||
*/ | ||
@@ -646,2 +656,10 @@ build( builder, output = null ) { | ||
if ( childNode.parents === true ) { | ||
const childProperties = builder.getNodeProperties( childNode ); | ||
childProperties.parents = childProperties.parents || []; | ||
childProperties.parents.push( this ); | ||
} | ||
childNode.build( builder ); | ||
@@ -663,2 +681,4 @@ | ||
result = properties.outputNode || null; | ||
} else if ( buildStage === 'analyze' ) { | ||
@@ -665,0 +685,0 @@ |
@@ -29,2 +29,3 @@ import NodeUniform from './NodeUniform.js'; | ||
import { RenderTarget } from '../../core/RenderTarget.js'; | ||
import { RenderTargetArray } from '../../core/RenderTargetArray.js'; | ||
import { Color } from '../../math/Color.js'; | ||
@@ -462,2 +463,18 @@ import { Vector2 } from '../../math/Vector2.js'; | ||
/** | ||
* Factory method for creating an instance of {@link RenderTargetArray} with the given | ||
* dimensions and options. | ||
* | ||
* @param {number} width - The width of the render target. | ||
* @param {number} height - The height of the render target. | ||
* @param {number} depth - The depth of the render target. | ||
* @param {Object} options - The options of the render target. | ||
* @return {RenderTargetArray} The render target. | ||
*/ | ||
createRenderTargetArray( width, height, depth, options ) { | ||
return new RenderTargetArray( width, height, depth, options ); | ||
} | ||
/** | ||
* Factory method for creating an instance of {@link CubeRenderTarget} with the given | ||
@@ -1836,5 +1853,7 @@ * dimensions and options. | ||
* @param {string} [type=node.getNodeType( this )] - The varying's type. | ||
* @param {?string} interpolationType - The interpolation type of the varying. | ||
* @param {?string} interpolationSampling - The interpolation sampling type of the varying. | ||
* @return {NodeVar} The node varying. | ||
*/ | ||
getVaryingFromNode( node, name = null, type = node.getNodeType( this ) ) { | ||
getVaryingFromNode( node, name = null, type = node.getNodeType( this ), interpolationType = null, interpolationSampling = null ) { | ||
@@ -1852,3 +1871,3 @@ const nodeData = this.getDataFromNode( node, 'any' ); | ||
nodeVarying = new NodeVarying( name, type ); | ||
nodeVarying = new NodeVarying( name, type, interpolationType, interpolationSampling ); | ||
@@ -1890,3 +1909,2 @@ varyings.push( nodeVarying ); | ||
declarations[ name ] = node; | ||
@@ -1901,2 +1919,5 @@ if ( index > 1 ) { | ||
declarations[ name ] = node; | ||
} | ||
@@ -2658,4 +2679,6 @@ | ||
return this.format( `${ snippet }.${ 'xyz'.slice( 0, toTypeLength ) }`, this.getTypeFromLength( toTypeLength, this.getComponentType( fromType ) ), toType ); | ||
snippet = toType === 'bool' ? `all( ${ snippet } )` : `${ snippet }.${ 'xyz'.slice( 0, toTypeLength ) }`; | ||
return this.format( snippet, this.getTypeFromLength( toTypeLength, this.getComponentType( fromType ) ), toType ); | ||
} | ||
@@ -2699,2 +2722,7 @@ | ||
/** | ||
* Prevents the node builder from being used as an iterable in TSL.Fn(), avoiding potential runtime errors. | ||
*/ | ||
*[ Symbol.iterator ]() { } | ||
// Deprecated | ||
@@ -2715,4 +2743,5 @@ | ||
} | ||
export default NodeBuilder; |
@@ -18,4 +18,6 @@ import NodeVar from './NodeVar.js'; | ||
* @param {string} type - The type of the varying. | ||
* @param {?string} interpolationType - The interpolation type of the varying. | ||
* @param {?string} interpolationSampling - The interpolation sampling type of the varying. | ||
*/ | ||
constructor( name, type ) { | ||
constructor( name, type, interpolationType = null, interpolationSampling = null ) { | ||
@@ -42,2 +44,18 @@ super( name, type ); | ||
/** | ||
* The interpolation type of the varying data. | ||
* | ||
* @type {?string} | ||
* @default null | ||
*/ | ||
this.interpolationType = interpolationType; | ||
/** | ||
* The interpolation sampling type of varying data. | ||
* | ||
* @type {?string} | ||
* @default null | ||
*/ | ||
this.interpolationSampling = interpolationSampling; | ||
} | ||
@@ -44,0 +62,0 @@ |
import Node from './Node.js'; | ||
import { select } from '../math/ConditionalNode.js'; | ||
import { ShaderNode, nodeProxy, getCurrentStack, setCurrentStack } from '../tsl/TSLBase.js'; | ||
import { ShaderNode, nodeProxy, getCurrentStack, setCurrentStack, nodeObject } from '../tsl/TSLBase.js'; | ||
@@ -61,2 +61,12 @@ /** | ||
/** | ||
* The expression node. Only | ||
* relevant for Switch/Case. | ||
* | ||
* @private | ||
* @type {Node} | ||
* @default null | ||
*/ | ||
this._expressionNode = null; | ||
/** | ||
* This flag can be used for type testing. | ||
@@ -147,2 +157,94 @@ * | ||
/** | ||
* Represents a `switch` statement in TSL. | ||
* | ||
* @param {any} expression - Represents the expression. | ||
* @param {Function} method - TSL code which is executed if the condition evaluates to `true`. | ||
* @return {StackNode} A reference to this stack node. | ||
*/ | ||
Switch( expression ) { | ||
this._expressionNode = nodeObject( expression ); | ||
return this; | ||
} | ||
/** | ||
* Represents a `case` statement in TSL. The TSL version accepts an arbitrary numbers of values. | ||
* The last parameter must be the callback method that should be executed in the `true` case. | ||
* | ||
* @param {...any} params - The values of the `Case()` statement as well as the callback method. | ||
* @return {StackNode} A reference to this stack node. | ||
*/ | ||
Case( ...params ) { | ||
const caseNodes = []; | ||
// extract case nodes from the parameter list | ||
if ( params.length >= 2 ) { | ||
for ( let i = 0; i < params.length - 1; i ++ ) { | ||
caseNodes.push( this._expressionNode.equal( nodeObject( params[ i ] ) ) ); | ||
} | ||
} else { | ||
throw new Error( 'TSL: Invalid parameter length. Case() requires at least two parameters.' ); | ||
} | ||
// extract method | ||
const method = params[ params.length - 1 ]; | ||
const methodNode = new ShaderNode( method ); | ||
// chain multiple cases when using Case( 1, 2, 3, () => {} ) | ||
let caseNode = caseNodes[ 0 ]; | ||
for ( let i = 1; i < caseNodes.length; i ++ ) { | ||
caseNode = caseNode.or( caseNodes[ i ] ); | ||
} | ||
// build condition | ||
const condNode = select( caseNode, methodNode ); | ||
if ( this._currentCond === null ) { | ||
this._currentCond = condNode; | ||
return this.add( this._currentCond ); | ||
} else { | ||
this._currentCond.elseNode = condNode; | ||
this._currentCond = condNode; | ||
return this; | ||
} | ||
} | ||
/** | ||
* Represents the default code block of a Switch/Case statement. | ||
* | ||
* @param {Function} method - TSL code which is executed in the `else` case. | ||
* @return {StackNode} A reference to this stack node. | ||
*/ | ||
Default( method ) { | ||
this.Else( method ); | ||
return this; | ||
} | ||
build( builder, ...params ) { | ||
@@ -149,0 +251,0 @@ |
@@ -170,3 +170,3 @@ import Node from './Node.js'; | ||
*/ | ||
export const Var = ( node, name = null ) => createVar( node, name ).append(); | ||
export const Var = ( node, name = null ) => createVar( node, name ).toStack(); | ||
@@ -182,3 +182,3 @@ /** | ||
*/ | ||
export const Const = ( node, name = null ) => createVar( node, name, true ).append(); | ||
export const Const = ( node, name = null ) => createVar( node, name, true ).toStack(); | ||
@@ -185,0 +185,0 @@ // Method chaining |
@@ -58,2 +58,18 @@ import Node from './Node.js'; | ||
/** | ||
* The interpolation type of the varying data. | ||
* | ||
* @type {?string} | ||
* @default null | ||
*/ | ||
this.interpolationType = null; | ||
/** | ||
* The interpolation sampling type of varying data. | ||
* | ||
* @type {?string} | ||
* @default null | ||
*/ | ||
this.interpolationSampling = null; | ||
} | ||
@@ -73,2 +89,18 @@ | ||
/** | ||
* Defines the interpolation type of the varying. | ||
* | ||
* @param {string} type - The interpolation type. | ||
* @param {?string} sampling - The interpolation sampling type | ||
* @return {VaryingNode} A reference to this node. | ||
*/ | ||
setInterpolation( type, sampling = null ) { | ||
this.interpolationType = type; | ||
this.interpolationSampling = sampling; | ||
return this; | ||
} | ||
getHash( builder ) { | ||
@@ -104,4 +136,6 @@ | ||
const type = this.getNodeType( builder ); | ||
const interpolationType = this.interpolationType; | ||
const interpolationSampling = this.interpolationSampling; | ||
properties.varying = varying = builder.getVaryingFromNode( this, name, type ); | ||
properties.varying = varying = builder.getVaryingFromNode( this, name, type, interpolationType, interpolationSampling ); | ||
properties.node = this.node; | ||
@@ -108,0 +142,0 @@ |
@@ -1,2 +0,3 @@ | ||
import TempNode from '../core/TempNode.js'; | ||
import Node from '../core/Node.js'; | ||
import { expression } from '../code/ExpressionNode.js'; | ||
import { nodeProxy } from '../tsl/TSLCore.js'; | ||
@@ -13,5 +14,5 @@ | ||
* | ||
* @augments TempNode | ||
* @augments Node | ||
*/ | ||
class AtomicFunctionNode extends TempNode { | ||
class AtomicFunctionNode extends Node { | ||
@@ -56,2 +57,10 @@ static get type() { | ||
/** | ||
* Creates a list of the parents for this node for detecting if the node needs to return a value. | ||
* | ||
* @type {boolean} | ||
* @default true | ||
*/ | ||
this.parents = true; | ||
} | ||
@@ -86,2 +95,5 @@ | ||
const properties = builder.getNodeProperties( this ); | ||
const parents = properties.parents; | ||
const method = this.method; | ||
@@ -107,11 +119,20 @@ | ||
const methodSnippet = `${ builder.getMethod( method, type ) }( ${ params.join( ', ' ) } )`; | ||
const isVoid = parents.length === 1 && parents[ 0 ].isStackNode === true; | ||
if ( b !== null ) { | ||
if ( isVoid ) { | ||
builder.addLineFlowCode( methodSnippet, this ); | ||
} else { | ||
if ( properties.constNode === undefined ) { | ||
properties.constNode = expression( methodSnippet, type ).toConst(); | ||
} | ||
return properties.constNode.build( builder ); | ||
} | ||
return methodSnippet; | ||
} | ||
@@ -157,7 +178,4 @@ | ||
const node = atomicNode( method, pointerNode, valueNode ); | ||
node.append(); | ||
return atomicNode( method, pointerNode, valueNode ).toStack(); | ||
return node; | ||
}; | ||
@@ -164,0 +182,0 @@ |
@@ -66,3 +66,3 @@ import Node from '../core/Node.js'; | ||
*/ | ||
export const workgroupBarrier = () => barrier( 'workgroup' ).append(); | ||
export const workgroupBarrier = () => barrier( 'workgroup' ).toStack(); | ||
@@ -78,3 +78,3 @@ /** | ||
*/ | ||
export const storageBarrier = () => barrier( 'storage' ).append(); | ||
export const storageBarrier = () => barrier( 'storage' ).toStack(); | ||
@@ -90,3 +90,3 @@ /** | ||
*/ | ||
export const textureBarrier = () => barrier( 'texture' ).append(); | ||
export const textureBarrier = () => barrier( 'texture' ).toStack(); | ||
@@ -168,3 +168,3 @@ import Node from '../core/Node.js'; | ||
const result = this.computeNode.setup( builder ); | ||
const result = this.computeNode.build( builder ); | ||
@@ -171,0 +171,0 @@ if ( result ) { |
@@ -110,4 +110,4 @@ import Node from '../core/Node.js'; | ||
/** | ||
* Overwrites the default {@link Node#customCacheKey} implementation by including the | ||
* light IDs into the cache key. | ||
* Overwrites the default {@link Node#customCacheKey} implementation by including | ||
* light data into the cache key. | ||
* | ||
@@ -118,3 +118,3 @@ * @return {number} The custom cache key. | ||
const lightIDs = []; | ||
const hashData = []; | ||
const lights = this._lights; | ||
@@ -124,7 +124,17 @@ | ||
lightIDs.push( lights[ i ].id ); | ||
const light = lights[ i ]; | ||
hashData.push( light.id ); | ||
if ( light.isSpotLight === true ) { | ||
const hashValue = ( light.map !== null ) ? light.map.id : - 1; | ||
hashData.push( hashValue ); | ||
} | ||
} | ||
return hashArray( lightIDs ); | ||
return hashArray( hashData ); | ||
@@ -131,0 +141,0 @@ } |
@@ -67,3 +67,3 @@ import Node from '../core/Node.js'; | ||
shadowPositionWorld.assign( material.shadowPositionNode || context.shadowPositionWorld || positionWorld ); | ||
shadowPositionWorld.assign( material.receivedShadowPositionNode || context.shadowPositionWorld || positionWorld ); | ||
@@ -70,0 +70,0 @@ } |
import ShadowBaseNode, { shadowPositionWorld } from './ShadowBaseNode.js'; | ||
import { float, vec2, vec3, vec4, If, int, Fn, nodeObject } from '../tsl/TSLBase.js'; | ||
import { float, vec2, vec3, int, Fn, nodeObject } from '../tsl/TSLBase.js'; | ||
import { reference } from '../accessors/ReferenceNode.js'; | ||
import { texture } from '../accessors/TextureNode.js'; | ||
import { positionWorld } from '../accessors/Position.js'; | ||
import { transformedNormalWorld } from '../accessors/Normal.js'; | ||
import { mix, fract, step, max, clamp, sqrt } from '../math/MathNode.js'; | ||
import { add, sub } from '../math/OperatorNode.js'; | ||
import { mix, sqrt } from '../math/MathNode.js'; | ||
import { add } from '../math/OperatorNode.js'; | ||
import { DepthTexture } from '../../textures/DepthTexture.js'; | ||
@@ -17,216 +16,74 @@ import NodeMaterial from '../../materials/nodes/NodeMaterial.js'; | ||
import { viewZToLogarithmicDepth } from '../display/ViewportDepthNode.js'; | ||
import { objectPosition } from '../accessors/Object3DNode.js'; | ||
import { lightShadowMatrix } from '../accessors/Lights.js'; | ||
import { resetRendererAndSceneState, restoreRendererAndSceneState } from '../../renderers/common/RendererUtils.js'; | ||
import { getDataFromObject } from '../core/NodeUtils.js'; | ||
import { getShadowMaterial, BasicShadowFilter, PCFShadowFilter, PCFSoftShadowFilter, VSMShadowFilter } from './ShadowFilterNode.js'; | ||
import ChainMap from '../../renderers/common/ChainMap.js'; | ||
const shadowMaterialLib = /*@__PURE__*/ new WeakMap(); | ||
const linearDistance = /*@__PURE__*/ Fn( ( [ position, cameraNear, cameraFar ] ) => { | ||
// | ||
let dist = positionWorld.sub( position ).length(); | ||
dist = dist.sub( cameraNear ).div( cameraFar.sub( cameraNear ) ); | ||
dist = dist.saturate(); // clamp to [ 0, 1 ] | ||
const _shadowRenderObjectLibrary = /*@__PURE__*/ new ChainMap(); | ||
const _shadowRenderObjectKeys = []; | ||
return dist; | ||
} ); | ||
const linearShadowDistance = ( light ) => { | ||
const camera = light.shadow.camera; | ||
const nearDistance = reference( 'near', 'float', camera ).setGroup( renderGroup ); | ||
const farDistance = reference( 'far', 'float', camera ).setGroup( renderGroup ); | ||
const referencePosition = objectPosition( light ); | ||
return linearDistance( referencePosition, nearDistance, farDistance ); | ||
}; | ||
const getShadowMaterial = ( light ) => { | ||
let material = shadowMaterialLib.get( light ); | ||
if ( material === undefined ) { | ||
const depthNode = light.isPointLight ? linearShadowDistance( light ) : null; | ||
material = new NodeMaterial(); | ||
material.colorNode = vec4( 0, 0, 0, 1 ); | ||
material.depthNode = depthNode; | ||
material.isShadowPassMaterial = true; // Use to avoid other overrideMaterial override material.colorNode unintentionally when using material.shadowNode | ||
material.name = 'ShadowMaterial'; | ||
material.fog = false; | ||
shadowMaterialLib.set( light, material ); | ||
} | ||
return material; | ||
}; | ||
/** | ||
* A shadow filtering function performing basic filtering. This is in fact an unfiltered version of the shadow map | ||
* with a binary `[0,1]` result. | ||
* Creates a function to render shadow objects in a scene. | ||
* | ||
* @method | ||
* @param {Object} inputs - The input parameter object. | ||
* @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. | ||
* @param {Node<vec3>} inputs.shadowCoord - The shadow coordinates. | ||
* @return {Node<float>} The filtering result. | ||
*/ | ||
export const BasicShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, shadowCoord } ) => { | ||
return texture( depthTexture, shadowCoord.xy ).compare( shadowCoord.z ); | ||
} ); | ||
/** | ||
* A shadow filtering function performing PCF filtering. | ||
* @param {Renderer} renderer - The renderer. | ||
* @param {LightShadow} shadow - The light shadow object containing shadow properties. | ||
* @param {number} shadowType - The type of shadow map (e.g., BasicShadowMap). | ||
* @param {boolean} useVelocity - Whether to use velocity data for rendering. | ||
* @return {Function} A function that renders shadow objects. | ||
* | ||
* @method | ||
* @param {Object} inputs - The input parameter object. | ||
* @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. | ||
* @param {Node<vec3>} inputs.shadowCoord - The shadow coordinates. | ||
* @param {LightShadow} inputs.shadow - The light shadow. | ||
* @return {Node<float>} The filtering result. | ||
* The returned function has the following parameters: | ||
* @param {Object3D} object - The 3D object to render. | ||
* @param {Scene} scene - The scene containing the object. | ||
* @param {Camera} _camera - The camera used for rendering. | ||
* @param {BufferGeometry} geometry - The geometry of the object. | ||
* @param {Material} material - The material of the object. | ||
* @param {Group} group - The group the object belongs to. | ||
* @param {...any} params - Additional parameters for rendering. | ||
*/ | ||
export const PCFShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, shadowCoord, shadow } ) => { | ||
export const getShadowRenderObjectFunction = ( renderer, shadow, shadowType, useVelocity ) => { | ||
const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare ); | ||
_shadowRenderObjectKeys[ 0 ] = renderer; | ||
_shadowRenderObjectKeys[ 1 ] = shadow; | ||
const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup ); | ||
const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup ); | ||
let renderObjectFunction = _shadowRenderObjectLibrary.get( _shadowRenderObjectKeys ); | ||
const texelSize = vec2( 1 ).div( mapSize ); | ||
const dx0 = texelSize.x.negate().mul( radius ); | ||
const dy0 = texelSize.y.negate().mul( radius ); | ||
const dx1 = texelSize.x.mul( radius ); | ||
const dy1 = texelSize.y.mul( radius ); | ||
const dx2 = dx0.div( 2 ); | ||
const dy2 = dy0.div( 2 ); | ||
const dx3 = dx1.div( 2 ); | ||
const dy3 = dy1.div( 2 ); | ||
if ( renderObjectFunction === undefined || ( renderObjectFunction.shadowType !== shadowType || renderObjectFunction.useVelocity !== useVelocity ) ) { | ||
return add( | ||
depthCompare( shadowCoord.xy.add( vec2( dx0, dy0 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( 0, dy0 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx1, dy0 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx2, dy2 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( 0, dy2 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx3, dy2 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx0, 0 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx2, 0 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy, shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx3, 0 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx1, 0 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx2, dy3 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( 0, dy3 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx3, dy3 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx0, dy1 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( 0, dy1 ) ), shadowCoord.z ), | ||
depthCompare( shadowCoord.xy.add( vec2( dx1, dy1 ) ), shadowCoord.z ) | ||
).mul( 1 / 17 ); | ||
renderObjectFunction = ( object, scene, _camera, geometry, material, group, ...params ) => { | ||
} ); | ||
if ( object.castShadow === true || ( object.receiveShadow && shadowType === VSMShadowMap ) ) { | ||
/** | ||
* A shadow filtering function performing PCF soft filtering. | ||
* | ||
* @method | ||
* @param {Object} inputs - The input parameter object. | ||
* @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. | ||
* @param {Node<vec3>} inputs.shadowCoord - The shadow coordinates. | ||
* @param {LightShadow} inputs.shadow - The light shadow. | ||
* @return {Node<float>} The filtering result. | ||
*/ | ||
export const PCFSoftShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, shadowCoord, shadow } ) => { | ||
if ( useVelocity ) { | ||
const depthCompare = ( uv, compare ) => texture( depthTexture, uv ).compare( compare ); | ||
getDataFromObject( object ).useVelocity = true; | ||
const mapSize = reference( 'mapSize', 'vec2', shadow ).setGroup( renderGroup ); | ||
} | ||
const texelSize = vec2( 1 ).div( mapSize ); | ||
const dx = texelSize.x; | ||
const dy = texelSize.y; | ||
object.onBeforeShadow( renderer, object, _camera, shadow.camera, geometry, scene.overrideMaterial, group ); | ||
const uv = shadowCoord.xy; | ||
const f = fract( uv.mul( mapSize ).add( 0.5 ) ); | ||
uv.subAssign( f.mul( texelSize ) ); | ||
renderer.renderObject( object, scene, _camera, geometry, material, group, ...params ); | ||
return add( | ||
depthCompare( uv, shadowCoord.z ), | ||
depthCompare( uv.add( vec2( dx, 0 ) ), shadowCoord.z ), | ||
depthCompare( uv.add( vec2( 0, dy ) ), shadowCoord.z ), | ||
depthCompare( uv.add( texelSize ), shadowCoord.z ), | ||
mix( | ||
depthCompare( uv.add( vec2( dx.negate(), 0 ) ), shadowCoord.z ), | ||
depthCompare( uv.add( vec2( dx.mul( 2 ), 0 ) ), shadowCoord.z ), | ||
f.x | ||
), | ||
mix( | ||
depthCompare( uv.add( vec2( dx.negate(), dy ) ), shadowCoord.z ), | ||
depthCompare( uv.add( vec2( dx.mul( 2 ), dy ) ), shadowCoord.z ), | ||
f.x | ||
), | ||
mix( | ||
depthCompare( uv.add( vec2( 0, dy.negate() ) ), shadowCoord.z ), | ||
depthCompare( uv.add( vec2( 0, dy.mul( 2 ) ) ), shadowCoord.z ), | ||
f.y | ||
), | ||
mix( | ||
depthCompare( uv.add( vec2( dx, dy.negate() ) ), shadowCoord.z ), | ||
depthCompare( uv.add( vec2( dx, dy.mul( 2 ) ) ), shadowCoord.z ), | ||
f.y | ||
), | ||
mix( | ||
mix( | ||
depthCompare( uv.add( vec2( dx.negate(), dy.negate() ) ), shadowCoord.z ), | ||
depthCompare( uv.add( vec2( dx.mul( 2 ), dy.negate() ) ), shadowCoord.z ), | ||
f.x | ||
), | ||
mix( | ||
depthCompare( uv.add( vec2( dx.negate(), dy.mul( 2 ) ) ), shadowCoord.z ), | ||
depthCompare( uv.add( vec2( dx.mul( 2 ), dy.mul( 2 ) ) ), shadowCoord.z ), | ||
f.x | ||
), | ||
f.y | ||
) | ||
).mul( 1 / 9 ); | ||
object.onAfterShadow( renderer, object, _camera, shadow.camera, geometry, scene.overrideMaterial, group ); | ||
} ); | ||
} | ||
/** | ||
* A shadow filtering function performing VSM filtering. | ||
* | ||
* @method | ||
* @param {Object} inputs - The input parameter object. | ||
* @param {DepthTexture} inputs.depthTexture - A reference to the shadow map's texture data. | ||
* @param {Node<vec3>} inputs.shadowCoord - The shadow coordinates. | ||
* @return {Node<float>} The filtering result. | ||
*/ | ||
export const VSMShadowFilter = /*@__PURE__*/ Fn( ( { depthTexture, shadowCoord } ) => { | ||
}; | ||
const occlusion = float( 1 ).toVar(); | ||
renderObjectFunction.shadowType = shadowType; | ||
renderObjectFunction.useVelocity = useVelocity; | ||
const distribution = texture( depthTexture ).sample( shadowCoord.xy ).rg; | ||
_shadowRenderObjectLibrary.set( _shadowRenderObjectKeys, renderObjectFunction ); | ||
const hardShadow = step( shadowCoord.z, distribution.x ); | ||
} | ||
If( hardShadow.notEqual( float( 1.0 ) ), () => { | ||
_shadowRenderObjectKeys[ 0 ] = null; | ||
_shadowRenderObjectKeys[ 1 ] = null; | ||
const distance = shadowCoord.z.sub( distribution.x ); | ||
const variance = max( 0, distribution.y.mul( distribution.y ) ); | ||
let softnessProbability = variance.div( variance.add( distance.mul( distance ) ) ); // Chebeyshevs inequality | ||
softnessProbability = clamp( sub( softnessProbability, 0.3 ).div( 0.95 - 0.3 ) ); | ||
occlusion.assign( clamp( max( hardShadow, softnessProbability ) ) ); | ||
return renderObjectFunction; | ||
} ); | ||
}; | ||
return occlusion; | ||
} ); | ||
/** | ||
@@ -243,6 +100,6 @@ * Represents the shader code for the first VSM render pass. | ||
*/ | ||
const VSMPassVertical = /*@__PURE__*/ Fn( ( { samples, radius, size, shadowPass } ) => { | ||
const VSMPassVertical = /*@__PURE__*/ Fn( ( { samples, radius, size, shadowPass, depthLayer } ) => { | ||
const mean = float( 0 ).toVar(); | ||
const squaredMean = float( 0 ).toVar(); | ||
const mean = float( 0 ).toVar( 'meanVertical' ); | ||
const squaredMean = float( 0 ).toVar( 'squareMeanVertical' ); | ||
@@ -256,3 +113,12 @@ const uvStride = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( 2 ).div( samples.sub( 1 ) ) ); | ||
const depth = shadowPass.sample( add( screenCoordinate.xy, vec2( 0, uvOffset ).mul( radius ) ).div( size ) ).x; | ||
let depth = shadowPass.sample( add( screenCoordinate.xy, vec2( 0, uvOffset ).mul( radius ) ).div( size ) ); | ||
if ( shadowPass.value.isDepthArrayTexture || shadowPass.value.isDataArrayTexture ) { | ||
depth = depth.depth( depthLayer ); | ||
} | ||
depth = depth.x; | ||
mean.addAssign( depth ); | ||
@@ -282,6 +148,6 @@ squaredMean.addAssign( depth.mul( depth ) ); | ||
*/ | ||
const VSMPassHorizontal = /*@__PURE__*/ Fn( ( { samples, radius, size, shadowPass } ) => { | ||
const VSMPassHorizontal = /*@__PURE__*/ Fn( ( { samples, radius, size, shadowPass, depthLayer } ) => { | ||
const mean = float( 0 ).toVar(); | ||
const squaredMean = float( 0 ).toVar(); | ||
const mean = float( 0 ).toVar( 'meanHorizontal' ); | ||
const squaredMean = float( 0 ).toVar( 'squareMeanHorizontal' ); | ||
@@ -295,3 +161,10 @@ const uvStride = samples.lessThanEqual( float( 1 ) ).select( float( 0 ), float( 2 ).div( samples.sub( 1 ) ) ); | ||
const distribution = shadowPass.sample( add( screenCoordinate.xy, vec2( uvOffset, 0 ).mul( radius ) ).div( size ) ); | ||
let distribution = shadowPass.sample( add( screenCoordinate.xy, vec2( uvOffset, 0 ).mul( radius ) ).div( size ) ); | ||
if ( shadowPass.value.isDepthArrayTexture || shadowPass.value.isDataArrayTexture ) { | ||
distribution = distribution.depth( depthLayer ); | ||
} | ||
mean.addAssign( distribution.x ); | ||
@@ -414,2 +287,11 @@ squaredMean.addAssign( add( distribution.y.mul( distribution.y ), distribution.x.mul( distribution.x ) ) ); | ||
/** | ||
* This index can be used when overriding setupRenderTarget with a RenderTarget Array to specify the depth layer. | ||
* | ||
* @type {number} | ||
* @readonly | ||
* @default true | ||
*/ | ||
this.depthLayer = 0; | ||
} | ||
@@ -428,3 +310,3 @@ | ||
*/ | ||
setupShadowFilter( builder, { filterFn, depthTexture, shadowCoord, shadow } ) { | ||
setupShadowFilter( builder, { filterFn, depthTexture, shadowCoord, shadow, depthLayer } ) { | ||
@@ -437,3 +319,3 @@ const frustumTest = shadowCoord.x.greaterThanEqual( 0 ) | ||
const shadowNode = filterFn( { depthTexture, shadowCoord, shadow } ); | ||
const shadowNode = filterFn( { depthTexture, shadowCoord, shadow, depthLayer } ); | ||
@@ -510,2 +392,18 @@ return frustumTest.select( shadowNode, float( 1 ) ); | ||
setupRenderTarget( shadow, builder ) { | ||
const depthTexture = new DepthTexture( shadow.mapSize.width, shadow.mapSize.height ); | ||
depthTexture.name = 'ShadowDepthTexture'; | ||
depthTexture.compareFunction = LessCompare; | ||
const shadowMap = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height ); | ||
shadowMap.texture.name = 'ShadowMap'; | ||
shadowMap.texture.type = shadow.mapType; | ||
shadowMap.depthTexture = depthTexture; | ||
return { shadowMap, depthTexture }; | ||
} | ||
/** | ||
@@ -525,8 +423,4 @@ * Setups the shadow output node. | ||
const depthTexture = new DepthTexture( shadow.mapSize.width, shadow.mapSize.height ); | ||
depthTexture.compareFunction = LessCompare; | ||
const { depthTexture, shadowMap } = this.setupRenderTarget( shadow, builder ); | ||
const shadowMap = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height ); | ||
shadowMap.depthTexture = depthTexture; | ||
shadow.camera.updateProjectionMatrix(); | ||
@@ -540,8 +434,46 @@ | ||
this.vsmShadowMapVertical = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height, { format: RGFormat, type: HalfFloatType } ); | ||
this.vsmShadowMapHorizontal = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height, { format: RGFormat, type: HalfFloatType } ); | ||
if ( shadowMap.isRenderTargetArray ) { | ||
const shadowPassVertical = texture( depthTexture ); | ||
const shadowPassHorizontal = texture( this.vsmShadowMapVertical.texture ); | ||
if ( ! shadowMap._vsmShadowMapVertical ) { | ||
shadowMap._vsmShadowMapVertical = builder.createRenderTargetArray( shadow.mapSize.width, shadow.mapSize.height, shadowMap.depth, { format: RGFormat, type: HalfFloatType, depthBuffer: false } ); | ||
shadowMap._vsmShadowMapVertical.texture.name = 'VSMVertical'; | ||
} | ||
this.vsmShadowMapVertical = shadowMap._vsmShadowMapVertical; | ||
if ( ! shadowMap._vsmShadowMapHorizontal ) { | ||
shadowMap._vsmShadowMapHorizontal = builder.createRenderTargetArray( shadow.mapSize.width, shadow.mapSize.height, shadowMap.depth, { format: RGFormat, type: HalfFloatType, depthBuffer: false } ); | ||
shadowMap._vsmShadowMapHorizontal.texture.name = 'VSMHorizontal'; | ||
} | ||
this.vsmShadowMapHorizontal = shadowMap._vsmShadowMapHorizontal; | ||
} else { | ||
this.vsmShadowMapVertical = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height, { format: RGFormat, type: HalfFloatType, depthBuffer: false } ); | ||
this.vsmShadowMapHorizontal = builder.createRenderTarget( shadow.mapSize.width, shadow.mapSize.height, { format: RGFormat, type: HalfFloatType, depthBuffer: false } ); | ||
} | ||
let shadowPassVertical = texture( depthTexture ); | ||
if ( depthTexture.isDepthArrayTexture ) { | ||
shadowPassVertical = shadowPassVertical.depth( this.depthLayer ); | ||
} | ||
let shadowPassHorizontal = texture( this.vsmShadowMapVertical.texture ); | ||
if ( depthTexture.isDepthArrayTexture ) { | ||
shadowPassHorizontal = shadowPassHorizontal.depth( this.depthLayer ); | ||
} | ||
const samples = reference( 'blurSamples', 'float', shadow ).setGroup( renderGroup ); | ||
@@ -552,7 +484,7 @@ const radius = reference( 'radius', 'float', shadow ).setGroup( renderGroup ); | ||
let material = this.vsmMaterialVertical || ( this.vsmMaterialVertical = new NodeMaterial() ); | ||
material.fragmentNode = VSMPassVertical( { samples, radius, size, shadowPass: shadowPassVertical } ).context( builder.getSharedContext() ); | ||
material.fragmentNode = VSMPassVertical( { samples, radius, size, shadowPass: shadowPassVertical, depthLayer: this.depthLayer } ).context( builder.getSharedContext() ); | ||
material.name = 'VSMVertical'; | ||
material = this.vsmMaterialHorizontal || ( this.vsmMaterialHorizontal = new NodeMaterial() ); | ||
material.fragmentNode = VSMPassHorizontal( { samples, radius, size, shadowPass: shadowPassHorizontal } ).context( builder.getSharedContext() ); | ||
material.fragmentNode = VSMPassHorizontal( { samples, radius, size, shadowPass: shadowPassHorizontal, depthLayer: this.depthLayer } ).context( builder.getSharedContext() ); | ||
material.name = 'VSMHorizontal'; | ||
@@ -582,5 +514,12 @@ | ||
const shadowNode = this.setupShadowFilter( builder, { filterFn, shadowTexture: shadowMap.texture, depthTexture: shadowDepthTexture, shadowCoord, shadow } ); | ||
const shadowNode = this.setupShadowFilter( builder, { filterFn, shadowTexture: shadowMap.texture, depthTexture: shadowDepthTexture, shadowCoord, shadow, depthLayer: this.depthLayer } ); | ||
const shadowColor = texture( shadowMap.texture, shadowCoord ); | ||
let shadowColor = texture( shadowMap.texture, shadowCoord ); | ||
if ( depthTexture.isDepthArrayTexture ) { | ||
shadowColor = shadowColor.depth( this.depthLayer ); | ||
} | ||
const shadowOutput = mix( 1, shadowNode.rgb.mix( shadowColor, 1 ), shadowIntensity.mul( shadowColor.a ) ).toVar(); | ||
@@ -651,3 +590,3 @@ | ||
shadowMap.setSize( shadow.mapSize.width, shadow.mapSize.height ); | ||
shadowMap.setSize( shadow.mapSize.width, shadow.mapSize.height, shadowMap.depth ); | ||
@@ -673,4 +612,10 @@ renderer.render( scene, shadow.camera ); | ||
shadow.camera.layers.mask = camera.layers.mask; | ||
const _shadowCameraLayer = shadow.camera.layers.mask; | ||
if ( ( shadow.camera.layers.mask & 0xFFFFFFFE ) === 0 ) { | ||
shadow.camera.layers.mask = camera.layers.mask; | ||
} | ||
const currentRenderObjectFunction = renderer.getRenderObjectFunction(); | ||
@@ -685,22 +630,6 @@ | ||
renderer.setRenderObjectFunction( ( object, scene, _camera, geometry, material, group, ...params ) => { | ||
renderer.setRenderObjectFunction( getShadowRenderObjectFunction( renderer, shadow, shadowType, useVelocity ) ); | ||
if ( object.castShadow === true || ( object.receiveShadow && shadowType === VSMShadowMap ) ) { | ||
renderer.setClearColor( 0x000000, 0 ); | ||
if ( useVelocity ) { | ||
getDataFromObject( object ).useVelocity = true; | ||
} | ||
object.onBeforeShadow( renderer, object, camera, shadow.camera, geometry, scene.overrideMaterial, group ); | ||
renderer.renderObject( object, scene, _camera, geometry, material, group, ...params ); | ||
object.onAfterShadow( renderer, object, camera, shadow.camera, geometry, scene.overrideMaterial, group ); | ||
} | ||
} ); | ||
renderer.setRenderTarget( shadowMap ); | ||
@@ -720,2 +649,4 @@ | ||
shadow.camera.layers.mask = _shadowCameraLayer; | ||
restoreRendererAndSceneState( renderer, scene, _rendererState ); | ||
@@ -734,4 +665,5 @@ | ||
this.vsmShadowMapVertical.setSize( shadow.mapSize.width, shadow.mapSize.height ); | ||
this.vsmShadowMapHorizontal.setSize( shadow.mapSize.width, shadow.mapSize.height ); | ||
const depth = this.shadowMap.depth; | ||
this.vsmShadowMapVertical.setSize( shadow.mapSize.width, shadow.mapSize.height, depth ); | ||
this.vsmShadowMapHorizontal.setSize( shadow.mapSize.width, shadow.mapSize.height, depth ); | ||
@@ -738,0 +670,0 @@ renderer.setRenderTarget( this.vsmShadowMapVertical ); |
@@ -263,2 +263,10 @@ import TempNode from '../core/TempNode.js'; | ||
if ( builder.shaderStage !== 'fragment' && ( method === MathNode.DFDX || method === MathNode.DFDY ) ) { | ||
console.warn( `THREE.TSL: '${ method }' is not supported in the ${ builder.shaderStage } stage.` ); | ||
method = '/*' + method + '*/'; | ||
} | ||
params.push( a.build( builder, inputType ) ); | ||
@@ -265,0 +273,0 @@ if ( b !== null ) params.push( b.build( builder, inputType ) ); |
import { WebGLCoordinateSystem } from '../../constants.js'; | ||
import TempNode from '../core/TempNode.js'; | ||
import { addMethodChaining, int, nodeProxy } from '../tsl/TSLCore.js'; | ||
import { addMethodChaining, Fn, int, nodeProxy } from '../tsl/TSLCore.js'; | ||
const _vectorOperators = { | ||
'==': 'equal', | ||
'!=': 'notEqual', | ||
'<': 'lessThan', | ||
'>': 'greaterThan', | ||
'<=': 'lessThanEqual', | ||
'>=': 'greaterThanEqual', | ||
'%': 'mod' | ||
}; | ||
/** | ||
@@ -79,2 +89,15 @@ * This node represents basic mathematical and logical operations like addition, | ||
/** | ||
* Returns the operator method name. | ||
* | ||
* @param {NodeBuilder} builder - The current node builder. | ||
* @param {string} output - The output type. | ||
* @returns {string} The operator method name. | ||
*/ | ||
getOperatorMethod( builder, output ) { | ||
return builder.getMethod( _vectorOperators[ this.op ], output ); | ||
} | ||
/** | ||
* This method is overwritten since the node type is inferred from the operator | ||
@@ -84,6 +107,5 @@ * and the input node types. | ||
* @param {NodeBuilder} builder - The current node builder. | ||
* @param {string} output - The current output string. | ||
* @return {string} The node type. | ||
*/ | ||
getNodeType( builder, output ) { | ||
getNodeType( builder ) { | ||
@@ -110,9 +132,9 @@ const op = this.op; | ||
} else if ( op === '!' || op === '==' || op === '!=' || op === '&&' || op === '||' || op === '^^' ) { | ||
} else if ( op === '!' || op === '&&' || op === '||' || op === '^^' ) { | ||
return 'bool'; | ||
} else if ( op === '<' || op === '>' || op === '<=' || op === '>=' ) { | ||
} else if ( op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=' ) { | ||
const typeLength = output ? builder.getTypeLength( output ) : Math.max( builder.getTypeLength( typeA ), builder.getTypeLength( typeB ) ); | ||
const typeLength = Math.max( builder.getTypeLength( typeA ), builder.getTypeLength( typeB ) ); | ||
@@ -178,3 +200,3 @@ return typeLength > 1 ? `bvec${ typeLength }` : 'bool'; | ||
const type = this.getNodeType( builder, output ); | ||
const type = this.getNodeType( builder ); | ||
@@ -195,2 +217,6 @@ let typeA = null; | ||
} else if ( builder.isVector( typeB ) ) { | ||
typeA = typeB; | ||
} else if ( typeA !== typeB ) { | ||
@@ -272,3 +298,2 @@ | ||
const outputLength = builder.getTypeLength( output ); | ||
const fnOpSnippet = builder.getFunctionOperator( op ); | ||
@@ -280,9 +305,9 @@ | ||
if ( op === '==' ) { | ||
if ( op === '==' || op === '!=' || op === '<' || op === '>' || op === '<=' || op === '>=' ) { | ||
if ( isGLSL ) { | ||
if ( outputLength > 1 ) { | ||
if ( builder.isVector( typeA ) ) { | ||
return builder.format( `${ builder.getMethod( 'equal', output ) }( ${ a }, ${ b } )`, type, output ); | ||
return builder.format( `${ this.getOperatorMethod( builder, output ) }( ${ a }, ${ b } )`, type, output ); | ||
@@ -299,70 +324,6 @@ } else { | ||
if ( outputLength > 1 || ! builder.isVector( typeA ) ) { | ||
return builder.format( `( ${ a } ${ op } ${ b } )`, type, output ); | ||
return builder.format( `( ${ a } == ${ b } )`, type, output ); | ||
} else { | ||
return builder.format( `all( ${ a } == ${ b } )`, type, output ); | ||
} | ||
} | ||
} else if ( op === '<' && outputLength > 1 ) { | ||
if ( isGLSL ) { | ||
return builder.format( `${ builder.getMethod( 'lessThan', output ) }( ${ a }, ${ b } )`, type, output ); | ||
} else { | ||
// WGSL | ||
return builder.format( `( ${ a } < ${ b } )`, type, output ); | ||
} | ||
} else if ( op === '<=' && outputLength > 1 ) { | ||
if ( isGLSL ) { | ||
return builder.format( `${ builder.getMethod( 'lessThanEqual', output ) }( ${ a }, ${ b } )`, type, output ); | ||
} else { | ||
// WGSL | ||
return builder.format( `( ${ a } <= ${ b } )`, type, output ); | ||
} | ||
} else if ( op === '>' && outputLength > 1 ) { | ||
if ( isGLSL ) { | ||
return builder.format( `${ builder.getMethod( 'greaterThan', output ) }( ${ a }, ${ b } )`, type, output ); | ||
} else { | ||
// WGSL | ||
return builder.format( `( ${ a } > ${ b } )`, type, output ); | ||
} | ||
} else if ( op === '>=' && outputLength > 1 ) { | ||
if ( isGLSL ) { | ||
return builder.format( `${ builder.getMethod( 'greaterThanEqual', output ) }( ${ a }, ${ b } )`, type, output ); | ||
} else { | ||
// WGSL | ||
return builder.format( `( ${ a } >= ${ b } )`, type, output ); | ||
} | ||
} else if ( op === '%' ) { | ||
@@ -376,3 +337,3 @@ | ||
return builder.format( `${ builder.getMethod( 'mod', type ) }( ${ a }, ${ b } )`, type, output ); | ||
return builder.format( `${ this.getOperatorMethod( builder, type ) }( ${ a }, ${ b } )`, type, output ); | ||
@@ -693,2 +654,64 @@ } | ||
/** | ||
* Increments a node by 1. | ||
* | ||
* @tsl | ||
* @function | ||
* @param {Node} a - The node to increment. | ||
* @returns {OperatorNode} | ||
*/ | ||
export const incrementBefore = Fn( ( [ a ] ) => { | ||
a.addAssign( 1 ); | ||
return a; | ||
} ); | ||
/** | ||
* Decrements a node by 1. | ||
* | ||
* @tsl | ||
* @function | ||
* @param {Node} a - The node to decrement. | ||
* @returns {OperatorNode} | ||
*/ | ||
export const decrementBefore = Fn( ( [ a ] ) => { | ||
a.subAssign( 1 ); | ||
return a; | ||
} ); | ||
/** | ||
* Increments a node by 1 and returns the previous value. | ||
* | ||
* @tsl | ||
* @function | ||
* @param {Node} a - The node to increment. | ||
* @returns {OperatorNode} | ||
*/ | ||
export const increment = /*@__PURE__*/ Fn( ( [ a ] ) => { | ||
const temp = int( a ).toConst(); | ||
a.addAssign( 1 ); | ||
return temp; | ||
} ); | ||
/** | ||
* Decrements a node by 1 and returns the previous value. | ||
* | ||
* @tsl | ||
* @function | ||
* @param {Node} a - The node to decrement. | ||
* @returns {OperatorNode} | ||
*/ | ||
export const decrement = /*@__PURE__*/ Fn( ( [ a ] ) => { | ||
const temp = int( a ).toConst(); | ||
a.subAssign( 1 ); | ||
return temp; | ||
} ); | ||
addMethodChaining( 'add', add ); | ||
@@ -716,2 +739,7 @@ addMethodChaining( 'sub', sub ); | ||
addMethodChaining( 'incrementBefore', incrementBefore ); | ||
addMethodChaining( 'decrementBefore', decrementBefore ); | ||
addMethodChaining( 'increment', increment ); | ||
addMethodChaining( 'decrement', decrement ); | ||
/** | ||
@@ -718,0 +746,0 @@ * @tsl |
@@ -137,2 +137,3 @@ // constants | ||
export * from './lighting/ShadowNode.js'; | ||
export * from './lighting/ShadowFilterNode.js'; | ||
export * from './lighting/PointShadowNode.js'; | ||
@@ -139,0 +140,0 @@ export * from './lighting/PointLightNode.js'; |
@@ -307,2 +307,4 @@ import Node from '../core/Node.js'; | ||
this.isShaderCallNodeInternal = true; | ||
} | ||
@@ -612,4 +614,8 @@ | ||
return shaderNode.call( inputs ); | ||
const fnCall = shaderNode.call( inputs ); | ||
if ( nodeType === 'void' ) fnCall.toStack(); | ||
return fnCall; | ||
}; | ||
@@ -668,17 +674,2 @@ | ||
/** | ||
* @tsl | ||
* @function | ||
* @deprecated since r168. Use {@link Fn} instead. | ||
* | ||
* @param {...any} params | ||
* @returns {Function} | ||
*/ | ||
export const tslFn = ( ...params ) => { // @deprecated, r168 | ||
console.warn( 'THREE.TSL: tslFn() has been renamed to Fn().' ); | ||
return Fn( ...params ); | ||
}; | ||
// | ||
@@ -710,6 +701,41 @@ | ||
/** | ||
* Represent a conditional node using if/else statements. | ||
* | ||
* ```js | ||
* If( condition, function ) | ||
* .ElseIf( condition, function ) | ||
* .Else( function ) | ||
* ``` | ||
* @tsl | ||
* @function | ||
* @param {...any} params - The parameters for the conditional node. | ||
* @returns {StackNode} The conditional node. | ||
*/ | ||
export const If = ( ...params ) => currentStack.If( ...params ); | ||
export function append( node ) { | ||
/** | ||
* Represent a conditional node using switch/case statements. | ||
* | ||
* ```js | ||
* Switch( value ) | ||
* .Case( 1, function ) | ||
* .Case( 2, 3, 4, function ) | ||
* .Default( function ) | ||
* ``` | ||
* @tsl | ||
* @function | ||
* @param {...any} params - The parameters for the conditional node. | ||
* @returns {StackNode} The conditional node. | ||
*/ | ||
export const Switch = ( ...params ) => currentStack.Switch( ...params ); | ||
/** | ||
* Add the given node to the current stack. | ||
* | ||
* @param {Node} node - The node to add. | ||
* @returns {Node} The node that was added to the stack. | ||
*/ | ||
export function Stack( node ) { | ||
if ( currentStack ) currentStack.add( node ); | ||
@@ -721,3 +747,3 @@ | ||
addMethodChaining( 'append', append ); | ||
addMethodChaining( 'toStack', Stack ); | ||
@@ -784,1 +810,40 @@ // types | ||
addMethodChaining( 'convert', convert ); | ||
// deprecated | ||
/** | ||
* @tsl | ||
* @function | ||
* @deprecated since r176. Use {@link Stack} instead. | ||
* | ||
* @param {Node} node - The node to add. | ||
* @returns {Function} | ||
*/ | ||
export const append = ( node ) => { // @deprecated, r176 | ||
console.warn( 'THREE.TSL: append() has been renamed to Stack().' ); | ||
return Stack( node ); | ||
}; | ||
addMethodChaining( 'append', ( node ) => { // @deprecated, r176 | ||
console.warn( 'THREE.TSL: .append() has been renamed to .toStack().' ); | ||
return Stack( node ); | ||
} ); | ||
/** | ||
* @tsl | ||
* @function | ||
* @deprecated since r168. Use {@link Fn} instead. | ||
* | ||
* @param {...any} params | ||
* @returns {Function} | ||
*/ | ||
export const tslFn = ( ...params ) => { // @deprecated, r168 | ||
console.warn( 'THREE.TSL: tslFn() has been renamed to Fn().' ); | ||
return Fn( ...params ); | ||
}; |
@@ -44,11 +44,14 @@ import TempNode from '../core/TempNode.js'; | ||
const title = '--- TSL debug - ' + builder.shaderStage + ' shader ---'; | ||
const border = '-'.repeat( title.length ); | ||
let code = ''; | ||
code += '// #--- TSL Debug ---#\n'; | ||
code += '// #' + title + '#\n'; | ||
code += builder.flow.code.replace( /^\t/mg, '' ) + '\n'; | ||
code += '/* ... */ ' + snippet + ' /* ... */\n'; | ||
code += '// #-----------------#\n'; | ||
code += '// #' + border + '#\n'; | ||
if ( callback !== null ) { | ||
callback( code ); | ||
callback( builder, code ); | ||
@@ -69,4 +72,13 @@ } else { | ||
/** | ||
* TSL function for creating a debug node. | ||
* | ||
* @tsl | ||
* @function | ||
* @param {Node} node - The node to debug. | ||
* @param {?Function} [callback=null] - Optional callback function to handle the debug output. | ||
* @returns {DebugNode} | ||
*/ | ||
export const debug = ( node, callback = null ) => nodeObject( new DebugNode( nodeObject( node ), callback ) ); | ||
addMethodChaining( 'debug', debug ); |
@@ -13,3 +13,3 @@ import { select } from '../math/ConditionalNode.js'; | ||
*/ | ||
export const Discard = ( conditional ) => ( conditional ? select( conditional, expression( 'discard' ) ) : expression( 'discard' ) ).append(); | ||
export const Discard = ( conditional ) => ( conditional ? select( conditional, expression( 'discard' ) ) : expression( 'discard' ) ).toStack(); | ||
@@ -23,4 +23,4 @@ /** | ||
*/ | ||
export const Return = () => expression( 'return' ).append(); | ||
export const Return = () => expression( 'return' ).toStack(); | ||
addMethodChaining( 'discard', Discard ); |
import Node from '../core/Node.js'; | ||
import { expression } from '../code/ExpressionNode.js'; | ||
import { nodeObject, nodeArray } from '../tsl/TSLBase.js'; | ||
import { nodeObject, nodeArray, Fn } from '../tsl/TSLBase.js'; | ||
@@ -104,5 +104,13 @@ /** | ||
properties.returnsNode = this.params[ this.params.length - 1 ]( inputs, stack, builder ); | ||
properties.returnsNode = this.params[ this.params.length - 1 ]( inputs, builder ); | ||
properties.stackNode = stack; | ||
const baseParam = this.params[ 0 ]; | ||
if ( baseParam.isNode !== true && typeof baseParam.update === 'function' ) { | ||
properties.updateNode = Fn( this.params[ 0 ].update )( inputs ); | ||
} | ||
builder.removeStack(); | ||
@@ -226,27 +234,66 @@ | ||
let declarationSnippet = ''; | ||
let conditionalSnippet = ''; | ||
let updateSnippet = ''; | ||
let updateSnippet; | ||
if ( ! update ) { | ||
const deltaOperator = () => condition.includes( '<' ) ? '+=' : '-='; | ||
if ( update !== undefined && update !== null ) { | ||
switch ( typeof update ) { | ||
case 'function': | ||
const flow = builder.flowStagesNode( properties.updateNode, 'void' ); | ||
const snippet = flow.code.replace( /\t|;/g, '' ); | ||
updateSnippet = snippet; | ||
break; | ||
case 'number': | ||
updateSnippet = name + ' ' + deltaOperator() + ' ' + builder.generateConst( type, update ); | ||
break; | ||
case 'string': | ||
updateSnippet = name + ' ' + update; | ||
break; | ||
default: | ||
if ( update.isNode ) { | ||
updateSnippet = name + ' ' + deltaOperator() + ' ' + update.build( builder ); | ||
} else { | ||
console.error( 'THREE.TSL: \'Loop( { update: ... } )\' is not a function, string or number.' ); | ||
updateSnippet = 'break /* invalid update */'; | ||
} | ||
} | ||
} else { | ||
if ( type === 'int' || type === 'uint' ) { | ||
if ( condition.includes( '<' ) ) update = '++'; | ||
else update = '--'; | ||
update = condition.includes( '<' ) ? '++' : '--'; | ||
} else { | ||
if ( condition.includes( '<' ) ) update = '+= 1.'; | ||
else update = '-= 1.'; | ||
update = deltaOperator() + ' 1.'; | ||
} | ||
updateSnippet = name + ' ' + update; | ||
} | ||
declarationSnippet += builder.getVar( type, name ) + ' = ' + startSnippet; | ||
const declarationSnippet = builder.getVar( type, name ) + ' = ' + startSnippet; | ||
const conditionalSnippet = name + ' ' + condition + ' ' + endSnippet; | ||
conditionalSnippet += name + ' ' + condition + ' ' + endSnippet; | ||
updateSnippet += name + ' ' + update; | ||
loopSnippet = `for ( ${ declarationSnippet }; ${ conditionalSnippet }; ${ updateSnippet } )`; | ||
@@ -290,3 +337,3 @@ | ||
*/ | ||
export const Loop = ( ...params ) => nodeObject( new LoopNode( nodeArray( params, 'int' ) ) ).append(); | ||
export const Loop = ( ...params ) => nodeObject( new LoopNode( nodeArray( params, 'int' ) ) ).toStack(); | ||
@@ -300,3 +347,3 @@ /** | ||
*/ | ||
export const Continue = () => expression( 'continue' ).append(); | ||
export const Continue = () => expression( 'continue' ).toStack(); | ||
@@ -310,3 +357,3 @@ /** | ||
*/ | ||
export const Break = () => expression( 'break' ).append(); | ||
export const Break = () => expression( 'break' ).toStack(); | ||
@@ -313,0 +360,0 @@ // Deprecated |
@@ -164,2 +164,13 @@ import Node from '../core/Node.js'; | ||
/** | ||
* Frees internal resources. Should be called when the node is no longer in use. | ||
*/ | ||
dispose() { | ||
super.dispose(); | ||
this._reflectorBaseNode.dispose(); | ||
} | ||
} | ||
@@ -273,5 +284,5 @@ | ||
* | ||
* @type {WeakMap<Camera, RenderTarget>} | ||
* @type {Map<Camera, RenderTarget>} | ||
*/ | ||
this.renderTargets = new WeakMap(); | ||
this.renderTargets = new Map(); | ||
@@ -314,2 +325,17 @@ /** | ||
/** | ||
* Frees internal resources. Should be called when the node is no longer in use. | ||
*/ | ||
dispose() { | ||
super.dispose(); | ||
for ( const renderTarget of this.renderTargets.values() ) { | ||
renderTarget.dispose(); | ||
} | ||
} | ||
/** | ||
* Returns a virtual camera for the given camera. The virtual camera is used to | ||
@@ -316,0 +342,0 @@ * render the scene from the reflector's view so correct reflections can be produced. |
@@ -13,2 +13,3 @@ import { BufferAttribute } from '../core/BufferAttribute.js'; | ||
import { Color } from '../math/Color.js'; | ||
import { FrustumArray } from '../math/FrustumArray.js'; | ||
@@ -83,2 +84,3 @@ function ascIdSort( a, b ) { | ||
const _frustum = /*@__PURE__*/ new Frustum(); | ||
const _frustumArray = /*@__PURE__*/ new FrustumArray(); | ||
const _box = /*@__PURE__*/ new Box3(); | ||
@@ -1446,2 +1448,9 @@ const _sphere = /*@__PURE__*/ new Sphere(); | ||
this._availableInstanceIds = source._availableInstanceIds.slice(); | ||
this._availableGeometryIds = source._availableGeometryIds.slice(); | ||
this._nextIndexStart = source._nextIndexStart; | ||
this._nextVertexStart = source._nextVertexStart; | ||
this._geometryCount = source._geometryCount; | ||
this._maxInstanceCount = source._maxInstanceCount; | ||
@@ -1452,6 +1461,8 @@ this._maxVertexCount = source._maxVertexCount; | ||
this._geometryInitialized = source._geometryInitialized; | ||
this._geometryCount = source._geometryCount; | ||
this._multiDrawCounts = source._multiDrawCounts.slice(); | ||
this._multiDrawStarts = source._multiDrawStarts.slice(); | ||
this._indirectTexture = source._indirectTexture.clone(); | ||
this._indirectTexture.image.data = this._indirectTexture.image.data.slice(); | ||
this._matricesTexture = source._matricesTexture.clone(); | ||
@@ -1518,4 +1529,5 @@ this._matricesTexture.image.data = this._matricesTexture.image.data.slice(); | ||
const frustum = camera.isArrayCamera ? _frustumArray : _frustum; | ||
// prepare the frustum in the local frame | ||
if ( perObjectFrustumCulled ) { | ||
if ( perObjectFrustumCulled && ! camera.isArrayCamera ) { | ||
@@ -1554,3 +1566,3 @@ _matrix | ||
culled = ! _frustum.intersectsSphere( _sphere ); | ||
culled = ! frustum.intersectsSphere( _sphere, camera ); | ||
@@ -1612,3 +1624,3 @@ } | ||
this.getBoundingSphereAt( geometryId, _sphere ).applyMatrix4( _matrix ); | ||
culled = ! _frustum.intersectsSphere( _sphere ); | ||
culled = ! frustum.intersectsSphere( _sphere, camera ); | ||
@@ -1615,0 +1627,0 @@ } |
@@ -35,5 +35,5 @@ | ||
* | ||
* @type {Window|XRSession} | ||
* @type {?(Window|XRSession)} | ||
*/ | ||
this._context = self; | ||
this._context = typeof self !== 'undefined' ? self : null; | ||
@@ -40,0 +40,0 @@ /** |
@@ -121,2 +121,13 @@ import DataMap from './DataMap.js'; | ||
function onBackgroundDispose() { | ||
background.removeEventListener( 'dispose', onBackgroundDispose ); | ||
backgroundMesh.material.dispose(); | ||
backgroundMesh.geometry.dispose(); | ||
} | ||
background.addEventListener( 'dispose', onBackgroundDispose ); | ||
} | ||
@@ -123,0 +134,0 @@ |
@@ -6,3 +6,4 @@ import DataMap from '../DataMap.js'; | ||
import { NodeFrame } from '../../../nodes/Nodes.js'; | ||
import { objectGroup, renderGroup, frameGroup, cubeTexture, texture, fog, rangeFogFactor, densityFogFactor, reference, pmremTexture, screenUV } from '../../../nodes/TSL.js'; | ||
import { objectGroup, renderGroup, frameGroup, cubeTexture, texture, texture3D, vec3, fog, rangeFogFactor, densityFogFactor, reference, pmremTexture, screenUV } from '../../../nodes/TSL.js'; | ||
import { builtin } from '../../../nodes/accessors/BuiltinNode.js'; | ||
@@ -205,2 +206,8 @@ import { CubeUVReflectionMapping, EquirectangularReflectionMapping, EquirectangularRefractionMapping } from '../../../constants.js'; | ||
nodeBuilder.clippingContext = renderObject.clippingContext; | ||
if ( this.renderer.getRenderTarget() ? this.renderer.getRenderTarget().multiview : false ) { | ||
nodeBuilder.enableMultiview(); | ||
} | ||
nodeBuilder.build(); | ||
@@ -663,3 +670,3 @@ | ||
return renderer.toneMapping + ',' + renderer.currentColorSpace; | ||
return renderer.toneMapping + ',' + renderer.currentColorSpace + ',' + renderer.xr.isPresenting; | ||
@@ -695,3 +702,5 @@ } | ||
const output = texture( outputTarget, screenUV ).renderOutput( renderer.toneMapping, renderer.currentColorSpace ); | ||
const output = outputTarget.isTextureArray ? | ||
texture3D( outputTarget, vec3( screenUV, builtin( 'gl_ViewID_OVR' ) ) ).renderOutput( renderer.toneMapping, renderer.currentColorSpace ) : | ||
texture( outputTarget, screenUV ).renderOutput( renderer.toneMapping, renderer.currentColorSpace ); | ||
@@ -698,0 +707,0 @@ _outputNodeMap.set( outputTarget, cacheKey ); |
@@ -22,6 +22,2 @@ import { DoubleSide } from '../../constants.js'; | ||
} else if ( a.material.id !== b.material.id ) { | ||
return a.material.id - b.material.id; | ||
} else if ( a.z !== b.z ) { | ||
@@ -28,0 +24,0 @@ |
@@ -512,4 +512,15 @@ import { hash, hashString } from '../../nodes/core/NodeUtils.js'; | ||
const hasIndex = ( index !== null ); | ||
const instanceCount = geometry.isInstancedBufferGeometry ? geometry.instanceCount : ( object.count > 1 ? object.count : 1 ); | ||
let instanceCount = 1; | ||
if ( geometry.isInstancedBufferGeometry === true ) { | ||
instanceCount = geometry.instanceCount; | ||
} else if ( object.count !== undefined ) { | ||
instanceCount = Math.max( 0, object.count ); | ||
} | ||
if ( instanceCount === 0 ) return null; | ||
@@ -516,0 +527,0 @@ |
@@ -5,3 +5,4 @@ import DataMap from './DataMap.js'; | ||
import { DepthTexture } from '../../textures/DepthTexture.js'; | ||
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type, EquirectangularReflectionMapping, EquirectangularRefractionMapping, CubeReflectionMapping, CubeRefractionMapping, UnsignedByteType } from '../../constants.js'; | ||
import { DepthArrayTexture } from '../../textures/DepthArrayTexture.js'; | ||
import { DepthStencilFormat, DepthFormat, UnsignedIntType, UnsignedInt248Type, UnsignedByteType } from '../../constants.js'; | ||
@@ -80,3 +81,12 @@ const _size = /*@__PURE__*/ new Vector3(); | ||
depthTexture = new DepthTexture(); | ||
if ( renderTarget.multiview === true && size.depth > 1 ) { | ||
depthTexture = new DepthArrayTexture(); | ||
} else { | ||
depthTexture = new DepthTexture(); | ||
} | ||
depthTexture.format = renderTarget.stencilBuffer ? DepthStencilFormat : DepthFormat; | ||
@@ -86,2 +96,3 @@ depthTexture.type = renderTarget.stencilBuffer ? UnsignedInt248Type : UnsignedIntType; // FloatType | ||
depthTexture.image.height = mipHeight; | ||
depthTexture.image.depth = size.depth; | ||
@@ -101,2 +112,3 @@ depthTextureMips[ activeMipmapLevel ] = depthTexture; | ||
depthTexture.image.height = mipHeight; | ||
depthTexture.image.depth = depthTexture.isDepthArrayTexture ? depthTexture.image.depth : 1; | ||
@@ -142,2 +154,3 @@ } | ||
texture.isTextureArray = renderTarget.multiview === true && size.depth > 1; | ||
if ( textureNeedsUpdate ) texture.needsUpdate = true; | ||
@@ -338,4 +351,2 @@ | ||
this.info.memory.textures --; | ||
}; | ||
@@ -429,3 +440,3 @@ | ||
return this.isEnvironmentTexture( texture ) || texture.isCompressedTexture === true || texture.generateMipmaps; | ||
return texture.isCompressedTexture === true || texture.generateMipmaps; | ||
@@ -435,16 +446,2 @@ } | ||
/** | ||
* Returns `true` if the given texture is an environment map. | ||
* | ||
* @param {Texture} texture - The texture. | ||
* @return {boolean} Whether the given texture is an environment map or not. | ||
*/ | ||
isEnvironmentTexture( texture ) { | ||
const mapping = texture.mapping; | ||
return ( mapping === EquirectangularReflectionMapping || mapping === EquirectangularRefractionMapping ) || ( mapping === CubeReflectionMapping || mapping === CubeRefractionMapping ); | ||
} | ||
/** | ||
* Frees internal resource when the given texture isn't | ||
@@ -457,7 +454,13 @@ * required anymore. | ||
this.backend.destroySampler( texture ); | ||
this.backend.destroyTexture( texture ); | ||
if ( this.has( texture ) === true ) { | ||
this.delete( texture ); | ||
this.backend.destroySampler( texture ); | ||
this.backend.destroyTexture( texture ); | ||
this.delete( texture ); | ||
this.info.memory.textures --; | ||
} | ||
} | ||
@@ -464,0 +467,0 @@ |
@@ -77,2 +77,3 @@ /** | ||
* @param {Object} renderContext - The render context to allocate queries for. | ||
* @returns {?number} | ||
*/ | ||
@@ -79,0 +80,0 @@ allocateQueriesForContext( /* renderContext */ ) {} |
@@ -12,2 +12,3 @@ import { ArrayCamera } from '../../cameras/ArrayCamera.js'; | ||
import { DepthTexture } from '../../textures/DepthTexture.js'; | ||
import { DepthArrayTexture } from '../../textures/DepthArrayTexture.js'; | ||
import { XRRenderTarget } from './XRRenderTarget.js'; | ||
@@ -36,4 +37,5 @@ import { CylinderGeometry } from '../../geometries/CylinderGeometry.js'; | ||
* @param {Renderer} renderer - The renderer. | ||
* @param {boolean} [multiview=false] - Enables multiview if the device supports it. | ||
*/ | ||
constructor( renderer ) { | ||
constructor( renderer, multiview = false ) { | ||
@@ -359,2 +361,22 @@ super(); | ||
/** | ||
* Whether the usage of multiview has been requested by the application or not. | ||
* | ||
* @private | ||
* @type {boolean} | ||
* @default false | ||
* @readonly | ||
*/ | ||
this._useMultiviewIfPossible = multiview; | ||
/** | ||
* Whether the usage of multiview is actually enabled. This flag only evaluates to `true` | ||
* if multiview has been requested by the application and the `OVR_multiview2` is available. | ||
* | ||
* @private | ||
* @type {boolean} | ||
* @readonly | ||
*/ | ||
this._useMultiview = false; | ||
} | ||
@@ -570,2 +592,13 @@ | ||
/** | ||
* Returns `true` if the engine renders to a multiview target. | ||
* | ||
* @return {boolean} Whether the engine renders to a multiview render target or not. | ||
*/ | ||
useMultiview() { | ||
return this._useMultiview; | ||
} | ||
createQuadLayer( width, height, translation, quaternion, pixelwidth, pixelheight, rendercall, attributes = [] ) { | ||
@@ -832,2 +865,9 @@ | ||
if ( this._useMultiviewIfPossible && renderer.hasFeature( 'OVR_multiview2' ) ) { | ||
projectionlayerInit.textureType = 'texture-array'; | ||
this._useMultiview = true; | ||
} | ||
const glBinding = new XRWebGLBinding( session, gl ); | ||
@@ -843,2 +883,16 @@ const glProjLayer = glBinding.createProjectionLayer( projectionlayerInit ); | ||
let depthTexture; | ||
if ( this._useMultiview ) { | ||
depthTexture = new DepthArrayTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, 2 ); | ||
depthTexture.type = depthType; | ||
depthTexture.format = depthFormat; | ||
} else { | ||
depthTexture = new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ); | ||
} | ||
this._xrRenderTarget = new XRRenderTarget( | ||
@@ -851,3 +905,3 @@ glProjLayer.textureWidth, | ||
colorSpace: renderer.outputColorSpace, | ||
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ), | ||
depthTexture: depthTexture, | ||
stencilBuffer: renderer.stencil, | ||
@@ -857,10 +911,13 @@ samples: attributes.antialias ? 4 : 0, | ||
resolveStencilBuffer: ( glProjLayer.ignoreDepthValues === false ), | ||
depth: this._useMultiview ? 2 : 1, | ||
multiview: this._useMultiview | ||
} ); | ||
this._xrRenderTarget.hasExternalTextures = true; | ||
this._xrRenderTarget.depth = this._useMultiview ? 2 : 1; | ||
this._supportsLayers = session.enabledFeatures.includes( 'layers' ); | ||
this._referenceSpace = await session.requestReferenceSpace( this.getReferenceSpaceType() ); | ||
this._supportsLayers = session.enabledFeatures.includes( 'layers' ); | ||
if ( this._supportsLayers ) { | ||
@@ -921,2 +978,4 @@ | ||
this._referenceSpace = await session.requestReferenceSpace( this.getReferenceSpaceType() ); | ||
} | ||
@@ -962,2 +1021,3 @@ | ||
cameraXR.far = cameraR.far = cameraL.far = depthFar; | ||
cameraXR.isMultiViewCamera = this._useMultiview; | ||
@@ -1274,2 +1334,3 @@ if ( this._currentDepthNear !== cameraXR.near || this._currentDepthFar !== cameraXR.far ) { | ||
this.isPresenting = false; | ||
this._useMultiview = false; | ||
@@ -1445,3 +1506,3 @@ renderer._animation.stop(); | ||
glSubImage.colorTexture, | ||
this._glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture | ||
( this._glProjLayer.ignoreDepthValues && ! this._useMultiview ) ? undefined : glSubImage.depthStencilTexture | ||
); | ||
@@ -1448,0 +1509,0 @@ |
export default /* glsl */` | ||
#ifdef PREMULTIPLIED_ALPHA | ||
// Get get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation. | ||
// Get normal blending with premultipled, use with CustomBlending, OneFactor, OneMinusSrcAlphaFactor, AddEquation. | ||
gl_FragColor.rgb *= gl_FragColor.a; | ||
@@ -6,0 +6,0 @@ |
@@ -26,3 +26,3 @@ export const vertex = /* glsl */` | ||
// use inline sRGB decode until browsers properly support SRGB8_APLHA8 with video textures | ||
// use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures | ||
@@ -29,0 +29,0 @@ texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); |
@@ -27,2 +27,13 @@ import { GLSLNodeParser, NodeBuilder, TextureNode, vectorComponents } from '../../../nodes/Nodes.js'; | ||
const interpolationTypeMap = { | ||
perspective: 'smooth', | ||
linear: 'noperspective' | ||
}; | ||
const interpolationModeMap = { | ||
'centroid': 'centroid', | ||
'flat first': 'flat', | ||
'flat either': 'flat' | ||
}; | ||
const defaultPrecisions = ` | ||
@@ -47,2 +58,4 @@ precision highp float; | ||
precision lowp sampler2DShadow; | ||
precision lowp sampler2DArrayShadow; | ||
precision lowp samplerCubeShadow; | ||
`; | ||
@@ -394,2 +407,4 @@ | ||
if ( depthSnippet ) uvSnippet = `vec4( ${ uvSnippet }, ${ depthSnippet } )`; | ||
return `texture( ${ textureProperty }, ${ uvSnippet } ).x`; | ||
@@ -468,2 +483,8 @@ | ||
if ( depthSnippet ) { | ||
return `texture( ${ textureProperty }, vec4( ${ uvSnippet }, ${ depthSnippet }, ${ compareSnippet } ) )`; | ||
} | ||
return `texture( ${ textureProperty }, vec3( ${ uvSnippet }, ${ compareSnippet } ) )`; | ||
@@ -543,3 +564,3 @@ | ||
if ( uniform.type === 'texture3D' ) { | ||
if ( uniform.type === 'texture3D' && texture.isTextureArray === false ) { | ||
@@ -550,6 +571,14 @@ snippet = `${typePrefix}sampler3D ${ uniform.name };`; | ||
snippet = `sampler2DShadow ${ uniform.name };`; | ||
if ( texture.isDepthArrayTexture === true ) { | ||
} else if ( texture.isDataArrayTexture === true || texture.isCompressedArrayTexture === true ) { | ||
snippet = `sampler2DArrayShadow ${ uniform.name };`; | ||
} else { | ||
snippet = `sampler2DShadow ${ uniform.name };`; | ||
} | ||
} else if ( texture.isDataArrayTexture === true || texture.isCompressedArrayTexture === true || texture.isTextureArray === true ) { | ||
snippet = `${typePrefix}sampler2DArray ${ uniform.name };`; | ||
@@ -774,6 +803,17 @@ | ||
const flat = type.includes( 'int' ) || type.includes( 'uv' ) || type.includes( 'iv' ) ? 'flat ' : ''; | ||
if ( varying.interpolationType ) { | ||
snippet += `${flat}out ${type} ${varying.name};\n`; | ||
const interpolationType = interpolationTypeMap[ varying.interpolationType ] || varying.interpolationType; | ||
const sampling = interpolationModeMap[ varying.interpolationSampling ] || ''; | ||
snippet += `${ interpolationType } ${ sampling } out ${ type } ${ varying.name };\n`; | ||
} else { | ||
const flat = type.includes( 'int' ) || type.includes( 'uv' ) || type.includes( 'iv' ) ? 'flat ' : ''; | ||
snippet += `${ flat }out ${ type } ${ varying.name };\n`; | ||
} | ||
} else { | ||
@@ -794,6 +834,19 @@ | ||
const type = this.getType( varying.type ); | ||
const flat = type.includes( 'int' ) || type.includes( 'uv' ) || type.includes( 'iv' ) ? 'flat ' : ''; | ||
snippet += `${flat}in ${type} ${varying.name};\n`; | ||
if ( varying.interpolationType ) { | ||
const interpolationType = interpolationTypeMap[ varying.interpolationType ] || varying.interpolationType; | ||
const sampling = interpolationModeMap[ varying.interpolationSampling ] || ''; | ||
snippet += `${ interpolationType } ${ sampling } in ${ type } ${ varying.name };\n`; | ||
} else { | ||
const flat = type.includes( 'int' ) || type.includes( 'uv' ) || type.includes( 'iv' ) ? 'flat ' : ''; | ||
snippet += `${ flat }in ${ type } ${ varying.name };\n`; | ||
} | ||
} | ||
@@ -1050,2 +1103,14 @@ | ||
/** | ||
* Enables multiview. | ||
*/ | ||
enableMultiview() { | ||
this.enableExtension( 'GL_OVR_multiview2', 'require', 'fragment' ); | ||
this.enableExtension( 'GL_OVR_multiview2', 'require', 'vertex' ); | ||
this.builtins[ 'vertex' ].push( 'layout(num_views = 2) in' ); | ||
} | ||
/** | ||
* Registers a transform in context of Transform Feedback. | ||
@@ -1166,2 +1231,5 @@ * | ||
// extensions | ||
${shaderData.extensions} | ||
// precision | ||
@@ -1168,0 +1236,0 @@ ${ defaultPrecisions } |
@@ -12,3 +12,4 @@ export const GLFeatureName = { | ||
'EXT_disjoint_timer_query_webgl2': 'timestamp-query', | ||
'OVR_multiview2': 'OVR_multiview2' | ||
}; |
@@ -115,3 +115,3 @@ import { LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, FloatType, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, SRGBColorSpace, NeverCompare, AlwaysCompare, LessCompare, LessEqualCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare } from '../../../constants.js'; | ||
} else if ( texture.isDataArrayTexture === true || texture.isCompressedArrayTexture === true ) { | ||
} else if ( texture.isDepthArrayTexture === true || texture.isDataArrayTexture === true || texture.isCompressedArrayTexture === true || texture.isTextureArray === true ) { | ||
@@ -310,4 +310,9 @@ glTextureType = gl.TEXTURE_2D_ARRAY; | ||
gl.texParameteri( textureType, gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] ); | ||
// WebGL 2 does not support wrapping for depth 2D array textures | ||
if ( texture.isDepthArrayTexture !== true && texture.isTextureArray === false ) { | ||
gl.texParameteri( textureType, gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] ); | ||
} | ||
} | ||
@@ -409,3 +414,3 @@ | ||
if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) { | ||
if ( texture.isDepthArrayTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture || texture.isTextureArray ) { | ||
@@ -572,3 +577,3 @@ gl.texStorage3D( gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, width, height, depth ); | ||
} else if ( texture.isDataArrayTexture ) { | ||
} else if ( texture.isDataArrayTexture || texture.isDepthArrayTexture ) { | ||
@@ -738,3 +743,3 @@ const image = options.image; | ||
if ( srcTexture.isDataArrayTexture ) { | ||
if ( srcTexture.isDataArrayTexture || srcTexture.isDepthArrayTexture ) { | ||
@@ -792,3 +797,3 @@ depth = image.depth; | ||
// set up the src texture | ||
const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture; | ||
const isDst3D = dstTexture.isDataArrayTexture || dstTexture.isData3DTexture || dstTexture.isDepthArrayTexture; | ||
if ( srcTexture.isRenderTargetTexture || srcTexture.isDepthTexture ) { | ||
@@ -795,0 +800,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, LuminanceAlphaFormat, LuminanceFormat, RedFormat, RGBFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, SRGBColorSpace, NoColorSpace } from '../../../constants.js'; | ||
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, SRGBColorSpace, NoColorSpace } from '../../../constants.js'; | ||
@@ -77,4 +77,2 @@ /** | ||
if ( p === RGBAFormat ) return gl.RGBA; | ||
if ( p === LuminanceFormat ) return gl.LUMINANCE; | ||
if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA; | ||
if ( p === DepthFormat ) return gl.DEPTH_COMPONENT; | ||
@@ -81,0 +79,0 @@ if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL; |
@@ -267,2 +267,3 @@ import GLSLNodeBuilder from './nodes/GLSLNodeBuilder.js'; | ||
this.extensions.get( 'WEBGL_multi_draw' ); | ||
this.extensions.get( 'OVR_multiview2' ); | ||
@@ -364,3 +365,3 @@ this.disjoint = this.extensions.get( 'EXT_disjoint_timer_query_webgl2' ); | ||
// are midframe flushes and an external depth texture. | ||
if ( ( this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) && renderTarget.autoAllocateDepthBuffer ) { | ||
if ( ( this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true ) && renderTarget.autoAllocateDepthBuffer === true && renderTarget.multiview === false ) { | ||
@@ -552,3 +553,3 @@ console.warn( 'THREE.WebGLBackend: Render-to-texture extension was disabled because an external texture was provided' ); | ||
if ( samples > 0 && this._useMultisampledRTT( renderContext.renderTarget ) === false ) { | ||
if ( samples > 0 && this._useMultisampledExtension( renderContext.renderTarget ) === false ) { | ||
@@ -967,2 +968,16 @@ const fb = renderTargetContextData.framebuffers[ renderContext.getCacheKey() ]; | ||
/** | ||
* Internal to determine if the current render target is a render target array with depth 2D array texture. | ||
* | ||
* @param {RenderContext} renderContext - The render context. | ||
* @return {boolean} Whether the render target is a render target array with depth 2D array texture. | ||
* | ||
* @private | ||
*/ | ||
_isRenderCameraDepthArray( renderContext ) { | ||
return renderContext.depthTexture && renderContext.depthTexture.isDepthArrayTexture && renderContext.camera.isArrayCamera; | ||
} | ||
/** | ||
* Executes a draw command for the given render object. | ||
@@ -1135,3 +1150,3 @@ * | ||
if ( renderObject.camera.isArrayCamera && renderObject.camera.cameras.length > 0 ) { | ||
if ( renderObject.camera.isArrayCamera === true && renderObject.camera.cameras.length > 0 && renderObject.camera.isMultiViewCamera === false ) { | ||
@@ -1167,2 +1182,34 @@ const cameraData = this.get( renderObject.camera ); | ||
const renderTarget = this._currentContext.renderTarget; | ||
const isRenderCameraDepthArray = this._isRenderCameraDepthArray( this._currentContext ); | ||
const prevActiveCubeFace = this._currentContext.activeCubeFace; | ||
if ( isRenderCameraDepthArray ) { | ||
// Clear the depth texture | ||
const textureData = this.get( renderTarget.depthTexture ); | ||
if ( textureData.clearedRenderId !== this.renderer._nodes.nodeFrame.renderId ) { | ||
textureData.clearedRenderId = this.renderer._nodes.nodeFrame.renderId; | ||
const { stencilBuffer } = renderTarget; | ||
for ( let i = 0, len = cameras.length; i < len; i ++ ) { | ||
this.renderer._activeCubeFace = i; | ||
this._currentContext.activeCubeFace = i; | ||
this._setFramebuffer( this._currentContext ); | ||
this.clear( false, true, stencilBuffer, this._currentContext, false ); | ||
} | ||
this.renderer._activeCubeFace = prevActiveCubeFace; | ||
this._currentContext.activeCubeFace = prevActiveCubeFace; | ||
} | ||
} | ||
for ( let i = 0, len = cameras.length; i < len; i ++ ) { | ||
@@ -1174,16 +1221,30 @@ | ||
if ( isRenderCameraDepthArray ) { | ||
// Update the active layer | ||
this.renderer._activeCubeFace = i; | ||
this._currentContext.activeCubeFace = i; | ||
this._setFramebuffer( this._currentContext ); | ||
} | ||
const vp = subCamera.viewport; | ||
const x = vp.x * pixelRatio; | ||
const y = vp.y * pixelRatio; | ||
const width = vp.width * pixelRatio; | ||
const height = vp.height * pixelRatio; | ||
if ( vp !== undefined ) { | ||
state.viewport( | ||
Math.floor( x ), | ||
Math.floor( renderObject.context.height - height - y ), | ||
Math.floor( width ), | ||
Math.floor( height ) | ||
); | ||
const x = vp.x * pixelRatio; | ||
const y = vp.y * pixelRatio; | ||
const width = vp.width * pixelRatio; | ||
const height = vp.height * pixelRatio; | ||
state.viewport( | ||
Math.floor( x ), | ||
Math.floor( renderObject.context.height - height - y ), | ||
Math.floor( width ), | ||
Math.floor( height ) | ||
); | ||
} | ||
state.bindBufferBase( gl.UNIFORM_BUFFER, cameraIndexData.index, cameraData.indexesGPU[ i ] ); | ||
@@ -1195,2 +1256,5 @@ | ||
this._currentContext.activeCubeFace = prevActiveCubeFace; | ||
this.renderer._activeCubeFace = prevActiveCubeFace; | ||
} | ||
@@ -1946,4 +2010,4 @@ | ||
const multisampledRTTExt = this.extensions.get( 'WEBGL_multisampled_render_to_texture' ); | ||
const useMultisampledRTT = this._useMultisampledRTT( renderTarget ); | ||
const multiviewExt = this.extensions.get( 'OVR_multiview2' ); | ||
const useMultisampledRTT = this._useMultisampledExtension( renderTarget ); | ||
const cacheKey = getCacheKey( descriptor ); | ||
@@ -2010,4 +2074,8 @@ | ||
if ( hasExternalTextures && useMultisampledRTT ) { | ||
if ( renderTarget.multiview ) { | ||
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, attachment, textureData.textureGPU, 0, samples, 0, 2 ); | ||
} else if ( hasExternalTextures && useMultisampledRTT ) { | ||
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, textureData.textureGPU, 0, samples ); | ||
@@ -2044,4 +2112,8 @@ | ||
if ( hasExternalTextures && useMultisampledRTT ) { | ||
if ( renderTarget.multiview ) { | ||
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, depthStyle, textureData.textureGPU, 0, samples, 0, 2 ); | ||
} else if ( hasExternalTextures && useMultisampledRTT ) { | ||
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0, samples ); | ||
@@ -2051,4 +2123,14 @@ | ||
gl.framebufferTexture2D( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0 ); | ||
if ( descriptor.depthTexture.isDepthArrayTexture ) { | ||
const layer = this.renderer._activeCubeFace; | ||
gl.framebufferTextureLayer( gl.FRAMEBUFFER, depthStyle, textureData.textureGPU, 0, layer ); | ||
} else { | ||
gl.framebufferTexture2D( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0 ); | ||
} | ||
} | ||
@@ -2062,5 +2144,25 @@ | ||
const isRenderCameraDepthArray = this._isRenderCameraDepthArray( descriptor ); | ||
if ( isRenderCameraDepthArray ) { | ||
state.bindFramebuffer( gl.FRAMEBUFFER, fb ); | ||
const layer = this.renderer._activeCubeFace; | ||
const depthData = this.get( descriptor.depthTexture ); | ||
const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT; | ||
gl.framebufferTextureLayer( | ||
gl.FRAMEBUFFER, | ||
depthStyle, | ||
depthData.textureGPU, | ||
0, | ||
layer | ||
); | ||
} | ||
// rebind external XR textures | ||
if ( isXRRenderTarget && hasExternalTextures ) { | ||
if ( ( isXRRenderTarget && hasExternalTextures ) || renderTarget.multiview ) { | ||
@@ -2073,4 +2175,8 @@ state.bindFramebuffer( gl.FRAMEBUFFER, fb ); | ||
if ( useMultisampledRTT ) { | ||
if ( renderTarget.multiview ) { | ||
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, textureData.textureGPU, 0, samples, 0, 2 ); | ||
} else if ( useMultisampledRTT ) { | ||
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, textureData.textureGPU, 0, samples ); | ||
@@ -2098,4 +2204,8 @@ | ||
if ( useMultisampledRTT ) { | ||
if ( renderTarget.multiview ) { | ||
multiviewExt.framebufferTextureMultisampleMultiviewOVR( gl.FRAMEBUFFER, depthStyle, textureData.textureGPU, 0, samples, 0, 2 ); | ||
} else if ( useMultisampledRTT ) { | ||
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, depthStyle, gl.TEXTURE_2D, textureData.textureGPU, 0, samples ); | ||
@@ -2115,3 +2225,3 @@ | ||
if ( samples > 0 && useMultisampledRTT === false ) { | ||
if ( samples > 0 && useMultisampledRTT === false && ! renderTarget.multiview ) { | ||
@@ -2409,4 +2519,10 @@ if ( msaaFb === undefined ) { | ||
*/ | ||
_useMultisampledRTT( renderTarget ) { | ||
_useMultisampledExtension( renderTarget ) { | ||
if ( renderTarget.multiview === true ) { | ||
return true; | ||
} | ||
return renderTarget.samples > 0 && this.extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTarget.autoAllocateDepthBuffer !== false; | ||
@@ -2413,0 +2529,0 @@ |
@@ -260,3 +260,4 @@ import { FrontSide, BackSide, DoubleSide, NearestFilter, PCFShadowMap, VSMShadowMap, RGBADepthPacking, NoBlending } from '../../constants.js'; | ||
( material.alphaMap && material.alphaTest > 0 ) || | ||
( material.map && material.alphaTest > 0 ) ) { | ||
( material.map && material.alphaTest > 0 ) || | ||
( material.alphaToCoverage === true ) ) { | ||
@@ -307,3 +308,3 @@ // in this case we need a unique material instance reflecting the | ||
result.alphaMap = material.alphaMap; | ||
result.alphaTest = material.alphaTest; | ||
result.alphaTest = ( material.alphaToCoverage === true ) ? 0.5 : material.alphaTest; // approximate alphaToCoverage by using a fixed alphaTest value | ||
result.map = material.map; | ||
@@ -310,0 +311,0 @@ |
@@ -1632,4 +1632,14 @@ import { LinearFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, NearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, RGBAFormat, DepthFormat, DepthStencilFormat, UnsignedIntType, FloatType, MirroredRepeatWrapping, ClampToEdgeWrapping, RepeatWrapping, UnsignedByteType, NoColorSpace, LinearSRGBColorSpace, NeverCompare, AlwaysCompare, LessCompare, LessEqualCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, SRGBTransfer, LinearTransfer, UnsignedShortType, UnsignedInt248Type } from '../../constants.js'; | ||
setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget ); | ||
const mipmaps = renderTarget.texture.mipmaps; | ||
if ( mipmaps && mipmaps.length > 0 ) { | ||
setupDepthTexture( renderTargetProperties.__webglFramebuffer[ 0 ], renderTarget ); | ||
} else { | ||
setupDepthTexture( renderTargetProperties.__webglFramebuffer, renderTarget ); | ||
} | ||
} else { | ||
@@ -1664,4 +1674,14 @@ | ||
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer ); | ||
const mipmaps = renderTarget.texture.mipmaps; | ||
if ( mipmaps && mipmaps.length > 0 ) { | ||
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] ); | ||
} else { | ||
state.bindFramebuffer( _gl.FRAMEBUFFER, renderTargetProperties.__webglFramebuffer ); | ||
} | ||
if ( renderTargetProperties.__webglDepthbuffer === undefined ) { | ||
@@ -1995,4 +2015,15 @@ | ||
state.bindFramebuffer( _gl.READ_FRAMEBUFFER, renderTargetProperties.__webglMultisampledFramebuffer ); | ||
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer ); | ||
const mipmaps = renderTarget.texture.mipmaps; | ||
if ( mipmaps && mipmaps.length > 0 ) { | ||
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer[ 0 ] ); | ||
} else { | ||
state.bindFramebuffer( _gl.DRAW_FRAMEBUFFER, renderTargetProperties.__webglFramebuffer ); | ||
} | ||
for ( let i = 0; i < textures.length; i ++ ) { | ||
@@ -1999,0 +2030,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, LuminanceAlphaFormat, LuminanceFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat } from '../../constants.js'; | ||
import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat } from '../../constants.js'; | ||
import { ColorManagement } from '../../math/ColorManagement.js'; | ||
@@ -28,4 +28,2 @@ | ||
if ( p === RGBAFormat ) return gl.RGBA; | ||
if ( p === LuminanceFormat ) return gl.LUMINANCE; | ||
if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA; | ||
if ( p === DepthFormat ) return gl.DEPTH_COMPONENT; | ||
@@ -32,0 +30,0 @@ if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL; |
@@ -456,3 +456,3 @@ import NodeUniformsGroup from '../../common/nodes/NodeUniformsGroup.js'; | ||
if ( texture.isDataArrayTexture || texture.isData3DTexture ) { | ||
if ( texture.isDataArrayTexture || texture.isDepthArrayTexture || texture.isData3DTexture ) { | ||
@@ -520,3 +520,3 @@ textureData.arrayLayerCount = new VarNode( | ||
const vecType = texture.isData3DTexture ? 'vec3' : 'vec2'; | ||
const coordSnippet = `${ vecType }<u32>(${ wrapFunction }(${ uvSnippet }) * ${ vecType }<f32>(${ textureDimension }))`; | ||
const coordSnippet = `${ vecType }<u32>( ${ wrapFunction }( ${ uvSnippet } ) * ${ vecType }<f32>( ${ textureDimension } ) )`; | ||
@@ -539,16 +539,26 @@ return this.generateTextureLoad( texture, textureProperty, coordSnippet, depthSnippet, levelSnippet ); | ||
let snippet; | ||
if ( texture.isVideoTexture === true || texture.isStorageTexture === true ) { | ||
return `textureLoad( ${ textureProperty }, ${ uvIndexSnippet } )`; | ||
snippet = `textureLoad( ${ textureProperty }, ${ uvIndexSnippet } )`; | ||
} else if ( depthSnippet ) { | ||
return `textureLoad( ${ textureProperty }, ${ uvIndexSnippet }, ${ depthSnippet }, u32( ${ levelSnippet } ) )`; | ||
snippet = `textureLoad( ${ textureProperty }, ${ uvIndexSnippet }, ${ depthSnippet }, u32( ${ levelSnippet } ) )`; | ||
} else { | ||
return `textureLoad( ${ textureProperty }, ${ uvIndexSnippet }, u32( ${ levelSnippet } ) )`; | ||
snippet = `textureLoad( ${ textureProperty }, ${ uvIndexSnippet }, u32( ${ levelSnippet } ) )`; | ||
if ( this.renderer.backend.compatibilityMode && texture.isDepthTexture ) { | ||
snippet += '.x'; | ||
} | ||
} | ||
return snippet; | ||
} | ||
@@ -672,2 +682,8 @@ | ||
if ( texture.isDepthArrayTexture ) { | ||
return `textureSampleCompare( ${ textureProperty }, ${ textureProperty }_sampler, ${ uvSnippet }, ${ depthSnippet }, ${ compareSnippet } )`; | ||
} | ||
return `textureSampleCompare( ${ textureProperty }, ${ textureProperty }_sampler, ${ uvSnippet }, ${ compareSnippet } )`; | ||
@@ -1567,7 +1583,14 @@ | ||
if ( /^(int|uint|ivec|uvec)/.test( varying.type ) ) { | ||
if ( varying.interpolationType ) { | ||
attributesSnippet += ' @interpolate( flat )'; | ||
const samplingSnippet = varying.interpolationSampling !== null ? `, ${ varying.interpolationSampling } )` : ' )'; | ||
attributesSnippet += ` @interpolate( ${ varying.interpolationType }${ samplingSnippet }`; | ||
// Otherwise, optimize interpolation when sensible | ||
} else if ( /^(int|uint|ivec|uvec)/.test( varying.type ) ) { | ||
attributesSnippet += ` @interpolate( ${ this.renderer.backend.compatibilityMode ? 'flat, either' : 'flat' } )`; | ||
} | ||
@@ -1599,4 +1622,13 @@ | ||
return nodeUniform.value.isStorageBufferAttribute && nodeUniform.node.structTypeNode !== null; | ||
const attribute = nodeUniform.value; | ||
const bufferNode = nodeUniform.node; | ||
const isAttributeStructType = ( attribute.isBufferAttribute || attribute.isInstancedBufferAttribute ) && bufferNode.structTypeNode !== null; | ||
const isStructArray = | ||
( bufferNode.value && bufferNode.value.array ) && | ||
( typeof bufferNode.value.itemSize === 'number' && bufferNode.value.array.length > bufferNode.value.itemSize ); | ||
return isAttributeStructType && ! isStructArray; | ||
} | ||
@@ -1658,3 +1690,3 @@ | ||
} else if ( texture.isDataArrayTexture === true || texture.isCompressedArrayTexture === true ) { | ||
} else if ( texture.isDataArrayTexture === true || texture.isCompressedArrayTexture === true || texture.isTextureArray === true ) { | ||
@@ -1665,4 +1697,12 @@ textureType = 'texture_2d_array<f32>'; | ||
textureType = `texture_depth${multisampled}_2d`; | ||
if ( this.renderer.backend.compatibilityMode && texture.compareFunction === null ) { | ||
textureType = `texture${ multisampled }_2d<f32>`; | ||
} else { | ||
textureType = `texture_depth${ multisampled }_2d${ texture.isDepthArrayTexture === true ? '_array' : '' }`; | ||
} | ||
} else if ( texture.isVideoTexture === true ) { | ||
@@ -1669,0 +1709,0 @@ |
@@ -61,3 +61,6 @@ import NodeFunction from '../../../nodes/core/NodeFunction.js'; | ||
'texture_depth_2d': 'depthTexture', | ||
'texture_depth_2d_array': 'depthTexture', | ||
'texture_depth_multisampled_2d': 'depthTexture', | ||
'texture_depth_cube': 'depthTexture', | ||
'texture_depth_cube_array': 'depthTexture', | ||
@@ -64,0 +67,0 @@ 'texture_3d': 'texture3D', |
import { | ||
GPUTextureAspect, GPUTextureViewDimension, GPUTextureSampleType, GPUBufferBindingType, GPUStorageTextureAccess | ||
GPUTextureAspect, GPUTextureViewDimension, GPUTextureSampleType, GPUBufferBindingType, GPUStorageTextureAccess, | ||
GPUSamplerBindingType | ||
} from './WebGPUConstants.js'; | ||
@@ -103,4 +104,8 @@ | ||
sampler.type = 'comparison'; | ||
sampler.type = GPUSamplerBindingType.Comparison; | ||
} else if ( backend.compatibilityMode ) { | ||
sampler.type = GPUSamplerBindingType.NonFiltering; | ||
} | ||
@@ -159,4 +164,12 @@ | ||
texture.sampleType = GPUTextureSampleType.Depth; | ||
if ( backend.compatibilityMode && binding.texture.compareFunction === null ) { | ||
texture.sampleType = GPUTextureSampleType.UnfilterableFloat; | ||
} else { | ||
texture.sampleType = GPUTextureSampleType.Depth; | ||
} | ||
} else if ( binding.texture.isDataTexture || binding.texture.isDataArrayTexture || binding.texture.isData3DTexture ) { | ||
@@ -194,3 +207,3 @@ | ||
} else if ( binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture ) { | ||
} else if ( binding.texture.isDataArrayTexture || binding.texture.isDepthArrayTexture || binding.texture.isCompressedArrayTexture ) { | ||
@@ -425,3 +438,3 @@ texture.viewDimension = GPUTextureViewDimension.TwoDArray; | ||
} else if ( binding.texture.isDataArrayTexture || binding.texture.isCompressedArrayTexture ) { | ||
} else if ( binding.texture.isDataArrayTexture || binding.texture.isDepthArrayTexture || binding.texture.isCompressedArrayTexture ) { | ||
@@ -428,0 +441,0 @@ dimensionViewGPU = GPUTextureViewDimension.TwoDArray; |
@@ -91,3 +91,3 @@ import { BlendColorFactor, OneMinusBlendColorFactor, } from '../../common/Constants.js'; | ||
if ( material.transparent === true && material.blending !== NoBlending ) { | ||
if ( material.blending !== NoBlending && ( material.blending !== NormalBlending || material.transparent !== false ) ) { | ||
@@ -232,5 +232,6 @@ blending = this._getBlending( material ); | ||
* @param {RenderContext} renderContext - The render context. | ||
* @param {?string} [label='renderBundleEncoder'] - The label. | ||
* @return {GPURenderBundleEncoder} The GPU render bundle encoder. | ||
*/ | ||
createBundleEncoder( renderContext ) { | ||
createBundleEncoder( renderContext, label = 'renderBundleEncoder' ) { | ||
@@ -245,3 +246,3 @@ const backend = this.backend; | ||
const descriptor = { | ||
label: 'renderBundleEncoder', | ||
label: label, | ||
colorFormats: [ colorFormat ], | ||
@@ -248,0 +249,0 @@ depthStencilFormat, |
import { | ||
GPUTextureFormat, GPUAddressMode, GPUFilterMode, GPUTextureDimension, GPUFeatureName | ||
GPUTextureFormat, GPUAddressMode, GPUFilterMode, GPUTextureDimension, GPUFeatureName, GPUTextureViewDimension | ||
} from './WebGPUConstants.js'; | ||
@@ -273,2 +273,8 @@ | ||
if ( texture.isCubeTexture ) { | ||
textureDescriptorGPU.textureBindingViewDimension = GPUTextureViewDimension.Cube; | ||
} | ||
textureData.texture = backend.device.createTexture( textureDescriptorGPU ); | ||
@@ -462,3 +468,3 @@ | ||
} else if ( texture.isDataArrayTexture || texture.isData3DTexture ) { | ||
} else if ( texture.isDataArrayTexture || texture.isDepthArrayTexture || texture.isData3DTexture ) { | ||
@@ -465,0 +471,0 @@ for ( let i = 0; i < options.image.depth; i ++ ) { |
@@ -34,2 +34,3 @@ /*// debugger tools | ||
* @property {boolean} [alpha=true] - Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque. | ||
* @property {boolean} [compatibilityMode=false] - Whether the backend should be in compatibility mode or not. | ||
* @property {boolean} [depth=true] - Whether the default framebuffer should have a depth buffer or not. | ||
@@ -67,2 +68,3 @@ * @property {boolean} [stencil=false] - Whether the default framebuffer should have a stencil buffer or not. | ||
this.parameters.alpha = ( parameters.alpha === undefined ) ? true : parameters.alpha; | ||
this.parameters.compatibilityMode = ( parameters.compatibilityMode === undefined ) ? false : parameters.compatibilityMode; | ||
@@ -72,2 +74,9 @@ this.parameters.requiredLimits = ( parameters.requiredLimits === undefined ) ? {} : parameters.requiredLimits; | ||
/** | ||
* Indicates whether the backend is in compatibility mode or not. | ||
* @type {boolean} | ||
* @default false | ||
*/ | ||
this.compatibilityMode = this.parameters.compatibilityMode; | ||
/** | ||
* A reference to the device. | ||
@@ -174,3 +183,4 @@ * | ||
const adapterOptions = { | ||
powerPreference: parameters.powerPreference | ||
powerPreference: parameters.powerPreference, | ||
featureLevel: parameters.compatibilityMode ? 'compatibility' : undefined | ||
}; | ||
@@ -350,2 +360,16 @@ | ||
/** | ||
* Internal to determine if the current render target is a render target array with depth 2D array texture. | ||
* | ||
* @param {RenderContext} renderContext - The render context. | ||
* @return {boolean} Whether the render target is a render target array with depth 2D array texture. | ||
* | ||
* @private | ||
*/ | ||
_isRenderCameraDepthArray( renderContext ) { | ||
return renderContext.depthTexture && renderContext.depthTexture.isDepthArrayTexture && renderContext.camera.isArrayCamera; | ||
} | ||
/** | ||
* Returns the render pass descriptor for the given render context. | ||
@@ -405,2 +429,4 @@ * | ||
const isRenderCameraDepthArray = this._isRenderCameraDepthArray( renderContext ); | ||
for ( let i = 0; i < textures.length; i ++ ) { | ||
@@ -429,29 +455,57 @@ | ||
viewDescriptor.dimension = GPUTextureViewDimension.TwoDArray; | ||
viewDescriptor.depthOrArrayLayers = textures[ i ].image.depth; | ||
if ( isRenderCameraDepthArray === true ) { | ||
const cameras = renderContext.camera.cameras; | ||
for ( let layer = 0; layer < cameras.length; layer ++ ) { | ||
const layerViewDescriptor = { | ||
...viewDescriptor, | ||
baseArrayLayer: layer, | ||
arrayLayerCount: 1, | ||
dimension: GPUTextureViewDimension.TwoD | ||
}; | ||
const textureView = textureData.texture.createView( layerViewDescriptor ); | ||
textureViews.push( { | ||
view: textureView, | ||
resolveTarget: undefined, | ||
depthSlice: undefined | ||
} ); | ||
} | ||
} else { | ||
viewDescriptor.dimension = GPUTextureViewDimension.TwoDArray; | ||
viewDescriptor.depthOrArrayLayers = textures[ i ].image.depth; | ||
} | ||
} | ||
const textureView = textureData.texture.createView( viewDescriptor ); | ||
if ( isRenderCameraDepthArray !== true ) { | ||
let view, resolveTarget; | ||
const textureView = textureData.texture.createView( viewDescriptor ); | ||
if ( textureData.msaaTexture !== undefined ) { | ||
let view, resolveTarget; | ||
view = textureData.msaaTexture.createView(); | ||
resolveTarget = textureView; | ||
if ( textureData.msaaTexture !== undefined ) { | ||
} else { | ||
view = textureData.msaaTexture.createView(); | ||
resolveTarget = textureView; | ||
view = textureView; | ||
resolveTarget = undefined; | ||
} else { | ||
view = textureView; | ||
resolveTarget = undefined; | ||
} | ||
textureViews.push( { | ||
view, | ||
resolveTarget, | ||
depthSlice: sliceIndex | ||
} ); | ||
} | ||
textureViews.push( { | ||
view, | ||
resolveTarget, | ||
depthSlice: sliceIndex | ||
} ); | ||
} | ||
@@ -464,4 +518,13 @@ | ||
const depthTextureData = this.get( renderContext.depthTexture ); | ||
descriptorBase.depthStencilView = depthTextureData.texture.createView(); | ||
const options = {}; | ||
if ( renderContext.depthTexture.isDepthArrayTexture ) { | ||
options.dimension = GPUTextureViewDimension.TwoD; | ||
options.arrayLayerCount = 1; | ||
options.baseArrayLayer = renderContext.activeCubeFace; | ||
} | ||
descriptorBase.depthStencilView = depthTextureData.texture.createView( options ); | ||
} | ||
@@ -587,3 +650,2 @@ | ||
colorAttachment.loadOp = GPULoadOp.Clear; | ||
colorAttachment.storeOp = GPUStoreOp.Store; | ||
@@ -593,6 +655,7 @@ } else { | ||
colorAttachment.loadOp = GPULoadOp.Load; | ||
colorAttachment.storeOp = GPUStoreOp.Store; | ||
} | ||
colorAttachment.storeOp = GPUStoreOp.Store; | ||
} | ||
@@ -608,3 +671,2 @@ | ||
colorAttachment.loadOp = GPULoadOp.Clear; | ||
colorAttachment.storeOp = GPUStoreOp.Store; | ||
@@ -614,6 +676,7 @@ } else { | ||
colorAttachment.loadOp = GPULoadOp.Load; | ||
colorAttachment.storeOp = GPUStoreOp.Store; | ||
} | ||
colorAttachment.storeOp = GPUStoreOp.Store; | ||
} | ||
@@ -629,3 +692,2 @@ | ||
depthStencilAttachment.depthLoadOp = GPULoadOp.Clear; | ||
depthStencilAttachment.depthStoreOp = GPUStoreOp.Store; | ||
@@ -635,6 +697,7 @@ } else { | ||
depthStencilAttachment.depthLoadOp = GPULoadOp.Load; | ||
depthStencilAttachment.depthStoreOp = GPUStoreOp.Store; | ||
} | ||
depthStencilAttachment.depthStoreOp = GPUStoreOp.Store; | ||
} | ||
@@ -644,7 +707,6 @@ | ||
if ( renderContext.clearStencil ) { | ||
if ( renderContext.clearStencil ) { | ||
depthStencilAttachment.stencilClearValue = renderContext.clearStencilValue; | ||
depthStencilAttachment.stencilLoadOp = GPULoadOp.Clear; | ||
depthStencilAttachment.stencilStoreOp = GPUStoreOp.Store; | ||
@@ -654,6 +716,7 @@ } else { | ||
depthStencilAttachment.stencilLoadOp = GPULoadOp.Load; | ||
depthStencilAttachment.stencilStoreOp = GPUStoreOp.Store; | ||
} | ||
depthStencilAttachment.stencilStoreOp = GPUStoreOp.Store; | ||
} | ||
@@ -664,4 +727,67 @@ | ||
const encoder = device.createCommandEncoder( { label: 'renderContext_' + renderContext.id } ); | ||
const currentPass = encoder.beginRenderPass( descriptor ); | ||
// shadow arrays - prepare bundle encoders for each camera in an array camera | ||
if ( this._isRenderCameraDepthArray( renderContext ) === true ) { | ||
const cameras = renderContext.camera.cameras; | ||
if ( ! renderContextData.layerDescriptors || renderContextData.layerDescriptors.length !== cameras.length ) { | ||
this._createDepthLayerDescriptors( renderContext, renderContextData, descriptor, cameras ); | ||
} else { | ||
this._updateDepthLayerDescriptors( renderContext, renderContextData, cameras ); | ||
} | ||
// Create bundle encoders for each layer | ||
renderContextData.bundleEncoders = []; | ||
renderContextData.bundleSets = []; | ||
// Create separate bundle encoders for each camera in the array | ||
for ( let i = 0; i < cameras.length; i ++ ) { | ||
const bundleEncoder = this.pipelineUtils.createBundleEncoder( | ||
renderContext, | ||
'renderBundleArrayCamera_' + i | ||
); | ||
// Initialize state tracking for this bundle | ||
const bundleSets = { | ||
attributes: {}, | ||
bindingGroups: [], | ||
pipeline: null, | ||
index: null | ||
}; | ||
renderContextData.bundleEncoders.push( bundleEncoder ); | ||
renderContextData.bundleSets.push( bundleSets ); | ||
} | ||
// We'll complete the bundles in finishRender | ||
renderContextData.currentPass = null; | ||
} else { | ||
const currentPass = encoder.beginRenderPass( descriptor ); | ||
renderContextData.currentPass = currentPass; | ||
if ( renderContext.viewport ) { | ||
this.updateViewport( renderContext ); | ||
} | ||
if ( renderContext.scissor ) { | ||
const { x, y, width, height } = renderContext.scissorValue; | ||
currentPass.setScissorRect( x, y, width, height ); | ||
} | ||
} | ||
// | ||
@@ -671,20 +797,77 @@ | ||
renderContextData.encoder = encoder; | ||
renderContextData.currentPass = currentPass; | ||
renderContextData.currentSets = { attributes: {}, bindingGroups: [], pipeline: null, index: null }; | ||
renderContextData.renderBundles = []; | ||
// | ||
} | ||
if ( renderContext.viewport ) { | ||
/** | ||
* This method creates layer descriptors for each camera in an array camera | ||
* to prepare for rendering to a depth array texture. | ||
* | ||
* @param {RenderContext} renderContext - The render context. | ||
* @param {Object} renderContextData - The render context data. | ||
* @param {Object} descriptor - The render pass descriptor. | ||
* @param {ArrayCamera} cameras - The array camera. | ||
* | ||
* @private | ||
*/ | ||
_createDepthLayerDescriptors( renderContext, renderContextData, descriptor, cameras ) { | ||
this.updateViewport( renderContext ); | ||
const depthStencilAttachment = descriptor.depthStencilAttachment; | ||
renderContextData.layerDescriptors = []; | ||
const depthTextureData = this.get( renderContext.depthTexture ); | ||
if ( ! depthTextureData.viewCache ) { | ||
depthTextureData.viewCache = []; | ||
} | ||
if ( renderContext.scissor ) { | ||
for ( let i = 0; i < cameras.length; i ++ ) { | ||
const { x, y, width, height } = renderContext.scissorValue; | ||
const layerDescriptor = { | ||
...descriptor, | ||
colorAttachments: [ { | ||
...descriptor.colorAttachments[ 0 ], | ||
view: descriptor.colorAttachments[ i ].view | ||
} ] | ||
}; | ||
currentPass.setScissorRect( x, y, width, height ); | ||
if ( descriptor.depthStencilAttachment ) { | ||
const layerIndex = i; | ||
if ( ! depthTextureData.viewCache[ layerIndex ] ) { | ||
depthTextureData.viewCache[ layerIndex ] = depthTextureData.texture.createView( { | ||
dimension: GPUTextureViewDimension.TwoD, | ||
baseArrayLayer: i, | ||
arrayLayerCount: 1 | ||
} ); | ||
} | ||
layerDescriptor.depthStencilAttachment = { | ||
view: depthTextureData.viewCache[ layerIndex ], | ||
depthLoadOp: depthStencilAttachment.depthLoadOp || GPULoadOp.Clear, | ||
depthStoreOp: depthStencilAttachment.depthStoreOp || GPUStoreOp.Store, | ||
depthClearValue: depthStencilAttachment.depthClearValue || 1.0 | ||
}; | ||
if ( renderContext.stencil ) { | ||
layerDescriptor.depthStencilAttachment.stencilLoadOp = depthStencilAttachment.stencilLoadOp; | ||
layerDescriptor.depthStencilAttachment.stencilStoreOp = depthStencilAttachment.stencilStoreOp; | ||
layerDescriptor.depthStencilAttachment.stencilClearValue = depthStencilAttachment.stencilClearValue; | ||
} | ||
} else { | ||
layerDescriptor.depthStencilAttachment = { ...depthStencilAttachment }; | ||
} | ||
renderContextData.layerDescriptors.push( layerDescriptor ); | ||
} | ||
@@ -695,2 +878,57 @@ | ||
/** | ||
* This method updates the layer descriptors for each camera in an array camera | ||
* to prepare for rendering to a depth array texture. | ||
* | ||
* @param {RenderContext} renderContext - The render context. | ||
* @param {Object} renderContextData - The render context data. | ||
* @param {ArrayCamera} cameras - The array camera. | ||
* | ||
*/ | ||
_updateDepthLayerDescriptors( renderContext, renderContextData, cameras ) { | ||
for ( let i = 0; i < cameras.length; i ++ ) { | ||
const layerDescriptor = renderContextData.layerDescriptors[ i ]; | ||
if ( layerDescriptor.depthStencilAttachment ) { | ||
const depthAttachment = layerDescriptor.depthStencilAttachment; | ||
if ( renderContext.depth ) { | ||
if ( renderContext.clearDepth ) { | ||
depthAttachment.depthClearValue = renderContext.clearDepthValue; | ||
depthAttachment.depthLoadOp = GPULoadOp.Clear; | ||
} else { | ||
depthAttachment.depthLoadOp = GPULoadOp.Load; | ||
} | ||
} | ||
if ( renderContext.stencil ) { | ||
if ( renderContext.clearStencil ) { | ||
depthAttachment.stencilClearValue = renderContext.clearStencilValue; | ||
depthAttachment.stencilLoadOp = GPULoadOp.Clear; | ||
} else { | ||
depthAttachment.stencilLoadOp = GPULoadOp.Load; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
/** | ||
* This method is executed at the end of a render call and finalizes work | ||
@@ -718,4 +956,52 @@ * after draw calls. | ||
renderContextData.currentPass.end(); | ||
// shadow arrays - Execute bundles for each layer | ||
const encoder = renderContextData.encoder; | ||
if ( this._isRenderCameraDepthArray( renderContext ) === true ) { | ||
const bundles = []; | ||
for ( let i = 0; i < renderContextData.bundleEncoders.length; i ++ ) { | ||
const bundleEncoder = renderContextData.bundleEncoders[ i ]; | ||
bundles.push( bundleEncoder.finish() ); | ||
} | ||
for ( let i = 0; i < renderContextData.layerDescriptors.length; i ++ ) { | ||
if ( i < bundles.length ) { | ||
const layerDescriptor = renderContextData.layerDescriptors[ i ]; | ||
const renderPass = encoder.beginRenderPass( layerDescriptor ); | ||
if ( renderContext.viewport ) { | ||
const { x, y, width, height, minDepth, maxDepth } = renderContext.viewportValue; | ||
renderPass.setViewport( x, y, width, height, minDepth, maxDepth ); | ||
} | ||
if ( renderContext.scissor ) { | ||
const { x, y, width, height } = renderContext.scissorValue; | ||
renderPass.setScissorRect( x, y, width, height ); | ||
} | ||
renderPass.executeBundles( [ bundles[ i ] ] ); | ||
renderPass.end(); | ||
} | ||
} | ||
} else if ( renderContextData.currentPass ) { | ||
renderContextData.currentPass.end(); | ||
} | ||
if ( occlusionQueryCount > 0 ) { | ||
@@ -1146,7 +1432,8 @@ | ||
const pipelineGPU = this.get( pipeline ).pipeline; | ||
const currentSets = renderContextData.currentSets; | ||
const passEncoderGPU = renderContextData.currentPass; | ||
const index = renderObject.getIndex(); | ||
const hasIndex = ( index !== null ); | ||
const drawParams = renderObject.getDrawParameters(); | ||
if ( drawParams === null ) return; | ||
@@ -1156,111 +1443,76 @@ | ||
if ( currentSets.pipeline !== pipelineGPU ) { | ||
const setPipelineAndBindings = ( passEncoderGPU, currentSets ) => { | ||
// pipeline | ||
passEncoderGPU.setPipeline( pipelineGPU ); | ||
currentSets.pipeline = pipelineGPU; | ||
} | ||
// bind groups | ||
const currentBindingGroups = currentSets.bindingGroups; | ||
for ( let i = 0, l = bindings.length; i < l; i ++ ) { | ||
// bind groups | ||
const bindGroup = bindings[ i ]; | ||
const bindingsData = this.get( bindGroup ); | ||
if ( currentBindingGroups[ bindGroup.index ] !== bindGroup.id ) { | ||
const currentBindingGroups = currentSets.bindingGroups; | ||
passEncoderGPU.setBindGroup( bindGroup.index, bindingsData.group ); | ||
currentBindingGroups[ bindGroup.index ] = bindGroup.id; | ||
for ( let i = 0, l = bindings.length; i < l; i ++ ) { | ||
} | ||
const bindGroup = bindings[ i ]; | ||
const bindingsData = this.get( bindGroup ); | ||
if ( currentBindingGroups[ bindGroup.index ] !== bindGroup.id ) { | ||
passEncoderGPU.setBindGroup( bindGroup.index, bindingsData.group ); | ||
currentBindingGroups[ bindGroup.index ] = bindGroup.id; | ||
} | ||
} | ||
// attributes | ||
// attributes | ||
// index | ||
const index = renderObject.getIndex(); | ||
if ( hasIndex === true ) { | ||
const hasIndex = ( index !== null ); | ||
if ( currentSets.index !== index ) { | ||
// index | ||
const buffer = this.get( index ).buffer; | ||
const indexFormat = ( index.array instanceof Uint16Array ) ? GPUIndexFormat.Uint16 : GPUIndexFormat.Uint32; | ||
if ( hasIndex === true ) { | ||
passEncoderGPU.setIndexBuffer( buffer, indexFormat ); | ||
if ( currentSets.index !== index ) { | ||
currentSets.index = index; | ||
const buffer = this.get( index ).buffer; | ||
const indexFormat = ( index.array instanceof Uint16Array ) ? GPUIndexFormat.Uint16 : GPUIndexFormat.Uint32; | ||
} | ||
passEncoderGPU.setIndexBuffer( buffer, indexFormat ); | ||
currentSets.index = index; | ||
} | ||
// vertex buffers | ||
} | ||
const vertexBuffers = renderObject.getVertexBuffers(); | ||
// vertex buffers | ||
for ( let i = 0, l = vertexBuffers.length; i < l; i ++ ) { | ||
const vertexBuffers = renderObject.getVertexBuffers(); | ||
const vertexBuffer = vertexBuffers[ i ]; | ||
for ( let i = 0, l = vertexBuffers.length; i < l; i ++ ) { | ||
if ( currentSets.attributes[ i ] !== vertexBuffer ) { | ||
const vertexBuffer = vertexBuffers[ i ]; | ||
const buffer = this.get( vertexBuffer ).buffer; | ||
passEncoderGPU.setVertexBuffer( i, buffer ); | ||
if ( currentSets.attributes[ i ] !== vertexBuffer ) { | ||
currentSets.attributes[ i ] = vertexBuffer; | ||
const buffer = this.get( vertexBuffer ).buffer; | ||
passEncoderGPU.setVertexBuffer( i, buffer ); | ||
} | ||
currentSets.attributes[ i ] = vertexBuffer; | ||
} | ||
// stencil | ||
} | ||
if ( context.stencil === true && material.stencilWrite === true && renderContextData.currentStencilRef !== material.stencilRef ) { | ||
// occlusion queries - handle multiple consecutive draw calls for an object | ||
passEncoderGPU.setStencilReference( material.stencilRef ); | ||
renderContextData.currentStencilRef = material.stencilRef; | ||
if ( renderContextData.occlusionQuerySet !== undefined ) { | ||
const lastObject = renderContextData.lastOcclusionObject; | ||
if ( lastObject !== object ) { | ||
if ( lastObject !== null && lastObject.occlusionTest === true ) { | ||
passEncoderGPU.endOcclusionQuery(); | ||
renderContextData.occlusionQueryIndex ++; | ||
} | ||
if ( object.occlusionTest === true ) { | ||
passEncoderGPU.beginOcclusionQuery( renderContextData.occlusionQueryIndex ); | ||
renderContextData.occlusionQueryObjects[ renderContextData.occlusionQueryIndex ] = object; | ||
} | ||
renderContextData.lastOcclusionObject = object; | ||
} | ||
} | ||
// stencil | ||
}; | ||
if ( context.stencil === true && material.stencilWrite === true && renderContextData.currentStencilRef !== material.stencilRef ) { | ||
// Define draw function | ||
const draw = ( passEncoderGPU, currentSets ) => { | ||
passEncoderGPU.setStencilReference( material.stencilRef ); | ||
renderContextData.currentStencilRef = material.stencilRef; | ||
setPipelineAndBindings( passEncoderGPU, currentSets ); | ||
} | ||
// draw | ||
const draw = () => { | ||
if ( object.isBatchedMesh === true ) { | ||
@@ -1380,15 +1632,42 @@ | ||
passEncoderGPU.setViewport( | ||
Math.floor( vp.x * pixelRatio ), | ||
Math.floor( vp.y * pixelRatio ), | ||
Math.floor( vp.width * pixelRatio ), | ||
Math.floor( vp.height * pixelRatio ), | ||
context.viewportValue.minDepth, | ||
context.viewportValue.maxDepth | ||
); | ||
passEncoderGPU.setBindGroup( cameraIndex.index, cameraData.indexesGPU[ i ] ); | ||
draw(); | ||
let pass = renderContextData.currentPass; | ||
let sets = renderContextData.currentSets; | ||
if ( renderContextData.bundleEncoders ) { | ||
const bundleEncoder = renderContextData.bundleEncoders[ i ]; | ||
const bundleSets = renderContextData.bundleSets[ i ]; | ||
pass = bundleEncoder; | ||
sets = bundleSets; | ||
} | ||
if ( vp ) { | ||
pass.setViewport( | ||
Math.floor( vp.x * pixelRatio ), | ||
Math.floor( vp.y * pixelRatio ), | ||
Math.floor( vp.width * pixelRatio ), | ||
Math.floor( vp.height * pixelRatio ), | ||
context.viewportValue.minDepth, | ||
context.viewportValue.maxDepth | ||
); | ||
} | ||
// Set camera index binding for this layer | ||
if ( cameraIndex && cameraData.indexesGPU ) { | ||
pass.setBindGroup( cameraIndex.index, cameraData.indexesGPU[ i ] ); | ||
sets.bindingGroups[ cameraIndex.index ] = cameraIndex.id; | ||
} | ||
draw( pass, sets ); | ||
} | ||
@@ -1400,4 +1679,35 @@ | ||
draw(); | ||
// Regular single camera rendering | ||
if ( renderContextData.currentPass ) { | ||
// Handle occlusion queries | ||
if ( renderContextData.occlusionQuerySet !== undefined ) { | ||
const lastObject = renderContextData.lastOcclusionObject; | ||
if ( lastObject !== object ) { | ||
if ( lastObject !== null && lastObject.occlusionTest === true ) { | ||
renderContextData.currentPass.endOcclusionQuery(); | ||
renderContextData.occlusionQueryIndex ++; | ||
} | ||
if ( object.occlusionTest === true ) { | ||
renderContextData.currentPass.beginOcclusionQuery( renderContextData.occlusionQueryIndex ); | ||
renderContextData.occlusionQueryObjects[ renderContextData.occlusionQueryIndex ] = object; | ||
} | ||
renderContextData.lastOcclusionObject = object; | ||
} | ||
} | ||
draw( renderContextData.currentPass, renderContextData.currentSets ); | ||
} | ||
} | ||
@@ -1404,0 +1714,0 @@ |
@@ -40,2 +40,3 @@ import Renderer from '../common/Renderer.js'; | ||
* @property {boolean} [forceWebGL=false] - If set to `true`, the renderer uses a WebGL 2 backend no matter if WebGPU is supported or not. | ||
* @property {boolean} [multiview=false] - If set to `true`, the renderer will use multiview during WebXR rendering if supported. | ||
* @property {number} [outputType=undefined] - Texture type for output to canvas. By default, device's preferred format is used; other formats may incur overhead. | ||
@@ -95,2 +96,8 @@ * @property {number} [colorBufferType=HalfFloatType] - Defines the type of color buffers. The default `HalfFloatType` is recommend for best | ||
if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) { | ||
__THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'observe', { detail: this } ) ); | ||
} | ||
} | ||
@@ -97,0 +104,0 @@ |
@@ -405,3 +405,3 @@ import { Vector3 } from '../../math/Vector3.js'; | ||
* @param {Group} hand - The group representing the hand space. | ||
* @param {XRHandJoint} inputjoint - The XR frame. | ||
* @param {XRJointSpace} inputjoint - The hand joint data. | ||
* @return {Group} A group representing the hand joint for the given input joint. | ||
@@ -408,0 +408,0 @@ */ |
@@ -281,3 +281,4 @@ import { ArrayCamera } from '../../cameras/ArrayCamera.js'; | ||
* environment. Depending on how the user moves in 3D space, setting an appropriate reference space can | ||
* improve tracking. Default is `local-floor`. | ||
* improve tracking. Default is `local-floor`. Valid values can be found here | ||
* https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace#reference_space_types. | ||
* | ||
@@ -284,0 +285,0 @@ * This method can not be used during a XR session. |
@@ -75,3 +75,3 @@ import { Source } from './Source.js'; | ||
/** | ||
* The depth compare function. | ||
* Code corresponding to the depth compare function. | ||
* | ||
@@ -78,0 +78,0 @@ * @type {?(NeverCompare|LessCompare|EqualCompare|LessEqualCompare|GreaterCompare|NotEqualCompare|GreaterEqualCompare|AlwaysCompare)} |
@@ -341,2 +341,11 @@ import { EventDispatcher } from '../core/EventDispatcher.js'; | ||
/** | ||
* Indicates if a texture should be handled like a texture array. | ||
* | ||
* @type {boolean} | ||
* @readonly | ||
* @default false | ||
*/ | ||
this.isTextureArray = false; | ||
/** | ||
* Indicates whether this texture should be processed by `PMREMGenerator` or not | ||
@@ -435,2 +444,3 @@ * (only relevant for render target textures). | ||
this.isRenderTargetTexture = source.isRenderTargetTexture; | ||
this.isTextureArray = source.isTextureArray; | ||
@@ -437,0 +447,0 @@ this.userData = JSON.parse( JSON.stringify( source.userData ) ); |
@@ -23,3 +23,3 @@ import { LinearFilter } from '../constants.js'; | ||
* | ||
* @param {Video} video - The video element to use as a data source for the texture. | ||
* @param {HTMLVideoElement} video - The video element to use as a data source for the texture. | ||
* @param {number} [mapping=Texture.DEFAULT_MAPPING] - The texture mapping. | ||
@@ -26,0 +26,0 @@ * @param {number} [wrapS=ClampToEdgeWrapping] - The wrapS value. |
@@ -37,2 +37,3 @@ import { REVISION } from './constants.js'; | ||
export { DepthTexture } from './textures/DepthTexture.js'; | ||
export { DepthArrayTexture } from './textures/DepthArrayTexture.js'; | ||
export { Texture } from './textures/Texture.js'; | ||
@@ -119,2 +120,3 @@ export * from './geometries/Geometries.js'; | ||
export { Frustum } from './math/Frustum.js'; | ||
export { FrustumArray } from './math/FrustumArray.js'; | ||
export { Sphere } from './math/Sphere.js'; | ||
@@ -121,0 +123,0 @@ export { Ray } from './math/Ray.js'; |
@@ -16,2 +16,3 @@ import { TSL } from 'three/webgpu'; | ||
export const If = TSL.If; | ||
export const Switch = TSL.Switch; | ||
export const Loop = TSL.Loop; | ||
@@ -134,2 +135,4 @@ export const NodeShaderStage = TSL.NodeShaderStage; | ||
export const debug = TSL.debug; | ||
export const decrement = TSL.decrement; | ||
export const decrementBefore = TSL.decrementBefore; | ||
export const defaultBuildStages = TSL.defaultBuildStages; | ||
@@ -188,2 +191,4 @@ export const defaultShaderStages = TSL.defaultShaderStages; | ||
export const getViewPosition = TSL.getViewPosition; | ||
export const getShadowMaterial = TSL.getShadowMaterial; | ||
export const getShadowRenderObjectFunction = TSL.getShadowRenderObjectFunction; | ||
export const glsl = TSL.glsl; | ||
@@ -198,2 +203,4 @@ export const glslFn = TSL.glslFn; | ||
export const hue = TSL.hue; | ||
export const increment = TSL.increment; | ||
export const incrementBefore = TSL.incrementBefore; | ||
export const instance = TSL.instance; | ||
@@ -224,2 +231,3 @@ export const instanceIndex = TSL.instanceIndex; | ||
export const lightPosition = TSL.lightPosition; | ||
export const lightShadowMatrix = TSL.lightShadowMatrix; | ||
export const lightTargetDirection = TSL.lightTargetDirection; | ||
@@ -226,0 +234,0 @@ export const lightTargetPosition = TSL.lightTargetPosition; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
30196755
0.85%1099
0.55%476735
1.18%14
7.69%