python-cad-tools 0.1.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_cad_tools/__init__.py +10 -0
- python_cad_tools/_locking.py +63 -0
- python_cad_tools/_project_loader.py +273 -0
- python_cad_tools/_project_state.py +65 -0
- python_cad_tools/_scaffold.py +66 -0
- python_cad_tools/_transaction.py +208 -0
- python_cad_tools/_viewer_static/app.webmanifest +18 -0
- python_cad_tools/_viewer_static/asset-manifest.json +1 -0
- python_cad_tools/_viewer_static/assets/animationGroup-Sd34ntWg.js +1 -0
- python_cad_tools/_viewer_static/assets/bakedVertexAnimation-Cd_pRdrn.js +316 -0
- python_cad_tools/_viewer_static/assets/basisTextureLoader-DWgvS_1G.js +1 -0
- python_cad_tools/_viewer_static/assets/brdfTextureTools-CWGiG1W2.js +2 -0
- python_cad_tools/_viewer_static/assets/bumpFragment-CWULheF1.js +127 -0
- python_cad_tools/_viewer_static/assets/bumpVertex-DqzFZayE.js +6 -0
- python_cad_tools/_viewer_static/assets/bumpVertexDeclaration-C5EFyTio.js +6 -0
- python_cad_tools/_viewer_static/assets/clipPlaneFragment-BXRtt4jj.js +46 -0
- python_cad_tools/_viewer_static/assets/clipPlaneVertex-B_VhD1oQ.js +37 -0
- python_cad_tools/_viewer_static/assets/cubemapToSphericalPolynomial-DRpaukza.js +1 -0
- python_cad_tools/_viewer_static/assets/dds-Dkb2Cx2N.js +1 -0
- python_cad_tools/_viewer_static/assets/dds.pure-DtvJsKvY.js +1 -0
- python_cad_tools/_viewer_static/assets/ddsTextureLoader-H78xux1g.js +1 -0
- python_cad_tools/_viewer_static/assets/default.fragment-oSQ-tWhe.js +469 -0
- python_cad_tools/_viewer_static/assets/default.vertex-DhFjw_Da.js +209 -0
- python_cad_tools/_viewer_static/assets/defaultUboDeclaration-BMDHNppx.js +5 -0
- python_cad_tools/_viewer_static/assets/dumpTools-BaNZPjUX.js +2 -0
- python_cad_tools/_viewer_static/assets/envTextureLoader-V0YnLcIM.js +1 -0
- python_cad_tools/_viewer_static/assets/exrTextureLoader-CjGyIK3x.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphApplyForceBlock-CW5nuobR.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphApplyImpulseBlock-LFqYIkhj.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphArrayIndexBlock-BMOHUbBm.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphBezierCurveEasingBlock-knmTiuEk.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphBinaryOperationBlock-DFLuCAKJ.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphBranchBlock-BJRHMXMo.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphCachedOperationBlock-Dng-6jE0.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphCancelDelayBlock-CgbK3CQZ.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphCodeExecutionBlock-8zMtq9tg.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphConditionalDataBlock-BiLr2rkI.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphConsoleLogBlock-J1vcCtNP.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphConstantBlock-CFb5nuaV.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphContextBlock-DAeGVzhC.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphCounterBlock-lZlAQiJd.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphDataSwitchBlock-BIzvmbVy.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphDebounceBlock-DvNuMVwy.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphDebugBlock-Dymd2VEE.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphDoNBlock-v68aoNLH.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphEasingBlock-CTnGv92q.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphFlipFlopBlock-DXsO0Chw.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphForLoopBlock-CPpe9T75.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphFunctionReferenceBlock-DjDev4Pq.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphGLTFDataProvider-GIYCz4AQ.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphGetAngularVelocityBlock-BStkOVeL.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphGetAssetBlock-Eiqoivbz.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphGetLinearVelocityBlock-B0cpV5ws.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphGetPhysicsMassPropertiesBlock-B-H64yaI.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphGetPropertyBlock-CUyOsPw0.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphGetSoundVolumeBlock-C0FjrsUz.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphGetVariableBlock-O4597zBl.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphIndexOfBlock-E00Z3KXM.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphInterpolationBlock-DnkA9MNH.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphIsKeyPressedBlock-DDfeuAyf.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphIsSoundPlayingBlock-DMXg8jdM.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphJsonPointerParserBlock-OmCorK0y.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphKeyDownEventBlock-RuVtj6g2.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphKeyUpEventBlock-DO4pAfHi.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphKeyboardEventBlock-Bx3pAzzh.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphMathBlocks-7W1XYOC8.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphMathCombineExtractBlocks-a4f0Kv6e.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphMatrixMathBlocks-C5Z-y1Au.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphMeshPickEventBlock-D4m-I4CS.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphMultiGateBlock-BISVSMw6.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPauseAnimationBlock-BYP2Z-HG.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPauseSoundBlock-Drh1EeW6.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPhysicsCollisionEventBlock-BoziAQ75.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPlayAnimationBlock-Clry-68M.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPlaySoundBlock-LbBVxGBE.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPointerDownEventBlock-DIVXCSHh.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPointerMoveEventBlock-BNNOzY2W.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPointerOutEventBlock-B8f2dOFT.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPointerOverEventBlock-CQr8LCee.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphPointerUpEventBlock-DMg_iEHl.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphReceiveCustomEventBlock-B8GJm9Ai.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSceneReadyEventBlock-Dcdb29K2.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSceneTickEventBlock-BLE5p4mi.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSendCustomEventBlock-BMzDItQ5.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSequenceBlock-DRURovjn.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSetAngularVelocityBlock-Ba8dhkLM.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSetDelayBlock-CnQR--Gn.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSetLinearVelocityBlock-Dm1r3vkh.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSetPhysicsMotionTypeBlock-BNtMLimi.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSetPropertyBlock-C-uv2jhP.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSetSoundVolumeBlock-D9LDx3lg.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSetVariableBlock-DszzRB5X.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSoundEndedEventBlock-DeTDSudb.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphStopAnimationBlock-DWuwoFWr.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphStopSoundBlock-DEnj2cQw.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphSwitchBlock-zs8Fp9ky.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphThrottleBlock-BYAKUQXd.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphTransformCoordinatesSystemBlock-DYP54m5P.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphTypeToTypeBlocks-vFwn79bS.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphUnaryOperationBlock-CaRh4Ef0.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphVectorMathBlocks-BEIhMs-A.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphWaitAllBlock-DFbELP_j.js +1 -0
- python_cad_tools/_viewer_static/assets/flowGraphWhileLoopBlock-C1OKQ-_F.js +1 -0
- python_cad_tools/_viewer_static/assets/fogFragment-DtDlQBnz.js +25 -0
- python_cad_tools/_viewer_static/assets/gaussianSplatting-Cfigjb15.js +242 -0
- python_cad_tools/_viewer_static/assets/gaussianSplatting-DIn8R8oF.js +296 -0
- python_cad_tools/_viewer_static/assets/gaussianSplatting.fragment-BxeRJ2k-.js +38 -0
- python_cad_tools/_viewer_static/assets/gaussianSplatting.fragment-DNDmvRs-.js +37 -0
- python_cad_tools/_viewer_static/assets/gaussianSplatting.vertex-D92z5jYn.js +86 -0
- python_cad_tools/_viewer_static/assets/gaussianSplatting.vertex-DSWfFnKQ.js +86 -0
- python_cad_tools/_viewer_static/assets/gaussianSplattingVoxel.fragment-DBQE2gDk.js +12 -0
- python_cad_tools/_viewer_static/assets/gaussianSplattingVoxel.fragment-qwx5ntqJ.js +17 -0
- python_cad_tools/_viewer_static/assets/gaussianSplattingVoxel.vertex-CP2kd3jU.js +30 -0
- python_cad_tools/_viewer_static/assets/gaussianSplattingVoxel.vertex-Dr-fEg_W.js +19 -0
- python_cad_tools/_viewer_static/assets/geometry.fragment-CsJIm2H0.js +242 -0
- python_cad_tools/_viewer_static/assets/geometry.fragment-Dph3muZt.js +262 -0
- python_cad_tools/_viewer_static/assets/geometry.vertex-BXGMTA_J.js +212 -0
- python_cad_tools/_viewer_static/assets/geometry.vertex-Bm9Wg3Gi.js +214 -0
- python_cad_tools/_viewer_static/assets/glowBlurPostProcess.fragment-BJSwKIJD.js +7 -0
- python_cad_tools/_viewer_static/assets/glowMapGeneration.fragment-DcyS1cTF.js +63 -0
- python_cad_tools/_viewer_static/assets/glowMapGeneration.vertex-BGq1Fakj.js +75 -0
- python_cad_tools/_viewer_static/assets/glowMapMerge.fragment-DxcneU_F.js +25 -0
- python_cad_tools/_viewer_static/assets/glowMapMerge.vertex-DaJJKqMV.js +8 -0
- python_cad_tools/_viewer_static/assets/harmonicsFunctions-DzJcvNWG.js +16 -0
- python_cad_tools/_viewer_static/assets/hdrTextureLoader-BGQvgh0h.js +2 -0
- python_cad_tools/_viewer_static/assets/helperFunctions-Cugfp1Fz.js +87 -0
- python_cad_tools/_viewer_static/assets/iesTextureLoader-CO4G0p2M.js +2 -0
- python_cad_tools/_viewer_static/assets/index-B2zBEWsq.js +7007 -0
- python_cad_tools/_viewer_static/assets/index-DcTTrc-8.css +1 -0
- python_cad_tools/_viewer_static/assets/kernelBlur.fragment-B6CTXTxY.js +57 -0
- python_cad_tools/_viewer_static/assets/kernelBlur.fragment-BkKbudbW.js +57 -0
- python_cad_tools/_viewer_static/assets/kernelBlur.vertex-BYwFU5IS.js +11 -0
- python_cad_tools/_viewer_static/assets/kernelBlur.vertex-D371zUfT.js +11 -0
- python_cad_tools/_viewer_static/assets/kernelBlurVaryingDeclaration-CgBGaCHg.js +1 -0
- python_cad_tools/_viewer_static/assets/kernelBlurVaryingDeclaration-YS8JpqdO.js +1 -0
- python_cad_tools/_viewer_static/assets/ktxTextureLoader-ncMSJTjl.js +1 -0
- python_cad_tools/_viewer_static/assets/lightFragment-skHiFbKB.js +398 -0
- python_cad_tools/_viewer_static/assets/logDepthDeclaration-BR8XRz9F.js +4 -0
- python_cad_tools/_viewer_static/assets/logDepthVertex-UKrhEIvg.js +14 -0
- python_cad_tools/_viewer_static/assets/mainUVVaryingDeclaration-BxQWGFcG.js +4 -0
- python_cad_tools/_viewer_static/assets/mesh.vertexData.functions-ayNlGC5K.js +1 -0
- python_cad_tools/_viewer_static/assets/meshUboDeclaration-BnX046aQ.js +4 -0
- python_cad_tools/_viewer_static/assets/oitFragment-CTMCOfNP.js +605 -0
- python_cad_tools/_viewer_static/assets/openpbr.fragment-DPJPqi6p.js +1530 -0
- python_cad_tools/_viewer_static/assets/openpbr.fragment-Dv6qTVVi.js +1384 -0
- python_cad_tools/_viewer_static/assets/openpbr.vertex-Bn2wrdGL.js +364 -0
- python_cad_tools/_viewer_static/assets/openpbr.vertex-CHESW3gB.js +251 -0
- python_cad_tools/_viewer_static/assets/openpbrMaterial.pure-BdK7VgO_.js +3 -0
- python_cad_tools/_viewer_static/assets/openpbrMaterialLoadingAdapter-Bm_AHDUN.js +4 -0
- python_cad_tools/_viewer_static/assets/openpbrTransmissionLayerData-BDa9qEoN.js +339 -0
- python_cad_tools/_viewer_static/assets/openpbrTransmissionLayerData-Ba_ly4LE.js +343 -0
- python_cad_tools/_viewer_static/assets/openpbrUboDeclaration-BY2lSH2C.js +5 -0
- python_cad_tools/_viewer_static/assets/openpbrUboDeclaration-DajhikDS.js +6 -0
- python_cad_tools/_viewer_static/assets/packingFunctions-BHPwcGG2.js +4 -0
- python_cad_tools/_viewer_static/assets/packingFunctions-DTwzBRBx.js +4 -0
- python_cad_tools/_viewer_static/assets/pass.fragment-9oKU4pI3.js +4 -0
- python_cad_tools/_viewer_static/assets/passCube.fragment-CpAeiYx1.js +23 -0
- python_cad_tools/_viewer_static/assets/passCube.fragment-DHtSWVRF.js +23 -0
- python_cad_tools/_viewer_static/assets/pbr.fragment-cIhMKwLs.js +2560 -0
- python_cad_tools/_viewer_static/assets/pbr.vertex-BfdONsf2.js +255 -0
- python_cad_tools/_viewer_static/assets/pbrBRDFFunctions-B_ppOzPO.js +173 -0
- python_cad_tools/_viewer_static/assets/pbrDebug-DDdwL5_t.js +693 -0
- python_cad_tools/_viewer_static/assets/pbrIBLFunctions-b1zdpzOP.js +43 -0
- python_cad_tools/_viewer_static/assets/pbrMaterial.pure-BZA7yVhu.js +2 -0
- python_cad_tools/_viewer_static/assets/pbrMaterialLoadingAdapter-BRvKRnjl.js +1 -0
- python_cad_tools/_viewer_static/assets/pbrUboDeclaration-CMZp25k3.js +5 -0
- python_cad_tools/_viewer_static/assets/postprocess.vertex-DzdUpNbW.js +9 -0
- python_cad_tools/_viewer_static/assets/procedural.vertex-BnbuQ-1f.js +7 -0
- python_cad_tools/_viewer_static/assets/procedural.vertex-Dp-Ng7Pc.js +8 -0
- python_cad_tools/_viewer_static/assets/reflectionFunction-DBlr3oDs.js +83 -0
- python_cad_tools/_viewer_static/assets/rgbdDecode.fragment-CyvnZFOJ.js +5 -0
- python_cad_tools/_viewer_static/assets/rgbdEncode.fragment-Dz4zLnoD.js +5 -0
- python_cad_tools/_viewer_static/assets/rgbdEncode.fragment-iscgpA1_.js +5 -0
- python_cad_tools/_viewer_static/assets/sceneUboDeclaration-BzFIc4mb.js +11 -0
- python_cad_tools/_viewer_static/assets/textureProcessor.fragment-C9D0rd-M.js +151 -0
- python_cad_tools/_viewer_static/assets/textureProcessor.fragment-JMKyWZng.js +146 -0
- python_cad_tools/_viewer_static/assets/tgaTextureLoader-oxTElIQJ.js +1 -0
- python_cad_tools/_viewer_static/assets/vertexColorMixing-mdC9xZe1.js +418 -0
- python_cad_tools/_viewer_static/favicon.svg +10 -0
- python_cad_tools/_viewer_static/index.html +18 -0
- python_cad_tools/_viewer_static/sw.js +61 -0
- python_cad_tools/artifacts.py +546 -0
- python_cad_tools/build-info.json +1 -0
- python_cad_tools/build.py +270 -0
- python_cad_tools/cli.py +212 -0
- python_cad_tools/context.py +67 -0
- python_cad_tools/determinism.py +66 -0
- python_cad_tools/drawings/__init__.py +124 -0
- python_cad_tools/drawings/_catalog.py +79 -0
- python_cad_tools/drawings/_validation.py +238 -0
- python_cad_tools/elements.py +121 -0
- python_cad_tools/exceptions.py +45 -0
- python_cad_tools/exporters/__init__.py +8 -0
- python_cad_tools/exporters/base.py +24 -0
- python_cad_tools/exporters/drawings/__init__.py +5 -0
- python_cad_tools/exporters/drawings/annotations.py +444 -0
- python_cad_tools/exporters/drawings/dxf.py +110 -0
- python_cad_tools/exporters/drawings/model.py +70 -0
- python_cad_tools/exporters/drawings/pdf.py +119 -0
- python_cad_tools/exporters/drawings/primitives.py +93 -0
- python_cad_tools/exporters/drawings/projection.py +64 -0
- python_cad_tools/exporters/drawings/svg.py +135 -0
- python_cad_tools/exporters/glb.py +100 -0
- python_cad_tools/exporters/ifc.py +229 -0
- python_cad_tools/exporters/quantities.py +136 -0
- python_cad_tools/exporters/step.py +117 -0
- python_cad_tools/geometry.py +187 -0
- python_cad_tools/manifests.py +338 -0
- python_cad_tools/project_config.py +174 -0
- python_cad_tools/py.typed +1 -0
- python_cad_tools/runtime_sync.py +126 -0
- python_cad_tools/schemas/build-manifest-1.json +1 -0
- python_cad_tools/schemas/design-manifest-1.json +1 -0
- python_cad_tools/schemas/download-manifest-2.json +46 -0
- python_cad_tools/schemas/drawing-annotations-1.json +66 -0
- python_cad_tools/schemas/glb-manifest-1.json +1 -0
- python_cad_tools/schemas/ifc-validation-1.json +1 -0
- python_cad_tools/schemas/quantities-1.json +1 -0
- python_cad_tools/schemas/run-metadata-1.json +1 -0
- python_cad_tools/schemas/site-metadata-1.json +34 -0
- python_cad_tools/schemas/step-validation-1.json +1 -0
- python_cad_tools/site.py +676 -0
- python_cad_tools/templates/project/.gitignore +9 -0
- python_cad_tools/templates/project/README.md +38 -0
- python_cad_tools/templates/project/config.py +36 -0
- python_cad_tools/templates/project/drawing_annotations.py +117 -0
- python_cad_tools/templates/project/model.py +87 -0
- python_cad_tools/templates/project/pyproject.toml +27 -0
- python_cad_tools/units.py +207 -0
- python_cad_tools/validation.py +153 -0
- python_cad_tools-0.1.0rc1.dist-info/METADATA +149 -0
- python_cad_tools-0.1.0rc1.dist-info/RECORD +236 -0
- python_cad_tools-0.1.0rc1.dist-info/WHEEL +5 -0
- python_cad_tools-0.1.0rc1.dist-info/entry_points.txt +2 -0
- python_cad_tools-0.1.0rc1.dist-info/licenses/LICENSE +679 -0
- python_cad_tools-0.1.0rc1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import{S as e}from"./index-B2zBEWsq.js";import{s as l}from"./sceneUboDeclaration-BzFIc4mb.js";import{m as s}from"./meshUboDeclaration-BnX046aQ.js";import{d as c}from"./defaultUboDeclaration-BMDHNppx.js";import{p as m,o as u,l as d,a as g,c as v,s as p,i as S,b as E,t as C,d as A,e as L}from"./oitFragment-CTMCOfNP.js";import{m as R}from"./mainUVVaryingDeclaration-BxQWGFcG.js";import{h as I}from"./helperFunctions-Cugfp1Fz.js";import{s as D,r as h}from"./reflectionFunction-DBlr3oDs.js";import{b as T,a as P,c as N}from"./bumpFragment-CWULheF1.js";import{c as _,a as O}from"./clipPlaneFragment-BXRtt4jj.js";import{l as F}from"./logDepthDeclaration-BR8XRz9F.js";import{f as M,l as b,a as W}from"./fogFragment-DtDlQBnz.js";import{d as x,l as G}from"./lightFragment-skHiFbKB.js";const i="lightsFragmentFunctions",f=`struct lightingInfo
|
|
2
|
+
{diffuse: vec3f,
|
|
3
|
+
#ifdef SPECULARTERM
|
|
4
|
+
specular: vec3f,
|
|
5
|
+
#endif
|
|
6
|
+
#ifdef NDOTL
|
|
7
|
+
ndl: f32,
|
|
8
|
+
#endif
|
|
9
|
+
};fn computeLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var result: lightingInfo;var lightVectorW: vec3f;var attenuation: f32=1.0;if (lightData.w==0.)
|
|
10
|
+
{var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}
|
|
11
|
+
else
|
|
12
|
+
{lightVectorW=normalize(-lightData.xyz);}
|
|
13
|
+
var ndl: f32=max(0.,dot(vNormal,lightVectorW));
|
|
14
|
+
#ifdef NDOTL
|
|
15
|
+
result.ndl=ndl;
|
|
16
|
+
#endif
|
|
17
|
+
result.diffuse=ndl*diffuseColor*attenuation;
|
|
18
|
+
#ifdef SPECULARTERM
|
|
19
|
+
var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
|
|
20
|
+
#endif
|
|
21
|
+
return result;}
|
|
22
|
+
fn getAttenuation(cosAngle: f32,exponent: f32)->f32 {return max(0.,pow(cosAngle,exponent));}
|
|
23
|
+
fn getIESAttenuation(cosAngle: f32,iesLightTexture: texture_2d<f32>,iesLightTextureSampler: sampler)->f32 {var angle=acos(cosAngle)/PI;return textureSampleLevel(iesLightTexture,iesLightTextureSampler,vec2f(angle,0),0.).r;}
|
|
24
|
+
fn computeBasicSpotLighting(viewDirectionW: vec3f,lightVectorW: vec3f,vNormal: vec3f,attenuation: f32,diffuseColor: vec3f,specularColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=max(0.,dot(vNormal,lightVectorW));
|
|
25
|
+
#ifdef NDOTL
|
|
26
|
+
result.ndl=ndl;
|
|
27
|
+
#endif
|
|
28
|
+
result.diffuse=ndl*diffuseColor*attenuation;
|
|
29
|
+
#ifdef SPECULARTERM
|
|
30
|
+
var angleW: vec3f=normalize(viewDirectionW+lightVectorW);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
|
|
31
|
+
#endif
|
|
32
|
+
return result;}
|
|
33
|
+
fn computeIESSpotLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32,iesLightTexture: texture_2d<f32>,iesLightTextureSampler: sampler)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var dotProduct=dot(lightDirection.xyz,-lightVectorW);var cosAngle: f32=max(0.,dotProduct);if (cosAngle>=lightDirection.w)
|
|
34
|
+
{attenuation*=getIESAttenuation(dotProduct,iesLightTexture,iesLightTextureSampler);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
|
|
35
|
+
var result: lightingInfo;result.diffuse=vec3f(0.);
|
|
36
|
+
#ifdef SPECULARTERM
|
|
37
|
+
result.specular=vec3f(0.);
|
|
38
|
+
#endif
|
|
39
|
+
#ifdef NDOTL
|
|
40
|
+
result.ndl=0.;
|
|
41
|
+
#endif
|
|
42
|
+
return result;}
|
|
43
|
+
fn computeSpotLighting(viewDirectionW: vec3f,vNormal: vec3f ,lightData: vec4f,lightDirection: vec4f,diffuseColor: vec3f,specularColor: vec3f,range: f32,glossiness: f32)->lightingInfo {var direction: vec3f=lightData.xyz-fragmentInputs.vPositionW;var lightVectorW: vec3f=normalize(direction);var attenuation: f32=max(0.,1.0-length(direction)/range);var cosAngle: f32=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)
|
|
44
|
+
{attenuation*=getAttenuation(cosAngle,lightData.w);return computeBasicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
|
|
45
|
+
var result: lightingInfo;result.diffuse=vec3f(0.);
|
|
46
|
+
#ifdef SPECULARTERM
|
|
47
|
+
result.specular=vec3f(0.);
|
|
48
|
+
#endif
|
|
49
|
+
#ifdef NDOTL
|
|
50
|
+
result.ndl=0.;
|
|
51
|
+
#endif
|
|
52
|
+
return result;}
|
|
53
|
+
fn computeHemisphericLighting(viewDirectionW: vec3f,vNormal: vec3f,lightData: vec4f,diffuseColor: vec3f,specularColor: vec3f,groundColor: vec3f,glossiness: f32)->lightingInfo {var result: lightingInfo;var ndl: f32=dot(vNormal,lightData.xyz)*0.5+0.5;
|
|
54
|
+
#ifdef NDOTL
|
|
55
|
+
result.ndl=ndl;
|
|
56
|
+
#endif
|
|
57
|
+
result.diffuse=mix(groundColor,diffuseColor,ndl);
|
|
58
|
+
#ifdef SPECULARTERM
|
|
59
|
+
var angleW: vec3f=normalize(viewDirectionW+lightData.xyz);var specComp: f32=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;
|
|
60
|
+
#endif
|
|
61
|
+
return result;}
|
|
62
|
+
fn computeProjectionTextureDiffuseLighting(projectionLightTexture: texture_2d<f32>,projectionLightSampler: sampler,textureProjectionMatrix: mat4x4f,posW: vec3f)->vec3f {var strq: vec4f=textureProjectionMatrix*vec4f(posW,1.0);strq/=strq.w;var textureColor: vec3f=textureSample(projectionLightTexture,projectionLightSampler,strq.xy).rgb;return textureColor;}
|
|
63
|
+
#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
|
|
64
|
+
#include<ltcHelperFunctions>
|
|
65
|
+
var areaLightsLTC1SamplerSampler: sampler;var areaLightsLTC1Sampler: texture_2d<f32>;var areaLightsLTC2SamplerSampler: sampler;var areaLightsLTC2Sampler: texture_2d<f32>;fn computeAreaLighting(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightPosition:vec3f,halfWidth:vec3f, halfHeight:vec3f,diffuseColor:vec3f,specularColor:vec3f,roughness:f32 )->lightingInfo
|
|
66
|
+
{var result: lightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc1Sampler,ltc2,ltc2Sampler,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
|
|
67
|
+
#ifdef SPECULARTERM
|
|
68
|
+
var fresnel:vec3f=( specularColor*data.Fresnel.x+( vec3f( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
|
|
69
|
+
#endif
|
|
70
|
+
result.diffuse+=diffuseColor*data.Diffuse;return result;}
|
|
71
|
+
fn computeAreaLightingWithTexture(ltc1: texture_2d<f32>,ltc1Sampler:sampler,ltc2:texture_2d<f32>,ltc2Sampler:sampler,emissionTexture: texture_2d<f32>,emissionTextureSampler:sampler,viewDirectionW: vec3f,vNormal:vec3f,vPosition:vec3f,lightPosition:vec3f,halfWidth:vec3f, halfHeight:vec3f,diffuseColor:vec3f,specularColor:vec3f,roughness:f32 )->lightingInfo
|
|
72
|
+
{var result: lightingInfo;var data: areaLightData=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc1Sampler,ltc2,ltc2Sampler,emissionTexture,emissionTextureSampler,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
|
|
73
|
+
#ifdef SPECULARTERM
|
|
74
|
+
var fresnel: vec3f=( specularColor*data.Fresnel.x+( vec3f( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
|
|
75
|
+
#endif
|
|
76
|
+
result.diffuse+=diffuseColor*data.Diffuse;return result;}
|
|
77
|
+
#endif
|
|
78
|
+
#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
|
|
79
|
+
#include<clusteredLightingFunctions>
|
|
80
|
+
fn computeClusteredLighting(
|
|
81
|
+
lightDataTexture: texture_2d<f32>,
|
|
82
|
+
tileMaskBuffer: ptr<storage,array<u32>>,
|
|
83
|
+
viewDirectionW: vec3f,
|
|
84
|
+
vNormal: vec3f,
|
|
85
|
+
lightData: vec4f,
|
|
86
|
+
sliceRange: vec2u,
|
|
87
|
+
glossiness: f32
|
|
88
|
+
)->lightingInfo {var result: lightingInfo;let tilePosition=vec2u(fragmentInputs.position.xy*lightData.xy);let maskResolution=vec2u(lightData.zw);var tileIndex=(tilePosition.x*maskResolution.x+tilePosition.y)*maskResolution.y;let batchRange=sliceRange/CLUSTLIGHT_BATCH;var batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tileIndex+=batchRange.x;for (var i=batchRange.x; i<=batchRange.y; i+=1) {var mask=tileMaskBuffer[tileIndex];tileIndex+=1;let maskOffset=max(sliceRange.x,batchOffset)-batchOffset;
|
|
89
|
+
let maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while mask != 0 {let trailing=firstTrailingBit(mask);mask ^= 1u<<trailing;let light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+trailing);var info: lightingInfo;if light.vLightDirection.w<0.0 {info=computeLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);} else {info=computeSpotLighting(viewDirectionW,vNormal,light.vLightData,light.vLightDirection,light.vLightDiffuse.rgb,light.vLightSpecular.rgb,light.vLightDiffuse.a,glossiness);}
|
|
90
|
+
result.diffuse+=info.diffuse;
|
|
91
|
+
#ifdef SPECULARTERM
|
|
92
|
+
result.specular+=info.specular;
|
|
93
|
+
#endif
|
|
94
|
+
}
|
|
95
|
+
batchOffset+=CLUSTLIGHT_BATCH;}
|
|
96
|
+
return result;}
|
|
97
|
+
#endif
|
|
98
|
+
`;e.IncludesShadersStoreWGSL[i]||(e.IncludesShadersStoreWGSL[i]=f);const y={name:i,shader:f},o="fresnelFunction",a=`#ifdef FRESNEL
|
|
99
|
+
fn computeFresnelTerm(viewDirection: vec3f,worldNormal: vec3f,bias: f32,power: f32)->f32
|
|
100
|
+
{let fresnelTerm: f32=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}
|
|
101
|
+
#endif
|
|
102
|
+
`;e.IncludesShadersStoreWGSL[o]||(e.IncludesShadersStoreWGSL[o]=a);const U={name:o,shader:a},t="defaultPixelShader",n=`#include<defaultUboDeclaration>
|
|
103
|
+
#include<prePassDeclaration>[SCENE_MRT_COUNT]
|
|
104
|
+
#include<oitDeclaration>
|
|
105
|
+
#define CUSTOM_FRAGMENT_BEGIN
|
|
106
|
+
varying vPositionW: vec3f;
|
|
107
|
+
#ifdef NORMAL
|
|
108
|
+
varying vNormalW: vec3f;
|
|
109
|
+
#endif
|
|
110
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
111
|
+
varying vColor: vec4f;
|
|
112
|
+
#endif
|
|
113
|
+
#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
|
|
114
|
+
varying vViewDepth: f32;
|
|
115
|
+
#endif
|
|
116
|
+
#include<mainUVVaryingDeclaration>[1..7]
|
|
117
|
+
#include<helperFunctions>
|
|
118
|
+
#include<lightUboDeclaration>[0..maxSimultaneousLights]
|
|
119
|
+
#include<lightsFragmentFunctions>
|
|
120
|
+
#include<shadowsFragmentFunctions>
|
|
121
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)
|
|
122
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)
|
|
123
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)
|
|
124
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)
|
|
125
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)
|
|
126
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)
|
|
127
|
+
#ifdef REFRACTION
|
|
128
|
+
#ifdef REFRACTIONMAP_3D
|
|
129
|
+
var refractionCubeSamplerSampler: sampler;var refractionCubeSampler: texture_cube<f32>;
|
|
130
|
+
#else
|
|
131
|
+
var refraction2DSamplerSampler: sampler;var refraction2DSampler: texture_2d<f32>;
|
|
132
|
+
#endif
|
|
133
|
+
#endif
|
|
134
|
+
#if defined(SPECULARTERM)
|
|
135
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)
|
|
136
|
+
#endif
|
|
137
|
+
#include<fresnelFunction>
|
|
138
|
+
#ifdef REFLECTION
|
|
139
|
+
#ifdef REFLECTIONMAP_3D
|
|
140
|
+
var reflectionCubeSamplerSampler: sampler;var reflectionCubeSampler: texture_cube<f32>;
|
|
141
|
+
#else
|
|
142
|
+
var reflection2DSamplerSampler: sampler;var reflection2DSampler: texture_2d<f32>;
|
|
143
|
+
#endif
|
|
144
|
+
#ifdef REFLECTIONMAP_SKYBOX
|
|
145
|
+
varying vPositionUVW: vec3f;
|
|
146
|
+
#else
|
|
147
|
+
#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
|
|
148
|
+
varying vDirectionW: vec3f;
|
|
149
|
+
#endif
|
|
150
|
+
#endif
|
|
151
|
+
#include<reflectionFunction>
|
|
152
|
+
#endif
|
|
153
|
+
#include<imageProcessingDeclaration>
|
|
154
|
+
#include<imageProcessingFunctions>
|
|
155
|
+
#include<textureRepetitionFunctions>
|
|
156
|
+
#include<bumpFragmentMainFunctions>
|
|
157
|
+
#include<bumpFragmentFunctions>
|
|
158
|
+
#include<clipPlaneFragmentDeclaration>
|
|
159
|
+
#include<logDepthDeclaration>
|
|
160
|
+
#include<fogFragmentDeclaration>
|
|
161
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
162
|
+
@fragment
|
|
163
|
+
fn main(input: FragmentInputs)->FragmentOutputs {
|
|
164
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
165
|
+
#include<clipPlaneFragment>
|
|
166
|
+
var viewDirectionW: vec3f=normalize(scene.vEyePosition.xyz-fragmentInputs.vPositionW);var baseColor: vec4f= vec4f(1.,1.,1.,1.);var diffuseColor: vec3f=uniforms.vDiffuseColor.rgb;var alpha: f32=uniforms.vDiffuseColor.a;
|
|
167
|
+
#ifdef NORMAL
|
|
168
|
+
var normalW: vec3f=normalize(fragmentInputs.vNormalW);
|
|
169
|
+
#else
|
|
170
|
+
var normalW: vec3f=normalize(cross(dpdx(fragmentInputs.vPositionW),dpdy(fragmentInputs.vPositionW)))* scene.vEyePosition.w;
|
|
171
|
+
#endif
|
|
172
|
+
#include<bumpFragment>
|
|
173
|
+
#ifdef TWOSIDEDLIGHTING
|
|
174
|
+
normalW=select(-normalW,normalW,fragmentInputs.frontFacing);
|
|
175
|
+
#endif
|
|
176
|
+
#ifdef DIFFUSE
|
|
177
|
+
baseColor=TEXRD(diffuseSampler,diffuseSamplerSampler,fragmentInputs.vDiffuseUV+uvOffset);
|
|
178
|
+
#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)
|
|
179
|
+
if (baseColor.a<uniforms.alphaCutOff) {discard;}
|
|
180
|
+
#endif
|
|
181
|
+
#ifdef ALPHAFROMDIFFUSE
|
|
182
|
+
alpha*=baseColor.a;
|
|
183
|
+
#endif
|
|
184
|
+
#define CUSTOM_FRAGMENT_UPDATE_ALPHA
|
|
185
|
+
baseColor=vec4f(baseColor.rgb*uniforms.vDiffuseInfos.y,baseColor.a);
|
|
186
|
+
#endif
|
|
187
|
+
#if defined(DECAL) && !defined(DECAL_AFTER_DETAIL)
|
|
188
|
+
var decalColor: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset);
|
|
189
|
+
#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)
|
|
190
|
+
#endif
|
|
191
|
+
#include<depthPrePass>
|
|
192
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
193
|
+
baseColor=vec4f(baseColor.rgb*fragmentInputs.vColor.rgb,baseColor.a);
|
|
194
|
+
#endif
|
|
195
|
+
#ifdef DETAIL
|
|
196
|
+
baseColor=vec4f(baseColor.rgb*2.0*mix(0.5,detailColor.r,uniforms.vDetailInfos.y),baseColor.a);
|
|
197
|
+
#endif
|
|
198
|
+
#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)
|
|
199
|
+
var decalColor: vec4f=textureSample(decalSampler,decalSamplerSampler,fragmentInputs.vDecalUV+uvOffset);
|
|
200
|
+
#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)
|
|
201
|
+
#endif
|
|
202
|
+
#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE
|
|
203
|
+
var baseAmbientColor: vec3f= vec3f(1.,1.,1.);
|
|
204
|
+
#ifdef AMBIENT
|
|
205
|
+
baseAmbientColor=TEXRD(ambientSampler,ambientSamplerSampler,fragmentInputs.vAmbientUV+uvOffset).rgb*uniforms.vAmbientInfos.y;
|
|
206
|
+
#endif
|
|
207
|
+
#define CUSTOM_FRAGMENT_BEFORE_LIGHTS
|
|
208
|
+
var glossiness: f32=uniforms.vSpecularColor.a;var specularColor: vec3f=uniforms.vSpecularColor.rgb;
|
|
209
|
+
#ifdef SPECULARTERM
|
|
210
|
+
#ifdef SPECULAR
|
|
211
|
+
var specularMapColor: vec4f=TEXRD(specularSampler,specularSamplerSampler,fragmentInputs.vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;
|
|
212
|
+
#ifdef GLOSSINESS
|
|
213
|
+
glossiness=glossiness*specularMapColor.a;
|
|
214
|
+
#endif
|
|
215
|
+
#endif
|
|
216
|
+
#endif
|
|
217
|
+
var diffuseBase: vec3f= vec3f(0.,0.,0.);var info: lightingInfo;
|
|
218
|
+
#ifdef SPECULARTERM
|
|
219
|
+
var specularBase: vec3f= vec3f(0.,0.,0.);
|
|
220
|
+
#endif
|
|
221
|
+
var shadow: f32=1.;var aggShadow: f32=0.;var numLights: f32=0.;
|
|
222
|
+
#ifdef LIGHTMAP
|
|
223
|
+
var lightmapColor: vec4f=TEXRD(lightmapSampler,lightmapSamplerSampler,fragmentInputs.vLightmapUV+uvOffset);
|
|
224
|
+
#ifdef RGBDLIGHTMAP
|
|
225
|
+
lightmapColor=vec4f(fromRGBD(lightmapColor),lightmapColor.a);
|
|
226
|
+
#endif
|
|
227
|
+
lightmapColor=vec4f(lightmapColor.rgb*uniforms.vLightmapInfos.y,lightmapColor.a);
|
|
228
|
+
#endif
|
|
229
|
+
#include<lightFragment>[0..maxSimultaneousLights]
|
|
230
|
+
aggShadow=aggShadow/numLights;var refractionColor: vec4f= vec4f(0.,0.,0.,1.);
|
|
231
|
+
#ifdef REFRACTION
|
|
232
|
+
var refractionVector: vec3f=normalize(refract(-viewDirectionW,normalW,uniforms.vRefractionInfos.y));
|
|
233
|
+
#ifdef REFRACTIONMAP_3D
|
|
234
|
+
#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC
|
|
235
|
+
refractionVector=parallaxCorrectNormal(fragmentInputs.vPositionW,refractionVector,uniforms.vRefractionSize,uniforms.vRefractionPosition);
|
|
236
|
+
#endif
|
|
237
|
+
refractionVector.y=refractionVector.y*uniforms.vRefractionInfos.w;var refractionLookup: vec4f=textureSample(refractionCubeSampler,refractionCubeSamplerSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}
|
|
238
|
+
#else
|
|
239
|
+
var vRefractionUVW: vec3f= (uniforms.refractionMatrix*(scene.view* vec4f(fragmentInputs.vPositionW+refractionVector*uniforms.vRefractionInfos.z,1.0))).xyz;var refractionCoords: vec2f=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=textureSample(refraction2DSampler,refraction2DSamplerSampler,refractionCoords);
|
|
240
|
+
#endif
|
|
241
|
+
#ifdef RGBDREFRACTION
|
|
242
|
+
refractionColor=vec4f(fromRGBD(refractionColor),refractionColor.a);
|
|
243
|
+
#endif
|
|
244
|
+
#ifdef IS_REFRACTION_LINEAR
|
|
245
|
+
refractionColor=vec4f(toGammaSpaceVec3(refractionColor.rgb),refractionColor.a);
|
|
246
|
+
#endif
|
|
247
|
+
refractionColor=vec4f(refractionColor.rgb*uniforms.vRefractionInfos.x,refractionColor.a);
|
|
248
|
+
#endif
|
|
249
|
+
var reflectionColor: vec4f= vec4f(0.,0.,0.,1.);
|
|
250
|
+
#ifdef REFLECTION
|
|
251
|
+
var vReflectionUVW: vec3f=computeReflectionCoords( vec4f(fragmentInputs.vPositionW,1.0),normalW);
|
|
252
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
253
|
+
vReflectionUVW=vec3f(vReflectionUVW.x,vReflectionUVW.y,vReflectionUVW.z*-1.0);
|
|
254
|
+
#endif
|
|
255
|
+
#ifdef REFLECTIONMAP_3D
|
|
256
|
+
#ifdef ROUGHNESS
|
|
257
|
+
var bias: f32=uniforms.vReflectionInfos.y;
|
|
258
|
+
#ifdef SPECULARTERM
|
|
259
|
+
#ifdef SPECULAR
|
|
260
|
+
#ifdef GLOSSINESS
|
|
261
|
+
bias*=(1.0-specularMapColor.a);
|
|
262
|
+
#endif
|
|
263
|
+
#endif
|
|
264
|
+
#endif
|
|
265
|
+
reflectionColor=textureSampleLevel(reflectionCubeSampler,reflectionCubeSamplerSampler,vReflectionUVW,bias);
|
|
266
|
+
#else
|
|
267
|
+
reflectionColor=textureSample(reflectionCubeSampler,reflectionCubeSamplerSampler,vReflectionUVW);
|
|
268
|
+
#endif
|
|
269
|
+
#else
|
|
270
|
+
var coords: vec2f=vReflectionUVW.xy;
|
|
271
|
+
#ifdef REFLECTIONMAP_PROJECTION
|
|
272
|
+
coords/=vReflectionUVW.z;
|
|
273
|
+
#endif
|
|
274
|
+
coords.y=1.0-coords.y;reflectionColor=textureSample(reflection2DSampler,reflection2DSamplerSampler,coords);
|
|
275
|
+
#endif
|
|
276
|
+
#ifdef RGBDREFLECTION
|
|
277
|
+
reflectionColor=vec4f(fromRGBD(reflectionColor),reflectionColor.a);
|
|
278
|
+
#endif
|
|
279
|
+
#ifdef IS_REFLECTION_LINEAR
|
|
280
|
+
reflectionColor=vec4f(toGammaSpaceVec3(reflectionColor.rgb),reflectionColor.a);
|
|
281
|
+
#endif
|
|
282
|
+
reflectionColor=vec4f(reflectionColor.rgb*uniforms.vReflectionInfos.x,reflectionColor.a);
|
|
283
|
+
#ifdef REFLECTIONFRESNEL
|
|
284
|
+
var reflectionFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.reflectionRightColor.a,uniforms.reflectionLeftColor.a);
|
|
285
|
+
#ifdef REFLECTIONFRESNELFROMSPECULAR
|
|
286
|
+
#ifdef SPECULARTERM
|
|
287
|
+
reflectionColor=vec4f(reflectionColor.rgb*specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a);
|
|
288
|
+
#else
|
|
289
|
+
reflectionColor=vec4f(reflectionColor.rgb*uniforms.reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a);
|
|
290
|
+
#endif
|
|
291
|
+
#else
|
|
292
|
+
reflectionColor=vec4f(reflectionColor.rgb*uniforms.reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*uniforms.reflectionRightColor.rgb,reflectionColor.a);
|
|
293
|
+
#endif
|
|
294
|
+
#endif
|
|
295
|
+
#endif
|
|
296
|
+
#ifdef REFRACTIONFRESNEL
|
|
297
|
+
var refractionFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.refractionRightColor.a,uniforms.refractionLeftColor.a);refractionColor=vec4f(refractionColor.rgb*uniforms.refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*uniforms.refractionRightColor.rgb,refractionColor.a);
|
|
298
|
+
#endif
|
|
299
|
+
#ifdef OPACITY
|
|
300
|
+
var opacityMap: vec4f=TEXRD(opacitySampler,opacitySamplerSampler,fragmentInputs.vOpacityUV+uvOffset);
|
|
301
|
+
#ifdef OPACITYRGB
|
|
302
|
+
opacityMap=vec4f(opacityMap.rgb* vec3f(0.3,0.59,0.11),opacityMap.a);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* uniforms.vOpacityInfos.y;
|
|
303
|
+
#else
|
|
304
|
+
alpha*=opacityMap.a*uniforms.vOpacityInfos.y;
|
|
305
|
+
#endif
|
|
306
|
+
#endif
|
|
307
|
+
#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
308
|
+
alpha*=fragmentInputs.vColor.a;
|
|
309
|
+
#endif
|
|
310
|
+
#ifdef OPACITYFRESNEL
|
|
311
|
+
var opacityFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.opacityParts.z,uniforms.opacityParts.w);alpha+=uniforms.opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*uniforms.opacityParts.y;
|
|
312
|
+
#endif
|
|
313
|
+
#ifdef ALPHATEST
|
|
314
|
+
#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS
|
|
315
|
+
if (alpha<uniforms.alphaCutOff) {discard;}
|
|
316
|
+
#endif
|
|
317
|
+
#ifndef ALPHABLEND
|
|
318
|
+
alpha=1.0;
|
|
319
|
+
#endif
|
|
320
|
+
#endif
|
|
321
|
+
var emissiveColor: vec3f=uniforms.vEmissiveColor;
|
|
322
|
+
#ifdef EMISSIVE
|
|
323
|
+
emissiveColor+=TEXRD(emissiveSampler,emissiveSamplerSampler,fragmentInputs.vEmissiveUV+uvOffset).rgb*uniforms.vEmissiveInfos.y;
|
|
324
|
+
#endif
|
|
325
|
+
#ifdef EMISSIVEFRESNEL
|
|
326
|
+
var emissiveFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.emissiveRightColor.a,uniforms.emissiveLeftColor.a);emissiveColor*=uniforms.emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*uniforms.emissiveRightColor.rgb;
|
|
327
|
+
#endif
|
|
328
|
+
#ifdef DIFFUSEFRESNEL
|
|
329
|
+
var diffuseFresnelTerm: f32=computeFresnelTerm(viewDirectionW,normalW,uniforms.diffuseRightColor.a,uniforms.diffuseLeftColor.a);diffuseBase*=uniforms.diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*uniforms.diffuseRightColor.rgb;
|
|
330
|
+
#endif
|
|
331
|
+
#ifdef EMISSIVEASILLUMINATION
|
|
332
|
+
var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor+uniforms.vAmbientColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;
|
|
333
|
+
#else
|
|
334
|
+
#ifdef LINKEMISSIVEWITHDIFFUSE
|
|
335
|
+
var finalDiffuse: vec3f=clamp((diffuseBase+emissiveColor)*diffuseColor+uniforms.vAmbientColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;
|
|
336
|
+
#else
|
|
337
|
+
var finalDiffuse: vec3f=clamp(diffuseBase*diffuseColor+emissiveColor+uniforms.vAmbientColor,vec3f(0.0),vec3f(1.0))*baseColor.rgb;
|
|
338
|
+
#endif
|
|
339
|
+
#endif
|
|
340
|
+
#ifdef SPECULARTERM
|
|
341
|
+
var finalSpecular: vec3f=specularBase*specularColor;
|
|
342
|
+
#ifdef SPECULAROVERALPHA
|
|
343
|
+
alpha=clamp(alpha+dot(finalSpecular, vec3f(0.3,0.59,0.11)),0.0,1.0);
|
|
344
|
+
#endif
|
|
345
|
+
#else
|
|
346
|
+
var finalSpecular: vec3f= vec3f(0.0);
|
|
347
|
+
#endif
|
|
348
|
+
#ifdef REFLECTIONOVERALPHA
|
|
349
|
+
alpha=clamp(alpha+dot(reflectionColor.rgb, vec3f(0.3,0.59,0.11)),0.0,1.0);
|
|
350
|
+
#endif
|
|
351
|
+
#ifdef EMISSIVEASILLUMINATION
|
|
352
|
+
var color: vec4f= vec4f(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+emissiveColor+refractionColor.rgb,vec3f(0.0),vec3f(1.0)),alpha);
|
|
353
|
+
#else
|
|
354
|
+
var color: vec4f= vec4f(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+refractionColor.rgb,alpha);
|
|
355
|
+
#endif
|
|
356
|
+
#ifdef LIGHTMAP
|
|
357
|
+
#ifndef LIGHTMAPEXCLUDED
|
|
358
|
+
#ifdef USELIGHTMAPASSHADOWMAP
|
|
359
|
+
color=vec4f(color.rgb*lightmapColor.rgb,color.a);
|
|
360
|
+
#else
|
|
361
|
+
color=vec4f(color.rgb+lightmapColor.rgb,color.a);
|
|
362
|
+
#endif
|
|
363
|
+
#endif
|
|
364
|
+
#endif
|
|
365
|
+
#define CUSTOM_FRAGMENT_BEFORE_FOG
|
|
366
|
+
color=vec4f(max(color.rgb,vec3f(0.)),color.a);
|
|
367
|
+
#include<logDepthFragment>
|
|
368
|
+
#include<fogFragment>
|
|
369
|
+
#ifdef IMAGEPROCESSINGPOSTPROCESS
|
|
370
|
+
color=vec4f(toLinearSpaceVec3(color.rgb),color.a);
|
|
371
|
+
#else
|
|
372
|
+
#ifdef IMAGEPROCESSING
|
|
373
|
+
color=vec4f(toLinearSpaceVec3(color.rgb),color.a);color=applyImageProcessing(color);
|
|
374
|
+
#endif
|
|
375
|
+
#endif
|
|
376
|
+
color=vec4f(color.rgb,color.a*mesh.visibility);
|
|
377
|
+
#ifdef PREMULTIPLYALPHA
|
|
378
|
+
color=vec4f(color.rgb*color.a, color.a);
|
|
379
|
+
#endif
|
|
380
|
+
#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
|
|
381
|
+
#ifdef PREPASS
|
|
382
|
+
#if SCENE_MRT_COUNT>0
|
|
383
|
+
var writeGeometryInfo: f32=select(0.0,1.0,color.a>0.4);var fragData: array<vec4<f32>,SCENE_MRT_COUNT>;
|
|
384
|
+
#ifdef PREPASS_COLOR
|
|
385
|
+
fragData[PREPASS_COLOR_INDEX]=color;
|
|
386
|
+
#endif
|
|
387
|
+
#ifdef PREPASS_POSITION
|
|
388
|
+
fragData[PREPASS_POSITION_INDEX]=vec4f(fragmentInputs.vPositionW,writeGeometryInfo);
|
|
389
|
+
#endif
|
|
390
|
+
#ifdef PREPASS_LOCAL_POSITION
|
|
391
|
+
fragData[PREPASS_LOCAL_POSITION_INDEX]=vec4f(fragmentInputs.vPosition,writeGeometryInfo);
|
|
392
|
+
#endif
|
|
393
|
+
#ifdef PREPASS_VELOCITY
|
|
394
|
+
var a: vec2f=(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w)*0.5+0.5;var b: vec2f=(fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w)*0.5+0.5;var velocity: vec2f=abs(a-b);velocity= vec2f(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;fragData[PREPASS_VELOCITY_INDEX]= vec4f(velocity,0.0,writeGeometryInfo);
|
|
395
|
+
#elif defined(PREPASS_VELOCITY_LINEAR)
|
|
396
|
+
var velocity : vec2f=vec2f(0.5)*((fragmentInputs.vPreviousPosition.xy/fragmentInputs.vPreviousPosition.w) -
|
|
397
|
+
(fragmentInputs.vCurrentPosition.xy/fragmentInputs.vCurrentPosition.w));fragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4f(velocity,0.0,writeGeometryInfo);
|
|
398
|
+
#endif
|
|
399
|
+
#ifdef PREPASS_IRRADIANCE
|
|
400
|
+
fragData[PREPASS_IRRADIANCE_INDEX]=vec4f(0.0,0.0,0.0,writeGeometryInfo);
|
|
401
|
+
#endif
|
|
402
|
+
#ifdef PREPASS_DEPTH
|
|
403
|
+
fragData[PREPASS_DEPTH_INDEX]=vec4f(fragmentInputs.vViewPos.z,0.0,0.0,writeGeometryInfo);
|
|
404
|
+
#endif
|
|
405
|
+
#ifdef PREPASS_SCREENSPACE_DEPTH
|
|
406
|
+
fragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4f(fragmentInputs.position.z,0.0,0.0,writeGeometryInfo);
|
|
407
|
+
#endif
|
|
408
|
+
#ifdef PREPASS_NORMALIZED_VIEW_DEPTH
|
|
409
|
+
fragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4f(fragmentInputs.vNormViewDepth,0.0,0.0,writeGeometryInfo);
|
|
410
|
+
#endif
|
|
411
|
+
#ifdef PREPASS_NORMAL
|
|
412
|
+
#ifdef PREPASS_NORMAL_WORLDSPACE
|
|
413
|
+
fragData[PREPASS_NORMAL_INDEX]=vec4f(normalW,writeGeometryInfo);
|
|
414
|
+
#else
|
|
415
|
+
fragData[PREPASS_NORMAL_INDEX]=vec4f(normalize((scene.view*vec4f(normalW,0.0)).rgb),writeGeometryInfo);
|
|
416
|
+
#endif
|
|
417
|
+
#endif
|
|
418
|
+
#ifdef PREPASS_WORLD_NORMAL
|
|
419
|
+
fragData[PREPASS_WORLD_NORMAL_INDEX]=vec4f(normalW*0.5+0.5,writeGeometryInfo);
|
|
420
|
+
#endif
|
|
421
|
+
#ifdef PREPASS_ALBEDO
|
|
422
|
+
fragData[PREPASS_ALBEDO_INDEX]=vec4f(baseColor.rgb,writeGeometryInfo);
|
|
423
|
+
#endif
|
|
424
|
+
#ifdef PREPASS_ALBEDO_SQRT
|
|
425
|
+
fragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4f(sqrt(baseColor.rgb),writeGeometryInfo);
|
|
426
|
+
#endif
|
|
427
|
+
#ifdef PREPASS_REFLECTIVITY
|
|
428
|
+
#if defined(SPECULAR)
|
|
429
|
+
fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(toLinearSpaceVec4(specularMapColor))*writeGeometryInfo;
|
|
430
|
+
#else
|
|
431
|
+
fragData[PREPASS_REFLECTIVITY_INDEX]=vec4f(toLinearSpaceVec3(specularColor),1.0)*writeGeometryInfo;
|
|
432
|
+
#endif
|
|
433
|
+
#endif
|
|
434
|
+
#if SCENE_MRT_COUNT>0
|
|
435
|
+
fragmentOutputs.fragData0=fragData[0];
|
|
436
|
+
#endif
|
|
437
|
+
#if SCENE_MRT_COUNT>1
|
|
438
|
+
fragmentOutputs.fragData1=fragData[1];
|
|
439
|
+
#endif
|
|
440
|
+
#if SCENE_MRT_COUNT>2
|
|
441
|
+
fragmentOutputs.fragData2=fragData[2];
|
|
442
|
+
#endif
|
|
443
|
+
#if SCENE_MRT_COUNT>3
|
|
444
|
+
fragmentOutputs.fragData3=fragData[3];
|
|
445
|
+
#endif
|
|
446
|
+
#if SCENE_MRT_COUNT>4
|
|
447
|
+
fragmentOutputs.fragData4=fragData[4];
|
|
448
|
+
#endif
|
|
449
|
+
#if SCENE_MRT_COUNT>5
|
|
450
|
+
fragmentOutputs.fragData5=fragData[5];
|
|
451
|
+
#endif
|
|
452
|
+
#if SCENE_MRT_COUNT>6
|
|
453
|
+
fragmentOutputs.fragData6=fragData[6];
|
|
454
|
+
#endif
|
|
455
|
+
#if SCENE_MRT_COUNT>7
|
|
456
|
+
fragmentOutputs.fragData7=fragData[7];
|
|
457
|
+
#endif
|
|
458
|
+
#endif
|
|
459
|
+
#endif
|
|
460
|
+
#if !defined(PREPASS) && !defined(ORDER_INDEPENDENT_TRANSPARENCY)
|
|
461
|
+
fragmentOutputs.color=color;
|
|
462
|
+
#endif
|
|
463
|
+
#include<oitFragment>
|
|
464
|
+
#if ORDER_INDEPENDENT_TRANSPARENCY
|
|
465
|
+
if (fragDepth==nearestDepth) {fragmentOutputs.frontColor=vec4f(fragmentOutputs.frontColor.rgb+color.rgb*color.a*alphaMultiplier,1.0-alphaMultiplier*(1.0-color.a));} else {fragmentOutputs.backColor+=color;}
|
|
466
|
+
#endif
|
|
467
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
468
|
+
}
|
|
469
|
+
`;e.ShadersStoreWGSL[t]||(e.ShadersStoreWGSL[t]=n);const V=[l,s,c,m,u,R,I,d,g,v,y,p,D,U,h,S,E,C,T,P,_,F,M,O,N,x,A,G,b,W,L];for(const r of V)e.IncludesShadersStoreWGSL[r.name]||(e.IncludesShadersStoreWGSL[r.name]=r.shader);const J={name:t,shader:n};export{J as defaultPixelShaderWGSL};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import{S as e}from"./index-B2zBEWsq.js";import{s as o}from"./sceneUboDeclaration-BzFIc4mb.js";import{m as d}from"./meshUboDeclaration-BnX046aQ.js";import{d as f}from"./defaultUboDeclaration-BMDHNppx.js";import{u as l,p as s,s as c,l as E,v,a as m,b as u,c as p,d as I,e as _,f as A}from"./vertexColorMixing-mdC9xZe1.js";import{h as N}from"./helperFunctions-Cugfp1Fz.js";import{b as x,a as S,i as V,m as M,c as L,d as D,e as T,f as R,g as G,h as U}from"./bakedVertexAnimation-Cd_pRdrn.js";import{m as W}from"./mainUVVaryingDeclaration-BxQWGFcG.js";import{b as O}from"./bumpVertexDeclaration-C5EFyTio.js";import{c as g,a as h}from"./clipPlaneVertex-B_VhD1oQ.js";import{f as P,a as C,l as X}from"./logDepthVertex-UKrhEIvg.js";import{l as F}from"./logDepthDeclaration-BR8XRz9F.js";import{b}from"./bumpVertex-DqzFZayE.js";const t="lightVxFragmentDeclaration",a=`#ifdef LIGHT{X}
|
|
2
|
+
uniform vLightData{X}: vec4f;uniform vLightDiffuse{X}: vec4f;
|
|
3
|
+
#ifdef SPECULARTERM
|
|
4
|
+
uniform vLightSpecular{X}: vec4f;
|
|
5
|
+
#else
|
|
6
|
+
var vLightSpecular{X}: vec4f= vec4f(0.);
|
|
7
|
+
#endif
|
|
8
|
+
#ifdef SHADOW{X}
|
|
9
|
+
#ifdef SHADOWCSM{X}
|
|
10
|
+
uniform lightMatrix{X}: mat4x4f[SHADOWCSMNUM_CASCADES{X}];varying var vPositionFromLight{X}: vec4f[SHADOWCSMNUM_CASCADES{X}];varying var vDepthMetric{X}: f32[SHADOWCSMNUM_CASCADES{X}];varying var vPositionFromCamera{X}: vec4f;
|
|
11
|
+
#elif defined(SHADOWCUBE{X})
|
|
12
|
+
#else
|
|
13
|
+
varying var vPositionFromLight{X}: vec4f;varying var vDepthMetric{X}: f32;uniform lightMatrix{X}: mat4x4f;
|
|
14
|
+
#endif
|
|
15
|
+
uniform shadowsInfo{X}: vec4f;uniform depthValues{X}: vec2f;
|
|
16
|
+
#endif
|
|
17
|
+
#ifdef SPOTLIGHT{X}
|
|
18
|
+
uniform vLightDirection{X}: vec4f;uniform vLightFalloff{X}: vec4f;
|
|
19
|
+
#elif defined(POINTLIGHT{X})
|
|
20
|
+
uniform vLightFalloff{X}: vec4f;
|
|
21
|
+
#elif defined(HEMILIGHT{X})
|
|
22
|
+
uniform vLightGround{X}: vec3f;
|
|
23
|
+
#endif
|
|
24
|
+
#if defined(AREALIGHT{X}) && defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
|
|
25
|
+
uniform vLightWidth{X}: vec4f;uniform vLightHeight{X}: vec4f;
|
|
26
|
+
#endif
|
|
27
|
+
#endif
|
|
28
|
+
`;e.IncludesShadersStoreWGSL[t]||(e.IncludesShadersStoreWGSL[t]=a);const H={name:t,shader:a},r="defaultVertexShader",n=`#include<defaultUboDeclaration>
|
|
29
|
+
#define CUSTOM_VERTEX_BEGIN
|
|
30
|
+
#ifndef USE_VERTEX_PULLING
|
|
31
|
+
attribute position: vec3f;
|
|
32
|
+
#ifdef NORMAL
|
|
33
|
+
attribute normal: vec3f;
|
|
34
|
+
#endif
|
|
35
|
+
#ifdef TANGENT
|
|
36
|
+
attribute tangent: vec4f;
|
|
37
|
+
#endif
|
|
38
|
+
#ifdef UV1
|
|
39
|
+
attribute uv: vec2f;
|
|
40
|
+
#endif
|
|
41
|
+
#include<uvAttributeDeclaration>[2..7]
|
|
42
|
+
#ifdef VERTEXCOLOR
|
|
43
|
+
attribute color: vec4f;
|
|
44
|
+
#endif
|
|
45
|
+
#endif
|
|
46
|
+
#include<helperFunctions>
|
|
47
|
+
#include<bonesDeclaration>
|
|
48
|
+
#include<bakedVertexAnimationDeclaration>
|
|
49
|
+
#include<instancesDeclaration>
|
|
50
|
+
#include<prePassVertexDeclaration>
|
|
51
|
+
#include<mainUVVaryingDeclaration>[1..7]
|
|
52
|
+
#include<samplerVertexDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse)
|
|
53
|
+
#include<samplerVertexDeclaration>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail)
|
|
54
|
+
#include<samplerVertexDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient)
|
|
55
|
+
#include<samplerVertexDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity)
|
|
56
|
+
#include<samplerVertexDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive)
|
|
57
|
+
#include<samplerVertexDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap)
|
|
58
|
+
#if defined(SPECULARTERM)
|
|
59
|
+
#include<samplerVertexDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular)
|
|
60
|
+
#endif
|
|
61
|
+
#include<samplerVertexDeclaration>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump)
|
|
62
|
+
#include<samplerVertexDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal)
|
|
63
|
+
varying vPositionW: vec3f;
|
|
64
|
+
#ifdef NORMAL
|
|
65
|
+
varying vNormalW: vec3f;
|
|
66
|
+
#endif
|
|
67
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
68
|
+
varying vColor: vec4f;
|
|
69
|
+
#endif
|
|
70
|
+
#include<bumpVertexDeclaration>
|
|
71
|
+
#include<clipPlaneVertexDeclaration>
|
|
72
|
+
#include<fogVertexDeclaration>
|
|
73
|
+
#include<__decl__lightVxFragment>[0..maxSimultaneousLights]
|
|
74
|
+
#include<morphTargetsVertexGlobalDeclaration>
|
|
75
|
+
#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]
|
|
76
|
+
#ifdef REFLECTIONMAP_SKYBOX
|
|
77
|
+
varying vPositionUVW: vec3f;
|
|
78
|
+
#endif
|
|
79
|
+
#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
|
|
80
|
+
varying vDirectionW: vec3f;
|
|
81
|
+
#endif
|
|
82
|
+
#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
|
|
83
|
+
varying vViewDepth: f32;
|
|
84
|
+
#endif
|
|
85
|
+
#include<logDepthDeclaration>
|
|
86
|
+
#include<vertexPullingDeclaration>
|
|
87
|
+
#define CUSTOM_VERTEX_DEFINITIONS
|
|
88
|
+
@vertex
|
|
89
|
+
fn main(input : VertexInputs)->FragmentInputs {
|
|
90
|
+
#define CUSTOM_VERTEX_MAIN_BEGIN
|
|
91
|
+
#ifdef USE_VERTEX_PULLING
|
|
92
|
+
var positionUpdated: vec3f=vec3f(0.0);
|
|
93
|
+
#ifdef NORMAL
|
|
94
|
+
var normalUpdated: vec3f=vec3f(0.0);
|
|
95
|
+
#endif
|
|
96
|
+
#ifdef TANGENT
|
|
97
|
+
var tangentUpdated: vec4f=vec4f(0.0);
|
|
98
|
+
#endif
|
|
99
|
+
#ifdef UV1
|
|
100
|
+
var uvUpdated: vec2f=vec2f(0.0);
|
|
101
|
+
#endif
|
|
102
|
+
#ifdef UV2
|
|
103
|
+
var uv2Updated: vec2f=vec2f(0.0);
|
|
104
|
+
#endif
|
|
105
|
+
#ifdef VERTEXCOLOR
|
|
106
|
+
var colorUpdated: vec4f=vec4f(0.0);
|
|
107
|
+
#endif
|
|
108
|
+
#else
|
|
109
|
+
var positionUpdated: vec3f=vertexInputs.position;
|
|
110
|
+
#ifdef NORMAL
|
|
111
|
+
var normalUpdated: vec3f=vertexInputs.normal;
|
|
112
|
+
#endif
|
|
113
|
+
#ifdef TANGENT
|
|
114
|
+
var tangentUpdated: vec4f=vertexInputs.tangent;
|
|
115
|
+
#endif
|
|
116
|
+
#ifdef UV1
|
|
117
|
+
var uvUpdated: vec2f=vertexInputs.uv;
|
|
118
|
+
#endif
|
|
119
|
+
#ifdef UV2
|
|
120
|
+
var uv2Updated: vec2f=vertexInputs.uv2;
|
|
121
|
+
#endif
|
|
122
|
+
#ifdef VERTEXCOLOR
|
|
123
|
+
var colorUpdated: vec4f=vertexInputs.color;
|
|
124
|
+
#endif
|
|
125
|
+
#endif
|
|
126
|
+
#include<vertexPullingVertex>
|
|
127
|
+
#include<morphTargetsVertexGlobal>
|
|
128
|
+
#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]
|
|
129
|
+
#ifdef REFLECTIONMAP_SKYBOX
|
|
130
|
+
vertexOutputs.vPositionUVW=positionUpdated;
|
|
131
|
+
#endif
|
|
132
|
+
#define CUSTOM_VERTEX_UPDATE_POSITION
|
|
133
|
+
#define CUSTOM_VERTEX_UPDATE_NORMAL
|
|
134
|
+
#include<instancesVertex>
|
|
135
|
+
#if defined(PREPASS) && ((defined(PREPASS_VELOCITY) || defined(PREPASS_VELOCITY_LINEAR)) && !defined(BONES_VELOCITY_ENABLED)
|
|
136
|
+
vertexOutputs.vCurrentPosition=scene.viewProjection*finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.vPreviousPosition=uniforms.previousViewProjection*finalPreviousWorld*vec4f(positionUpdated,1.0);
|
|
137
|
+
#endif
|
|
138
|
+
#ifdef USE_VERTEX_PULLING
|
|
139
|
+
#include<bonesVertex>(vertexInputs.matricesIndices,vp_matricesIndices,vertexInputs.matricesWeights,vp_matricesWeights,vertexInputs.matricesIndicesExtra,vp_matricesIndicesExtra,vertexInputs.matricesWeightsExtra,vp_matricesWeightsExtra)
|
|
140
|
+
#include<bakedVertexAnimation>(vertexInputs.matricesIndices,vp_matricesIndices,vertexInputs.matricesWeights,vp_matricesWeights,vertexInputs.matricesIndicesExtra,vp_matricesIndicesExtra,vertexInputs.matricesWeightsExtra,vp_matricesWeightsExtra)
|
|
141
|
+
#else
|
|
142
|
+
#include<bonesVertex>
|
|
143
|
+
#include<bakedVertexAnimation>
|
|
144
|
+
#endif
|
|
145
|
+
var worldPos: vec4f=finalWorld*vec4f(positionUpdated,1.0);
|
|
146
|
+
#ifdef NORMAL
|
|
147
|
+
var normalWorld: mat3x3f= mat3x3f(finalWorld[0].xyz,finalWorld[1].xyz,finalWorld[2].xyz);
|
|
148
|
+
#if defined(INSTANCES) && defined(THIN_INSTANCES)
|
|
149
|
+
vertexOutputs.vNormalW=normalUpdated/ vec3f(dot(normalWorld[0],normalWorld[0]),dot(normalWorld[1],normalWorld[1]),dot(normalWorld[2],normalWorld[2]));vertexOutputs.vNormalW=normalize(normalWorld*vertexOutputs.vNormalW);
|
|
150
|
+
#else
|
|
151
|
+
#ifdef NONUNIFORMSCALING
|
|
152
|
+
normalWorld=transposeMat3(inverseMat3(normalWorld));
|
|
153
|
+
#endif
|
|
154
|
+
vertexOutputs.vNormalW=normalize(normalWorld*normalUpdated);
|
|
155
|
+
#endif
|
|
156
|
+
#endif
|
|
157
|
+
#define CUSTOM_VERTEX_UPDATE_WORLDPOS
|
|
158
|
+
#ifdef MULTIVIEW
|
|
159
|
+
if (gl_ViewID_OVR==0u) {vertexOutputs.position=scene.viewProjection*worldPos;} else {vertexOutputs.position=scene.viewProjectionR*worldPos;}
|
|
160
|
+
#else
|
|
161
|
+
vertexOutputs.position=scene.viewProjection*worldPos;
|
|
162
|
+
#endif
|
|
163
|
+
vertexOutputs.vPositionW= worldPos.xyz;
|
|
164
|
+
#ifdef PREPASS
|
|
165
|
+
#include<prePassVertex>
|
|
166
|
+
#endif
|
|
167
|
+
#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
|
|
168
|
+
vertexOutputs.vDirectionW=normalize((finalWorld* vec4f(positionUpdated,0.0)).xyz);
|
|
169
|
+
#endif
|
|
170
|
+
#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
|
|
171
|
+
#ifdef RIGHT_HANDED
|
|
172
|
+
vertexOutputs.vViewDepth=-(scene.view*worldPos).z;
|
|
173
|
+
#else
|
|
174
|
+
vertexOutputs.vViewDepth=(scene.view*worldPos).z;
|
|
175
|
+
#endif
|
|
176
|
+
#endif
|
|
177
|
+
#ifndef UV1
|
|
178
|
+
var uvUpdated: vec2f=vec2f(0.,0.);
|
|
179
|
+
#endif
|
|
180
|
+
#ifdef MAINUV1
|
|
181
|
+
vertexOutputs.vMainUV1=uvUpdated;
|
|
182
|
+
#endif
|
|
183
|
+
#ifndef UV2
|
|
184
|
+
var uv2Updated: vec2f=vec2f(0.,0.);
|
|
185
|
+
#endif
|
|
186
|
+
#ifdef MAINUV2
|
|
187
|
+
vertexOutputs.vMainUV2=uv2Updated;
|
|
188
|
+
#endif
|
|
189
|
+
#include<uvVariableDeclaration>[3..7]
|
|
190
|
+
#include<samplerVertexImplementation>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_MATRIXNAME_,diffuse,_INFONAME_,DiffuseInfos.x)
|
|
191
|
+
#include<samplerVertexImplementation>(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x)
|
|
192
|
+
#include<samplerVertexImplementation>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x)
|
|
193
|
+
#include<samplerVertexImplementation>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x)
|
|
194
|
+
#include<samplerVertexImplementation>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_MATRIXNAME_,emissive,_INFONAME_,EmissiveInfos.x)
|
|
195
|
+
#include<samplerVertexImplementation>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_MATRIXNAME_,lightmap,_INFONAME_,LightmapInfos.x)
|
|
196
|
+
#if defined(SPECULARTERM)
|
|
197
|
+
#include<samplerVertexImplementation>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_MATRIXNAME_,specular,_INFONAME_,SpecularInfos.x)
|
|
198
|
+
#endif
|
|
199
|
+
#include<samplerVertexImplementation>(_DEFINENAME_,BUMP,_VARYINGNAME_,Bump,_MATRIXNAME_,bump,_INFONAME_,BumpInfos.x)
|
|
200
|
+
#include<samplerVertexImplementation>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_MATRIXNAME_,decal,_INFONAME_,DecalInfos.x)
|
|
201
|
+
#include<bumpVertex>
|
|
202
|
+
#include<clipPlaneVertex>
|
|
203
|
+
#include<fogVertex>
|
|
204
|
+
#include<shadowsVertex>[0..maxSimultaneousLights]
|
|
205
|
+
#include<vertexColorMixing>
|
|
206
|
+
#include<logDepthVertex>
|
|
207
|
+
#define CUSTOM_VERTEX_MAIN_END
|
|
208
|
+
}
|
|
209
|
+
`;e.ShadersStoreWGSL[r]||(e.ShadersStoreWGSL[r]=n);const Y=[o,d,f,l,N,x,S,V,s,W,c,O,g,P,H,E,M,L,F,v,m,D,T,R,G,U,u,p,I,b,h,C,_,A,X];for(const i of Y)e.IncludesShadersStoreWGSL[i.name]||(e.IncludesShadersStoreWGSL[i.name]=i.shader);const ie={name:r,shader:n};export{ie as defaultVertexShaderWGSL};
|