Skip to content

Commit

Permalink
Fix culling not working with projection transforms (#8844)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev7355608 authored and bigtimebuddy committed Dec 12, 2022
1 parent 08f4e5e commit 2e90711
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/display/src/Container.ts
@@ -1,9 +1,11 @@
import { MASK_TYPES, settings, utils } from '@pixi/core';
import { MASK_TYPES, Matrix, settings, utils } from '@pixi/core';
import { DisplayObject } from './DisplayObject';

import type { MaskData, Renderer, Matrix, Rectangle } from '@pixi/core';
import type { MaskData, Renderer, Rectangle } from '@pixi/core';
import type { IDestroyOptions } from './DisplayObject';

const tempMatrix = new Matrix();

function sortChildren(a: DisplayObject, b: DisplayObject): number
{
if (a.zIndex === b.zIndex)
Expand Down Expand Up @@ -561,6 +563,22 @@ export class Container<T extends DisplayObject = DisplayObject> extends DisplayO
bounds = this.getBounds(true);
}

// Prepend the transform that is appended to the projection matrix.
const projectionTransform = renderer.projection.transform;

if (projectionTransform)
{
if (transform)
{
transform = tempMatrix.copyFrom(transform);
transform.prepend(projectionTransform);
}
else
{
transform = projectionTransform;
}
}

// Render the container if the source frame intersects the bounds.
if (bounds && sourceFrame.intersects(bounds, transform))
{
Expand Down

0 comments on commit 2e90711

Please sign in to comment.