Skip to content

Commit

Permalink
CSS2DRenderer: Fix culling regression. (#23594)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Feb 26, 2022
1 parent 3d24599 commit 30f34a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions examples/jsm/renderers/CSS2DRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ class CSS2DRenderer {

if ( object.isCSS2DObject ) {

const visible = object.visible && _vector.z >= - 1 && _vector.z <= 1 && object.layers.test( camera.layers );
object.element.style.display = visible ? '' : 'none';
_vector.setFromMatrixPosition( object.matrixWorld );
_vector.applyMatrix4( _viewProjectionMatrix );

if ( visible ) {
const visible = ( object.visible === true ) && ( _vector.z >= - 1 && _vector.z <= 1 ) && ( object.layers.test( camera.layers ) === true );
object.element.style.display = ( visible === true ) ? '' : 'none';

object.onBeforeRender( _this, scene, camera );
if ( visible === true ) {

_vector.setFromMatrixPosition( object.matrixWorld );
_vector.applyMatrix4( _viewProjectionMatrix );
object.onBeforeRender( _this, scene, camera );

const element = object.element;

Expand Down
7 changes: 3 additions & 4 deletions examples/jsm/renderers/CSS3DRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,10 @@ class CSS3DRenderer {

if ( object.isCSS3DObject ) {

const visible = object.visible && object.layers.test( camera.layers );
object.element.style.display = visible ? '' : 'none';
const visible = ( object.visible === true ) && ( object.layers.test( camera.layers ) === true );
object.element.style.display = ( visible === true ) ? '' : 'none';

// only getObjectCSSMatrix when object.visible
if ( visible ) {
if ( visible === true ) {

object.onBeforeRender( _this, scene, camera );

Expand Down

0 comments on commit 30f34a3

Please sign in to comment.