SceneObjectParallaxLayer

Extends: SceneObject

Properties


Constructor

new SceneObjectParallaxLayer( name: string, drawableObj: DrawableParallaxLayer, ): SceneObjectParallaxLayer

Parameters


Instance Methods

findCanvasPosition( rendererObj: Renderer, drawMode: SceneObjectDrawMode, ): boolean

protected

Computes this frame's canvas draw position(s). Called from the base SceneObject.draw() (never overridden directly - see class doc), already re-invoked correctly whenever the camera moves: objMovedInRelationToCamera()'s default implementation already ORs in cameraObj.movedLastFrame(), so no change to the shared SceneObject/update() machinery is needed for this to stay live under camera movement.

Parameters

Returns

  • boolean

isPotentiallyOnScreen(cameraObj: Camera): boolean

protected

A repeating axis's tile enumeration (computeAxisTilePositions) always fills the current viewport around whatever canvas position the base tile lands at - it's visually infinite along that axis regardless of how far raw world/camera distance has drifted, so the inherited raw-position frustum check would incorrectly cull a layer that is, by construction, still covering the screen.

Parameters

Returns

  • boolean

getPositionsForFrustumCheck( drawMode: SceneObjectDrawMode, ): dynamic

protected

The base SceneObject default returns the raw (un-shifted) drawable world position, which is wrong for a parallax layer: its actual on-screen position is the parallax-shifted "effective" position, which can stay within the camera's frustum indefinitely (the whole point of factor < 1) even while the raw owning-entity position drifts arbitrarily far from the camera as it roams. Only reached for a non-repeating layer (isPotentiallyOnScreen() above already short-circuits the repeating case). Uses m.lastCameraPosition rather than requiring a fresh camera parameter here (this method has none) - kept current every frame by isPotentiallyOnScreen() above, so this is never more than momentarily stale. Falls back to the raw world position only before either method has ever run - moot in practice, since isPotentiallyOnScreen() already returns true unconditionally on the first frame via isFirstFrameSinceEnabled, without ever reaching this method.

Parameters

Returns

  • dynamic

performDraw( rendererObj: Renderer, drawMode: SceneObjectDrawMode, ): boolean

protected

Parameters

Returns

  • boolean