This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

engine.visualizer Functions

Controls visualizer-related settings. The visualizer is used to render mesh wireframe, object bounding boxes, and all sorts of visual helpers (such as physical collision shapes, joints, etc.).

  • 3D visualizer (engine.visualizer.render*3D()) is rendered based on scene depth.
  • 2D visualizer (engine.visualizer.render*2D()) is rendered atop of everything else.

To render 3D objects atop of the scene, you can transform 3D space coordinates into screen space and render lines and triangles using 2D visualizer functions.

Usage Example

To render a vector, do the following:

Source code (UnigineScript)
// my_world.cpp

Player player;  // In-game camera.

int init() {

player = new PlayerSpectator();   // Create a new player
engine.game.setPlayer(player);	// used in the game.

...

return 1;
}

int update() {

// The player position is updated

...  

// Call a rendering function
engine.visualizer.renderVector(vec3_zero, vec3(1.0f,0.0f,0.0f), vec4_one, 0.25f, 0);

return 1;
}

Visualizer Class

Members


void engine.visualizer.setEnabled(int enabled)

Enables or disables visualization of helper objects like handlers and bound boxes.

Arguments

  • int enabled - Positive number to enable visualization of helper objects, 0 to disable it.

int engine.visualizer.isEnabled()

Returns a value indicating if visualization of helper objects like handlers and bound boxes is enabled.

Return value

Positive number if visualization is enabled; otherwise, 0.

void engine.visualizer.setSize(int size)

Updates the current handler size.

Arguments

  • int size - New handler size in pixels.

int engine.visualizer.getSize()

Returns the handler size. All handlers have the same size.

Return value

Size of a handler in pixels.

void engine.visualizer.setTextureName(string name)

Updates the current name of the texture.

Arguments

  • string name - New name of the texture.

string engine.visualizer.getTextureName()

Returns the string with the name of the texture.

Return value

Name of the texture.

void engine.visualizer.renderBillboard3D(Vec3 arg1, float arg2, vec4 arg3, int screen_space = 0)

Renders a 3D billboard of the specified size.

Arguments

  • Vec3 arg1 - Coordinates of the billboard.
  • float arg2 - The billboard size.
  • vec4 arg3 - The billboard texture coordinates.
  • int screen_space - A flag indicating the type of dimensions to be used:
    • 0 - use the world space dimensions
    • 1 - use the screen space dimensions

void engine.visualizer.renderBoundBox(BoundBox bb, Mat4 transform, vec4 color)

Renders the bounding box in a given color.

Arguments

  • BoundBox bb - The bounding box.
  • Mat4 transform - Transformation matrix for the bounding box.
  • vec4 color - Color, in which the box will be rendered.

void engine.visualizer.renderBoundSphere(BoundSphere bs, Mat4 transform, vec4 color)

Renders the bounding sphere in a given color.

Arguments

  • BoundSphere bs - The bounding sphere.
  • Mat4 transform - Transformation matrix for the bounding sphere.
  • vec4 color - Color, in which the sphere will be rendered.

void engine.visualizer.renderBox(vec3 arg1, Mat4 arg2, vec4 arg3)

Renders a box in a given color.

Arguments

  • vec3 arg1 - Dimensions of the box.
  • Mat4 arg2 - Transformation matrix used to position the box.
  • vec4 arg3 - Color, in which the box will be rendered.

void engine.visualizer.renderBoxHandler(Node node, vec3 arg2, vec4 arg3)

Renders a handler in a form of a box.

Arguments

  • Node node - Node, for which the handler is rendered.
  • vec3 arg2 - Dimensions of the box.
  • vec4 arg3 - Color, in which the box will be rendered.

void engine.visualizer.renderCapsule(float arg1, float arg2, Mat4 arg3, vec4 arg4)

Renders a capsule (capped cylinder) in a given color.

Arguments

  • float arg1 - Radius of the capsule.
  • float arg2 - Height of the capsule.
  • Mat4 arg3 - Transformation matrix used to position the capsule.
  • vec4 arg4 - Color, in which the capsule will be rendered.

void engine.visualizer.renderCircle(float arg1, Mat4 arg2, vec4 arg3)

Renders a circle in a given color.

Arguments

  • float arg1 - Radius of the circle.
  • Mat4 arg2 - Transformation matrix used to position the circle.
  • vec4 arg3 - Color, in which the circle will be rendered.

void engine.visualizer.renderCone(float arg1, float arg2, Mat4 arg3, vec4 arg4)

Renders a cone in a given color.

Arguments

  • float arg1 - Radius of the cone.
  • float arg2 - Angle of the cone.
  • Mat4 arg3 - Transformation matrix used to position the cone.
  • vec4 arg4 - Color, in which the cone will be rendered.

void engine.visualizer.renderCylinder(float arg1, float arg2, Mat4 arg3, vec4 arg4)

Renders a cylinder in a given color.

Arguments

  • float arg1 - Radius of the cylinder.
  • float arg2 - Height of the cylinder.
  • Mat4 arg3 - Transformation matrix used to position the cylinder.
  • vec4 arg4 - Color, in which the cylinder will be rendered.

void engine.visualizer.renderDirection(Vec3 arg1, vec3 arg2, vec4 arg3, float arrow_size = 0.25f, int screen_space = 0)

Renders a direction vector of a given color.

Arguments

  • Vec3 arg1 - Coordinates of the vector origin.
  • vec3 arg2 - Target vector direction.
  • vec4 arg3 - Vector color.
  • float arrow_size - Arrow size.
  • int screen_space - A flag indicating the type of dimensions to be used:
    • 0 - use the world space dimensions
    • 1 - use the screen space dimensions

void engine.visualizer.renderEllipse(vec3 arg1, Mat4 arg2, vec4 arg3)

Renders an ellipse in a given color.

Arguments

  • vec3 arg1 - Ellipse radius values along three axes.
  • Mat4 arg2 - Transformation matrix for the ellipse.
  • vec4 arg3 - Color, in which the box will be rendered.

void engine.visualizer.renderFrustum(mat4 arg1, Mat4 arg2, vec4 arg3)

Renders a frustum in a given color.

Arguments

  • mat4 arg1 - Projection matrix used to transform the coordinates.
  • Mat4 arg2 - Transformation matrix used to position the frustum.
  • vec4 arg3 - Color, in which the frustum will be rendered.

void engine.visualizer.renderLine2D(vec3 arg1, vec3 arg2, vec3 arg3, vec3 arg4, vec4 arg5)

Renders a 2D line of a given color. 2D lines are rendered in the screen plane; coordinates of the upper left corner are (0; 0), of the lower right corner — (1; 1).

Arguments

  • vec3 arg1 - Starting point of the line.
  • vec3 arg2 - First intermediate point of the line.
  • vec3 arg3 - Second intermediate point of the line.
  • vec3 arg4 - Ending point of the line.
  • vec4 arg5 - Color, in which the line will be rendered.

void engine.visualizer.renderLine2D(vec3 arg1, vec3 arg2, vec4 arg3)

Renders a 2D line of a given color. 2D lines are rendered in the screen plane; coordinates of the upper left corner are (0; 0), of the lower right corner — (1; 1).

Arguments

  • vec3 arg1 - Starting point of the line.
  • vec3 arg2 - First intermediate point of the line.
  • vec4 arg3 - Second intermediate point of the line.

void engine.visualizer.renderLine2D(vec3 arg1, vec3 arg2, vec3 arg3, vec4 arg4)

Renders a 2D line of a given color. 2D lines are rendered in the screen plane; coordinates of the upper left corner are (0; 0), of the lower right corner — (1; 1).

Arguments

  • vec3 arg1 - Starting point of the line.
  • vec3 arg2 - First intermediate point of the line.
  • vec3 arg3 - Second intermediate point of the line.
  • vec4 arg4 - Ending point of the line.

void engine.visualizer.renderLine3D(Vec3 arg1, Vec3 arg2, Vec3 arg3, Vec3 arg4, vec4 arg5)

Renders a 3D line in a given color. 3D lines are rendered in the world space.

Arguments

  • Vec3 arg1 - Starting point of the line.
  • Vec3 arg2 - First intermediate point of the line.
  • Vec3 arg3 - Second intermediate point of the line.
  • Vec3 arg4 - Ending point of the line.
  • vec4 arg5 - Color, in which the line will be rendered.

void engine.visualizer.renderLine3D(Vec3 arg1, Vec3 arg2, vec4 arg3)

Renders a 3D line in a given color. 3D lines are rendered in the world space.

Arguments

  • Vec3 arg1 - Starting point of the line.
  • Vec3 arg2 - First intermediate point of the line.
  • vec4 arg3 - Second intermediate point of the line.

void engine.visualizer.renderLine3D(Vec3 arg1, Vec3 arg2, Vec3 arg3, vec4 arg4)

Renders a 3D line in a given color. 3D lines are rendered in the world space.

Arguments

  • Vec3 arg1 - Starting point of the line.
  • Vec3 arg2 - First intermediate point of the line.
  • Vec3 arg3 - Second intermediate point of the line.
  • vec4 arg4 - Ending point of the line.

void engine.visualizer.renderMessage2D(vec3 arg1, vec3 arg2, string arg3, vec4 arg4, int arg5)

Renders a message in a given color. Message position is specified in screen coordinates.

Arguments

  • vec3 arg1 - Anchor point of the message in range [0;1].
  • vec3 arg2 - Message alignment. The first two values in the vector set the offset, the third one is ignored. For example, vec3(-1,-1,0) means the center of the message will be offset to its upper left edge. vec3(1,1,0) offsets the center to the lower right corner.
  • string arg3 - Message to display.
  • vec4 arg4 - Color, in which the message will be rendered.
  • int arg5 - 1 to use font outlining, 0 not to use.

void engine.visualizer.renderMessage3D(Vec3 arg1, vec3 arg2, string arg3, vec4 arg4, int arg5)

Renders a message in a given color. Message position is specified in world coordinates.

Arguments

  • Vec3 arg1 - Anchor point of the message.
  • vec3 arg2 - Message alignment. The first two values in the vector set the offset, the third one is ignored. For example, vec3(-1,-1,0) means the center of the message will be offset to its upper left edge. vec3(1,1,0) offsets the center to the lower right corner.
  • string arg3 - Message to display.
  • vec4 arg4 - Color, in which the message will be rendered.
  • int arg5 - 1 to use font outlining, 0 not to use.

void engine.visualizer.renderNodeBoundBox(Node node, vec4 color)

Renders an axis-aligned bound box of a given node.

Arguments

  • Node node - Node, for which the bound box is rendered.
  • vec4 color - Color, in which the box will be rendered.

void engine.visualizer.renderNodeBoundSphere(Node node, vec4 color)

Renders a bound sphere of a given node.

Arguments

  • Node node - Node, for which the bound sphere is rendered.
  • vec4 color - Color, in which the sphere will be rendered.

void engine.visualizer.renderObject(Object object, vec4 arg2)

Renders an object wireframe.

Arguments

  • Object object - Object, which wireframe will be rendered.
  • vec4 arg2 - Color, in which the wireframe will be rendered.

void engine.visualizer.renderObjectSurface(Object object, int arg2, vec4 arg3)

Renders borders of a given object surface.

Arguments

  • Object object - Object, which contains the target surface.
  • int arg2 - The number of the target surface in the object.
  • vec4 arg3 - Color, in which the borders will be rendered.

void engine.visualizer.renderObjectSurfaceBoundBox(Object object, int surface, vec4 color)

Renders a bound box of a given object surface.

Arguments

  • Object object - Object, which contains the target surface.
  • int surface - The number of the target surface in the object.
  • vec4 color - Color, in which the box will be rendered.

void engine.visualizer.renderObjectSurfaceBoundSphere(Object object, int surface, vec4 color)

Renders a bound sphere of a given object surface.

Arguments

  • Object object - Object, which contains the target surface.
  • int surface - The number of the target surface in the object.
  • vec4 color - Color, in which the sphere will be rendered.

void engine.visualizer.renderPoint2D(vec3 arg1, float arg2, vec4 arg3)

Renders a 2D point of a given size and color. 2D points are rendered in the screen plane; coordinates of the upper left corner are (0; 0), of the lower right corner—(1; 1).

Arguments

  • vec3 arg1 - Point coordinates.
  • float arg2 - Point size.
  • vec4 arg3 - Color, in which the point will be rendered.

void engine.visualizer.renderPoint3D(Vec3 arg1, float arg2, vec4 arg3, int screen_space = 0)

Renders a 3D point of a given size and color. 3D points are rendered in the world space.

Arguments

  • Vec3 arg1 - Point coordinates.
  • float arg2 - Point size in range [0;1]. The point size is set in proportion to the screen resolution.
  • vec4 arg3 - Point color.
  • int screen_space - A flag indicating the type of dimensions to be used:
    • 0 - use the world space dimensions
    • 1 - use the screen space dimensions

void engine.visualizer.renderQuad2D(vec3 arg1, vec3 arg2, vec3 arg3, vec3 arg4, vec4 arg5)

Renders a 2D quad in a given color. 2D quads are rendered in the screen plane; coordinates of the upper left corner are (0; 0), of the lower right corner—(1; 1).

Arguments

  • vec3 arg1 - Coordinates of the first vertex.
  • vec3 arg2 - Coordinates of the second vertex.
  • vec3 arg3 - Coordinates of the third vertex.
  • vec3 arg4 - Coordinates of the fourth vertex.
  • vec4 arg5 - Color, in which the quad will be rendered.

void engine.visualizer.renderQuad3D(Vec3 arg1, Vec3 arg2, Vec3 arg3, Vec3 arg4, vec4 arg5)

Renders a 3D quad in a given color. 3D quads are rendered in the world space.

Arguments

  • Vec3 arg1 - Coordinates of the first vertex.
  • Vec3 arg2 - Coordinates of the second vertex.
  • Vec3 arg3 - Coordinates of the third vertex.
  • Vec3 arg4 - Coordinates of the fourth vertex.
  • vec4 arg5 - Color, in which the quad will be rendered.

void engine.visualizer.renderSector(float arg1, float arg2, Mat4 arg3, vec4 arg4)

Renders a sector of the circle in a given color.

Arguments

  • float arg1 - Radius of the circle from which a sector will be cut.
  • float arg2 - Angle of the sector.
  • Mat4 arg3 - Transformation matrix used to position the sector.
  • vec4 arg4 - Color, in which the sector will be rendered.

void engine.visualizer.renderSolidBox(vec3 arg1, Mat4 arg2, vec4 arg3)

Renders a solid-colored box.

Arguments

  • vec3 arg1 - Size of the solid box.
  • Mat4 arg2 - Transformation matrix used to position the solid box.
  • vec4 arg3 - Color, in which the solid box will be rendered.

void engine.visualizer.renderSolidCapsule(float arg1, float arg2, Mat4 arg3, vec4 arg4)

Renders a solid-colored capsule.

Arguments

  • float arg1 - Radius of the capsule.
  • float arg2 - Height of the capsule.
  • Mat4 arg3 - Transformation matrix used to position the capsule.
  • vec4 arg4 - Color, in which the capsule will be rendered.

void engine.visualizer.renderSolidCylinder(float arg1, float arg2, Mat4 arg3, vec4 arg4)

Renders a solid-colored cylinder.

Arguments

  • float arg1 - Radius of the cylinder.
  • float arg2 - Height of the cylinder.
  • Mat4 arg3 - Transformation matrix used to position the cylinder.
  • vec4 arg4 - Color, in which the cylinder will be rendered.

void engine.visualizer.renderSolidEllipse(vec3 arg1, Mat4 arg2, vec4 arg3)

Renders a solid-colored ellipse.

Arguments

  • vec3 arg1 - Ellipse radius values along three axes.
  • Mat4 arg2 - Transformation matrix used to position the ellipse.
  • vec4 arg3 - Color, in which the ellipse will be rendered.

void engine.visualizer.renderSolidObject(Object object, vec4 arg2)

Renders a solid-colored object.

Arguments

  • Object object - Object that will be rendered.
  • vec4 arg2 - Color in which the object will be rendered.

void engine.visualizer.renderSolidObjectSurface(Object object, int arg2, vec4 arg3)

Renders a solid-colored surface of a given object.

Arguments

  • Object object - Object that will be rendered.
  • int arg2 - The number of the object's surface.
  • vec4 arg3 - Color, in which the object's surface will be rendered.

void engine.visualizer.renderSolidSphere(float arg1, Mat4 arg2, vec4 arg3)

Renders a solid sphere in a given color.

Arguments

  • float arg1 - Radius of the solid sphere.
  • Mat4 arg2 - Transformation matrix used to position the solid sphere.
  • vec4 arg3 - Sphere color.

void engine.visualizer.renderSphere(float arg1, Mat4 arg2, vec4 arg3)

Renders a sphere in a given color.

Arguments

  • float arg1 - Radius of the sphere.
  • Mat4 arg2 - Transformation matrix used to position the sphere.
  • vec4 arg3 - Color, in which the sphere will be rendered.

void engine.visualizer.renderSphereHandler(Node node, float arg2, vec4 arg3)

Renders a node handler in a form of a sphere.

Arguments

  • Node node - Node, for which the handler is rendered.
  • float arg2 - Radius of the sphere.
  • vec4 arg3 - Sphere color.

void engine.visualizer.renderTextureHandler(Node node, float arg2, int screen_space = 0)

Renders a texture handler of the specified size.

Arguments

  • Node node - Pointer to the node, for which the handler is rendered.
  • float arg2 - Texture size (length of one side of the texture).
  • int screen_space - A flag indicating the type of dimensions to be used:
    • 0 - use the world space dimensions
    • 1 - use the screen space dimensions

void engine.visualizer.renderTriangle2D(vec3 arg1, vec3 arg2, vec3 arg3, vec4 arg4)

Renders a 2D triangle in a given color. 2D triangles are rendered in the screen plane; coordinates of the upper left corner are (0; 0), of the lower right corner—(1; 1).

Arguments

  • vec3 arg1 - Coordinates of the first vertex.
  • vec3 arg2 - Coordinates of the second vertex.
  • vec3 arg3 - Coordinates of the third vertex.
  • vec4 arg4 - Color, in which the triangle will be rendered.

void engine.visualizer.renderTriangle3D(Vec3 arg1, Vec3 arg2, Vec3 arg3, vec4 arg4)

Renders a 3D triangle of a given color. 3D triangles are rendered in the world space.

Arguments

  • Vec3 arg1 - Coordinates of the first vertex.
  • Vec3 arg2 - Coordinates of the second vertex.
  • Vec3 arg3 - Coordinates of the third vertex.
  • vec4 arg4 - Color, in which the triangle will be rendered.

engine.visualizer.renderVector(Vec3 arg1, Vec3 arg2, vec4 arg3, float arrow_size = 0.25f, int screen_space = 0)

Renders a vector of a given color.

Arguments

  • Vec3 arg1 - Coordinates of the vector origin.
  • Vec3 arg2 - Coordinates of the vector target.
  • vec4 arg3 - Vector color.
  • float arrow_size - Arrow size.
  • int screen_space - A flag indicating the type of dimensions to be used:
    • 0 - use the world space dimensions
    • 1 - use the screen space dimensions

void engine.visualizer.renderWorldSectorObjectSurfaces(WorldSector sector, vec4 color)

Renders objects wireframes inside a given sector.

Arguments

  • WorldSector sector - Sector, in which the object wireframes will be rendered.
  • vec4 color - Color, in which the wireframes will be rendered.
Last update: 2017-07-03
Build: ()