@vived/component-abb-6700 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.todo.md +13 -0
- package/README.md +122 -0
- package/dist/.gitkeep +0 -0
- package/dist/Adapters/aBB6700PMAdapter.d.ts +10 -0
- package/dist/Adapters/aBB6700PMAdapter.d.ts.map +1 -0
- package/dist/Controllers/createABB6700.d.ts +12 -0
- package/dist/Controllers/createABB6700.d.ts.map +1 -0
- package/dist/Controllers/getPose.d.ts +11 -0
- package/dist/Controllers/getPose.d.ts.map +1 -0
- package/dist/Controllers/setJointAngle.d.ts +12 -0
- package/dist/Controllers/setJointAngle.d.ts.map +1 -0
- package/dist/Controllers/setPose.d.ts +11 -0
- package/dist/Controllers/setPose.d.ts.map +1 -0
- package/dist/Entities/ABB6700Entity.d.ts +35 -0
- package/dist/Entities/ABB6700Entity.d.ts.map +1 -0
- package/dist/Entities/ABB6700Repo.d.ts +32 -0
- package/dist/Entities/ABB6700Repo.d.ts.map +1 -0
- package/dist/Factory/ABB6700FeatureFactory.d.ts +26 -0
- package/dist/Factory/ABB6700FeatureFactory.d.ts.map +1 -0
- package/dist/Mocks/MockABB6700PM.d.ts +11 -0
- package/dist/Mocks/MockABB6700PM.d.ts.map +1 -0
- package/dist/Mocks/MockSetJointAngleUC.d.ts +7 -0
- package/dist/Mocks/MockSetJointAngleUC.d.ts.map +1 -0
- package/dist/Mocks/MockSetPoseUC.d.ts +7 -0
- package/dist/Mocks/MockSetPoseUC.d.ts.map +1 -0
- package/dist/PMs/ABB6700PM.d.ts +32 -0
- package/dist/PMs/ABB6700PM.d.ts.map +1 -0
- package/dist/UCs/CalcStabilizerUC.d.ts +7 -0
- package/dist/UCs/CalcStabilizerUC.d.ts.map +1 -0
- package/dist/UCs/SetJointAngleUC.d.ts +15 -0
- package/dist/UCs/SetJointAngleUC.d.ts.map +1 -0
- package/dist/UCs/SetPoseUC.d.ts +22 -0
- package/dist/UCs/SetPoseUC.d.ts.map +1 -0
- package/dist/Views/ABB6700BabylonView.d.ts +27 -0
- package/dist/Views/ABB6700BabylonView.d.ts.map +1 -0
- package/dist/abb_6700.glb +0 -0
- package/dist/abstractAudioBus-CyBWsmuN.js +14 -0
- package/dist/animationGroup-BhNThqQe.js +1454 -0
- package/dist/basisTextureLoader-BT391BsV.js +310 -0
- package/dist/brdfTextureTools-DUyKBAXf.js +79 -0
- package/dist/bumpFragment-Dd-ojPA1.js +134 -0
- package/dist/bumpFragment-KE1_PuMl.js +287 -0
- package/dist/bumpVertex-BcdvVFVx.js +8 -0
- package/dist/bumpVertexDeclaration-B5Uvs-RS.js +8 -0
- package/dist/bumpVertexDeclaration-ixSg-yGI.js +8 -0
- package/dist/clipPlaneFragment-DJwQynjA.js +136 -0
- package/dist/clipPlaneVertex-D4Wk50XG.js +376 -0
- package/dist/clipPlaneVertex-eQ147Tn2.js +350 -0
- package/dist/component.config.d.ts +17 -0
- package/dist/component.config.d.ts.map +1 -0
- package/dist/ddsTextureLoader-DeoF3iGO.js +331 -0
- package/dist/default.fragment-DKnTR9nY.js +548 -0
- package/dist/default.fragment-rIGWrUS5.js +486 -0
- package/dist/default.vertex-Bt5y1VyA.js +212 -0
- package/dist/default.vertex-Dext1liJ.js +224 -0
- package/dist/defaultUboDeclaration-BwslQZX8.js +11 -0
- package/dist/defaultUboDeclaration-DSXACgip.js +9 -0
- package/dist/easing-BAt0SO-B.js +163 -0
- package/dist/envTextureLoader-CBiW_Q-U.js +40 -0
- package/dist/exrTextureLoader-5SC6PKIA.js +740 -0
- package/dist/flowGraphApplyForceBlock-6e8-wcaw.js +32 -0
- package/dist/flowGraphApplyImpulseBlock-B27EZQow.js +32 -0
- package/dist/flowGraphArrayIndexBlock-DIUn5e4i.js +31 -0
- package/dist/flowGraphBezierCurveEasingBlock-BJmiHk40.js +25 -0
- package/dist/flowGraphBinaryOperationBlock-Bj7TANCc.js +25 -0
- package/dist/flowGraphBranchBlock-7CRvIKWc.js +19 -0
- package/dist/flowGraphCachedOperationBlock-CP1ZiuIB.js +26 -0
- package/dist/flowGraphCancelDelayBlock-DqtgzBGm.js +20 -0
- package/dist/flowGraphCodeExecutionBlock-CaYXCGqo.js +23 -0
- package/dist/flowGraphConditionalDataBlock-DJ7evX8_.js +28 -0
- package/dist/flowGraphConsoleLogBlock-cMkpqLzO.js +68 -0
- package/dist/flowGraphConstantBlock-JWybwT0A.js +28 -0
- package/dist/flowGraphContextBlock-CFDXHcbn.js +19 -0
- package/dist/flowGraphCounterBlock-B0uPkgw9.js +24 -0
- package/dist/flowGraphDataSwitchBlock-B0GSifvJ.js +27 -0
- package/dist/flowGraphDebounceBlock-CSw8zKym.js +24 -0
- package/dist/flowGraphDebugBlock-DiSR6Ahn.js +65 -0
- package/dist/flowGraphDoNBlock-C-48oQ2H.js +24 -0
- package/dist/flowGraphEasingBlock-DKUaE7Rp.js +50 -0
- package/dist/flowGraphFlipFlopBlock-DX5BGhMV.js +20 -0
- package/dist/flowGraphForLoopBlock-Di-Qwg23.js +27 -0
- package/dist/flowGraphFunctionReferenceBlock-D8X5TFsO.js +20 -0
- package/dist/flowGraphGLTFDataProvider-C4j7nPQv.js +16 -0
- package/dist/flowGraphGetAngularVelocityBlock-Cq-yTQ4D.js +31 -0
- package/dist/flowGraphGetAssetBlock-B36eioor.js +21 -0
- package/dist/flowGraphGetLinearVelocityBlock-MdrV0eUD.js +31 -0
- package/dist/flowGraphGetPhysicsMassPropertiesBlock-wXDZP1wM.js +30 -0
- package/dist/flowGraphGetPropertyBlock-eP0badwf.js +46 -0
- package/dist/flowGraphGetSoundVolumeBlock-D3gXGHXa.js +29 -0
- package/dist/flowGraphGetVariableBlock-C7-qZAec.js +31 -0
- package/dist/flowGraphIndexOfBlock-CC5l9n9P.js +31 -0
- package/dist/flowGraphInterpolationBlock-B6922jzt.js +50 -0
- package/dist/flowGraphIsKeyPressedBlock-X_iuiUOX.js +31 -0
- package/dist/flowGraphIsSoundPlayingBlock-DONQX8N8.js +29 -0
- package/dist/flowGraphJsonPointerParserBlock-DBH_gN8I.js +95 -0
- package/dist/flowGraphKeyDownEventBlock-D5T1Uyfv.js +26 -0
- package/dist/flowGraphKeyUpEventBlock-BPY_Kgkm.js +21 -0
- package/dist/flowGraphKeyboardEventBlock-C49fx3TC.js +20 -0
- package/dist/flowGraphMathBlocks-CkvrN3VJ.js +864 -0
- package/dist/flowGraphMathCombineExtractBlocks-QSjGlnoz.js +248 -0
- package/dist/flowGraphMatrixMathBlocks-B3D7Cz9p.js +117 -0
- package/dist/flowGraphMeshPickEventBlock-BBTz-taa.js +35 -0
- package/dist/flowGraphMultiGateBlock-BhY1y5BG.js +50 -0
- package/dist/flowGraphPauseAnimationBlock-CHZZXMbg.js +19 -0
- package/dist/flowGraphPauseSoundBlock-B7hMmJ0c.js +31 -0
- package/dist/flowGraphPhysicsCollisionEventBlock-CxoPpT-q.js +56 -0
- package/dist/flowGraphPlayAnimationBlock-DVAvIFux.js +99 -0
- package/dist/flowGraphPlaySoundBlock-DjHGrqbC.js +32 -0
- package/dist/flowGraphPointerDownEventBlock-qI-H0JST.js +31 -0
- package/dist/flowGraphPointerMoveEventBlock-DAi4VUyy.js +31 -0
- package/dist/flowGraphPointerOutEventBlock-CFtj68aC.js +21 -0
- package/dist/flowGraphPointerOverEventBlock-VxdHhFuu.js +23 -0
- package/dist/flowGraphPointerUpEventBlock-DRR1f07q.js +31 -0
- package/dist/flowGraphReceiveCustomEventBlock-B3bwdB66.js +52 -0
- package/dist/flowGraphSceneReadyEventBlock-Dy6lDT3j.js +23 -0
- package/dist/flowGraphSceneTickEventBlock-Bl9BF_Xw.js +32 -0
- package/dist/flowGraphSendCustomEventBlock-BAR4PGFq.js +35 -0
- package/dist/flowGraphSequenceBlock-veqU32ZZ.js +32 -0
- package/dist/flowGraphSetAngularVelocityBlock-Dj9b-zu6.js +31 -0
- package/dist/flowGraphSetDelayBlock-CMjudtvk.js +131 -0
- package/dist/flowGraphSetLinearVelocityBlock-DVDhhJBd.js +31 -0
- package/dist/flowGraphSetPhysicsMotionTypeBlock-CL3cxNCO.js +36 -0
- package/dist/flowGraphSetPropertyBlock-D3sWL3Ss.js +47 -0
- package/dist/flowGraphSetSoundVolumeBlock-CxVk45yR.js +32 -0
- package/dist/flowGraphSetVariableBlock-D1oJiwLj.js +47 -0
- package/dist/flowGraphSoundEndedEventBlock-CubEwii0.js +47 -0
- package/dist/flowGraphStopAnimationBlock-B9inwIQx.js +48 -0
- package/dist/flowGraphStopSoundBlock-BijIX2jC.js +31 -0
- package/dist/flowGraphSwitchBlock-BMhPb4OX.js +54 -0
- package/dist/flowGraphThrottleBlock-C7vrnkb1.js +37 -0
- package/dist/flowGraphTransformCoordinatesSystemBlock-DoISqaUG.js +29 -0
- package/dist/flowGraphTypeToTypeBlocks-CSML6QWx.js +57 -0
- package/dist/flowGraphUnaryOperationBlock-B0Shf-lJ.js +24 -0
- package/dist/flowGraphVectorMathBlocks-DoTRR_E0.js +178 -0
- package/dist/flowGraphWaitAllBlock-BvmDMc24.js +54 -0
- package/dist/flowGraphWhileLoopBlock-BaIq4-K2.js +27 -0
- package/dist/geometry.fragment-Bsis3UG2.js +275 -0
- package/dist/geometry.vertex-DskQ5b8j.js +222 -0
- package/dist/harmonicsFunctions-CtNrRfir.js +193 -0
- package/dist/harmonicsFunctions-PEz6APC7.js +18 -0
- package/dist/hdrTextureLoader-D9rYxJ9q.js +112 -0
- package/dist/helperFunctions-Bt7Zfkrp.js +89 -0
- package/dist/helperFunctions-CPmRxd37.js +121 -0
- package/dist/iesTextureLoader-BGUFjVhI.js +93 -0
- package/dist/index-CS3Icp_r.js +67657 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/ktxTextureLoader-cUaGg9_L.js +459 -0
- package/dist/lightFragment-BRDibDKG.js +404 -0
- package/dist/lightFragment-DCqtGMp_.js +402 -0
- package/dist/logDepthDeclaration-Bwm-3KyB.js +16 -0
- package/dist/logDepthDeclaration-gUfeSnXX.js +20 -0
- package/dist/logDepthVertex-CKeuJ6ae.js +213 -0
- package/dist/logDepthVertex-CXkmZels.js +459 -0
- package/dist/mesh.vertexData.functions-Bc9lJlrU.js +74 -0
- package/dist/oitFragment-B8zuQigp.js +792 -0
- package/dist/oitFragment-DH3h3T6x.js +657 -0
- package/dist/openpbr.fragment-BglYS6LA.js +1405 -0
- package/dist/openpbr.fragment-DrOTZs4m.js +1553 -0
- package/dist/openpbr.vertex-B-PaLFOR.js +384 -0
- package/dist/openpbr.vertex-DMdFRTnX.js +268 -0
- package/dist/openpbrMaterial-HCU0aOca.js +2880 -0
- package/dist/openpbrMaterialLoadingAdapter-CWRAa-7S.js +1122 -0
- package/dist/openpbrTransmissionLayerData-CfDVObj5.js +352 -0
- package/dist/openpbrUboDeclaration-CA2pvSbt.js +9 -0
- package/dist/openpbrUboDeclaration-xU8VOaib.js +10 -0
- package/dist/pass.fragment-1mMP54bb.js +10 -0
- package/dist/pass.fragment-DzaUp_jk.js +10 -0
- package/dist/passCube.fragment-CQaXS7g3.js +29 -0
- package/dist/passCube.fragment-QJGPwAXI.js +29 -0
- package/dist/pbr.fragment-BnaAAGxb.js +2775 -0
- package/dist/pbr.fragment-CYZk_EGU.js +2619 -0
- package/dist/pbr.vertex-CyvdCw91.js +372 -0
- package/dist/pbr.vertex-DJMAkDxs.js +270 -0
- package/dist/pbrBRDFFunctions-EugoWm6O.js +175 -0
- package/dist/pbrDebug-Bk3sPoEG.js +719 -0
- package/dist/pbrDebug-Cdalzb1I.js +614 -0
- package/dist/pbrIBLFunctions-B0bVAXCF.js +47 -0
- package/dist/pbrIBLFunctions-C06z-ouZ.js +51 -0
- package/dist/pbrMaterial-C4FCKBZQ.js +1660 -0
- package/dist/pbrMaterialLoadingAdapter-BGHlS_ZN.js +1032 -0
- package/dist/pbrUboDeclaration-1lN5_-Bw.js +9 -0
- package/dist/pbrUboDeclaration-BJOUUOZ2.js +10 -0
- package/dist/procedural.vertex-CFPKczKj.js +14 -0
- package/dist/procedural.vertex-DUW7bYZt.js +13 -0
- package/dist/rgbdDecode.fragment-CEGgE4tL.js +8 -0
- package/dist/rgbdDecode.fragment-FT0wkgah.js +8 -0
- package/dist/rgbdEncode.fragment-CLnJJf6E.js +8 -0
- package/dist/rgbdEncode.fragment-CaAcMsY9.js +8 -0
- package/dist/sceneUboDeclaration-B6oxsfcj.js +8 -0
- package/dist/sceneUboDeclaration-JByfVKik.js +13 -0
- package/dist/setupABB6700InstanceFactory.d.ts +7 -0
- package/dist/setupABB6700InstanceFactory.d.ts.map +1 -0
- package/dist/studio.env +0 -0
- package/dist/textureProcessor.fragment-BYPw6SMQ.js +152 -0
- package/dist/textureProcessor.fragment-Ciw9-F3w.js +157 -0
- package/dist/textureTools-Cct_bGgp.js +40 -0
- package/dist/tgaTextureLoader-BJOIdnFr.js +198 -0
- package/dist/thinEngine-Bt9FW4dD.js +2425 -0
- package/dist/webAudioBus-BUzRHSxr.js +88 -0
- package/dist/webAudioMainBus-Dds1TgJG.js +49 -0
- package/package.json +49 -0
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
import { b0 as e } from "./index-CS3Icp_r.js";
|
|
2
|
+
import "./oitFragment-B8zuQigp.js";
|
|
3
|
+
import "./defaultUboDeclaration-BwslQZX8.js";
|
|
4
|
+
import "./logDepthDeclaration-gUfeSnXX.js";
|
|
5
|
+
import "./helperFunctions-CPmRxd37.js";
|
|
6
|
+
import "./lightFragment-BRDibDKG.js";
|
|
7
|
+
import "./bumpFragment-KE1_PuMl.js";
|
|
8
|
+
const o = "defaultFragmentDeclaration", f = `uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 vSpecularColor;uniform vec3 vEmissiveColor;uniform vec3 vAmbientColor;uniform float visibility;
|
|
9
|
+
#ifdef DIFFUSE
|
|
10
|
+
uniform vec2 vDiffuseInfos;
|
|
11
|
+
#endif
|
|
12
|
+
#ifdef AMBIENT
|
|
13
|
+
uniform vec2 vAmbientInfos;
|
|
14
|
+
#endif
|
|
15
|
+
#ifdef OPACITY
|
|
16
|
+
uniform vec2 vOpacityInfos;
|
|
17
|
+
#endif
|
|
18
|
+
#ifdef EMISSIVE
|
|
19
|
+
uniform vec2 vEmissiveInfos;
|
|
20
|
+
#endif
|
|
21
|
+
#ifdef LIGHTMAP
|
|
22
|
+
uniform vec2 vLightmapInfos;
|
|
23
|
+
#endif
|
|
24
|
+
#ifdef BUMP
|
|
25
|
+
uniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;
|
|
26
|
+
#endif
|
|
27
|
+
#ifdef ALPHATEST
|
|
28
|
+
uniform float alphaCutOff;
|
|
29
|
+
#endif
|
|
30
|
+
#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS)
|
|
31
|
+
uniform mat4 view;
|
|
32
|
+
#endif
|
|
33
|
+
#ifdef REFRACTION
|
|
34
|
+
uniform vec4 vRefractionInfos;
|
|
35
|
+
#ifndef REFRACTIONMAP_3D
|
|
36
|
+
uniform mat4 refractionMatrix;
|
|
37
|
+
#endif
|
|
38
|
+
#ifdef REFRACTIONFRESNEL
|
|
39
|
+
uniform vec4 refractionLeftColor;uniform vec4 refractionRightColor;
|
|
40
|
+
#endif
|
|
41
|
+
#if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D)
|
|
42
|
+
uniform vec3 vRefractionPosition;uniform vec3 vRefractionSize;
|
|
43
|
+
#endif
|
|
44
|
+
#endif
|
|
45
|
+
#if defined(SPECULAR) && defined(SPECULARTERM)
|
|
46
|
+
uniform vec2 vSpecularInfos;
|
|
47
|
+
#endif
|
|
48
|
+
#ifdef DIFFUSEFRESNEL
|
|
49
|
+
uniform vec4 diffuseLeftColor;uniform vec4 diffuseRightColor;
|
|
50
|
+
#endif
|
|
51
|
+
#ifdef OPACITYFRESNEL
|
|
52
|
+
uniform vec4 opacityParts;
|
|
53
|
+
#endif
|
|
54
|
+
#ifdef EMISSIVEFRESNEL
|
|
55
|
+
uniform vec4 emissiveLeftColor;uniform vec4 emissiveRightColor;
|
|
56
|
+
#endif
|
|
57
|
+
#if defined(REFLECTION) || (defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED))
|
|
58
|
+
uniform vec2 vReflectionInfos;
|
|
59
|
+
#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)
|
|
60
|
+
uniform mat4 reflectionMatrix;
|
|
61
|
+
#endif
|
|
62
|
+
#ifndef REFLECTIONMAP_SKYBOX
|
|
63
|
+
#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)
|
|
64
|
+
uniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;
|
|
65
|
+
#endif
|
|
66
|
+
#endif
|
|
67
|
+
#ifdef REFLECTIONFRESNEL
|
|
68
|
+
uniform vec4 reflectionLeftColor;uniform vec4 reflectionRightColor;
|
|
69
|
+
#endif
|
|
70
|
+
#endif
|
|
71
|
+
#ifdef DETAIL
|
|
72
|
+
uniform vec4 vDetailInfos;
|
|
73
|
+
#endif
|
|
74
|
+
#include<decalFragmentDeclaration>
|
|
75
|
+
#if TEXTURE_REPETITION_MODE>0
|
|
76
|
+
uniform vec4 vTextureRepetitionHexTilingParams;
|
|
77
|
+
#endif
|
|
78
|
+
#define ADDITIONAL_FRAGMENT_DECLARATION
|
|
79
|
+
`;
|
|
80
|
+
e.IncludesShadersStore[o] || (e.IncludesShadersStore[o] = f);
|
|
81
|
+
const r = "lightsFragmentFunctions", l = `struct lightingInfo
|
|
82
|
+
{vec3 diffuse;
|
|
83
|
+
#ifdef SPECULARTERM
|
|
84
|
+
vec3 specular;
|
|
85
|
+
#endif
|
|
86
|
+
#ifdef NDOTL
|
|
87
|
+
float ndl;
|
|
88
|
+
#endif
|
|
89
|
+
};lightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {lightingInfo result;vec3 lightVectorW;float attenuation=1.0;if (lightData.w==0.)
|
|
90
|
+
{vec3 direction=lightData.xyz-vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}
|
|
91
|
+
else
|
|
92
|
+
{lightVectorW=normalize(-lightData.xyz);}
|
|
93
|
+
float ndl=max(0.,dot(vNormal,lightVectorW));
|
|
94
|
+
#ifdef NDOTL
|
|
95
|
+
result.ndl=ndl;
|
|
96
|
+
#endif
|
|
97
|
+
result.diffuse=ndl*diffuseColor*attenuation;
|
|
98
|
+
#ifdef SPECULARTERM
|
|
99
|
+
vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
|
|
100
|
+
#endif
|
|
101
|
+
return result;}
|
|
102
|
+
float getAttenuation(float cosAngle,float exponent) {return max(0.,pow(cosAngle,exponent));}
|
|
103
|
+
float getIESAttenuation(float cosAngle,sampler2D iesLightSampler) {float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
|
|
104
|
+
lightingInfo basicSpotLighting(vec3 viewDirectionW,vec3 lightVectorW,vec3 vNormal,float attenuation,vec3 diffuseColor,vec3 specularColor,float glossiness) {lightingInfo result;
|
|
105
|
+
float ndl=max(0.,dot(vNormal,lightVectorW));
|
|
106
|
+
#ifdef NDOTL
|
|
107
|
+
result.ndl=ndl;
|
|
108
|
+
#endif
|
|
109
|
+
result.diffuse=ndl*diffuseColor*attenuation;
|
|
110
|
+
#ifdef SPECULARTERM
|
|
111
|
+
vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
|
|
112
|
+
#endif
|
|
113
|
+
return result;}
|
|
114
|
+
lightingInfo computeIESSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness,sampler2D iesLightSampler) {
|
|
115
|
+
vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float dotProduct=dot(lightDirection.xyz,-lightVectorW);float cosAngle=max(0.,dotProduct);if (cosAngle>=lightDirection.w)
|
|
116
|
+
{
|
|
117
|
+
attenuation*=getIESAttenuation(dotProduct,iesLightSampler);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
|
|
118
|
+
lightingInfo result;result.diffuse=vec3(0.);
|
|
119
|
+
#ifdef SPECULARTERM
|
|
120
|
+
result.specular=vec3(0.);
|
|
121
|
+
#endif
|
|
122
|
+
#ifdef NDOTL
|
|
123
|
+
result.ndl=0.;
|
|
124
|
+
#endif
|
|
125
|
+
return result;}
|
|
126
|
+
lightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {vec3 direction=lightData.xyz-vPositionW;vec3 lightVectorW=normalize(direction);float attenuation=max(0.,1.0-length(direction)/range);float cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));if (cosAngle>=lightDirection.w)
|
|
127
|
+
{
|
|
128
|
+
attenuation*=getAttenuation(cosAngle,lightData.w);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
|
|
129
|
+
lightingInfo result;result.diffuse=vec3(0.);
|
|
130
|
+
#ifdef SPECULARTERM
|
|
131
|
+
result.specular=vec3(0.);
|
|
132
|
+
#endif
|
|
133
|
+
#ifdef NDOTL
|
|
134
|
+
result.ndl=0.;
|
|
135
|
+
#endif
|
|
136
|
+
return result;}
|
|
137
|
+
lightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {lightingInfo result;float ndl=dot(vNormal,lightData.xyz)*0.5+0.5;
|
|
138
|
+
#ifdef NDOTL
|
|
139
|
+
result.ndl=ndl;
|
|
140
|
+
#endif
|
|
141
|
+
result.diffuse=mix(groundColor,diffuseColor,ndl);
|
|
142
|
+
#ifdef SPECULARTERM
|
|
143
|
+
vec3 angleW=normalize(viewDirectionW+lightData.xyz);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;
|
|
144
|
+
#endif
|
|
145
|
+
return result;}
|
|
146
|
+
#define inline
|
|
147
|
+
vec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix,vec3 posW){vec4 strq=textureProjectionMatrix*vec4(posW,1.0);strq/=strq.w;vec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;return textureColor;}
|
|
148
|
+
#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
|
|
149
|
+
#include<ltcHelperFunctions>
|
|
150
|
+
uniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;
|
|
151
|
+
#define inline
|
|
152
|
+
lightingInfo computeAreaLighting(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness)
|
|
153
|
+
{lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
|
|
154
|
+
#ifdef SPECULARTERM
|
|
155
|
+
vec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
|
|
156
|
+
#endif
|
|
157
|
+
result.diffuse+=diffuseColor*data.Diffuse;return result;}
|
|
158
|
+
lightingInfo computeAreaLightingWithTexture(sampler2D ltc1,sampler2D ltc2,sampler2D emissionTexture,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness)
|
|
159
|
+
{lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnelWithEmission(ltc1,ltc2,emissionTexture,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
|
|
160
|
+
#ifdef SPECULARTERM
|
|
161
|
+
vec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
|
|
162
|
+
#endif
|
|
163
|
+
result.diffuse+=diffuseColor*data.Diffuse;return result;}
|
|
164
|
+
#endif
|
|
165
|
+
#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
|
|
166
|
+
#include<clusteredLightingFunctions>
|
|
167
|
+
#define inline
|
|
168
|
+
lightingInfo computeClusteredLighting(
|
|
169
|
+
sampler2D lightDataTexture,
|
|
170
|
+
sampler2D tileMaskTexture,
|
|
171
|
+
vec3 viewDirectionW,
|
|
172
|
+
vec3 vNormal,
|
|
173
|
+
vec4 lightData,
|
|
174
|
+
ivec2 sliceRange,
|
|
175
|
+
float glossiness
|
|
176
|
+
) {lightingInfo result;ivec2 tilePosition=ivec2(gl_FragCoord.xy*lightData.xy);int maskHeight=int(lightData.z);tilePosition.y=min(tilePosition.y,maskHeight-1);ivec2 batchRange=sliceRange/CLUSTLIGHT_BATCH;int batchOffset=batchRange.x*CLUSTLIGHT_BATCH;tilePosition.y+=maskHeight*batchRange.x;for (int i=batchRange.x; i<=batchRange.y; i+=1) {uint mask=uint(texelFetch(tileMaskTexture,tilePosition,0).r);tilePosition.y+=maskHeight;int maskOffset=max(sliceRange.x-batchOffset,0);int maskWidth=min(sliceRange.y-batchOffset+1,CLUSTLIGHT_BATCH);mask=extractBits(mask,maskOffset,maskWidth);while (mask != 0u) {uint bit=mask & -mask;mask ^= bit;int position=onlyBitPosition(bit);ClusteredLight light=getClusteredLight(lightDataTexture,batchOffset+maskOffset+position);lightingInfo info;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);}
|
|
177
|
+
result.diffuse+=info.diffuse;
|
|
178
|
+
#ifdef SPECULARTERM
|
|
179
|
+
result.specular+=info.specular;
|
|
180
|
+
#endif
|
|
181
|
+
}
|
|
182
|
+
batchOffset+=CLUSTLIGHT_BATCH;}
|
|
183
|
+
return result;}
|
|
184
|
+
#endif
|
|
185
|
+
`;
|
|
186
|
+
e.IncludesShadersStore[r] || (e.IncludesShadersStore[r] = l);
|
|
187
|
+
const t = "fresnelFunction", a = `#ifdef FRESNEL
|
|
188
|
+
float computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)
|
|
189
|
+
{float fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}
|
|
190
|
+
#endif
|
|
191
|
+
`;
|
|
192
|
+
e.IncludesShadersStore[t] || (e.IncludesShadersStore[t] = a);
|
|
193
|
+
const i = "defaultPixelShader", n = `#define CUSTOM_FRAGMENT_EXTENSION
|
|
194
|
+
#include<__decl__defaultFragment>
|
|
195
|
+
#if defined(BUMP) || !defined(NORMAL)
|
|
196
|
+
#extension GL_OES_standard_derivatives : enable
|
|
197
|
+
#endif
|
|
198
|
+
#include<prePassDeclaration>[SCENE_MRT_COUNT]
|
|
199
|
+
#include<oitDeclaration>
|
|
200
|
+
#define CUSTOM_FRAGMENT_BEGIN
|
|
201
|
+
#ifdef LOGARITHMICDEPTH
|
|
202
|
+
#extension GL_EXT_frag_depth : enable
|
|
203
|
+
#endif
|
|
204
|
+
varying vec3 vPositionW;
|
|
205
|
+
#ifdef NORMAL
|
|
206
|
+
varying vec3 vNormalW;
|
|
207
|
+
#endif
|
|
208
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
209
|
+
varying vec4 vColor;
|
|
210
|
+
#endif
|
|
211
|
+
#if defined(CLUSTLIGHT_BATCH) && CLUSTLIGHT_BATCH>0
|
|
212
|
+
varying float vViewDepth;
|
|
213
|
+
#endif
|
|
214
|
+
#include<mainUVVaryingDeclaration>[1..7]
|
|
215
|
+
#include<helperFunctions>
|
|
216
|
+
#include<__decl__lightFragment>[0..maxSimultaneousLights]
|
|
217
|
+
#include<lightsFragmentFunctions>
|
|
218
|
+
#include<shadowsFragmentFunctions>
|
|
219
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)
|
|
220
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)
|
|
221
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)
|
|
222
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)
|
|
223
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)
|
|
224
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)
|
|
225
|
+
#ifdef REFRACTION
|
|
226
|
+
#ifdef REFRACTIONMAP_3D
|
|
227
|
+
uniform samplerCube refractionCubeSampler;
|
|
228
|
+
#else
|
|
229
|
+
uniform sampler2D refraction2DSampler;
|
|
230
|
+
#endif
|
|
231
|
+
#endif
|
|
232
|
+
#if defined(SPECULARTERM)
|
|
233
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)
|
|
234
|
+
#endif
|
|
235
|
+
#include<fresnelFunction>
|
|
236
|
+
#ifdef REFLECTION
|
|
237
|
+
#ifdef REFLECTIONMAP_3D
|
|
238
|
+
uniform samplerCube reflectionCubeSampler;
|
|
239
|
+
#else
|
|
240
|
+
uniform sampler2D reflection2DSampler;
|
|
241
|
+
#endif
|
|
242
|
+
#ifdef REFLECTIONMAP_SKYBOX
|
|
243
|
+
varying vec3 vPositionUVW;
|
|
244
|
+
#else
|
|
245
|
+
#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
|
|
246
|
+
varying vec3 vDirectionW;
|
|
247
|
+
#endif
|
|
248
|
+
#endif
|
|
249
|
+
#include<reflectionFunction>
|
|
250
|
+
#endif
|
|
251
|
+
#include<imageProcessingDeclaration>
|
|
252
|
+
#include<imageProcessingFunctions>
|
|
253
|
+
#include<textureRepetitionFunctions>
|
|
254
|
+
#include<bumpFragmentMainFunctions>
|
|
255
|
+
#include<bumpFragmentFunctions>
|
|
256
|
+
#include<clipPlaneFragmentDeclaration>
|
|
257
|
+
#include<logDepthDeclaration>
|
|
258
|
+
#include<fogFragmentDeclaration>
|
|
259
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
260
|
+
void main(void) {
|
|
261
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
262
|
+
#include<clipPlaneFragment>
|
|
263
|
+
vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;
|
|
264
|
+
#ifdef NORMAL
|
|
265
|
+
vec3 normalW=normalize(vNormalW);
|
|
266
|
+
#else
|
|
267
|
+
vec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;
|
|
268
|
+
#endif
|
|
269
|
+
#include<bumpFragment>
|
|
270
|
+
#ifdef TWOSIDEDLIGHTING
|
|
271
|
+
normalW=gl_FrontFacing ? normalW : -normalW;
|
|
272
|
+
#endif
|
|
273
|
+
#ifdef DIFFUSE
|
|
274
|
+
baseColor=TEXRD(diffuseSampler,vDiffuseUV+uvOffset);
|
|
275
|
+
#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)
|
|
276
|
+
if (baseColor.a<alphaCutOff)
|
|
277
|
+
discard;
|
|
278
|
+
#endif
|
|
279
|
+
#ifdef ALPHAFROMDIFFUSE
|
|
280
|
+
alpha*=baseColor.a;
|
|
281
|
+
#endif
|
|
282
|
+
#define CUSTOM_FRAGMENT_UPDATE_ALPHA
|
|
283
|
+
baseColor.rgb*=vDiffuseInfos.y;
|
|
284
|
+
#endif
|
|
285
|
+
#if defined(DECAL) && !defined(DECAL_AFTER_DETAIL)
|
|
286
|
+
vec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);
|
|
287
|
+
#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)
|
|
288
|
+
#endif
|
|
289
|
+
#include<depthPrePass>
|
|
290
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
291
|
+
baseColor.rgb*=vColor.rgb;
|
|
292
|
+
#endif
|
|
293
|
+
#ifdef DETAIL
|
|
294
|
+
baseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);
|
|
295
|
+
#endif
|
|
296
|
+
#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)
|
|
297
|
+
vec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);
|
|
298
|
+
#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)
|
|
299
|
+
#endif
|
|
300
|
+
#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE
|
|
301
|
+
vec3 baseAmbientColor=vec3(1.,1.,1.);
|
|
302
|
+
#ifdef AMBIENT
|
|
303
|
+
baseAmbientColor=TEXRD(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;
|
|
304
|
+
#endif
|
|
305
|
+
#define CUSTOM_FRAGMENT_BEFORE_LIGHTS
|
|
306
|
+
float glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;
|
|
307
|
+
#ifdef SPECULARTERM
|
|
308
|
+
#ifdef SPECULAR
|
|
309
|
+
vec4 specularMapColor=TEXRD(specularSampler,vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;
|
|
310
|
+
#ifdef GLOSSINESS
|
|
311
|
+
glossiness=glossiness*specularMapColor.a;
|
|
312
|
+
#endif
|
|
313
|
+
#endif
|
|
314
|
+
#endif
|
|
315
|
+
vec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;
|
|
316
|
+
#ifdef SPECULARTERM
|
|
317
|
+
vec3 specularBase=vec3(0.,0.,0.);
|
|
318
|
+
#endif
|
|
319
|
+
float shadow=1.;float aggShadow=0.;float numLights=0.;
|
|
320
|
+
#ifdef LIGHTMAP
|
|
321
|
+
vec4 lightmapColor=TEXRD(lightmapSampler,vLightmapUV+uvOffset);
|
|
322
|
+
#ifdef RGBDLIGHTMAP
|
|
323
|
+
lightmapColor.rgb=fromRGBD(lightmapColor);
|
|
324
|
+
#endif
|
|
325
|
+
lightmapColor.rgb*=vLightmapInfos.y;
|
|
326
|
+
#endif
|
|
327
|
+
#include<lightFragment>[0..maxSimultaneousLights]
|
|
328
|
+
aggShadow=aggShadow/numLights;vec4 refractionColor=vec4(0.,0.,0.,1.);
|
|
329
|
+
#ifdef REFRACTION
|
|
330
|
+
vec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));
|
|
331
|
+
#ifdef REFRACTIONMAP_3D
|
|
332
|
+
#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC
|
|
333
|
+
refractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);
|
|
334
|
+
#endif
|
|
335
|
+
refractionVector.y=refractionVector.y*vRefractionInfos.w;vec4 refractionLookup=textureCube(refractionCubeSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}
|
|
336
|
+
#else
|
|
337
|
+
vec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));vec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;refractionCoords.y=1.0-refractionCoords.y;refractionColor=texture2D(refraction2DSampler,refractionCoords);
|
|
338
|
+
#endif
|
|
339
|
+
#ifdef RGBDREFRACTION
|
|
340
|
+
refractionColor.rgb=fromRGBD(refractionColor);
|
|
341
|
+
#endif
|
|
342
|
+
#ifdef IS_REFRACTION_LINEAR
|
|
343
|
+
refractionColor.rgb=toGammaSpace(refractionColor.rgb);
|
|
344
|
+
#endif
|
|
345
|
+
refractionColor.rgb*=vRefractionInfos.x;
|
|
346
|
+
#endif
|
|
347
|
+
vec4 reflectionColor=vec4(0.,0.,0.,1.);
|
|
348
|
+
#ifdef REFLECTION
|
|
349
|
+
vec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
|
|
350
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
351
|
+
vReflectionUVW.z*=-1.0;
|
|
352
|
+
#endif
|
|
353
|
+
#ifdef REFLECTIONMAP_3D
|
|
354
|
+
#ifdef ROUGHNESS
|
|
355
|
+
float bias=vReflectionInfos.y;
|
|
356
|
+
#ifdef SPECULARTERM
|
|
357
|
+
#ifdef SPECULAR
|
|
358
|
+
#ifdef GLOSSINESS
|
|
359
|
+
bias*=(1.0-specularMapColor.a);
|
|
360
|
+
#endif
|
|
361
|
+
#endif
|
|
362
|
+
#endif
|
|
363
|
+
reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);
|
|
364
|
+
#else
|
|
365
|
+
reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);
|
|
366
|
+
#endif
|
|
367
|
+
#else
|
|
368
|
+
vec2 coords=vReflectionUVW.xy;
|
|
369
|
+
#ifdef REFLECTIONMAP_PROJECTION
|
|
370
|
+
coords/=vReflectionUVW.z;
|
|
371
|
+
#endif
|
|
372
|
+
coords.y=1.0-coords.y;reflectionColor=texture2D(reflection2DSampler,coords);
|
|
373
|
+
#endif
|
|
374
|
+
#ifdef RGBDREFLECTION
|
|
375
|
+
reflectionColor.rgb=fromRGBD(reflectionColor);
|
|
376
|
+
#endif
|
|
377
|
+
#ifdef IS_REFLECTION_LINEAR
|
|
378
|
+
reflectionColor.rgb=toGammaSpace(reflectionColor.rgb);
|
|
379
|
+
#endif
|
|
380
|
+
reflectionColor.rgb*=vReflectionInfos.x;
|
|
381
|
+
#ifdef REFLECTIONFRESNEL
|
|
382
|
+
float reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);
|
|
383
|
+
#ifdef REFLECTIONFRESNELFROMSPECULAR
|
|
384
|
+
#ifdef SPECULARTERM
|
|
385
|
+
reflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
|
|
386
|
+
#else
|
|
387
|
+
reflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
|
|
388
|
+
#endif
|
|
389
|
+
#else
|
|
390
|
+
reflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
|
|
391
|
+
#endif
|
|
392
|
+
#endif
|
|
393
|
+
#endif
|
|
394
|
+
#ifdef REFRACTIONFRESNEL
|
|
395
|
+
float refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);refractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;
|
|
396
|
+
#endif
|
|
397
|
+
#ifdef OPACITY
|
|
398
|
+
vec4 opacityMap=TEXRD(opacitySampler,vOpacityUV+uvOffset);
|
|
399
|
+
#ifdef OPACITYRGB
|
|
400
|
+
opacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;
|
|
401
|
+
#else
|
|
402
|
+
alpha*=opacityMap.a*vOpacityInfos.y;
|
|
403
|
+
#endif
|
|
404
|
+
#endif
|
|
405
|
+
#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
406
|
+
alpha*=vColor.a;
|
|
407
|
+
#endif
|
|
408
|
+
#ifdef OPACITYFRESNEL
|
|
409
|
+
float opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;
|
|
410
|
+
#endif
|
|
411
|
+
#ifdef ALPHATEST
|
|
412
|
+
#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS
|
|
413
|
+
if (alpha<alphaCutOff)
|
|
414
|
+
discard;
|
|
415
|
+
#endif
|
|
416
|
+
#ifndef ALPHABLEND
|
|
417
|
+
alpha=1.0;
|
|
418
|
+
#endif
|
|
419
|
+
#endif
|
|
420
|
+
vec3 emissiveColor=vEmissiveColor;
|
|
421
|
+
#ifdef EMISSIVE
|
|
422
|
+
emissiveColor+=TEXRD(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;
|
|
423
|
+
#endif
|
|
424
|
+
#ifdef EMISSIVEFRESNEL
|
|
425
|
+
float emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);emissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;
|
|
426
|
+
#endif
|
|
427
|
+
#ifdef DIFFUSEFRESNEL
|
|
428
|
+
float diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);diffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;
|
|
429
|
+
#endif
|
|
430
|
+
#ifdef EMISSIVEASILLUMINATION
|
|
431
|
+
vec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;
|
|
432
|
+
#else
|
|
433
|
+
#ifdef LINKEMISSIVEWITHDIFFUSE
|
|
434
|
+
vec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;
|
|
435
|
+
#else
|
|
436
|
+
vec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;
|
|
437
|
+
#endif
|
|
438
|
+
#endif
|
|
439
|
+
#ifdef SPECULARTERM
|
|
440
|
+
vec3 finalSpecular=specularBase*specularColor;
|
|
441
|
+
#ifdef SPECULAROVERALPHA
|
|
442
|
+
alpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);
|
|
443
|
+
#endif
|
|
444
|
+
#else
|
|
445
|
+
vec3 finalSpecular=vec3(0.0);
|
|
446
|
+
#endif
|
|
447
|
+
#ifdef REFLECTIONOVERALPHA
|
|
448
|
+
alpha=clamp(alpha+dot(reflectionColor.rgb,vec3(0.3,0.59,0.11)),0.,1.);
|
|
449
|
+
#endif
|
|
450
|
+
#ifdef EMISSIVEASILLUMINATION
|
|
451
|
+
vec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+emissiveColor+refractionColor.rgb,0.0,1.0),alpha);
|
|
452
|
+
#else
|
|
453
|
+
vec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+refractionColor.rgb,alpha);
|
|
454
|
+
#endif
|
|
455
|
+
#ifdef LIGHTMAP
|
|
456
|
+
#ifndef LIGHTMAPEXCLUDED
|
|
457
|
+
#ifdef USELIGHTMAPASSHADOWMAP
|
|
458
|
+
color.rgb*=lightmapColor.rgb;
|
|
459
|
+
#else
|
|
460
|
+
color.rgb+=lightmapColor.rgb;
|
|
461
|
+
#endif
|
|
462
|
+
#endif
|
|
463
|
+
#endif
|
|
464
|
+
#define CUSTOM_FRAGMENT_BEFORE_FOG
|
|
465
|
+
color.rgb=max(color.rgb,0.);
|
|
466
|
+
#include<logDepthFragment>
|
|
467
|
+
#include<fogFragment>
|
|
468
|
+
#ifdef IMAGEPROCESSINGPOSTPROCESS
|
|
469
|
+
color.rgb=toLinearSpace(color.rgb);
|
|
470
|
+
#else
|
|
471
|
+
#ifdef IMAGEPROCESSING
|
|
472
|
+
color.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color);
|
|
473
|
+
#endif
|
|
474
|
+
#endif
|
|
475
|
+
color.a*=visibility;
|
|
476
|
+
#ifdef PREMULTIPLYALPHA
|
|
477
|
+
color.rgb*=color.a;
|
|
478
|
+
#endif
|
|
479
|
+
#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
|
|
480
|
+
#ifdef PREPASS
|
|
481
|
+
#if SCENE_MRT_COUNT>0
|
|
482
|
+
float writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;
|
|
483
|
+
#ifdef PREPASS_COLOR
|
|
484
|
+
gl_FragData[PREPASS_COLOR_INDEX]=color;
|
|
485
|
+
#endif
|
|
486
|
+
#ifdef PREPASS_POSITION
|
|
487
|
+
gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);
|
|
488
|
+
#endif
|
|
489
|
+
#ifdef PREPASS_LOCAL_POSITION
|
|
490
|
+
gl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);
|
|
491
|
+
#endif
|
|
492
|
+
#if defined(PREPASS_VELOCITY)
|
|
493
|
+
vec2 a=(vCurrentPosition.xy/vCurrentPosition.w)*0.5+0.5;vec2 b=(vPreviousPosition.xy/vPreviousPosition.w)*0.5+0.5;vec2 velocity=abs(a-b);velocity=vec2(pow(velocity.x,1.0/3.0),pow(velocity.y,1.0/3.0))*sign(a-b)*0.5+0.5;gl_FragData[PREPASS_VELOCITY_INDEX]=vec4(velocity,0.0,writeGeometryInfo);
|
|
494
|
+
#elif defined(PREPASS_VELOCITY_LINEAR)
|
|
495
|
+
vec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);
|
|
496
|
+
#endif
|
|
497
|
+
#ifdef PREPASS_IRRADIANCE
|
|
498
|
+
gl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo);
|
|
499
|
+
#endif
|
|
500
|
+
#ifdef PREPASS_DEPTH
|
|
501
|
+
gl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo);
|
|
502
|
+
#endif
|
|
503
|
+
#ifdef PREPASS_SCREENSPACE_DEPTH
|
|
504
|
+
gl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);
|
|
505
|
+
#endif
|
|
506
|
+
#ifdef PREPASS_NORMALIZED_VIEW_DEPTH
|
|
507
|
+
gl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);
|
|
508
|
+
#endif
|
|
509
|
+
#ifdef PREPASS_NORMAL
|
|
510
|
+
#ifdef PREPASS_NORMAL_WORLDSPACE
|
|
511
|
+
gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);
|
|
512
|
+
#else
|
|
513
|
+
gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);
|
|
514
|
+
#endif
|
|
515
|
+
#endif
|
|
516
|
+
#ifdef PREPASS_WORLD_NORMAL
|
|
517
|
+
gl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo);
|
|
518
|
+
#endif
|
|
519
|
+
#ifdef PREPASS_ALBEDO
|
|
520
|
+
gl_FragData[PREPASS_ALBEDO_INDEX]=vec4(baseColor.rgb,writeGeometryInfo);
|
|
521
|
+
#endif
|
|
522
|
+
#ifdef PREPASS_ALBEDO_SQRT
|
|
523
|
+
gl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqrt(baseColor.rgb),writeGeometryInfo);
|
|
524
|
+
#endif
|
|
525
|
+
#ifdef PREPASS_REFLECTIVITY
|
|
526
|
+
#if defined(SPECULAR)
|
|
527
|
+
gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularMapColor))*writeGeometryInfo;
|
|
528
|
+
#else
|
|
529
|
+
gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularColor),1.0)*writeGeometryInfo;
|
|
530
|
+
#endif
|
|
531
|
+
#endif
|
|
532
|
+
#endif
|
|
533
|
+
#endif
|
|
534
|
+
#if !defined(PREPASS) || defined(WEBGL2)
|
|
535
|
+
gl_FragColor=color;
|
|
536
|
+
#endif
|
|
537
|
+
#include<oitFragment>
|
|
538
|
+
#if ORDER_INDEPENDENT_TRANSPARENCY
|
|
539
|
+
if (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-color.a);} else {backColor+=color;}
|
|
540
|
+
#endif
|
|
541
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
542
|
+
}
|
|
543
|
+
`;
|
|
544
|
+
e.ShadersStore[i] || (e.ShadersStore[i] = n);
|
|
545
|
+
const m = { name: i, shader: n };
|
|
546
|
+
export {
|
|
547
|
+
m as defaultPixelShader
|
|
548
|
+
};
|