LayerSet
APJS Script API reference for the LayerSet class.
| Type | Name | Interface Description |
|---|---|---|
| Functions | constructor(bitset?: number, mask?: number) | • Function: Constructs a LayerSet instance. Parameters • • |
| Functions | clear(bitsNum?: number): this | • Function: Clears the layer set by setting all bits to false. Parameters • Returns This LayerSet instance for chaining. |
| Functions | equals(v: LayerSet): boolean | • Function: Compares the current LayerSet with another LayerSet for equality. Parameters • Returns A boolean indicating whether the two LayerSets have identical bit patterns. |
| Functions | get(layerIndex: number): boolean | • Function: Retrieves the value of a specific layer. Parameters • Returns A boolean indicating whether the specified layer is active or not. |
| Functions | isEmpty(): boolean | • Function: Checks if the layer set is empty (all bits are false). Returns A boolean indicating whether all layers are inactive. |
| Functions | set(layer: number, value: boolean): this | • Function: Sets the value of a specific layer. Parameters • • Returns This LayerSet instance for chaining. |
| Functions | toString(): string | • Function: Returns a string representation of the LayerSet object. Returns A string representing the LayerSet object. |
Examples
constructor(bitset?: number, mask?: number)
let obj = new APJS.LayerSet();
get(layerIndex: number): boolean
if (camera.renderLayer.get(sceneObject.layer)) {
// Do something.
}
set(layer: number, value: boolean): this
const LAYER_DEFAULT = 0;
const LAYER_1 = 1;
camera.renderLayer = camera.renderLayer.set(LAYER_DEFAULT, true);
camera.renderLayer = camera.renderLayer.set(LAYER_1, true);
Use Case
@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use LayerSet here
}
onUpdate(deltaTime: number) {
}
}