SceneObjectVoxelTerrain

Extends: SceneObject

Draws a DrawableVoxelTerrain: marches a VoxelTerrainView from the camera whenever anything that shapes it changes (otherwise draws last frame's spans again), straight to the target, or with roll into a level view as wide as the frame's diagonal that's rotated on.

Properties

  • drawable (DrawableVoxelTerrain)
  • view (BGE.VoxelTerrainView) — The march: its spans are in level-view pixels
  • marchedLastFrame (boolean) — Whether the last draw marched (false: it reused the spans) and was rolled
  • rolledLastFrame (boolean)
  • redrawsLastFrame (integer) — Spans drawn again over objects in the last frame

Constructor

new SceneObjectVoxelTerrain( name: string, drawableObj: DrawableVoxelTerrain, ): SceneObjectVoxelTerrain

Parameters


Instance Methods

drawsInFixedStage(): boolean

Returns

  • boolean

participatesInOverlapDetection(): boolean

Returns

  • boolean

participatesInDistanceFade(): boolean

Returns

  • boolean

isEligibleForStaticBsp(): boolean

Returns

  • boolean

isPotentiallyOnScreen(cameraObj: Camera): boolean

protected

Parameters

Returns

  • boolean

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

protected

Parameters

Returns

  • boolean

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

protected

Parameters

Returns

  • boolean

levelDepthOf(point: BGE.Math.Vector): float

How far a world point is along the level view direction, as the spans' depths are.

Parameters

  • point (BGE.Math.Vector)

Returns

  • float

levelPointOf(x: float, y: float): BGE.Math.Vector

Where a point on the target is in the level view (the same with no roll).

Parameters

  • x (float)
  • y (float)

Returns

  • BGE.Math.Vector

testHidden( projected: Array.<float>, allLimit: float, limit: float, hideBox: BGE.VoxelHideBox, ): integer

Whether hills hide an object, from its projected points (x, y, depth triples from Camera3d.projectPointsWithDepth()). Only partly if any point is behind the camera: its on-screen part then reaches past the box of the rest.

Parameters

  • projected (Array.<float>)
  • allLimit (float) — level depth (see levelDepthOf()) hills must be nearer than to hide all of it: its nearest point's, less the tolerance
  • limit (float) — level depth hills nearer than are drawn back over it
  • hideBox (BGE.VoxelHideBox) — filled with the object's level-view box and columns, for redrawOver()

Returns

  • integer — a BGE.VoxelHidden

redrawOver( rendererObj: Renderer, hideBox: BGE.VoxelHideBox, ): void

Draws again, clipped to a box from testHidden() (one column wider each side), the spans nearer than its limit - to put the hills back over an object drawn after them.

Parameters

Returns

  • void