SceneObjectModel

Extends: SceneObjectBillboard

Properties


Constructor

new SceneObjectModel( name: string, drawableObj: DrawableModel, ): SceneObjectModel

Parameters


Instance Methods

didRegionToDrawChange(): boolean

protected

Returns

  • boolean

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

protected

Parameters

Returns

  • boolean

drawToTempBitmap( rendererObj: BGE.Renderer, tempBitmap: ifDraw2d, canvasPointsTopLeftBound: BGE.Math.Vector, drawMode: SceneObjectDrawMode, allowFastDraw?: boolean, ): TempBitmapDrawResult

protected

Parameters

  • rendererObj (BGE.Renderer)
  • tempBitmap (ifDraw2d)
  • canvasPointsTopLeftBound (BGE.Math.Vector)
  • drawMode (SceneObjectDrawMode)
  • allowFastDraw (boolean, optional, default: false)

Returns

updateWorldPosition(drawMode: SceneObjectDrawMode): boolean

protected

Parameters

Returns

  • boolean

getPositionForCameraDistance( drawMode: SceneObjectDrawMode, ): BGE.Math.Vector

Parameters

Returns

  • BGE.Math.Vector

getPositionsForFrustumCheck( drawMode: SceneObjectDrawMode, ): dynamic

protected

Parameters

Returns

  • dynamic

getAllCanvasPoints(): dynamic

protected

Returns

  • dynamic

getOutlineCanvasPoints(): dynamic

protected

A model is a triangle mesh, not a single quad, so there is no one perimeter to stroke - outlining a model means the wireFrame draw modes (which stroke every face), not the Drawable.outlineRGBA outline the other billboard SceneObjects support.

Returns

  • dynamic

getCanvasBounds(): dynamic

protected

Returns

  • dynamic

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

protected

Parameters

Returns

  • boolean

getTempBitmapThreshold(drawMode: SceneObjectDrawMode): integer

protected

Parameters

Returns

  • integer

getPrimitiveCount(): integer

Overrides the base class's "always 1" default: a model's real primitive count is its actual current face list, which m.modelCanvasFaces (rebuilt every frame by updateCanvasPosition, above) already reflects correctly for whatever draw mode is active - front-facing-only for oriented/solid/wireFrame, front+back for the DrawBackFace variants, and empty for matchCamera/directToCamera/directScaled (which this class doesn't render at all via any path). No new draw-mode-awareness is needed here - it's inherited for free from updateCanvasPosition's existing, already-correct backface-cull logic.

Returns

  • integer

getPrimitiveDepth(index: integer): float

priority (computed in updateCanvasPosition, above) is a positive value equal to the distance of the face's closest vertex to the camera - larger for a farther face. That's the OPPOSITE sign convention from the base class's negDistanceFromCamera (negative in front of the camera, more negative = farther), which is what Renderer.drawPendingClusterPrimitives()'s combined sort assumes for every primitive regardless of SceneObject subtype. Negating it here converts to that shared convention: -priority is negative, and more negative for a farther face (e.g. a face 100 units out has priority 100 -> depth -100, versus a face 10 units out with priority 10 -> depth -10; ascending sort puts -100 before -10, i.e. farthest first, matching negDistanceFromCamera and the main scene's own painter's-algorithm sort).

Fixed (issue #112): updateCanvasPosition()'s m.modelCanvasFaces.SortBy("priority", "r") now sorts descending (farthest-first), matching this method's own farthest-first convention - the solo draw loop (drawToCanvas/drawToTempBitmap, which iterate modelCanvasFaces in stored order with no reversal) and the cluster draw path (this method + drawPrimitive, which look up by index and get re-sorted by Renderer.drawPendingClusterPrimitives independently) now agree: both draw a model's self-overlapping faces farthest-first, nearest-last-on-top, regardless of whether the model draws solo or as part of a multi-member overlap cluster.

Parameters

  • index (integer)

Returns

  • float

drawPrimitive(rendererObj: Renderer, index: integer): boolean

Parameters

  • rendererObj (Renderer)
  • index (integer)

Returns

  • boolean