Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
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

Unigine::ObjectDynamic Class

Interface for object dynamic handling.

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

Related classes:
Unigine::ObjectDynamic::Attribute

Unigine::ObjectDynamic Class

Members


static int type ()

ObjectDynamic type.

Return value

ObjectDynamic type identifier.

static Ptr< ObjectDynamic > create (const NodePtr & node)

ObjectDynamic constructor.

Arguments

  • const NodePtr & node - Node smart pointer.

static Ptr< ObjectDynamic > create (const ObjectPtr & object)

ObjectDynamic constructor.

Arguments

  • const ObjectPtr & object - Object smart pointer.

static Ptr< ObjectDynamic > create (int dynamic)

ObjectDynamic constructor.

Arguments

  • int dynamic - Dynamic flag. If set to 1, indicates that the object is going to be changed every frame.

virtual void setInstancing (int instancing) const =0

Controls hardware instancing.

Arguments

  • int instancing - Instancing flag. Set to 1 to enable hardware instancing.

virtual int getInstancing () const =0

Returns hardware instancing.

Return value

Hardware instancing flag.

virtual void setParameterBool (const char * name, int value) const =0

Sets boolean shader parameter.

Arguments

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

virtual void setParameterInt (const char * name, const int * value, int size) const =0

Sets integer shader parameter.

Arguments

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

virtual void setParameterFloat (const char * name, const float * value, int size) const =0

Sets float shader parameter.

Arguments

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

virtual void setParameterFloatArray (const char * name, const float * value, int size, int num) const =0

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

Arguments

  • const char * name - Shader parameter name.
  • const float * value - Parameter value pointer.
  • int size - Parameter size.
  • int num - Number of parameters.

virtual void clearSurfaces () const =0

Clears all the surface settings.

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

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.

virtual void setSurfaceName (const char * name, int surface) const =0

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.

virtual void updateSurfaceBegin (int surface) const =0

Synchronizes surface begin index.

Arguments

  • int surface - Number of a target surface.

virtual void setSurfaceBegin (int begin, int surface) const =0

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.

virtual int getSurfaceBegin (int surface) const =0

Returns the begin index of the specified object surface.

Arguments

  • int surface - Number of a target surface.

virtual void updateSurfaceEnd (int surface) const =0

Synchronizes surface end index.

Arguments

  • int surface - Number of a target surface.

virtual void setSurfaceEnd (int end, int surface) const =0

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.

virtual int getSurfaceEnd (int surface) const =0

Returns the end index of the specified object surface.

Arguments

  • int surface - Number of a target surface.

virtual void setSurfaceMode (int mode, int surface) const =0

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.

virtual int getSurfaceMode (int surface) const =0

Returns surface rendering mode.

Arguments

  • int surface - Number of a target surface.

virtual void setVertexFormat (const Attribute * attributes, int num_attributes) const =0

Sets the number of the vertex attributes.

Arguments

  • const Attribute * attributes - Vertex attributes.
  • int num_attributes - Number of vertex attributes.

virtual int getVertexSize () const =0

Returns the size of the current vertex.

Return value

Vertex size in bytes.

virtual int getNumAttributes () const =0

Returns the number of vertex attributes.

Return value

Number of vertex attributes.

virtual const Attribute * getAttributes () const =0

Returns an array of vertex attributes.

Return value

Array of vertex attributes.

virtual void clearVertex () const =0

Clears all the current vertex settings.

virtual void allocateVertex (int num) const =0

Allocates a given number of vertices in the vertex buffer.

Arguments

  • int num - The number of vertices to allocate.

virtual void removeVertex (int num, int size, int indices) const =0

Removes the specified number of vertices.

Arguments

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

virtual void setNumVertex (int num) const =0

Sets the number of mesh vertices.

Arguments

  • int num - Number of mesh vertices.

virtual int getNumVertex () const =0

Returns the number of object vertices.

Return value

The number of vertices.

virtual void addVertex (const void * vertex) const =0

Adds a vertex to the vertices buffer.

Arguments

  • const void * vertex - Vertex pointer.

virtual void setVertex (int num, const void * vertex) const =0

Updates a vertex in the vertices buffer.

Arguments

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

virtual void addVertexArray (const void * vertex, int num_vertex) const =0

Adds an array of the specified vertices number.

Arguments

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

virtual void setVertexArray (const void * vertex, int num_vertex) const =0

Updates the vertices array.

Arguments

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

virtual const void * getVertexArray () const =0

Returns an array of vertices.

Return value

Pointer to the array of vertices.

virtual const void * getVertex (int num) const =0

Returns a vertex pointer by a vertex number.

Arguments

  • int num - Vertex number.

Return value

Vertex pointer.

virtual void addVertexHalf (int attribute, const float * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const float * value - Value pointer.
  • int size - Size of the vertex: can be 2 or 4 bytes for this type.

virtual void setVertexHalf (int attribute, const float * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const float * value - Value pointer.
  • int size - Size of the vertex: can be 2 or 4 bytes for this type.

virtual void addVertexFloat (int attribute, const float * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const float * value - Value pointer.
  • int size - Size of the vertex: can be 1,2,3 or 4 bytes for this type.

virtual void setVertexFloat (int attribute, const float * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const float * value - Value pointer.
  • int size - Size of value.

virtual void addVertexDouble (int attribute, const double * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const double * value - Value pointer.
  • int size - Size of the vertex: can be 1,2,3 or 4 bytes for this type.

virtual void setVertexDouble (int attribute, const double * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const double * value - Value pointer.
  • int size - Size of value.

virtual void addVertexUChar (int attribute, const unsigned char * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const unsigned char * value - Value pointer.
  • int size - Size of the vertex: can be 4 bytes for this type.

virtual void setVertexUChar (int attribute, const unsigned char * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const unsigned char * value - Value pointer.
  • int size - Size of the vertex: can be 4 bytes for this type.

virtual void addVertexUShort (int attribute, const unsigned short * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const unsigned short * value - Value pointer.
  • int size - Size of the vertex: can be 4 bytes for this type.

virtual void setVertexUShort (int attribute, const unsigned short * value, int size) const =0

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

Arguments

  • int attribute - Attribute number.
  • const unsigned short * value - Value pointer.
  • int size - Size of the vertex: can be 4 bytes for this type.

virtual void clearIndices () const =0

Clears all the vertex indices in the object.

virtual void allocateIndices (int num) const =0

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

Arguments

  • int num - The number of vertex indices.

virtual void removeIndices (int num, int size) const =0

Removes the specified number of indices.

Arguments

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

virtual void setNumIndices (int num) const =0

Sets the number of vertex indices.

Arguments

  • int num - Number of indices.

virtual int getNumIndices () const =0

Returns the number of vertex indices of the object.

Return value

The number of indices.

virtual void addIndex (int index) const =0

Adds an index to the index buffer.

Arguments

  • int index - Index to add.

virtual void setIndex (int num, int index) const =0

Updates an 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.

virtual void addIndicesArray (const int * indices, int num_indices) const =0

Adds an array of the specified number of indices.

Arguments

  • const int * indices - Indices array pointer.
  • int num_indices - Number of indices.

virtual void setIndicesArray (const int * indices, int num_indices) const =0

Updates the specified indices array.

Arguments

  • const int * indices - Indices array pointer.
  • int num_indices - Number of indices.

virtual const int * getIndicesArray () const =0

Returns an array of indices.

Return value

Pointer to the array of indices.

virtual int getIndex (int num) const =0

Returns an index of the vertex by the index number.

Arguments

  • int num - Index number.

Return value

Vertex index in the index buffer.

virtual void addTriangles (int num_triangles) const =0

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.

virtual void addTriangleFan (int num_vertex) const =0

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.

virtual void addTriangleStrip (int num_vertex) const =0

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.

virtual void addTriangleQuads (int num_quads) const =0

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.

virtual void addLineStrip (int num_vertex) const =0

Adds a given number of line strips to the mesh.

Arguments

  • int num_vertex - Number of vertices.

virtual void addPoints (int num_points) const =0

Adds a given number of points to the mesh.

Arguments

  • int num_points - Number of points.

virtual void setBoundBox (const BoundBox & bb, int surface) const =0

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.

virtual void setBoundBox (const BoundBox & bb) const =0

Sets a bounding box of the specified size for the dynamic object.

Arguments

  • const BoundBox & bb - Bounding box.

virtual void flushVertex () const =0

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.

virtual void flushIndices () const =0

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.

Unigine::ObjectDynamic::anonymous_81 Enumeration

IMMUTABLE_VERTEX = 1 << 0
IMMUTABLE_INDICES = 1 << 1
DYNAMIC_VERTEX = 1 << 2
DYNAMIC_INDICES = 1 << 3
IMMUTABLE_ALL = (IMMUTABLE_VERTEX | IMMUTABLE_INDICES)
DYNAMIC_ALL = (DYNAMIC_VERTEX | DYNAMIC_INDICES)

Unigine::ObjectDynamic::anonymous_82 Enumeration

MODE_POINTS = 0
MODE_LINES
MODE_TRIANGLES
MODE_PATCHES

Unigine::ObjectDynamic::anonymous_83 Enumeration

TYPE_HALF = 0
TYPE_FLOAT
TYPE_DOUBLE
TYPE_UCHAR
TYPE_USHORT
Last update: 2017-07-03