SceneObjectRectangle
Extends: SceneObjectBillboard
Draws a DrawableRectangle. Extends SceneObjectBillboard, so a rectangle orients and foreshortens in 3D in the oriented draw modes and stays screen-aligned in the direct ones, exactly like an image does.
Unlike an image, though, a rectangle has no texture to sample: it's a single flat color. So it never needs the inherited pinned-corners path - filling the projected quad produces identical pixels for far less work, and DrawableRectangle never has to hold a bitmap of its own. This is how SceneObjectPolygon draws, for the same reason.
It does still cache that fill into a temp bitmap in the oriented draw modes, exactly like a polygon: filling a rotated quad means rasterizing two triangles through scratch bitmaps, which is far too expensive to repeat every frame for an object that hasn't moved. In the direct (billboard) draw modes there's nothing worth caching - the draw is already a single DrawRect - so those skip the temp bitmap entirely.
Properties
drawable(DrawableRectangle)
Constructor
new SceneObjectRectangle(
name: string,
drawableObj: DrawableRectangle,
): SceneObjectRectangleParameters
name(string)drawableObj(DrawableRectangle)
Instance Methods
getBoundingPoints(cameraObj: Camera): dynamic
A rectangle always has a real width/height, unlike SceneObjectPolygon/ SceneObjectModel (see the comment on SceneObjectBillboard.computeBillboardWorldCorners()) - so this overrides the base SceneObject.getBoundingPoints() wrapper to always return the object's 4 world-space corners rather than the frustum check's single-point shortcut in screen-aligned draw modes.
Parameters
cameraObj(Camera)
Returns
dynamic— the object's 4 world-space corners
usesTempBitmap(drawMode: SceneObjectDrawMode): boolean
Parameters
drawMode(SceneObjectDrawMode)
Returns
boolean
didRegionToDrawChange(): boolean
Returns
boolean
drawToTempBitmap(
rendererObj: BGE.Renderer,
tempBitmap: ifDraw2d,
canvasPointsTopLeftBound: BGE.Math.Vector,
drawMode: SceneObjectDrawMode,
allowFastDraw?: boolean,
): TempBitmapDrawResult
Parameters
rendererObj(BGE.Renderer)tempBitmap(ifDraw2d)canvasPointsTopLeftBound(BGE.Math.Vector)drawMode(SceneObjectDrawMode)allowFastDraw(boolean, optional, default: false)
Returns
drawToCanvas(
rendererObj: BGE.Renderer,
drawMode: SceneObjectDrawMode,
): boolean
Parameters
rendererObj(BGE.Renderer)drawMode(SceneObjectDrawMode)
Returns
boolean
drawOutlineToCanvas(
rendererObj: BGE.Renderer,
drawMode: SceneObjectDrawMode,
): boolean
Parameters
rendererObj(BGE.Renderer)drawMode(SceneObjectDrawMode)
Returns
boolean
needsCanvasCornerPoints(): boolean
Returns
boolean
needsManualPretranslationForDirectMode(): boolean
Returns
boolean