Cull

class Cull

Provides a simple, configurable mechanism for culling a subtree of your scene graph.

If your scene graph is not static, culling needs to be done before rendering. You can run it on the prerender event fired by the renderer.

Constructor


new Cull(options: Partial<ICullOptions>) → {}
Parameters:
Name Type Attributes Default Description
options Partial<ICullOptions>
options.recursive

<optional>

whether culling should be recursive

options.toggle

<optional>

'renderable'

which property of display-object was be set to indicate its culling state. It should be one of renderable, visible.

Summary


Methods from Cull

this
add(target: PIXI.DisplayObject)

Adds a display-object to the culling list

this
addAll(targets: PIXI.DisplayObject[])

Adds all the display-objects to the culling list

this
clear()

Clears the culling list

this
cull(rect: PIXI.Rectangle, skipUpdate: boolean)
this
remove(target: PIXI.DisplayObject)

Removes the display-object from the culling list

this
removeAll(targets: PIXI.DisplayObject[])

Removes all the passed display-objects from the culling list

this
uncull()

Sets all display-objects to the unculled state.

void
protected cullRecursive(rect: PIXI.Rectangle, displayObject: PIXI.DisplayObject, skipUpdate: boolean)

Recursively culls the subtree of displayObject.

void
protected uncullRecursive(displayObject: PIXI.DisplayObject)

Recursively unculls the subtree of displayObject.

Public Methods


add Cull.ts:45
add(target: PIXI.DisplayObject) → {this}

Adds a display-object to the culling list

Parameters:
Name Type Description
target PIXI.DisplayObject

the display-object to be culled

Returns:
Type Description
this

this

addAll Cull.ts:58
addAll(targets: PIXI.DisplayObject[]) → {this}

Adds all the display-objects to the culling list

Parameters:
Name Type Description
targets PIXI.DisplayObject[]

the display-objects to be culled

Returns:
Type Description
this

this

clear Cull.ts:103
clear() → {this}

Clears the culling list

Returns:
Type Description
this

this

cull Cull.ts:115
cull(rect: PIXI.Rectangle, skipUpdate: boolean) → {this}
Parameters:
Name Type Default Description
rect PIXI.Rectangle

the rectangle outside of which display-objects should be culled

skipUpdate boolean false

whether to skip unculling, transform update, bounds calculation. It is highly recommended you enable this by calling this.uncull() and root.getBounds(false) manually before your render loop.

Returns:
Type Description
this

this

remove Cull.ts:74
remove(target: PIXI.DisplayObject) → {this}

Removes the display-object from the culling list

Parameters:
Name Type Description
target PIXI.DisplayObject

the display-object to be removed

Returns:
Type Description
this

this

removeAll Cull.ts:87
removeAll(targets: PIXI.DisplayObject[]) → {this}

Removes all the passed display-objects from the culling list

Parameters:
Name Type Description
targets PIXI.DisplayObject[]

the display-objects to be removed

Returns:
Type Description
this

this

uncull Cull.ts:159
uncull() → {this}

Sets all display-objects to the unculled state.

This happens regardless of whether the culling toggle was set by this.cull or manually. This is why it is recommended to one of visible or renderable for normal use and the other for culling.

Returns:
Type Description
this

this

Protected Methods


cullRecursive Cull.ts:184
protected cullRecursive(rect: PIXI.Rectangle, displayObject: PIXI.DisplayObject, skipUpdate: boolean) → {void}

Recursively culls the subtree of displayObject.

Parameters:
Name Type Attributes Description
rect PIXI.Rectangle

the visiblity rectangle

displayObject PIXI.DisplayObject

the root of the subtree to cull

skipUpdate boolean

<optional>

whether to skip bounds calculation. However, transforms are expected to be updated by the caller.

Returns:
Type Description
void
uncullRecursive Cull.ts:226
protected uncullRecursive(displayObject: PIXI.DisplayObject) → {void}

Recursively unculls the subtree of displayObject.

Parameters:
Name Type Description
displayObject PIXI.DisplayObject
Returns:
Type Description
void

Powered by webdoc!