UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1

Unigine::Visualizer Class

Unigine visualizer. This interface provides access to Unigine visualizer functions.

To use this class, include the UnigineVisualizer.h file.

Unigine::Visualizer Class

Members


virtual ~Visualizer ()

Virtual destructor.

static Visualizer * get ()

Returns a pointer to the existing render.

Return value

Pointer to the existing render.

virtual void setEnabled (int enable) const =0

Enables or disables the visualizer.

Arguments

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

virtual int isEnabled () const =0

Returns a value indicating if the visualizer is enabled.

Return value

Returns 1 if the visualizer is enabled; otherwise, 0.

virtual void setSize (int size) const =0

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

Arguments

  • int size - A new handler size in pixels.

virtual int getSize () const =0

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

Return value

The current size of the handler in pixels.

virtual void setTextureName (const char * name) const =0

Updates the current name of the texture.

Arguments

  • const char * name - A new name of the texture.

virtual const char * getTextureName () const =0

Returns the string with the name of the texture.

Return value

The name of the texture.

virtual void setProjection (const mat4 & projection) const =0

Updates the projection matrix of the visualizer.

Arguments

  • const mat4 & projection - A projection matrix if the visualization is enabled.

virtual mat4 getProjection () const =0

Returns the current projection matrix of the visualizer.

Return value

The projection matrix if the visualization is enabled.

virtual void setModelview (const UNIGINE_MAT4 & modelview) const =0

Updates the modelview matrix of the visualizer. This matrix prevents the desynchronization between the visualizer and the render. It is set after the camera update in the editor.

Arguments

  • const UNIGINE_MAT4 & modelview - A modelview matrix if the visualization is enabled.

virtual UNIGINE_MAT4 getModelview () const =0

Returns the current modelview matrix of the visualizer. This matrix prevents the desynchronization between the visualizer and the render. It is set after the camera update in the editor.

Return value

The modelview matrix if the visualization is enabled.

virtual float getScale (const UNIGINE_VEC3 & position) const =0

Returns the scale factor of the visualizer at the specified world position.

Arguments

  • const UNIGINE_VEC3 & position - World position.

Return value

Scale factor of the visualizer.

virtual void renderPoint2D (const vec3 & v, float size, const vec4 & color) const =0

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

  • const vec3 & v - Point coordinates.
  • float size - Point size in range [0;1]. The point size is set in proportion to the screen resolution.
  • const vec4 & color - Point color.

virtual void renderPoint3D (const UNIGINE_VEC3 & v, float size, const vec4 & color) const =0

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

Arguments

  • const UNIGINE_VEC3 & v - Point coordinates.
  • float size - Point size in range [0;1]. The point size is set in proportion to the screen resolution.
  • const vec4 & color - Point color.

virtual void renderLine2D (const vec3 & v0, const vec3 & v1, const vec4 & color) const =0

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

  • const vec3 & v0 - Starting point of the line.
  • const vec3 & v1 - Ending point of the line.
  • const vec4 & color - Line color.

virtual void renderLine3D (const UNIGINE_VEC3 & v0, const UNIGINE_VEC3 & v1, const vec4 & color) const =0

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

Arguments

  • const UNIGINE_VEC3 & v0 - Starting point of the line.
  • const UNIGINE_VEC3 & v1 - Ending point of the line.
  • const vec4 & color - Line color.

virtual void renderLine2D (const vec3 & v0, const vec3 & v1, const vec3 & v2, const vec4 & color) const =0

Renders a 2D line of a given color by using 1 additional point. 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

  • const vec3 & v0 - Coordinates of the starting point of the line.
  • const vec3 & v1 - Coordinates of the intermediate point of the line.
  • const vec3 & v2 - Coordinates of the ending point of the line.
  • const vec4 & color - Line color.

virtual void renderLine3D (const UNIGINE_VEC3 & v0, const UNIGINE_VEC3 & v1, const UNIGINE_VEC3 & v2, const vec4 & color) const =0

Renders a 3D line of a given color by using 1 additional point. 3D lines are rendered in the world space.

Arguments

  • const UNIGINE_VEC3 & v0 - Coordinates of the starting point of the line.
  • const UNIGINE_VEC3 & v1 - Coordinates of the intermediate point of the line.
  • const UNIGINE_VEC3 & v2 - Coordinates of the ending point of the line.
  • const vec4 & color - Line color.

virtual void renderLine2D (const vec3 & v0, const vec3 & v1, const vec3 & v2, const vec3 & v3, const vec4 & color) const =0

Renders a 2D line of a given color by using 2 additional points.

Arguments

  • const vec3 & v0 - Coordinates of the starting point of the line.
  • const vec3 & v1 - Coordinates of the first intermediate point of the line.
  • const vec3 & v2 - Coordinates of the second intermediate point of the line.
  • const vec3 & v3 - Coordinates of the ending point of the line.
  • const vec4 & color - Line color.

virtual void renderLine3D (const UNIGINE_VEC3 & v0, const UNIGINE_VEC3 & v1, const UNIGINE_VEC3 & v2, const UNIGINE_VEC3 & v3, const vec4 & color) const =0

Renders a 3D line of a given color by using 2 additional points. 3D lines are rendered in the world space.

Arguments

  • const UNIGINE_VEC3 & v0 - Coordinates of the starting point of the line.
  • const UNIGINE_VEC3 & v1 - Coordinates of the first intermediate point of the line.
  • const UNIGINE_VEC3 & v2 - Coordinates of the second intermediate point of the line.
  • const UNIGINE_VEC3 & v3 - Coordinates of the ending point of the line.
  • const vec4 & color - Line color.

virtual void renderTriangle2D (const vec3 & v0, const vec3 & v1, const vec3 & v2, const vec4 & color) const =0

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

  • const vec3 & v0 - Coordinates of the first vertex.
  • const vec3 & v1 - Coordinates of the second vertex.
  • const vec3 & v2 - Coordinates of the third vertex.
  • const vec4 & color - Triangle color.

virtual void renderTriangle3D (const UNIGINE_VEC3 & v0, const UNIGINE_VEC3 & v1, const UNIGINE_VEC3 & v2, const vec4 & color) const =0

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

Arguments

  • const UNIGINE_VEC3 & v0 - Coordinates of the first vertex.
  • const UNIGINE_VEC3 & v1 - Coordinates of the second vertex.
  • const UNIGINE_VEC3 & v2 - Coordinates of the third vertex.
  • const vec4 & color - Triangle color.

virtual void renderQuad2D (const vec3 & v0, const vec3 & v1, const vec3 & v2, const vec3 & v3, const vec4 & color) const =0

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

  • const vec3 & v0 - Coordinates of the first vertex.
  • const vec3 & v1 - Coordinates of the second vertex.
  • const vec3 & v2 - Coordinates of the third vertex.
  • const vec3 & v3 - Coordinates of the fourth vertex.
  • const vec4 & color - Quadrilateral color.

virtual void renderQuad3D (const UNIGINE_VEC3 & v0, const UNIGINE_VEC3 & v1, const UNIGINE_VEC3 & v2, const UNIGINE_VEC3 & v3, const vec4 & color) const =0

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

Arguments

  • const UNIGINE_VEC3 & v0 - Coordinates of the first vertex.
  • const UNIGINE_VEC3 & v1 - Coordinates of the second vertex.
  • const UNIGINE_VEC3 & v2 - Coordinates of the third vertex.
  • const UNIGINE_VEC3 & v3 - Coordinates of the fourth vertex.
  • const vec4 & color - Quadrilateral color.

virtual void renderBillboard3D (const UNIGINE_VEC3 & v, float size, const vec4 & texcoord) const =0

Renders a 3D billboard of the specified size.

Arguments

  • const UNIGINE_VEC3 & v - Coordinates of the billboard.
  • float size - The billboard size.
  • const vec4 & texcoord - The billboard texture coordinates.

virtual void renderVector (const UNIGINE_VEC3 & position, const UNIGINE_VEC3 & vector, const vec4 & color) const =0

Renders a vector of a given color.

Arguments

  • const UNIGINE_VEC3 & position - Coordinates of the vector origin.
  • const UNIGINE_VEC3 & vector - Coordinates of the vector target.
  • const vec4 & color - Vector color.

virtual void renderDirection (const UNIGINE_VEC3 & position, const vec3 & direction, const vec4 & color) const =0

Renders a direction vector of a given color.

Arguments

  • const UNIGINE_VEC3 & position - Coordinates of the vector origin.
  • const vec3 & direction - Target vector direction.
  • const vec4 & color - Vector color.

virtual void renderBox (const vec3 & size, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a wireframe box of a given color.

Arguments

  • const vec3 & size - Dimensions of the box.
  • const UNIGINE_MAT4 & transform - Transformation matrix, which is used to position the box.
  • const vec4 & color - Box color.

virtual void renderFrustum (const mat4 & projection, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a wireframe frustum of a given color.

Arguments

  • const mat4 & projection - Projection matrix used to transform the coordinates.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the frustum.
  • const vec4 & color - Frustum color.

virtual void renderCircle (float radius, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a wireframe circle of a given color.

Arguments

  • float radius - Radius of the circle.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the circle.
  • const vec4 & color - Circle color.

virtual void renderSector (float radius, float angle, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a wireframe sector of a given color.

Arguments

  • float radius - Radius of the circle from which a sector is cut.
  • float angle - Angle of the sector.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the sector.
  • const vec4 & color - Sector color.

virtual void renderCone (float radius, float angle, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a wireframe cone of a given color.

Arguments

  • float radius - Radius of the cone.
  • float angle - Angle of the cone.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the cone.
  • const vec4 & color - Cone color.

virtual void renderSphere (float radius, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a wireframe sphere of a given color.

Arguments

  • float radius - Radius of the sphere.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the sphere.
  • const vec4 & color - Sphere color.

virtual void renderCapsule (float radius, float height, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

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

Arguments

  • float radius - Radius of the capsule.
  • float height - Height of the capsule.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the capsule.
  • const vec4 & color - Capsule color.

virtual void renderCylinder (float radius, float height, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a wireframe cylinder of a given color.

Arguments

  • float radius - Radius of the cylinder.
  • float height - Height of the cylinder.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the cylinder.
  • const vec4 & color - Cylinder color.

virtual void renderEllipse (const vec3 & radius, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a wireframe ellipse of a given color.

Arguments

  • const vec3 & radius - Ellipse radius values along three axes.
  • const UNIGINE_MAT4 & transform - Transformation matrix for the ellipse.
  • const vec4 & color - Ellipse color.

virtual void renderSolidBox (const vec3 & size, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a solid box of a given color.

Arguments

  • const vec3 & size - Size of the solid box.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the solid box.
  • const vec4 & color - Box color.

virtual void renderSolidSphere (float radius, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a solid sphere of a given color.

Arguments

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

virtual void renderSolidCapsule (float radius, float height, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a solid capsule.

Arguments

  • float radius - Radius of the capsule.
  • float height - Height of the capsule.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the capsule.
  • const vec4 & color - Capsule color.

virtual void renderSolidCylinder (float radius, float height, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a solid cylinder of a given color.

Arguments

  • float radius - Radius of the cylinder.
  • float height - Height of the cylinder.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the cylinder.
  • const vec4 & color - Cylinder color.

virtual void renderSolidEllipse (const vec3 & radius, const UNIGINE_MAT4 & transform, const vec4 & color) const =0

Renders a solid ellipse of a given color.

Arguments

  • const vec3 & radius - Ellipse radius values along three axes.
  • const UNIGINE_MAT4 & transform - Transformation matrix used to position the ellipse.
  • const vec4 & color - Ellipse color.

virtual void renderSolidObject (ObjectPtr object, const vec4 & color) const =0

Renders a solid-colored object.

Arguments

  • ObjectPtr object - Object smart pointer.
  • const vec4 & color - Color in which the object will be rendered.

virtual void renderSolidObjectSurface (ObjectPtr object, int surface, const vec4 & color) const =0

Renders a solid-colored surface of a given object.

Arguments

  • ObjectPtr object - Object smart pointer.
  • int surface - The number of the object's surface.
  • const vec4 & color - Color, in which the object's surface will be rendered.

virtual void renderBoxHandler (const NodePtr & node, const vec3 & size, const vec4 & color) const =0

Renders a handler in a form of a box.

Arguments

  • const NodePtr & node - Pointer to the node, for which the handler is rendered.
  • const vec3 & size - Dimensions of the box (length of one face of the box).
  • const vec4 & color - Box color.

virtual void renderSphereHandler (const NodePtr & node, float radius, const vec4 & color) const =0

Renders a node handler in a form of a sphere.

Arguments

  • const NodePtr & node - Pointer to the node, for which the handler is rendered.
  • float radius - Radius of the sphere.
  • const vec4 & color - Sphere color.

virtual void renderTextureHandler (const NodePtr & node, float size) const =0

Renders a texture handler of the specified size.

Arguments

  • const NodePtr & node - Pointer to the node, for which the handler is rendered.
  • float size - Texture size (length of one side of the texture).

virtual void renderMessage2D (const vec3 & position, const vec3 & center, const char * str, const vec4 & color, int outline) const =0

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

Arguments

  • const vec3 & position - Coordinates of the anchor point of the message in range [0;1].
  • const vec3 & center - Center of the message. The first two values in the vector set the offset, the third one is ignored. For example, vec3(-1,-1,0) offsets the center of the message to its upper left edge. vec3(1,1,0) offsets the center to the lower right corner.
  • const char * str - Message text to display.
  • const vec4 & color - Message color.
  • int outline - Message outline: 1 to use the outline, 0 not to use.

virtual void renderMessage3D (const UNIGINE_VEC3 & position, const vec3 & center, const char * str, const vec4 & color, int outline) const =0

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

Arguments

  • const UNIGINE_VEC3 & position - Coordinates of the anchor point of the message (in world coordinates).
  • const vec3 & center - Center of the message. The first two values in the vector set the offset, the third one is ignored. For example, vec3(-1,-1,0) offsets the center of the message to its upper left edge. vec3(1,1,0) offsets the center to the lower right corner.
  • const char * str - Message text to display.
  • const vec4 & color - Message color.
  • int outline - Message outline: 1 to use the outline, 0 not to use.
Last update: 2017-07-03