BGE/RendererHelpers
Alias: BGE.RendererHelpers
Static Methods
triangleMayOverlapRect(
points: Array.<BGE.Math.Vector>,
width: float,
height: float,
): boolean
Whether a triangle can overlap the rectangle (0,0)-(width,height): false only when one of its edges has the whole rectangle on its outside. Pair with a bounding box test.
Parameters
points(Array.<BGE.Math.Vector>) — the triangle's 3 cornerswidth(float)height(float)
Returns
boolean
createTriangleBitmap(
bitmap: ifDraw2d,
points: Array.<BGE.Math.Vector>,
): TriangleBitmap
Parameters
bitmap(ifDraw2d)points(Array.<BGE.Math.Vector>)
Returns
createRegionWithId(region: roRegion, id?: string): RegionWithId
Parameters
region(roRegion)id(string, optional, default: "\"\"")
Returns
growOrClearBitmap(
existing: roBitmap,
width: integer,
height: integer,
): roBitmap
Returns existing, cleared and ready for reuse, if it's already at least widthxheight - or a freshly allocated bitmap otherwise. Grow-only reuse avoids a fresh CreateObject() every single frame an object's projected size merely shifts slightly, only reallocating once the existing bitmap has actually been outgrown - see SceneObjectBillboard.createTempBitmap.
Parameters
existing(roBitmap) — the previously cached bitmap, or invalid if there is none yetwidth(integer)height(integer)
Returns
roBitmap— invalid if allocation failed
applyAlphaFade(rgba: integer, fade: float): integer
Scales the alpha byte of a packed RGBA color by fade (0-1), keeping the RGB. Used to apply a distance fade at draw time on top of whatever alpha the color already has.
Parameters
rgba(integer) — packed 0xRRGGBBAA color (-1 is opaque white)fade(float) — 1 leaves the color unchanged, 0 makes it fully transparent
Returns
integer— the faded packed color
Other
CANVAS_CLIP_MARGIN_FRACTION
How far past each canvas edge a temp bitmap is kept, as a fraction of the canvas size
Default: 0.1
MODEL_CLIP_MARGIN_FRACTION
The same for a model's: wider, as a camera orbiting the player slides a clipped capture past a 10% margin in a few frames (3x the impostor misses)
Default: 0.25
TriangleBitmap
Properties
bitmap(ifDraw2d)triangle(BGE.Math.Triangle)scratchRegion(BGE.ScratchRegion)scale(BGE.Math.Vector)
ClipRect
A canvas-space rectangle, by its edges
Properties
x0(float)y0(float)x1(float)y1(float)
RegionWithId
Properties
region(roRegion)id(string)columnTexture(BGE.QuadColumnTexture) — a model texture's column texture, shared by its faces (see Model3dTexture.getColumnCuts())source(roBitmap) — a bitmap the region was copied from, kept as long as it: Roku queues draws, and a source
LimitPointMappings
These are limits in screen space origin top /
/
/ >right left < / \ / \ / bottom opposite
Baseline angle is the average angle from [left-right, top-bottom]
Parameters
points(Array.<BGE.Math.Vector>)screenSpace(boolean, optional, default: true)
Properties
totalPointCount(integer)leftIndex(integer)rightIndex(integer)topIndex(integer)bottomIndex(integer)left(BGE.Math.Vector)right(BGE.Math.Vector)top(BGE.Math.Vector)bottom(BGE.Math.Vector)origin(BGE.Math.Vector)opposite(BGE.Math.Vector)baselineAngle(float)width(float)height(float)
Returns
BGE.RendererHelpers.LimitPointMappings
LimitPoints2d
Properties
left(BGE.Math.Vector)right(BGE.Math.Vector)top(BGE.Math.Vector)bottom(BGE.Math.Vector)