[0.8.9][NK] RDU (Rendering lines & frame-wire shapes)

johnycilohoklajohnycilohokla REGISTERED Posts: 283 Developer
edited December 2015 in Modding Tutorials

RDU

RDU is a set of utility functions that allow rendering lines and basic frame-wire shapes.

API documentation (RDU)

Important: Rendering using RDU needs to be called every frame (ex. from Update function).

NKColors

Color		Variable				r		g		b
Orange NKColors.ORANGE 255 120 0
Green NKColors.GREEN 0 128 0
Yellow NKColors.YELLOW 255 255 0
Red NKColors.RED 255 0 0
Blue NKColors.BLUE 0 0 255
Teal NKColors.TEAL 107 202 226
Brown NKColors.BROWN 139 69 19
White NKColors.WHITE 255 255 255
Black NKColors.BLACK 0 0 0

Sphere

Draws a sphere with radius centered at the position.
RDU.NKDisplaySphere(
position, -- [vec3] world position
radius, -- [float] sphere radius
color -- [NKColor] color
)
Example:
image

Line

Draws a line from position to another position in the world.
RDU.NKDisplayLine(
from, -- [vec3] from position
to, -- [vec3] to position
color -- [NKColor] color
)
Example:
image
Lots of "examples":
image

AABB

Draws a frame-wire cube from min to max, centered between min and max.
extents = (max-min)/2
position = min + extents
RDU.NKDisplayAABB(
min, -- [vec3] min position of the AABB
max, -- [vec3] max position of the AABB
color -- [NKColor] color
)
Example:
image

OBB

Draws a frame-wire cube centered at the position.
Extends are subtracted/added to the position to get the min/max values.
min = position - extents
max = position + extents
orientation is used to rotate the cube around it's center.
RDU.NKDisplayOBB(
position, -- [vec3] min position of the BB
extents, -- [vec3] half extents
orientation, -- [quat] orientation of the BB
color -- [NKColor] color
)
Example:
image

Text (3D position)

Draws text, the world position is translated to screen position.
The text will overlay all world objects and GUI.
RDU.NKDisplay3DText(
text, -- [string] text to display
position -- [vec3] world position
)
Example:
image

Text (2D position)

Draws text at the x,y screen position.
The text will overlay all world objects and GUI.
RDU.NKDisplay2DText(
text, -- [string] text to display
x, -- [int] x position on screen (from left)
y -- [int] y position on screen (from top)
)
Example:
imageimage
My Blog
jc.png
  yt.png  t.png  

Comments

  • RawrRawr REGISTERED, Tester Posts: 510 Seed
    I know so little about this game.
    Programmer, designer, artist.
Sign In or Register to comment.