This page has been translated automatically.
Программирование
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
Engine-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
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::ObjectDynamic Class

Header:#include <UnigineObjects.h>
Inherits:Object

ObjectDynamic class allows to create a dynamic object, which can be rendered by means of any type of geometry (vertex format for an object is changeable). The class supports instancing as well as point/line/triangle rendering modes. ObjectDynamic class requires a custom shader for rendering, no build-in shaders are available.

ObjectDynamic Class

Members


static ObjectDynamicPtr create(int flags = 0)

Constructor. Creates a new dynamic object. By default, no flags are used.

Arguments

Ptr<ObjectDynamic> cast(const Ptr<Node> & node)

Casts an ObjectDynamic out of the Node instance.

Arguments

  • const Ptr<Node> & node - Pointer to Node.

Return value

Pointer to ObjectDynamic.

Ptr<ObjectDynamic> cast(const Ptr<Object> & base)

Casts an ObjectDynamic out of the Object instance.

Arguments

  • const Ptr<Object> & base - Pointer to Object.

Return value

Pointer to ObjectDynamic.

const ObjectDynamic::Attribute * getAttributes()

Returns an array of vertex attributes.

Return value

Array of vertex attributes.

void setBoundBox(const BoundBox & bb)

Sets a bounding box of a specified size for a given dynamic object surface.

Arguments

  • const BoundBox & bb - Bounding box.

void setBoundBox(const BoundBox & bb, int surface)

Sets a bounding box of a specified size for a given dynamic object surface.

Arguments

  • const BoundBox & bb - Bounding box.
  • int surface - Surface number in range from 0 to the total number of dynamic mesh surfaces.

void setIndex(int num, int index)

Updates the index in the index buffer (replaces the index with the given number with the specified index of the vertex).

Arguments

  • int num - Index number in the index buffer.
  • int index - Vertex index in the index buffer to set.

int getIndex(int num)

Returns the index of the vertex by the index number.

Arguments

  • int num - Index number.

Return value

Vertex index in the index buffer.

void setIndicesArray(int[] indices)

Updates the specified indices array.

Arguments

  • int[] indices

void setInstancing(int instancing)

Activates the hardware instancing technique.

Arguments

  • int instancing - Instancing flag. 1 to enable hardware instancing, 0 to disable it.

int getInstancing()

Returns a value indicating if the hardware instancing flag is enabled.

Return value

1 if the hardware instancing flag is enabled; otherwise, 0.

int getNumAttributes()

Returns the number of vertex attributes.

Return value

Number of vertex attributes.

void setNumIndices(int indices)

Sets the number of vertex indices.

Arguments

  • int indices - Number of indices.

int getNumIndices()

Returns the number of vertex indices of the object.

Return value

The number of indices.

void setNumVertex(int num)

Sets the number of mesh vertices.

Arguments

  • int num - Number of mesh vertices.

int getNumVertex()

Returns the number of object vertices.

Return value

The number of vertices.

void setParameterBool(const char * name, int value)

Sets boolean shader parameter.

Arguments

  • const char * name - Shader parameter name.
  • int value - Parameter value.

void setParameterFloat(const char * name, float[] value)

Sets float shader parameter.

Arguments

  • const char * name - Name of the parameter.
  • float[] value - Parameter value pointer.

void setParameterFloatArray(const char * name, float[] value, int num)

Sets an array of the specified number of float shader parameters.

Arguments

  • const char * name -
  • float[] value -
  • int num -

void setParameterInt(const char * name, int[] value)

Sets integer shader parameter.

Arguments

  • const char * name - Name of the parameter.
  • int[] value - Parameter value.

void setSurfaceBegin(int begin, int surface)

Sets the begin index for the specified object surface.

Arguments

  • int begin - The index to be set as the begin one for the surface.
  • int surface - Number of a target surface.

int getSurfaceBegin(int surface)

Returns the begin index of the specified object surface.

Arguments

  • int surface - Number of a target surface.

Return value

The begin index.

void setSurfaceEnd(int end, int surface)

Sets the end index for the specified object surface.

Arguments

  • int end - The index to be set as the end one for the surface.
  • int surface - Number of a target surface.

int getSurfaceEnd(int surface)

Returns the end index of the specified object surface.

Arguments

  • int surface - Number of a target surface.

Return value

The end index.

void setSurfaceMode(int mode, int surface)

Sets primitives to render the specified object surface with: triangles (by default), lines or points.

Arguments

  • int mode - Surface rendering mode.
  • int surface - Number of a target surface.

int getSurfaceMode(int surface)

Returns surface rendering mode.

Arguments

  • int surface - Number of a target surface.

Return value

Surface rendering mode:
  • OBJECT_DYNAMIC_MODE_POINTS = 0
  • OBJECT_DYNAMIC_MODE_LINES
  • OBJECT_DYNAMIC_MODE_TRIANGLES

void setSurfaceName(const char * name, int surface)

Sets the name for the specified surface. The name will be set only if the specified surface was added via the addSurface() method.

Arguments

  • const char * name - Surface name.
  • int surface - Number of a target surface in range from 0 to the total number of surfaces.

void setVertex(int num, const void * vertex)

Updates a vertex in the vertices buffer.

Arguments

  • int num - Vertex number.
  • const void * vertex - Vertex pointer.

void setVertexArray(const void * vertex, int num_vertex)

Updates the vertices array.

Arguments

  • const void * vertex - Vertices array pointer.
  • int num_vertex - Number of vertices.

void setVertexDouble(int attribute, double[] value)

Updates the last added vertex to the vertex of the double type with the given parameters.

Arguments

  • int attribute - Attribute number.
  • double[] value - Value pointer.

void setVertexDouble(int vertex, int attribute, double[] value)

Updates the given vertex to the vertex of the double type with the given parameters.

Arguments

  • int vertex - Vertex index.
  • int attribute - Attribute number.
  • double[] value - Value pointer.

void setVertexFloat(int attribute, float[] value)

Updates the last added vertex with the vertex of the float type with the given parameters.

Arguments

  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • float[] value - Vertex coordinates.

void setVertexFloat(int vertex, int attribute, float[] value)

Updates the given vertex to the vertex of the float type with the given parameters

Arguments

  • int vertex - Vertex index.
  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • float[] value - Vertex coordinates.

void setVertexFormat(const ObjectDynamic::Attribute[] & attributes)

Sets the number of the vertex attributes.

Arguments

  • const ObjectDynamic::Attribute[] & attributes - Number of the vertex attributes, can be up to 16 attributes for one vertex. The numeration starts from 0. Each attribute consists of:
    • An offset of the vertex in bytes, depends on the vertex type and size.
    • Type of the vertex: OBJECT_DYNAMIC_TYPE_FLOAT, OBJECT_DYNAMIC_TYPE_HALF, OBJECT_DYNAMIC_TYPE_UCHAR
    • Size of the vertex: can be 1,2,3,4 for float type; 2,4 for half type; 4 for UChar type
      Notice
      When it goes to shader, 0-attribute always comes with the size of 4, no matter what size is specified in the method. All the other attributes comes with the specified sizes.

    The example of setting 3 different vertices attributes:

    Source code (UnigineScript)
    // vertex format
    dynamic.setVertexFormat((
    	ivec3( 0, OBJECT_DYNAMIC_TYPE_FLOAT, 1),
    	ivec3( 12, OBJECT_DYNAMIC_TYPE_HALF, 2),
    	ivec3( 24, OBJECT_DYNAMIC_TYPE_UCHAR, 4),
    ));

void setVertexHalf(int attribute, float[] value)

Updates the last added vertex to the vertex of the half-float type with the given parameters.

Arguments

  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • float[] value - Vertex coordinates.

setVertexHalf(int vertex, int attribute, float[] value)

Updates the last added vertex to the vertex of the half-float type with the given parameters.

Arguments

  • int vertex - Vertex index.
  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • float[] value - Vertex coordinates.

int getVertexSize()

Returns the size of the current vertex.

Return value

Vertex size in bytes.

void setVertexUChar(int attribute, uchar[] value)

Updates the last added vertex with the vertex of the unsigned char type with the given parameters.

Arguments

  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • uchar[] value - Vertex coordinates.

void setVertexUChar(int vertex, int attribute, uchar[] value)

Arguments

  • int vertex
  • int attribute
  • uchar[] value

void setVertexUShort(int attribute, ushort[] value)

Updates the last added vertex to the vertex of the unsigned short type with the given parameters.

Arguments

  • int attribute - Attribute number.
  • ushort[] value - Value pointer.

void setVertexUShort(int vertex, int attribute, ushort[] value)

Updates the given vertex to the vertex of the unsigned short type with the given parameters.

Arguments

  • int vertex - Vertex index.
  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • ushort[] value - Vertex coordinates.

void addIndex(int index)

Adds an index to the index buffer.

Arguments

  • int index - Index to add.

void addIndicesArray(int[] indices)

Adds an array of the specified number of indices.

Arguments

  • int[] indices - Indices array.

void addLineStrip(int num_vertex)

Adds a given number of line strips to the mesh.

Arguments

  • int num_vertex - Number of vertices.

void addPoints(int num_points)

Adds a given number of points to the mesh.

Arguments

  • int num_points - Number of points.

void addSurface(const char * name)

Adds all the last listed and unsigned vertices and triangles to a new surface with a specified name.

Arguments

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

void addTriangleFan(int num_vertex)

Adds a triangle fan to the object. This method does not add the vertices, but allocates the indices. (Vertices should be added afterwards by the respective methods).

Arguments

  • int num_vertex - The number of vertices.

void addTriangleQuads(int num_quads)

Adds a given number of quadrilaterals to the mesh. This method does not add vertices, rather it allocates indices, for which vertices should be then created with the addVertex() function. Indices will point to vertices starting from the current last vertex in the vertex buffer.

Arguments

  • int num_quads - Number of quadrilaterals.

void addTriangles(int num_triangles)

Adds a given number of triangles to the object. This method does not add the vertices, but allocates the indices. (Vertices should be added afterwards by the respective methods).

Arguments

  • int num_triangles - The number of triangles.

void addTriangleStrip(int num_vertex)

Adds a triangle strip of to the object. This method does not add the vertices, but allocates the indices. (Vertices should be added afterwards by the respective methods).

Arguments

  • int num_vertex - The number of vertices.

void addVertex(const void * vertex)

Adds a vertex to the vertices buffer.

Arguments

  • const void * vertex - Vertex pointer.

void addVertexArray(const void * vertex, int num_vertex)

Adds an array of the specified vertices number.

Arguments

  • const void * vertex - Vertices array pointer.
  • int num_vertex - Number of vertices.

void addVertexDouble(int attribute, double[] value)

Adds a vertex of a double type with the given attribute, coordinates and size to the object.

Arguments

  • int attribute - Attribute number.
  • double[] value - Value pointer.

void addVertexFloat(int attribute, float[] value)

Adds a vertex of a float type with the given attribute, coordinates and size to the object.

Arguments

  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • float[] value - Vertex coordinates.

void addVertexHalf(int attribute, float[] value)

Adds a vertex of the half-float type with the given attribute, coordinates and size to the object.

Arguments

  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • float[] value - Vertex coordinates.

void addVertexUChar(int attribute, uchar[] value)

Adds a vertex of an unsigned char value with the given attribute, coordinates and size to the object.

Arguments

  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • uchar[] value - Vertex coordinates.

void addVertexUShort(int attribute, ushort[] value)

Adds a vertex of an unsigned short value with the given attribute, coordinates and size to the object.

Arguments

  • int attribute - The number of the attribute, set in the setVertexFormat() method.
  • ushort[] value - Vertex coordinates.

void allocateIndices(int num)

Allocates a given number of vertex indices in the index buffer.

Arguments

  • int num - The number of vertex indices.

void allocateVertex(int num)

Allocates a given number of vertices in the vertex buffer.

Arguments

  • int num - The number of vertices to allocate.

void clearIndices()

Clears all the vertex indices in the object.

void clearSurfaces()

Clears all the surface settings.

void clearVertex()

Clears all the current vertex settings.

void flushIndices()

Flushes the index buffer and sends all data to GPU. This method is called automatically, if the length of the index buffer changes. If you change the contents of the index buffers, you should call this method.

void flushVertex()

Flushes the vertex buffer and sends all data to GPU. This method is called automatically, if the length of the vertex buffer changes. If you change the contents of the vertex buffers, you should call this method.

void removeIndices(int num, int size)

Removes the specified number of indices.

Arguments

  • int num - Index number.
  • int size - Number of indices to remove.

void removeVertex(int num, int size, int indices)

Removes the specified number of vertices.

Arguments

  • int num - Vertex number.
  • int size - Number of vertices to remove.
  • int indices - Fix the indices buffer.

int type()

void updateSurfaceBegin(int surface)

Synchronizes surface begin index.

Arguments

  • int surface - Number of a target surface.

void updateSurfaceEnd(int surface)

Synchronizes surface end index.

Arguments

  • int surface - Number of a target surface.

int DYNAMIC_ALL

int DYNAMIC_INDICES

int DYNAMIC_VERTEX

int IMMUTABLE_ALL

int IMMUTABLE_INDICES

int IMMUTABLE_VERTEX

int MODE_LINES

Description

Mode to render the lines.

int MODE_POINTS

Description

Mode to render the points.

int MODE_QUAD_PATCHES

int MODE_TRIANGLES

Description

Mode to render the triangles (to create the objects).

int MODE_TRIANGLE_PATCHES

int TYPE_DOUBLE

Description

Use a double type to store vertices.

int TYPE_FLOAT

Description

Use a float type to store vertices.

int TYPE_HALF

Description

Use a half-float type to store vertices.

int TYPE_UCHAR

Description

Use an unsigned char type to store vertices.

int TYPE_USHORT

Description

Use an unsigned short type to store vertices.
Last update: 03.07.2017
Build: ()