Skip to content

Commit

Permalink
LensflareMesh: Honor color space in framebuffer textures.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Jan 24, 2025
1 parent 206ce7b commit bb3206e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/jsm/objects/LensflareMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Mesh,
MeshBasicNodeMaterial,
NodeMaterial,
SRGBColorSpace,
UnsignedByteType,
Vector2,
Vector3,
Expand Down Expand Up @@ -40,6 +41,7 @@ class LensflareMesh extends Mesh {
const occlusionMap = new FramebufferTexture( 16, 16 );

let currentType = UnsignedByteType;
let currentColorSpace = SRGBColorSpace;

const geometry = LensflareMesh.Geometry;

Expand Down Expand Up @@ -171,15 +173,18 @@ class LensflareMesh extends Mesh {

const renderTarget = renderer.getRenderTarget();
const type = ( renderTarget !== null ) ? renderTarget.texture.type : UnsignedByteType;
const colorSpace = ( renderTarget !== null ) ? renderTarget.texture.colorSpace : renderer.outputColorSpace;

if ( currentType !== type ) {
if ( currentType !== type || currentColorSpace !== colorSpace ) {

tempMap.dispose();
occlusionMap.dispose();

tempMap.type = occlusionMap.type = type;
tempMap.colorSpace = occlusionMap.colorSpace = colorSpace;

currentType = type;
currentColorSpace = colorSpace;

}

Expand Down

0 comments on commit bb3206e

Please sign in to comment.