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
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