SceneObjectCircle

Extends: SceneObjectBillboard

Draws a DrawableCircle. The fill is inherited, unmodified SceneObjectBillboard machinery (pinned-corners texture warp, tinting, temp-bitmap caching) blitting the renderer's shared circle resource (Renderer.getCircleResource(), built lazily on first use) - exactly like SceneObjectImage, just with a fixed texture instead of one supplied by the drawable. Only the outline differs from a plain Image: it's stroked as an N-gon inscribed in this object's own already-transformed canvasPoints quad (via the generic getOutlineCanvasPoints() hook), which is far cheaper than rasterizing the fill itself as a many-sided polygon and needs no new Renderer draw method.

Properties


Constructor

new SceneObjectCircle( name: string, drawableObj: DrawableCircle, ): SceneObjectCircle

Parameters


Instance Methods

getBoundingPoints(cameraObj: Camera): dynamic

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

Returns

  • dynamic — the object's 4 world-space corners

getRegionWithIdToDraw( rendererObj: BGE.Renderer, ): BGE.RendererHelpers.RegionWithId

protected

Every DrawableCircle/DrawableSphere instance shares the exact same region, so this fetches the renderer's own cached one (built once, on first use) rather than allocating a fresh roRegion here every single frame.

Parameters

Returns

  • BGE.RendererHelpers.RegionWithId

isEligibleForFastDrawCheck( drawMode: SceneObjectDrawMode, ): boolean

protected

The base class only caches a temp bitmap for the oriented modes by default, because its own solid-mode fill (a flat drawPolygon, no texture) is cheap enough not to need it - see SceneObjectRectangle.usesTempBitmap, which overrides this same hook for its own reason (skipping the cache for an unfilled rectangle). A circle's solid fill is the same expensive pinned-corners texture warp the oriented modes use, so it would need the same reuse-across-frames caching too, or drawToCanvas's inherited solid branch (see below) would re-run that warp from scratch on every single frame with no caching at all - UNLESS canvasPoints happens to be a plain rotated rectangle (see the base class's canUseTransformedFastDraw()), in which case drawToCanvas's own fast path is cheap enough every frame that no temp bitmap is needed at all, the same way directScaled needs none.

oriented/orientedDrawBackFace/solid/solidDrawBackFace only - NOT isOrientedDrawMode, which is really "not a direct mode" and so also matches directScaled (used by every DrawableSphere). directScaled already has its own cheap, exact drawRegionAsRotatedQuad path in the base class (SceneObjectBillboard's own directScaled branch) that doesn't need - and must not go through - this approximation check at all. wireFrame draws only its outline (see drawToCanvas below) and never touches the region fill, so it must also keep using the base class's default (no temp bitmap) regardless of this check.

Parameters

Returns

  • boolean

drawToCanvas( rendererObj: BGE.Renderer, drawMode: SceneObjectDrawMode, ): boolean

protected

The base class's own wireFrame branch draws the plain 4-corner quad directly (a square) - correct for DrawableRectangle, whose fill genuinely is its own quad, but wrong for a circle. Routed through drawOutlineToCanvas()/getOutlineCanvasPoints() below instead (same pattern SceneObjectRectangle uses).

oriented/solid modes only reach here at all when usesTempBitmap() has already decided the fast path is safe (see isEligibleForFastDrawCheck() above for why) - drawn via the base class's drawFastPath() instead of the base class's own solid branch (a flat drawPolygon, wrong for a circle) or the inherited drawToTempBitmap/drawPinnedCorners path (correct but far more expensive - the whole point of this fast path). Otherwise drawToTempBitmap already draws the right thing (getRegionWithIdToDraw's circular region, via drawPinnedCornersTo) and caches it.

Parameters

Returns

  • boolean

getOutlineCanvasPoints(): dynamic

protected

N points around the ellipse inscribed in this object's own transformed canvasPoints quad, computed from the quad's own corner vectors as the ellipse's basis rather than a fresh world-to-canvas transform pass - so this automatically gets the same foreshortening the quad itself has in oriented 3D draw modes.

No hasOutline() check here, matching the base class's own default implementation - that gating already happens at the "stroke on top of the fill" call site (performDraw), and a wireFrame draw mode (see drawToCanvas above) needs these points regardless of whether an outline color was ever set, the same way SceneObjectRectangle's wireFrame mode still strokes with the fill color when no outlineRGBA is set (see Drawable.getOutlineColorRGBA's fallback).

Returns

  • dynamic