Use texture instead of texture2D for MacOS.

This commit is contained in:
Florian Nücke
2022-02-13 20:12:00 +01:00
parent f0a06c8929
commit 5d0bd81446

View File

@@ -84,11 +84,11 @@ bool getProjectorColor(vec3 worldPos, vec3 worldNormal,
vec4 projectorUvPrediv = CLIP_TO_TEX * projectorClipPosPrediv;
vec2 projectorUv = projectorUvPrediv.xy / projectorUvPrediv.w;
float projectorDepth = texture2D(projectorDepthSampler, projectorUv).r;
float projectorDepth = texture(projectorDepthSampler, projectorUv).r;
float projectorClipDepth = projectorDepth * 2 - 1;
if (projectorClipPos.z <= projectorClipDepth + DEPTH_BIAS) {
vec3 projectorColor = texture2D(projectorColorSampler, vec2(projectorUv.s, 1 - projectorUv.t)).rgb;
vec3 projectorColor = texture(projectorColorSampler, vec2(projectorUv.s, 1 - projectorUv.t)).rgb;
float dotAttenuation = clamp((d - DOT_EPSILON) / (1 - DOT_EPSILON), 0, 1);
float distanceAttenuation = clamp(1 - (linearDepth - START_FADE_DISTANCE) / (MAX_DISTANCE - START_FADE_DISTANCE), 0, 1);
result = projectorColor * dotAttenuation * distanceAttenuation;
@@ -98,7 +98,7 @@ bool getProjectorColor(vec3 worldPos, vec3 worldNormal,
}
void main() {
float depth = texture2D(MainCameraDepth, texCoord).r;
float depth = texture(MainCameraDepth, texCoord).r;
// Check for no hit, for early exit.
if (depth >= 1) {