Lysa  0.0
Lysa 3D Engine
Vector3DRenderer Class Referenceabstract

Detailed Description

A GPU renderer that draws 3-D wireframe lines, filled triangles, images, and text in world space.

Lua full name: lysa.Vector3DRenderer

Public Member Functions

nil draw_line (from: float3, to: float3, color: float4)
 Draws a colored line segment between two world-space points. More...
 
nil draw_triangle (v1: float3, v2: float3, v3: float3, color: float4)
 Draws a filled colored triangle from three world-space vertices. More...
 
nil draw_image (imageId: integer, position: float3, rotation: quaternion, size: float2, color: float4)
 Draws a textured quad at the given world-space position and rotation, tinted by color. Pass INVALID_ID for imageId to draw a solid-color quad. More...
 
nil draw_text (text: string, font: Font, fontScale: number, position: float3, rotation: quaternion, color: float4, alignment: lysa.TextAlignment?, rotationGlobal: boolean?)
 Draws a UTF-8 string in world space. alignment defaults to LEFT (position = left edge), CENTER (position = center), or RIGHT (position = right edge). rotationGlobal=false (default) rotates locally around position; true rotates around the world origin. More...
 
nil draw_spline (points: table, color: float4, segsPerSpan: integer?, tension: number?)
 Draws a cardinal spline through the given world-space control points (at least 2). segsPerSpan defaults to 16; tension in [0,1] where 0 = Catmull-Rom and 1 = straight segments (default 0). More...
 
integer begin_draw (sessionId: integer?)
 Opens a new draw session and returns its id. If sessionId is provided and already exists, the session is cleared first. Omit or pass INVALID_ID to auto-generate a new id. More...
 
nil end_draw ()
 Closes the current draw session; all primitives recorded since begin_draw() are committed to it. More...
 
nil set_visible (sessionId: integer, visible: boolean)
 Shows or hides the draw session with the given id. Hidden sessions are skipped by the GPU command generator but their primitives remain in the buffers so they can be shown again cheaply. More...
 
nil clear_session (sessionId: integer)
 Erases all primitives belonging to the given session and compacts the internal vertex and params buffers. More...
 

Properties

boolean use_camera
 Primitives are grouped into draw sessions (begin_draw/end_draw). Each session can be shown, hidden, or cleared independently without affecting other sessions.
 

Member Function Documentation

nil draw_line ( float3  from,
float3  to,
float4  color)

Draws a colored line segment between two world-space points.

Parameters
fromfloat3
tofloat3
colorfloat4
nil draw_triangle ( float3  v1,
float3  v2,
float3  v3,
float4  color)

Draws a filled colored triangle from three world-space vertices.

Parameters
v1float3
v2float3
v3float3
colorfloat4
nil draw_image ( integer  imageId,
float3  position,
quaternion  rotation,
float2  size,
float4  color)

Draws a textured quad at the given world-space position and rotation, tinted by color. Pass INVALID_ID for imageId to draw a solid-color quad.

Parameters
imageIdinteger
positionfloat3
rotationquaternion
sizefloat2
colorfloat4
nil draw_text ( string  text,
Font  font,
number  fontScale,
float3  position,
quaternion  rotation,
float4  color,
lysa.TextAlignment?  alignment,
boolean?  rotationGlobal)

Draws a UTF-8 string in world space. alignment defaults to LEFT (position = left edge), CENTER (position = center), or RIGHT (position = right edge). rotationGlobal=false (default) rotates locally around position; true rotates around the world origin.

Parameters
textstring
fontFont
fontScalenumber
positionfloat3
rotationquaternion
colorfloat4
alignmentlysa.TextAlignment?
rotationGlobalboolean?
nil draw_spline ( table  points,
float4  color,
integer?  segsPerSpan,
number?  tension)

Draws a cardinal spline through the given world-space control points (at least 2). segsPerSpan defaults to 16; tension in [0,1] where 0 = Catmull-Rom and 1 = straight segments (default 0).

Parameters
pointstable
colorfloat4
segsPerSpaninteger?
tensionnumber?
integer begin_draw ( integer?  sessionId)

Opens a new draw session and returns its id. If sessionId is provided and already exists, the session is cleared first. Omit or pass INVALID_ID to auto-generate a new id.

Parameters
sessionIdinteger?
Returns
integer
nil end_draw ( )

Closes the current draw session; all primitives recorded since begin_draw() are committed to it.

nil set_visible ( integer  sessionId,
boolean  visible)

Shows or hides the draw session with the given id. Hidden sessions are skipped by the GPU command generator but their primitives remain in the buffers so they can be shown again cheaply.

Parameters
sessionIdinteger
visibleboolean
nil clear_session ( integer  sessionId)

Erases all primitives belonging to the given session and compacts the internal vertex and params buffers.

Parameters
sessionIdinteger

Property Documentation

boolean use_camera

Primitives are grouped into draw sessions (begin_draw/end_draw). Each session can be shown, hidden, or cleared independently without affecting other sessions.
Constructor: Vector3DRenderer(rt) Vector3DRenderer(rt, useCamera, depthTest, filledTri, alphaBlend)