This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
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
CIGI Client Plugin
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.

Unigine.Visualizer Class

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.).

Usage Example

To render a world origin, do the following:

Source code (C#)
// AppWorldLogic.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Unigine;

namespace UnigineApp
{
	class AppWorldLogic : WorldLogic
	{

	public override int init()
		{
			/* ... */
			// enable the visualizer
			Visualizer.get().setEnabled(1);

			return 1;
		}


		public override int update()
		{
			// render world origin
			Visualizer.get().renderVector(new dvec3(0.0f, 0.0f, 0.1f), new dvec3(1.0f, 0.0f, 0.1f), new vec4(1.0f, 0.0f, 0.0f, 1.0f));
			Visualizer.get().renderVector(new dvec3(0.0f, 0.0f, 0.1f), new dvec3(0.0f, 1.0f, 0.1f), new vec4(0.0f, 1.0f, 0.0f, 1.0f));
			Visualizer.get().renderVector(new dvec3(0.0f, 0.0f, 0.1f), new dvec3(0.0f, 0.0f, 1.1f), new vec4(0.0f, 0.0f, 1.0f, 1.0f));

			return 1;
		}
	}
}

Visualizer Class

Members


void setEnabled(int enabled)

Enables or disables the visualizer.

Arguments

  • int enabled - 1 to enable the visualizer, 0 to disable it.

int isEnabled()

Returns a value indicating if the visualizer is enabled.

Return value

1 if the visualizer is enabled; otherwise, 0.

void setSize(int size)

Updates the current size of the handler. All handlers have the same size.

Arguments

  • int size - New handler size in pixels.

int getSize()

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

Return value

The current size of the handler in pixels.

void setTextureName(string name)

Updates the current name of the texture.

Arguments

  • string name - New name of the texture.

string getTextureName()

Returns the string with the name of the texture.

Return value

The name of the texture.

void clear()

Clears all internal primitives created by calls to renderSmth functions. These primitives are accumulated in the internal buffer and then rendered together.
Notice
This method can be used to render several viewports with visualizer.

void renderPoint2D(vec3 v, float size, vec4 color)

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 v - Point coordinates.
  • float size - Point size.
  • vec4 color - Color, in which the point will be rendered.

void renderPoint3D(Vec3 v, float size, vec4 color, int screen_space = 0)

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

Arguments

  • Vec3 v - Point coordinates.
  • float size - Point size in range [0;1]. The point size is set in proportion to the screen resolution.
  • vec4 color - 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 renderLine2D(vec3 v0, vec3 v1, vec4 color)

Renders a 2D line of a given color by using 2 points. 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 v0 - Starting point of the line.
  • vec3 v1 - First intermediate point of the line.
  • vec4 color - Second intermediate point of the line.

void renderLine3D(Vec3 v0, Vec3 v1, vec4 color)

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

Arguments

  • Vec3 v0 - Starting point of the line.
  • Vec3 v1 - First intermediate point of the line.
  • vec4 color - Second intermediate point of the line.

void renderLine2D(vec3 v0, vec3 v1, vec3 v2, vec4 color)

Renders a 2D line of a given color by using 2 points. 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 v0 - Starting point of the line.
  • vec3 v1 - First intermediate point of the line.
  • vec3 v2 - Second intermediate point of the line.
  • vec4 color - Ending point of the line.

void renderLine3D(Vec3 v0, Vec3 v1, Vec3 v2, vec4 color)

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

Arguments

  • Vec3 v0 - Starting point of the line.
  • Vec3 v1 - First intermediate point of the line.
  • Vec3 v2 - Second intermediate point of the line.
  • vec4 color - Ending point of the line.

void renderLine2D(vec3 v0, vec3 v1, vec3 v2, vec3 v3, vec4 color)

Renders a 2D line of a given color by using 2 points. 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 v0 - Starting point of the line.
  • vec3 v1 - First intermediate point of the line.
  • vec3 v2 - Second intermediate point of the line.
  • vec3 v3 - Ending point of the line.
  • vec4 color - Color, in which the line will be rendered.

void renderLine3D(Vec3 v0, Vec3 v1, Vec3 v2, Vec3 v3, vec4 color)

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

Arguments

  • Vec3 v0 - Starting point of the line.
  • Vec3 v1 - First intermediate point of the line.
  • Vec3 v2 - Second intermediate point of the line.
  • Vec3 v3 - Ending point of the line.
  • vec4 color - Color, in which the line will be rendered.

void renderTriangle2D(vec3 v0, vec3 v1, vec3 v2, vec4 color)

Renders a 2D triangle of 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 v0 - Coordinates of the first vertex.
  • vec3 v1 - Coordinates of the second vertex.
  • vec3 v2 - Coordinates of the third vertex.
  • vec4 color - Color, in which the triangle will be rendered.

void renderTriangle3D(Vec3 v0, Vec3 v1, Vec3 v2, vec4 color)

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

Arguments

  • Vec3 v0 - Coordinates of the first vertex.
  • Vec3 v1 - Coordinates of the second vertex.
  • Vec3 v2 - Coordinates of the third vertex.
  • vec4 color - Color, in which the triangle will be rendered.

void renderQuad2D(vec3 v0, vec3 v1, vec3 v2, vec3 v3, vec4 color)

Renders a 2D quadrilateral of 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 v0 - Coordinates of the first vertex.
  • vec3 v1 - Coordinates of the second vertex.
  • vec3 v2 - Coordinates of the third vertex.
  • vec3 v3 - Coordinates of the fourth vertex.
  • vec4 color - Color, in which the quad will be rendered.

void renderQuad3D(Vec3 v0, Vec3 v1, Vec3 v2, Vec3 v3, vec4 color)

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

Arguments

  • Vec3 v0 - Coordinates of the first vertex.
  • Vec3 v1 - Coordinates of the second vertex.
  • Vec3 v2 - Coordinates of the third vertex.
  • Vec3 v3 - Coordinates of the fourth vertex.
  • vec4 color - Color, in which the quad will be rendered.

void renderBillboard3D(Vec3 v, float size, vec4 texcoord, int screen_space = 0)

Renders a 3D billboard of the specified size.

Arguments

  • Vec3 v - Coordinates of the billboard.
  • float size - The billboard size.
  • vec4 texcoord - 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

renderVector(Vec3 position_start, Vec3 position_end, vec4 color, float arrow_size = 0.25f, int screen_space = 0)

Renders a vector of a given color.

Arguments

  • Vec3 position_start - Coordinates of the vector origin.
  • Vec3 position_end - Coordinates of the vector target.
  • vec4 color - 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 renderDirection(Vec3 position, vec3 direction, vec4 color, float arrow_size = 0.25f, int screen_space = 1)

Renders a direction vector of a given color.

Arguments

  • Vec3 position - Coordinates of the vector origin.
  • vec3 direction - Target vector direction.
  • vec4 color - 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 renderBox(vec3 size, Mat4 transform, vec4 color)

Renders a wireframe box of a given color.

Arguments

  • vec3 size - Dimensions of the box.
  • Mat4 transform - Transformation matrix used to position the box.
  • vec4 color - Color, in which the box will be rendered.

void renderFrustum(mat4 projection, Mat4 transform, vec4 color)

Renders a wireframe frustum of a given color.

Arguments

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

void renderCircle(float radius, Mat4 transform, vec4 color)

Renders a wireframe circle of a given color.

Arguments

  • float radius - Radius of the circle.
  • Mat4 transform - Transformation matrix used to position the circle.
  • vec4 color - Color, in which the circle will be rendered.

void renderSector(float radius, float angle, Mat4 transform, vec4 color)

Renders a wireframe sector of a given color.

Arguments

  • float radius - Radius of the circle from which a sector will be cut.
  • float angle - Angle of the sector.
  • Mat4 transform - Transformation matrix used to position the sector.
  • vec4 color - Color, in which the sector will be rendered.

void renderCone(float radius, float angle, Mat4 transform, vec4 color)

Renders a wireframe cone of a given color.

Arguments

  • float radius - Radius of the cone.
  • float angle - Angle of the cone.
  • Mat4 transform - Transformation matrix used to position the cone.
  • vec4 color - Color, in which the cone will be rendered.

void renderSphere(float radius, Mat4 transform, vec4 color)

Renders a wireframe sphere of a given color.

Arguments

  • float radius - Radius of the sphere.
  • Mat4 transform - Transformation matrix used to position the sphere.
  • vec4 color - Color, in which the sphere will be rendered.

void renderCapsule(float radius, float height, Mat4 transform, vec4 color)

Renders a wireframe capsule (capped cylinder) of a given color.

Arguments

  • float radius - Radius of the capsule.
  • float height - Height of the capsule.
  • Mat4 transform - Transformation matrix used to position the capsule.
  • vec4 color - Color, in which the capsule will be rendered.

void renderCylinder(float radius, float height, Mat4 transform, vec4 color)

Renders a wireframe cylinder of a given color.

Arguments

  • float radius - Radius of the cylinder.
  • float height - Height of the cylinder.
  • Mat4 transform - Transformation matrix used to position the cylinder.
  • vec4 color - Color, in which the cylinder will be rendered.

void renderEllipse(vec3 radius, Mat4 transform, vec4 color)

Renders a wireframe ellipse of a given color.

Arguments

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

void renderSolidBox(vec3 size, Mat4 transform, vec4 color)

Renders a solid box of a given color.

Arguments

  • vec3 size - Size of the solid box.
  • Mat4 transform - Transformation matrix used to position the solid box.
  • vec4 color - Color, in which the solid box will be rendered.

void renderSolidSphere(float radius, Mat4 transform, vec4 color)

Renders a solid sphere of a given color.

Arguments

  • float radius - Radius of the solid sphere.
  • Mat4 transform - Transformation matrix used to position the solid sphere.
  • vec4 color - Sphere color.

void renderSolidCapsule(float radius, float height, Mat4 transform, vec4 color)

Renders a solid capsule.

Arguments

  • float radius - Radius of the capsule.
  • float height - Height of the capsule.
  • Mat4 transform - Transformation matrix used to position the capsule.
  • vec4 color - Color, in which the capsule will be rendered.

void renderSolidCylinder(float radius, float height, Mat4 transform, vec4 color)

Renders a solid cylinder of a given color.

Arguments

  • float radius - Radius of the cylinder.
  • float height - Height of the cylinder.
  • Mat4 transform - Transformation matrix used to position the cylinder.
  • vec4 color - Color, in which the cylinder will be rendered.

void renderSolidEllipse(vec3 radius, Mat4 transform, vec4 color)

Renders a solid ellipse of a given color.

Arguments

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

void 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 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 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 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 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 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 renderBoxHandler(Node node, vec3 size, vec4 color)

Renders a handler in a form of a box.

Arguments

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

void renderSphereHandler(Node node, float radius, vec4 color)

Renders a node handler in a form of a sphere.

Arguments

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

void renderTextureHandler(Node node, float size, int screen_space = 1)

Renders a texture handler of the specified size.

Arguments

  • Node node - Pointer to the node, for which the handler is rendered.
  • float size - 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 renderObject(Object object, vec4 color)

Renders an object wireframe.

Arguments

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

void renderObjectSurface(Object object, int surface, vec4 color)

Renders borders 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 borders will be rendered.

void renderSolidObject(Object object, vec4 color)

Renders a solid-colored object.

Arguments

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

void renderSolidObjectSurface(Object object, int surface, vec4 color)

Renders a solid-colored surface of a given object.

Arguments

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

void 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.

void renderMessage2D(vec3 position, vec3 center, string str, vec4 color, int outline)

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

Arguments

  • vec3 position - Coordinates of the anchor point of the message, each in [0;1] range.
  • vec3 center - Message alignment. The first two values in the vector set the offset, the third one is ignored. For example, vec3(-1,-1,0) sets the offset of the center of the message to its upper left edge. vec3(1,1,0) - to the lower right corner.
  • string str - Message text to display.
  • vec4 color - Color, in which the message will be rendered.
  • int outline - 1 to use font outlining, 0 not to use.

void renderMessage2D(vec3 position, vec3 center, string str, vec4 color, int outline, int font_size)

Renders a message in a given color with the specified font size. Message position is specified in screen coordinates.

Arguments

  • vec3 position - Coordinates of the anchor point of the message, each in [0;1] range.
  • vec3 center - Message alignment. The first two values in the vector set the offset, the third one is ignored. For example, vec3(-1,-1,0) sets the offset of the center of the message to its upper left edge. vec3(1,1,0) - to the lower right corner.
  • string str - Message text to display.
  • vec4 color - Color, in which the message will be rendered.
  • int outline - 1 to use font outlining, 0 not to use.
  • int font_size - Font size.

void renderMessage3D(Vec3 position, vec3 center, string str, vec4 color, int outline)

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

Arguments

  • Vec3 position - Coordinates of the anchor point of the message (in world coordinates).
  • vec3 center - Message alignment. The first two values in the vector set the offset, the third one is ignored. For example, vec3(-1,-1,0) sets the offset of the center of the message to its upper left edge. vec3(1,1,0) - to the lower right corner.
  • string str - Message text to display.
  • vec4 color - Color, in which the message will be rendered.
  • int outline - 1 to use font outlining, 0 not to use.

void renderMessage3D(Vec3 position, vec3 center, string str, vec4 color, int outline, int font_size)

Renders a message in a given color with the specified font size. Message position is specified in world coordinates.

Arguments

  • Vec3 position - Coordinates of the anchor point of the message (in world coordinates).
  • vec3 center - Message alignment. The first two values in the vector set the offset, the third one is ignored. For example, vec3(-1,-1,0) sets the offset of the center of the message to its upper left edge. vec3(1,1,0) - to the lower right corner.
  • string str - Message text to display.
  • vec4 color - Color, in which the message will be rendered.
  • int outline - 1 to use font outlining, 0 not to use.
  • int font_size - Font size.
Last update: 2018-08-10
Build: ()