This page has been translated automatically.
Programming
Fundamentials
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
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

ObjectDynamic Class

Interface for object dynamic handling.

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

ObjectDynamic Class

Members


ObjectDynamic (int flags = 0)

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

Arguments

int getNumVertex ()

Returns the number of object vertices.

Return value

The number of vertices.

void setIndicesArray (int[] indices)

Updates the specified indices array.

Arguments

  • int[] indices

int getIndex (int num)

Returns an index of the vertex by the index number.

Arguments

  • int num - Index number.

Return value

Vertex index in the index buffer.

void setParameterBool (const char * name, int value)

Sets boolean shader parameter.

Arguments

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

void addLineStrip (int num_vertex)

Adds a given number of line strips to the mesh.

Arguments

  • int num_vertex - Number of vertices.

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.

void clearVertex ()

Clears all the current vertex settings.

void allocateVertex (int num)

Allocates a given number of vertices in the vertex buffer.

Arguments

  • int num - The number of vertices to allocate.

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

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

Arguments

  • int vertex
  • int attribute
  • float[] value

void allocateIndices (int num)

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

Arguments

  • int num - The number of vertex indices.

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.

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.

int getNumIndices ()

Returns the number of vertex indices of the object.

Return value

The number of indices.

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
  • uchar[] value

setVertexUCHar (int vertex, int attribute, uchar[] value)

Arguments

  • int vertex
  • int attribute
  • uchar[] value

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 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 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
  • uchar[] value

void setVertexDouble (int attribute, double[] value)

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

Arguments

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

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

Arguments

  • int vertex
  • int attribute
  • double[] value

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

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 addVertex (const void * vertex)

Adds a vertex to the vertices buffer.

Arguments

  • const void * vertex - Vertex pointer.

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 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 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 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 setVertexHalf (int attribute, float[] value)

Updates the last added vertex with 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)

Arguments

  • int vertex
  • int attribute
  • float[] value

void setIndex (int num, int index)

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.

void setNumVertex (int num)

Sets the number of mesh vertices.

Arguments

  • int num - Number of mesh vertices.

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
  • ushort[] value

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.

int getVertexSize ()

Returns the size of the current vertex.

Return value

Vertex size in bytes.

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

Sets integer shader parameter.

Arguments

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

void setNumIndices (int indices)

Sets the number of vertex indices.

Arguments

  • int indices - Number of indices.

const ObjectDynamic::Attribute * getAttributes ()

Returns an array of vertex attributes.

Return value

Array of vertex attributes.

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

void setVertexUShort (int attribute, ushort[] value)

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

Arguments

  • int attribute
  • ushort[] value

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

Arguments

  • int vertex
  • int attribute
  • ushort[] value

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 removeIndices (int num, int size)

Removes the specified number of indices.

Arguments

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

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 setParameterFloat (const char * name, float[] value)

Sets float shader parameter.

Arguments

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

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 addPoints (int num_points)

Adds a given number of points to the mesh.

Arguments

  • int num_points - Number of points.

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 clearSurfaces ()

Clears all the surface settings.

int getInstancing ()

Returns hardware instancing.

Return value

Hardware instancing flag.

void addIndicesArray (int[] indices)

Adds an array of the specified number of indices.

Arguments

  • int[] indices

void updateSurfaceBegin (int surface)

Synchronizes surface begin index.

Arguments

  • int surface - Number of a target surface.

int getNumAttributes ()

Returns the number of vertex attributes.

Return value

Number of vertex attributes.

void clearIndices ()

Clears all the vertex indices in the object.

void addIndex (int index)

Adds an index to the index buffer.

Arguments

  • int index - Index to add.

void setInstancing (int instancing)

Controls hardware instancing.

Arguments

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

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 updateSurfaceEnd (int surface)

Synchronizes surface end index.

Arguments

  • int surface - Number of a target surface.

int IMMUTABLE_VERTEX

int IMMUTABLE_INDICES

int DYNAMIC_VERTEX

int DYNAMIC_INDICES

int IMMUTABLE_ALL

int DYNAMIC_ALL

int MODE_POINTS

Description

Mode to render the points.

int MODE_LINES

Description

Mode to render the lines.

int MODE_TRIANGLES

Description

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

int MODE_TRIANGLE_PATCHES

int MODE_QUAD_PATCHES

int TYPE_HALF

Description

Use a half-float type to store vertices.

int TYPE_FLOAT

Description

Use a float type to store vertices.

int TYPE_DOUBLE

Description

Use a double 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: 2017-07-03
Build: ()