Simplify reflection enabled condition and handle null render target
This commit is contained in:
@@ -657,7 +657,7 @@ export class RuntimeHost {
|
||||
contactPatches,
|
||||
reflection: {
|
||||
texture: null,
|
||||
enabled: faceId === "posY" && this.getWaterReflectionMode() !== "none"
|
||||
enabled: faceId === "posY"
|
||||
}
|
||||
});
|
||||
|
||||
@@ -833,7 +833,6 @@ export class RuntimeHost {
|
||||
for (const binding of this.runtimeWaterContactUniforms) {
|
||||
if (
|
||||
reflectionMode === "none" ||
|
||||
binding.reflectionRenderTarget === null ||
|
||||
binding.reflectionTextureUniform === null ||
|
||||
binding.reflectionMatrixUniform === null ||
|
||||
binding.reflectionEnabledUniform === null
|
||||
@@ -844,6 +843,10 @@ export class RuntimeHost {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (binding.reflectionRenderTarget === null) {
|
||||
binding.reflectionRenderTarget = this.createWaterReflectionRenderTarget();
|
||||
}
|
||||
|
||||
const canRenderReflection = updatePlanarReflectionCamera(
|
||||
binding.brush,
|
||||
this.camera,
|
||||
@@ -851,7 +854,7 @@ export class RuntimeHost {
|
||||
binding.reflectionMatrixUniform.value
|
||||
);
|
||||
|
||||
if (!canRenderReflection) {
|
||||
if (!canRenderReflection || binding.reflectionRenderTarget === null) {
|
||||
binding.reflectionEnabledUniform.value = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user