@graphty/graphty-element 1.0.1
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/README.md +9 -0
- package/dist/basisTextureLoader-BqIvxvNl.js +312 -0
- package/dist/basisTextureLoader-BqIvxvNl.js.map +1 -0
- package/dist/custom-elements.json +1 -0
- package/dist/dds-BlAaKjyJ.js +357 -0
- package/dist/dds-BlAaKjyJ.js.map +1 -0
- package/dist/ddsTextureLoader-D7Jh83wc.js +44 -0
- package/dist/ddsTextureLoader-D7Jh83wc.js.map +1 -0
- package/dist/default.fragment-BNc4beoN.js +452 -0
- package/dist/default.fragment-BNc4beoN.js.map +1 -0
- package/dist/default.fragment-CSeCDRwv.js +512 -0
- package/dist/default.fragment-CSeCDRwv.js.map +1 -0
- package/dist/default.vertex-9pBFrn06.js +202 -0
- package/dist/default.vertex-9pBFrn06.js.map +1 -0
- package/dist/default.vertex-DDjK1DRv.js +185 -0
- package/dist/default.vertex-DDjK1DRv.js.map +1 -0
- package/dist/defaultUboDeclaration-CG47IDRY.js +9 -0
- package/dist/defaultUboDeclaration-CG47IDRY.js.map +1 -0
- package/dist/defaultUboDeclaration-Ct5CiQ-w.js +11 -0
- package/dist/defaultUboDeclaration-Ct5CiQ-w.js.map +1 -0
- package/dist/dumpTools-DA1xMSIZ.js +103 -0
- package/dist/dumpTools-DA1xMSIZ.js.map +1 -0
- package/dist/envTextureLoader-DdCLpySN.js +238 -0
- package/dist/envTextureLoader-DdCLpySN.js.map +1 -0
- package/dist/exrTextureLoader-CnJSRQ9w.js +741 -0
- package/dist/exrTextureLoader-CnJSRQ9w.js.map +1 -0
- package/dist/graphty.js +12 -0
- package/dist/graphty.js.map +1 -0
- package/dist/graphty.umd.cjs +12657 -0
- package/dist/graphty.umd.cjs.map +1 -0
- package/dist/greasedLine.fragment-BZnGGe-r.js +30 -0
- package/dist/greasedLine.fragment-BZnGGe-r.js.map +1 -0
- package/dist/greasedLine.fragment-DixuqXus.js +12 -0
- package/dist/greasedLine.fragment-DixuqXus.js.map +1 -0
- package/dist/greasedLine.vertex-BhhwFKPy.js +33 -0
- package/dist/greasedLine.vertex-BhhwFKPy.js.map +1 -0
- package/dist/greasedLine.vertex-DIhgGSOi.js +49 -0
- package/dist/greasedLine.vertex-DIhgGSOi.js.map +1 -0
- package/dist/harmonicsFunctions-B9jTNKTF.js +197 -0
- package/dist/harmonicsFunctions-B9jTNKTF.js.map +1 -0
- package/dist/harmonicsFunctions-D9ZL5yLA.js +194 -0
- package/dist/harmonicsFunctions-D9ZL5yLA.js.map +1 -0
- package/dist/hdrTextureLoader-DreWCvHD.js +112 -0
- package/dist/hdrTextureLoader-DreWCvHD.js.map +1 -0
- package/dist/helperFunctions-Dh1WD8YN.js +106 -0
- package/dist/helperFunctions-Dh1WD8YN.js.map +1 -0
- package/dist/helperFunctions-ZBnqb-in.js +79 -0
- package/dist/helperFunctions-ZBnqb-in.js.map +1 -0
- package/dist/iesTextureLoader-JdfAyRK-.js +94 -0
- package/dist/iesTextureLoader-JdfAyRK-.js.map +1 -0
- package/dist/index-ChGTkj2q.js +62191 -0
- package/dist/index-ChGTkj2q.js.map +1 -0
- package/dist/instancesVertex-BrWNnWxF.js +46 -0
- package/dist/instancesVertex-BrWNnWxF.js.map +1 -0
- package/dist/instancesVertex-evcSIvCA.js +55 -0
- package/dist/instancesVertex-evcSIvCA.js.map +1 -0
- package/dist/ktxTextureLoader-Dg1h0a-4.js +520 -0
- package/dist/ktxTextureLoader-Dg1h0a-4.js.map +1 -0
- package/dist/logDepthDeclaration-BHUUDd5l.js +12 -0
- package/dist/logDepthDeclaration-BHUUDd5l.js.map +1 -0
- package/dist/logDepthDeclaration-Bou5AJOP.js +28 -0
- package/dist/logDepthDeclaration-Bou5AJOP.js.map +1 -0
- package/dist/logDepthVertex-CCFGLExi.js +496 -0
- package/dist/logDepthVertex-CCFGLExi.js.map +1 -0
- package/dist/logDepthVertex-r_niddz9.js +496 -0
- package/dist/logDepthVertex-r_niddz9.js.map +1 -0
- package/dist/mesh.vertexData.functions-Bc9lJlrU.js +75 -0
- package/dist/mesh.vertexData.functions-Bc9lJlrU.js.map +1 -0
- package/dist/meshUboDeclaration-Dg__Mhmj.js +18 -0
- package/dist/meshUboDeclaration-Dg__Mhmj.js.map +1 -0
- package/dist/oitFragment-Bn29Ggvj.js +1191 -0
- package/dist/oitFragment-Bn29Ggvj.js.map +1 -0
- package/dist/oitFragment-D6JBEGk0.js +1328 -0
- package/dist/oitFragment-D6JBEGk0.js.map +1 -0
- package/dist/pass.fragment-C9O4ZLJL.js +11 -0
- package/dist/pass.fragment-C9O4ZLJL.js.map +1 -0
- package/dist/pass.fragment-Cf0ob1Y3.js +11 -0
- package/dist/pass.fragment-Cf0ob1Y3.js.map +1 -0
- package/dist/passCube.fragment-Mg8Qj5T9.js +30 -0
- package/dist/passCube.fragment-Mg8Qj5T9.js.map +1 -0
- package/dist/passCube.fragment-uM4B7TOI.js +30 -0
- package/dist/passCube.fragment-uM4B7TOI.js.map +1 -0
- package/dist/pbr.fragment-C8Lm3cwF.js +3176 -0
- package/dist/pbr.fragment-C8Lm3cwF.js.map +1 -0
- package/dist/pbr.fragment-siOdCYqI.js +3219 -0
- package/dist/pbr.fragment-siOdCYqI.js.map +1 -0
- package/dist/pbr.vertex-Bw_TrGQv.js +229 -0
- package/dist/pbr.vertex-Bw_TrGQv.js.map +1 -0
- package/dist/pbr.vertex-CmEPCcBW.js +365 -0
- package/dist/pbr.vertex-CmEPCcBW.js.map +1 -0
- package/dist/postprocess.vertex-B086G8mM.js +16 -0
- package/dist/postprocess.vertex-B086G8mM.js.map +1 -0
- package/dist/rgbdDecode.fragment-bNaGtQ-x.js +9 -0
- package/dist/rgbdDecode.fragment-bNaGtQ-x.js.map +1 -0
- package/dist/rgbdDecode.fragment-koAcppx0.js +9 -0
- package/dist/rgbdDecode.fragment-koAcppx0.js.map +1 -0
- package/dist/rgbdEncode.fragment-BDHL2P_i.js +9 -0
- package/dist/rgbdEncode.fragment-BDHL2P_i.js.map +1 -0
- package/dist/rgbdEncode.fragment-Dw0FS9aH.js +9 -0
- package/dist/rgbdEncode.fragment-Dw0FS9aH.js.map +1 -0
- package/dist/tgaTextureLoader-DIfkfgQh.js +199 -0
- package/dist/tgaTextureLoader-DIfkfgQh.js.map +1 -0
- package/package.json +124 -0
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
import { S as e } from "./index-ChGTkj2q.js";
|
|
2
|
+
import "./oitFragment-D6JBEGk0.js";
|
|
3
|
+
import "./defaultUboDeclaration-Ct5CiQ-w.js";
|
|
4
|
+
import "./logDepthDeclaration-Bou5AJOP.js";
|
|
5
|
+
import "./helperFunctions-Dh1WD8YN.js";
|
|
6
|
+
const o = "defaultFragmentDeclaration", t = `uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 vSpecularColor;uniform vec3 vEmissiveColor;uniform vec3 vAmbientColor;uniform float visibility;
|
|
7
|
+
#ifdef DIFFUSE
|
|
8
|
+
uniform vec2 vDiffuseInfos;
|
|
9
|
+
#endif
|
|
10
|
+
#ifdef AMBIENT
|
|
11
|
+
uniform vec2 vAmbientInfos;
|
|
12
|
+
#endif
|
|
13
|
+
#ifdef OPACITY
|
|
14
|
+
uniform vec2 vOpacityInfos;
|
|
15
|
+
#endif
|
|
16
|
+
#ifdef EMISSIVE
|
|
17
|
+
uniform vec2 vEmissiveInfos;
|
|
18
|
+
#endif
|
|
19
|
+
#ifdef LIGHTMAP
|
|
20
|
+
uniform vec2 vLightmapInfos;
|
|
21
|
+
#endif
|
|
22
|
+
#ifdef BUMP
|
|
23
|
+
uniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;
|
|
24
|
+
#endif
|
|
25
|
+
#ifdef ALPHATEST
|
|
26
|
+
uniform float alphaCutOff;
|
|
27
|
+
#endif
|
|
28
|
+
#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS)
|
|
29
|
+
uniform mat4 view;
|
|
30
|
+
#endif
|
|
31
|
+
#ifdef REFRACTION
|
|
32
|
+
uniform vec4 vRefractionInfos;
|
|
33
|
+
#ifndef REFRACTIONMAP_3D
|
|
34
|
+
uniform mat4 refractionMatrix;
|
|
35
|
+
#endif
|
|
36
|
+
#ifdef REFRACTIONFRESNEL
|
|
37
|
+
uniform vec4 refractionLeftColor;uniform vec4 refractionRightColor;
|
|
38
|
+
#endif
|
|
39
|
+
#if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D)
|
|
40
|
+
uniform vec3 vRefractionPosition;uniform vec3 vRefractionSize;
|
|
41
|
+
#endif
|
|
42
|
+
#endif
|
|
43
|
+
#if defined(SPECULAR) && defined(SPECULARTERM)
|
|
44
|
+
uniform vec2 vSpecularInfos;
|
|
45
|
+
#endif
|
|
46
|
+
#ifdef DIFFUSEFRESNEL
|
|
47
|
+
uniform vec4 diffuseLeftColor;uniform vec4 diffuseRightColor;
|
|
48
|
+
#endif
|
|
49
|
+
#ifdef OPACITYFRESNEL
|
|
50
|
+
uniform vec4 opacityParts;
|
|
51
|
+
#endif
|
|
52
|
+
#ifdef EMISSIVEFRESNEL
|
|
53
|
+
uniform vec4 emissiveLeftColor;uniform vec4 emissiveRightColor;
|
|
54
|
+
#endif
|
|
55
|
+
#if defined(REFLECTION) || (defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED))
|
|
56
|
+
uniform vec2 vReflectionInfos;
|
|
57
|
+
#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)
|
|
58
|
+
uniform mat4 reflectionMatrix;
|
|
59
|
+
#endif
|
|
60
|
+
#ifndef REFLECTIONMAP_SKYBOX
|
|
61
|
+
#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)
|
|
62
|
+
uniform vec3 vReflectionPosition;uniform vec3 vReflectionSize;
|
|
63
|
+
#endif
|
|
64
|
+
#endif
|
|
65
|
+
#ifdef REFLECTIONFRESNEL
|
|
66
|
+
uniform vec4 reflectionLeftColor;uniform vec4 reflectionRightColor;
|
|
67
|
+
#endif
|
|
68
|
+
#endif
|
|
69
|
+
#ifdef DETAIL
|
|
70
|
+
uniform vec4 vDetailInfos;
|
|
71
|
+
#endif
|
|
72
|
+
#include<decalFragmentDeclaration>
|
|
73
|
+
#define ADDITIONAL_FRAGMENT_DECLARATION
|
|
74
|
+
`;
|
|
75
|
+
e.IncludesShadersStore[o] || (e.IncludesShadersStore[o] = t);
|
|
76
|
+
const r = "lightsFragmentFunctions", l = `struct lightingInfo
|
|
77
|
+
{vec3 diffuse;
|
|
78
|
+
#ifdef SPECULARTERM
|
|
79
|
+
vec3 specular;
|
|
80
|
+
#endif
|
|
81
|
+
#ifdef NDOTL
|
|
82
|
+
float ndl;
|
|
83
|
+
#endif
|
|
84
|
+
};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.)
|
|
85
|
+
{vec3 direction=lightData.xyz-vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}
|
|
86
|
+
else
|
|
87
|
+
{lightVectorW=normalize(-lightData.xyz);}
|
|
88
|
+
float ndl=max(0.,dot(vNormal,lightVectorW));
|
|
89
|
+
#ifdef NDOTL
|
|
90
|
+
result.ndl=ndl;
|
|
91
|
+
#endif
|
|
92
|
+
result.diffuse=ndl*diffuseColor*attenuation;
|
|
93
|
+
#ifdef SPECULARTERM
|
|
94
|
+
vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
|
|
95
|
+
#endif
|
|
96
|
+
return result;}
|
|
97
|
+
float getAttenuation(float cosAngle,float exponent) {return max(0.,pow(cosAngle,exponent));}
|
|
98
|
+
float getIESAttenuation(float cosAngle,sampler2D iesLightSampler) {float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}
|
|
99
|
+
lightingInfo basicSpotLighting(vec3 viewDirectionW,vec3 lightVectorW,vec3 vNormal,float attenuation,vec3 diffuseColor,vec3 specularColor,float glossiness) {lightingInfo result;
|
|
100
|
+
float ndl=max(0.,dot(vNormal,lightVectorW));
|
|
101
|
+
#ifdef NDOTL
|
|
102
|
+
result.ndl=ndl;
|
|
103
|
+
#endif
|
|
104
|
+
result.diffuse=ndl*diffuseColor*attenuation;
|
|
105
|
+
#ifdef SPECULARTERM
|
|
106
|
+
vec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;
|
|
107
|
+
#endif
|
|
108
|
+
return result;}
|
|
109
|
+
lightingInfo computeIESSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness,sampler2D iesLightSampler) {
|
|
110
|
+
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)
|
|
111
|
+
{
|
|
112
|
+
attenuation*=getIESAttenuation(dotProduct,iesLightSampler);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
|
|
113
|
+
lightingInfo result;result.diffuse=vec3(0.);
|
|
114
|
+
#ifdef SPECULARTERM
|
|
115
|
+
result.specular=vec3(0.);
|
|
116
|
+
#endif
|
|
117
|
+
#ifdef NDOTL
|
|
118
|
+
result.ndl=0.;
|
|
119
|
+
#endif
|
|
120
|
+
return result;}
|
|
121
|
+
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)
|
|
122
|
+
{
|
|
123
|
+
attenuation*=getAttenuation(cosAngle,lightData.w);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}
|
|
124
|
+
lightingInfo result;result.diffuse=vec3(0.);
|
|
125
|
+
#ifdef SPECULARTERM
|
|
126
|
+
result.specular=vec3(0.);
|
|
127
|
+
#endif
|
|
128
|
+
#ifdef NDOTL
|
|
129
|
+
result.ndl=0.;
|
|
130
|
+
#endif
|
|
131
|
+
return result;}
|
|
132
|
+
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;
|
|
133
|
+
#ifdef NDOTL
|
|
134
|
+
result.ndl=ndl;
|
|
135
|
+
#endif
|
|
136
|
+
result.diffuse=mix(groundColor,diffuseColor,ndl);
|
|
137
|
+
#ifdef SPECULARTERM
|
|
138
|
+
vec3 angleW=normalize(viewDirectionW+lightData.xyz);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;
|
|
139
|
+
#endif
|
|
140
|
+
return result;}
|
|
141
|
+
#define inline
|
|
142
|
+
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;}
|
|
143
|
+
#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)
|
|
144
|
+
#include<ltcHelperFunctions>
|
|
145
|
+
uniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;
|
|
146
|
+
#define inline
|
|
147
|
+
lightingInfo computeAreaLighting(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness)
|
|
148
|
+
{lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);
|
|
149
|
+
#ifdef SPECULARTERM
|
|
150
|
+
vec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;
|
|
151
|
+
#endif
|
|
152
|
+
result.diffuse+=diffuseColor*data.Diffuse;return result;}
|
|
153
|
+
#endif
|
|
154
|
+
`;
|
|
155
|
+
e.IncludesShadersStore[r] || (e.IncludesShadersStore[r] = l);
|
|
156
|
+
const f = "fresnelFunction", a = `#ifdef FRESNEL
|
|
157
|
+
float computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)
|
|
158
|
+
{float fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}
|
|
159
|
+
#endif
|
|
160
|
+
`;
|
|
161
|
+
e.IncludesShadersStore[f] || (e.IncludesShadersStore[f] = a);
|
|
162
|
+
const i = "defaultPixelShader", n = `#define CUSTOM_FRAGMENT_EXTENSION
|
|
163
|
+
#include<__decl__defaultFragment>
|
|
164
|
+
#if defined(BUMP) || !defined(NORMAL)
|
|
165
|
+
#extension GL_OES_standard_derivatives : enable
|
|
166
|
+
#endif
|
|
167
|
+
#include<prePassDeclaration>[SCENE_MRT_COUNT]
|
|
168
|
+
#include<oitDeclaration>
|
|
169
|
+
#define CUSTOM_FRAGMENT_BEGIN
|
|
170
|
+
#ifdef LOGARITHMICDEPTH
|
|
171
|
+
#extension GL_EXT_frag_depth : enable
|
|
172
|
+
#endif
|
|
173
|
+
varying vec3 vPositionW;
|
|
174
|
+
#ifdef NORMAL
|
|
175
|
+
varying vec3 vNormalW;
|
|
176
|
+
#endif
|
|
177
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
178
|
+
varying vec4 vColor;
|
|
179
|
+
#endif
|
|
180
|
+
#include<mainUVVaryingDeclaration>[1..7]
|
|
181
|
+
#include<helperFunctions>
|
|
182
|
+
#include<__decl__lightFragment>[0..maxSimultaneousLights]
|
|
183
|
+
#include<lightsFragmentFunctions>
|
|
184
|
+
#include<shadowsFragmentFunctions>
|
|
185
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)
|
|
186
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)
|
|
187
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)
|
|
188
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)
|
|
189
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)
|
|
190
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)
|
|
191
|
+
#ifdef REFRACTION
|
|
192
|
+
#ifdef REFRACTIONMAP_3D
|
|
193
|
+
uniform samplerCube refractionCubeSampler;
|
|
194
|
+
#else
|
|
195
|
+
uniform sampler2D refraction2DSampler;
|
|
196
|
+
#endif
|
|
197
|
+
#endif
|
|
198
|
+
#if defined(SPECULARTERM)
|
|
199
|
+
#include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)
|
|
200
|
+
#endif
|
|
201
|
+
#include<fresnelFunction>
|
|
202
|
+
#ifdef REFLECTION
|
|
203
|
+
#ifdef REFLECTIONMAP_3D
|
|
204
|
+
uniform samplerCube reflectionCubeSampler;
|
|
205
|
+
#else
|
|
206
|
+
uniform sampler2D reflection2DSampler;
|
|
207
|
+
#endif
|
|
208
|
+
#ifdef REFLECTIONMAP_SKYBOX
|
|
209
|
+
varying vec3 vPositionUVW;
|
|
210
|
+
#else
|
|
211
|
+
#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)
|
|
212
|
+
varying vec3 vDirectionW;
|
|
213
|
+
#endif
|
|
214
|
+
#endif
|
|
215
|
+
#include<reflectionFunction>
|
|
216
|
+
#endif
|
|
217
|
+
#include<imageProcessingDeclaration>
|
|
218
|
+
#include<imageProcessingFunctions>
|
|
219
|
+
#include<bumpFragmentMainFunctions>
|
|
220
|
+
#include<bumpFragmentFunctions>
|
|
221
|
+
#include<clipPlaneFragmentDeclaration>
|
|
222
|
+
#include<logDepthDeclaration>
|
|
223
|
+
#include<fogFragmentDeclaration>
|
|
224
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
225
|
+
void main(void) {
|
|
226
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
227
|
+
#include<clipPlaneFragment>
|
|
228
|
+
vec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;
|
|
229
|
+
#ifdef NORMAL
|
|
230
|
+
vec3 normalW=normalize(vNormalW);
|
|
231
|
+
#else
|
|
232
|
+
vec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));
|
|
233
|
+
#endif
|
|
234
|
+
#include<bumpFragment>
|
|
235
|
+
#ifdef TWOSIDEDLIGHTING
|
|
236
|
+
normalW=gl_FrontFacing ? normalW : -normalW;
|
|
237
|
+
#endif
|
|
238
|
+
#ifdef DIFFUSE
|
|
239
|
+
baseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);
|
|
240
|
+
#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)
|
|
241
|
+
if (baseColor.a<alphaCutOff)
|
|
242
|
+
discard;
|
|
243
|
+
#endif
|
|
244
|
+
#ifdef ALPHAFROMDIFFUSE
|
|
245
|
+
alpha*=baseColor.a;
|
|
246
|
+
#endif
|
|
247
|
+
#define CUSTOM_FRAGMENT_UPDATE_ALPHA
|
|
248
|
+
baseColor.rgb*=vDiffuseInfos.y;
|
|
249
|
+
#endif
|
|
250
|
+
#if defined(DECAL) && !defined(DECAL_AFTER_DETAIL)
|
|
251
|
+
vec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);
|
|
252
|
+
#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)
|
|
253
|
+
#endif
|
|
254
|
+
#include<depthPrePass>
|
|
255
|
+
#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
256
|
+
baseColor.rgb*=vColor.rgb;
|
|
257
|
+
#endif
|
|
258
|
+
#ifdef DETAIL
|
|
259
|
+
baseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);
|
|
260
|
+
#endif
|
|
261
|
+
#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)
|
|
262
|
+
vec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);
|
|
263
|
+
#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)
|
|
264
|
+
#endif
|
|
265
|
+
#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE
|
|
266
|
+
vec3 baseAmbientColor=vec3(1.,1.,1.);
|
|
267
|
+
#ifdef AMBIENT
|
|
268
|
+
baseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;
|
|
269
|
+
#endif
|
|
270
|
+
#define CUSTOM_FRAGMENT_BEFORE_LIGHTS
|
|
271
|
+
float glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;
|
|
272
|
+
#ifdef SPECULARTERM
|
|
273
|
+
#ifdef SPECULAR
|
|
274
|
+
vec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;
|
|
275
|
+
#ifdef GLOSSINESS
|
|
276
|
+
glossiness=glossiness*specularMapColor.a;
|
|
277
|
+
#endif
|
|
278
|
+
#endif
|
|
279
|
+
#endif
|
|
280
|
+
vec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;
|
|
281
|
+
#ifdef SPECULARTERM
|
|
282
|
+
vec3 specularBase=vec3(0.,0.,0.);
|
|
283
|
+
#endif
|
|
284
|
+
float shadow=1.;float aggShadow=0.;float numLights=0.;
|
|
285
|
+
#ifdef LIGHTMAP
|
|
286
|
+
vec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);
|
|
287
|
+
#ifdef RGBDLIGHTMAP
|
|
288
|
+
lightmapColor.rgb=fromRGBD(lightmapColor);
|
|
289
|
+
#endif
|
|
290
|
+
lightmapColor.rgb*=vLightmapInfos.y;
|
|
291
|
+
#endif
|
|
292
|
+
#include<lightFragment>[0..maxSimultaneousLights]
|
|
293
|
+
aggShadow=aggShadow/numLights;vec4 refractionColor=vec4(0.,0.,0.,1.);
|
|
294
|
+
#ifdef REFRACTION
|
|
295
|
+
vec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));
|
|
296
|
+
#ifdef REFRACTIONMAP_3D
|
|
297
|
+
#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC
|
|
298
|
+
refractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);
|
|
299
|
+
#endif
|
|
300
|
+
refractionVector.y=refractionVector.y*vRefractionInfos.w;vec4 refractionLookup=textureCube(refractionCubeSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}
|
|
301
|
+
#else
|
|
302
|
+
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);
|
|
303
|
+
#endif
|
|
304
|
+
#ifdef RGBDREFRACTION
|
|
305
|
+
refractionColor.rgb=fromRGBD(refractionColor);
|
|
306
|
+
#endif
|
|
307
|
+
#ifdef IS_REFRACTION_LINEAR
|
|
308
|
+
refractionColor.rgb=toGammaSpace(refractionColor.rgb);
|
|
309
|
+
#endif
|
|
310
|
+
refractionColor.rgb*=vRefractionInfos.x;
|
|
311
|
+
#endif
|
|
312
|
+
vec4 reflectionColor=vec4(0.,0.,0.,1.);
|
|
313
|
+
#ifdef REFLECTION
|
|
314
|
+
vec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);
|
|
315
|
+
#ifdef REFLECTIONMAP_OPPOSITEZ
|
|
316
|
+
vReflectionUVW.z*=-1.0;
|
|
317
|
+
#endif
|
|
318
|
+
#ifdef REFLECTIONMAP_3D
|
|
319
|
+
#ifdef ROUGHNESS
|
|
320
|
+
float bias=vReflectionInfos.y;
|
|
321
|
+
#ifdef SPECULARTERM
|
|
322
|
+
#ifdef SPECULAR
|
|
323
|
+
#ifdef GLOSSINESS
|
|
324
|
+
bias*=(1.0-specularMapColor.a);
|
|
325
|
+
#endif
|
|
326
|
+
#endif
|
|
327
|
+
#endif
|
|
328
|
+
reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);
|
|
329
|
+
#else
|
|
330
|
+
reflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);
|
|
331
|
+
#endif
|
|
332
|
+
#else
|
|
333
|
+
vec2 coords=vReflectionUVW.xy;
|
|
334
|
+
#ifdef REFLECTIONMAP_PROJECTION
|
|
335
|
+
coords/=vReflectionUVW.z;
|
|
336
|
+
#endif
|
|
337
|
+
coords.y=1.0-coords.y;reflectionColor=texture2D(reflection2DSampler,coords);
|
|
338
|
+
#endif
|
|
339
|
+
#ifdef RGBDREFLECTION
|
|
340
|
+
reflectionColor.rgb=fromRGBD(reflectionColor);
|
|
341
|
+
#endif
|
|
342
|
+
#ifdef IS_REFLECTION_LINEAR
|
|
343
|
+
reflectionColor.rgb=toGammaSpace(reflectionColor.rgb);
|
|
344
|
+
#endif
|
|
345
|
+
reflectionColor.rgb*=vReflectionInfos.x;
|
|
346
|
+
#ifdef REFLECTIONFRESNEL
|
|
347
|
+
float reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);
|
|
348
|
+
#ifdef REFLECTIONFRESNELFROMSPECULAR
|
|
349
|
+
#ifdef SPECULARTERM
|
|
350
|
+
reflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
|
|
351
|
+
#else
|
|
352
|
+
reflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
|
|
353
|
+
#endif
|
|
354
|
+
#else
|
|
355
|
+
reflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;
|
|
356
|
+
#endif
|
|
357
|
+
#endif
|
|
358
|
+
#endif
|
|
359
|
+
#ifdef REFRACTIONFRESNEL
|
|
360
|
+
float refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);refractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;
|
|
361
|
+
#endif
|
|
362
|
+
#ifdef OPACITY
|
|
363
|
+
vec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);
|
|
364
|
+
#ifdef OPACITYRGB
|
|
365
|
+
opacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;
|
|
366
|
+
#else
|
|
367
|
+
alpha*=opacityMap.a*vOpacityInfos.y;
|
|
368
|
+
#endif
|
|
369
|
+
#endif
|
|
370
|
+
#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)
|
|
371
|
+
alpha*=vColor.a;
|
|
372
|
+
#endif
|
|
373
|
+
#ifdef OPACITYFRESNEL
|
|
374
|
+
float opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;
|
|
375
|
+
#endif
|
|
376
|
+
#ifdef ALPHATEST
|
|
377
|
+
#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS
|
|
378
|
+
if (alpha<alphaCutOff)
|
|
379
|
+
discard;
|
|
380
|
+
#endif
|
|
381
|
+
#ifndef ALPHABLEND
|
|
382
|
+
alpha=1.0;
|
|
383
|
+
#endif
|
|
384
|
+
#endif
|
|
385
|
+
vec3 emissiveColor=vEmissiveColor;
|
|
386
|
+
#ifdef EMISSIVE
|
|
387
|
+
emissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;
|
|
388
|
+
#endif
|
|
389
|
+
#ifdef EMISSIVEFRESNEL
|
|
390
|
+
float emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);emissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;
|
|
391
|
+
#endif
|
|
392
|
+
#ifdef DIFFUSEFRESNEL
|
|
393
|
+
float diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);diffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;
|
|
394
|
+
#endif
|
|
395
|
+
#ifdef EMISSIVEASILLUMINATION
|
|
396
|
+
vec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;
|
|
397
|
+
#else
|
|
398
|
+
#ifdef LINKEMISSIVEWITHDIFFUSE
|
|
399
|
+
vec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;
|
|
400
|
+
#else
|
|
401
|
+
vec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;
|
|
402
|
+
#endif
|
|
403
|
+
#endif
|
|
404
|
+
#ifdef SPECULARTERM
|
|
405
|
+
vec3 finalSpecular=specularBase*specularColor;
|
|
406
|
+
#ifdef SPECULAROVERALPHA
|
|
407
|
+
alpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);
|
|
408
|
+
#endif
|
|
409
|
+
#else
|
|
410
|
+
vec3 finalSpecular=vec3(0.0);
|
|
411
|
+
#endif
|
|
412
|
+
#ifdef REFLECTIONOVERALPHA
|
|
413
|
+
alpha=clamp(alpha+dot(reflectionColor.rgb,vec3(0.3,0.59,0.11)),0.,1.);
|
|
414
|
+
#endif
|
|
415
|
+
#ifdef EMISSIVEASILLUMINATION
|
|
416
|
+
vec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+emissiveColor+refractionColor.rgb,0.0,1.0),alpha);
|
|
417
|
+
#else
|
|
418
|
+
vec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+refractionColor.rgb,alpha);
|
|
419
|
+
#endif
|
|
420
|
+
#ifdef LIGHTMAP
|
|
421
|
+
#ifndef LIGHTMAPEXCLUDED
|
|
422
|
+
#ifdef USELIGHTMAPASSHADOWMAP
|
|
423
|
+
color.rgb*=lightmapColor.rgb;
|
|
424
|
+
#else
|
|
425
|
+
color.rgb+=lightmapColor.rgb;
|
|
426
|
+
#endif
|
|
427
|
+
#endif
|
|
428
|
+
#endif
|
|
429
|
+
#define CUSTOM_FRAGMENT_BEFORE_FOG
|
|
430
|
+
color.rgb=max(color.rgb,0.);
|
|
431
|
+
#include<logDepthFragment>
|
|
432
|
+
#include<fogFragment>
|
|
433
|
+
#ifdef IMAGEPROCESSINGPOSTPROCESS
|
|
434
|
+
color.rgb=toLinearSpace(color.rgb);
|
|
435
|
+
#else
|
|
436
|
+
#ifdef IMAGEPROCESSING
|
|
437
|
+
color.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color);
|
|
438
|
+
#endif
|
|
439
|
+
#endif
|
|
440
|
+
color.a*=visibility;
|
|
441
|
+
#ifdef PREMULTIPLYALPHA
|
|
442
|
+
color.rgb*=color.a;
|
|
443
|
+
#endif
|
|
444
|
+
#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR
|
|
445
|
+
#ifdef PREPASS
|
|
446
|
+
float writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;
|
|
447
|
+
#ifdef PREPASS_COLOR
|
|
448
|
+
gl_FragData[PREPASS_COLOR_INDEX]=color;
|
|
449
|
+
#endif
|
|
450
|
+
#ifdef PREPASS_POSITION
|
|
451
|
+
gl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);
|
|
452
|
+
#endif
|
|
453
|
+
#ifdef PREPASS_LOCAL_POSITION
|
|
454
|
+
gl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);
|
|
455
|
+
#endif
|
|
456
|
+
#if defined(PREPASS_VELOCITY)
|
|
457
|
+
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);
|
|
458
|
+
#elif defined(PREPASS_VELOCITY_LINEAR)
|
|
459
|
+
vec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);
|
|
460
|
+
#endif
|
|
461
|
+
#ifdef PREPASS_IRRADIANCE
|
|
462
|
+
gl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo);
|
|
463
|
+
#endif
|
|
464
|
+
#ifdef PREPASS_DEPTH
|
|
465
|
+
gl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo);
|
|
466
|
+
#endif
|
|
467
|
+
#ifdef PREPASS_SCREENSPACE_DEPTH
|
|
468
|
+
gl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);
|
|
469
|
+
#endif
|
|
470
|
+
#ifdef PREPASS_NORMALIZED_VIEW_DEPTH
|
|
471
|
+
gl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);
|
|
472
|
+
#endif
|
|
473
|
+
#ifdef PREPASS_NORMAL
|
|
474
|
+
#ifdef PREPASS_NORMAL_WORLDSPACE
|
|
475
|
+
gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);
|
|
476
|
+
#else
|
|
477
|
+
gl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);
|
|
478
|
+
#endif
|
|
479
|
+
#endif
|
|
480
|
+
#ifdef PREPASS_WORLD_NORMAL
|
|
481
|
+
gl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo);
|
|
482
|
+
#endif
|
|
483
|
+
#ifdef PREPASS_ALBEDO
|
|
484
|
+
gl_FragData[PREPASS_ALBEDO_INDEX]=vec4(baseColor.rgb,writeGeometryInfo);
|
|
485
|
+
#endif
|
|
486
|
+
#ifdef PREPASS_ALBEDO_SQRT
|
|
487
|
+
gl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqrt(baseColor.rgb),writeGeometryInfo);
|
|
488
|
+
#endif
|
|
489
|
+
#ifdef PREPASS_REFLECTIVITY
|
|
490
|
+
#if defined(SPECULAR)
|
|
491
|
+
gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularMapColor))*writeGeometryInfo;
|
|
492
|
+
#else
|
|
493
|
+
gl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularColor),1.0)*writeGeometryInfo;
|
|
494
|
+
#endif
|
|
495
|
+
#endif
|
|
496
|
+
#endif
|
|
497
|
+
#if !defined(PREPASS) || defined(WEBGL2)
|
|
498
|
+
gl_FragColor=color;
|
|
499
|
+
#endif
|
|
500
|
+
#include<oitFragment>
|
|
501
|
+
#if ORDER_INDEPENDENT_TRANSPARENCY
|
|
502
|
+
if (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-color.a);} else {backColor+=color;}
|
|
503
|
+
#endif
|
|
504
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
505
|
+
}
|
|
506
|
+
`;
|
|
507
|
+
e.ShadersStore[i] || (e.ShadersStore[i] = n);
|
|
508
|
+
const u = { name: i, shader: n };
|
|
509
|
+
export {
|
|
510
|
+
u as defaultPixelShader
|
|
511
|
+
};
|
|
512
|
+
//# sourceMappingURL=default.fragment-CSeCDRwv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.fragment-CSeCDRwv.js","sources":["../node_modules/@babylonjs/core/Shaders/ShadersInclude/defaultFragmentDeclaration.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions.js","../node_modules/@babylonjs/core/Shaders/ShadersInclude/fresnelFunction.js","../node_modules/@babylonjs/core/Shaders/default.fragment.js"],"sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./decalFragmentDeclaration.js\";\nconst name = \"defaultFragmentDeclaration\";\nconst shader = `uniform vec4 vEyePosition;uniform vec4 vDiffuseColor;uniform vec4 vSpecularColor;uniform vec3 vEmissiveColor;uniform vec3 vAmbientColor;uniform float visibility;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY \nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;uniform vec2 vTangentSpaceParams;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION) || defined(PREPASS)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;uniform vec4 refractionRightColor;\n#endif\n#if defined(USE_LOCAL_REFRACTIONMAP_CUBIC) && defined(REFRACTIONMAP_3D)\nuniform vec3 vRefractionPosition;uniform vec3 vRefractionSize; \n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;uniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;uniform vec4 emissiveRightColor;\n#endif\n#if defined(REFLECTION) || (defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED))\nuniform vec2 vReflectionInfos;\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION) || defined(REFLECTIONMAP_EQUIRECTANGULAR) || defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_SKYBOX)\nuniform mat4 reflectionMatrix;\n#endif\n#ifndef REFLECTIONMAP_SKYBOX\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;uniform vec3 vReflectionSize; \n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;uniform vec4 reflectionRightColor;\n#endif\n#endif\n#ifdef DETAIL\nuniform vec4 vDetailInfos;\n#endif\n#include<decalFragmentDeclaration>\n#define ADDITIONAL_FRAGMENT_DECLARATION\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const defaultFragmentDeclaration = { name, shader };\n//# sourceMappingURL=defaultFragmentDeclaration.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nimport \"./ltcHelperFunctions.js\";\nconst name = \"lightsFragmentFunctions\";\nconst shader = `struct lightingInfo\n{vec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};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.)\n{vec3 direction=lightData.xyz-vPositionW;attenuation=max(0.,1.0-length(direction)/range);lightVectorW=normalize(direction);}\nelse\n{lightVectorW=normalize(-lightData.xyz);}\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nfloat getAttenuation(float cosAngle,float exponent) {return max(0.,pow(cosAngle,exponent));}\nfloat getIESAttenuation(float cosAngle,sampler2D iesLightSampler) {float angle=acos(cosAngle)/PI;return texture2D(iesLightSampler,vec2(angle,0.)).r;}\nlightingInfo basicSpotLighting(vec3 viewDirectionW,vec3 lightVectorW,vec3 vNormal,float attenuation,vec3 diffuseColor,vec3 specularColor,float glossiness) {lightingInfo result; \nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightVectorW);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;}\nlightingInfo computeIESSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness,sampler2D iesLightSampler) { \nvec3 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)\n{ \nattenuation*=getIESAttenuation(dotProduct,iesLightSampler);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}\nlightingInfo result;result.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;}\nlightingInfo 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)\n{ \nattenuation*=getAttenuation(cosAngle,lightData.w);return basicSpotLighting(viewDirectionW,lightVectorW,vNormal,attenuation,diffuseColor,specularColor,glossiness);}\nlightingInfo result;result.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;}\nlightingInfo 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;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);float specComp=max(0.,dot(vNormal,angleW));specComp=pow(specComp,max(1.,glossiness));result.specular=specComp*specularColor;\n#endif\nreturn result;}\n#define inline\nvec3 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;}\n#if defined(AREALIGHTUSED) && defined(AREALIGHTSUPPORTED)\n#include<ltcHelperFunctions>\nuniform sampler2D areaLightsLTC1Sampler;uniform sampler2D areaLightsLTC2Sampler;\n#define inline\nlightingInfo computeAreaLighting(sampler2D ltc1,sampler2D ltc2,vec3 viewDirectionW,vec3 vNormal,vec3 vPosition,vec3 lightPosition,vec3 halfWidth,vec3 halfHeight,vec3 diffuseColor,vec3 specularColor,float roughness) \n{lightingInfo result;areaLightData data=computeAreaLightSpecularDiffuseFresnel(ltc1,ltc2,viewDirectionW,vNormal,vPosition,lightPosition,halfWidth,halfHeight,roughness);\n#ifdef SPECULARTERM\nvec3 fresnel=( specularColor*data.Fresnel.x+( vec3( 1.0 )-specularColor )*data.Fresnel.y );result.specular+=specularColor*fresnel*data.Specular;\n#endif\nresult.diffuse+=diffuseColor*data.Diffuse;return result;}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const lightsFragmentFunctions = { name, shader };\n//# sourceMappingURL=lightsFragmentFunctions.js.map","// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore.js\";\nconst name = \"fresnelFunction\";\nconst shader = `#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{float fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);return clamp(fresnelTerm,0.,1.);}\n#endif\n`;\n// Sideeffect\nif (!ShaderStore.IncludesShadersStore[name]) {\n ShaderStore.IncludesShadersStore[name] = shader;\n}\n/** @internal */\nexport const fresnelFunction = { name, shader };\n//# sourceMappingURL=fresnelFunction.js.map","// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore.js\";\nimport \"./ShadersInclude/defaultFragmentDeclaration.js\";\nimport \"./ShadersInclude/defaultUboDeclaration.js\";\nimport \"./ShadersInclude/prePassDeclaration.js\";\nimport \"./ShadersInclude/oitDeclaration.js\";\nimport \"./ShadersInclude/mainUVVaryingDeclaration.js\";\nimport \"./ShadersInclude/helperFunctions.js\";\nimport \"./ShadersInclude/lightFragmentDeclaration.js\";\nimport \"./ShadersInclude/lightUboDeclaration.js\";\nimport \"./ShadersInclude/lightsFragmentFunctions.js\";\nimport \"./ShadersInclude/shadowsFragmentFunctions.js\";\nimport \"./ShadersInclude/samplerFragmentDeclaration.js\";\nimport \"./ShadersInclude/fresnelFunction.js\";\nimport \"./ShadersInclude/reflectionFunction.js\";\nimport \"./ShadersInclude/imageProcessingDeclaration.js\";\nimport \"./ShadersInclude/imageProcessingFunctions.js\";\nimport \"./ShadersInclude/bumpFragmentMainFunctions.js\";\nimport \"./ShadersInclude/bumpFragmentFunctions.js\";\nimport \"./ShadersInclude/clipPlaneFragmentDeclaration.js\";\nimport \"./ShadersInclude/logDepthDeclaration.js\";\nimport \"./ShadersInclude/fogFragmentDeclaration.js\";\nimport \"./ShadersInclude/clipPlaneFragment.js\";\nimport \"./ShadersInclude/bumpFragment.js\";\nimport \"./ShadersInclude/decalFragment.js\";\nimport \"./ShadersInclude/depthPrePass.js\";\nimport \"./ShadersInclude/lightFragment.js\";\nimport \"./ShadersInclude/logDepthFragment.js\";\nimport \"./ShadersInclude/fogFragment.js\";\nimport \"./ShadersInclude/oitFragment.js\";\nconst name = \"defaultPixelShader\";\nconst shader = `#define CUSTOM_FRAGMENT_EXTENSION\n#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#include<prePassDeclaration>[SCENE_MRT_COUNT]\n#include<oitDeclaration>\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nvarying vec4 vColor;\n#endif\n#include<mainUVVaryingDeclaration>[1..7]\n#include<helperFunctions>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DIFFUSE,_VARYINGNAME_,Diffuse,_SAMPLERNAME_,diffuse)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,LIGHTMAP,_VARYINGNAME_,Lightmap,_SAMPLERNAME_,lightmap)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,DECAL,_VARYINGNAME_,Decal,_SAMPLERNAME_,decal)\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULARTERM)\n#include<samplerFragmentDeclaration>(_DEFINENAME_,SPECULAR,_VARYINGNAME_,Specular,_SAMPLERNAME_,specular)\n#endif\n#include<fresnelFunction>\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<bumpFragmentMainFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);vec4 baseColor=vec4(1.,1.,1.,1.);vec3 diffuseColor=vDiffuseColor.rgb;float alpha=vDiffuseColor.a;\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include<bumpFragment>\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#if defined(ALPHATEST) && !defined(ALPHATEST_AFTERALLALPHACOMPUTATIONS)\nif (baseColor.a<alphaCutOff)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#if defined(DECAL) && !defined(DECAL_AFTER_DETAIL)\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#include<depthPrePass>\n#if defined(VERTEXCOLOR) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nbaseColor.rgb*=vColor.rgb;\n#endif\n#ifdef DETAIL\nbaseColor.rgb=baseColor.rgb*2.0*mix(0.5,detailColor.r,vDetailInfos.y);\n#endif\n#if defined(DECAL) && defined(DECAL_AFTER_DETAIL)\nvec4 decalColor=texture2D(decalSampler,vDecalUV+uvOffset);\n#include<decalFragment>(surfaceAlbedo,baseColor,GAMMADECAL,_GAMMADECAL_NOTUSED_)\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\nfloat glossiness=vSpecularColor.a;vec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);specularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#endif\nvec3 diffuseBase=vec3(0.,0.,0.);lightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;float aggShadow=0.;float numLights=0.;\n#ifdef LIGHTMAP\nvec4 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset);\n#ifdef RGBDLIGHTMAP\nlightmapColor.rgb=fromRGBD(lightmapColor);\n#endif\nlightmapColor.rgb*=vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\naggShadow=aggShadow/numLights;vec4 refractionColor=vec4(0.,0.,0.,1.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\n#ifdef USE_LOCAL_REFRACTIONMAP_CUBIC\nrefractionVector=parallaxCorrectNormal(vPositionW,refractionVector,vRefractionSize,vRefractionPosition);\n#endif\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;vec4 refractionLookup=textureCube(refractionCubeSampler,refractionVector);if (dot(refractionVector,viewDirectionW)<1.0) {refractionColor=refractionLookup;}\n#else\nvec3 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);\n#endif\n#ifdef RGBDREFRACTION\nrefractionColor.rgb=fromRGBD(refractionColor);\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor.rgb=toGammaSpace(refractionColor.rgb);\n#endif\nrefractionColor.rgb*=vRefractionInfos.x;\n#endif\nvec4 reflectionColor=vec4(0.,0.,0.,1.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nvReflectionUVW.z*=-1.0;\n#endif\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias);\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW);\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;reflectionColor=texture2D(reflection2DSampler,coords);\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor.rgb=toGammaSpace(reflectionColor.rgb);\n#endif\nreflectionColor.rgb*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor.rgb*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor.rgb*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);refractionColor.rgb*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#if defined(VERTEXALPHA) || defined(INSTANCESCOLOR) && defined(INSTANCES)\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);alpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n#ifdef ALPHATEST\n#ifdef ALPHATEST_AFTERALLALPHACOMPUTATIONS\nif (alpha<alphaCutOff)\ndiscard;\n#endif\n#ifndef ALPHABLEND\nalpha=1.0;\n#endif\n#endif\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);emissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);diffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor.rgb,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+emissiveColor+refractionColor.rgb,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor.rgb+refractionColor.rgb,alpha);\n#endif\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor.rgb;\n#else\ncolor.rgb+=lightmapColor.rgb;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\ncolor.rgb=max(color.rgb,0.);\n#include<logDepthFragment>\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);color=applyImageProcessing(color);\n#endif\n#endif\ncolor.a*=visibility;\n#ifdef PREMULTIPLYALPHA\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\n#ifdef PREPASS\nfloat writeGeometryInfo=color.a>0.4 ? 1.0 : 0.0;\n#ifdef PREPASS_COLOR\ngl_FragData[PREPASS_COLOR_INDEX]=color; \n#endif\n#ifdef PREPASS_POSITION\ngl_FragData[PREPASS_POSITION_INDEX]=vec4(vPositionW,writeGeometryInfo);\n#endif\n#ifdef PREPASS_LOCAL_POSITION\ngl_FragData[PREPASS_LOCAL_POSITION_INDEX]=vec4(vPosition,writeGeometryInfo);\n#endif\n#if defined(PREPASS_VELOCITY)\nvec2 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);\n#elif defined(PREPASS_VELOCITY_LINEAR)\nvec2 velocity=vec2(0.5)*((vPreviousPosition.xy/vPreviousPosition.w)-(vCurrentPosition.xy/vCurrentPosition.w));gl_FragData[PREPASS_VELOCITY_LINEAR_INDEX]=vec4(velocity,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_IRRADIANCE\ngl_FragData[PREPASS_IRRADIANCE_INDEX]=vec4(0.0,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_DEPTH\ngl_FragData[PREPASS_DEPTH_INDEX]=vec4(vViewPos.z,0.0,0.0,writeGeometryInfo); \n#endif\n#ifdef PREPASS_SCREENSPACE_DEPTH\ngl_FragData[PREPASS_SCREENSPACE_DEPTH_INDEX]=vec4(gl_FragCoord.z,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMALIZED_VIEW_DEPTH\ngl_FragData[PREPASS_NORMALIZED_VIEW_DEPTH_INDEX]=vec4(vNormViewDepth,0.0,0.0,writeGeometryInfo);\n#endif\n#ifdef PREPASS_NORMAL\n#ifdef PREPASS_NORMAL_WORLDSPACE\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalW,writeGeometryInfo);\n#else\ngl_FragData[PREPASS_NORMAL_INDEX]=vec4(normalize((view*vec4(normalW,0.0)).rgb),writeGeometryInfo);\n#endif\n#endif\n#ifdef PREPASS_WORLD_NORMAL\ngl_FragData[PREPASS_WORLD_NORMAL_INDEX]=vec4(normalW*0.5+0.5,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO\ngl_FragData[PREPASS_ALBEDO_INDEX]=vec4(baseColor.rgb,writeGeometryInfo);\n#endif\n#ifdef PREPASS_ALBEDO_SQRT\ngl_FragData[PREPASS_ALBEDO_SQRT_INDEX]=vec4(sqrt(baseColor.rgb),writeGeometryInfo);\n#endif\n#ifdef PREPASS_REFLECTIVITY\n#if defined(SPECULAR)\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularMapColor))*writeGeometryInfo; \n#else\ngl_FragData[PREPASS_REFLECTIVITY_INDEX]=vec4(toLinearSpace(specularColor),1.0)*writeGeometryInfo;\n#endif\n#endif\n#endif\n#if !defined(PREPASS) || defined(WEBGL2)\ngl_FragColor=color;\n#endif\n#include<oitFragment>\n#if ORDER_INDEPENDENT_TRANSPARENCY\nif (fragDepth==nearestDepth) {frontColor.rgb+=color.rgb*color.a*alphaMultiplier;frontColor.a=1.0-alphaMultiplier*(1.0-color.a);} else {backColor+=color;}\n#endif\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStore[name]) {\n ShaderStore.ShadersStore[name] = shader;\n}\n/** @internal */\nexport const defaultPixelShader = { name, shader };\n//# sourceMappingURL=default.fragment.js.map"],"names":["name","shader","ShaderStore","defaultPixelShader"],"mappings":"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","x_google_ignoreList":[0,1,2,3]}
|