UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials

Unigine::Object Class

Interface for object handling. See also the UnigineScript analog.

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

Unigine::Object Class

Members


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

Object constructor.

Arguments

  • const NodePtr & node - Node smart pointer.

virtual Ptr< Object > getObject () const =0

Returns an object pointer.

Return value

Object pointer.

virtual int getNumSurfaces () const =0

Returns the number of object surfaces.

Return value

Number of surfaces of the object.

virtual int findSurface (const char * name) const =0

Searches for an object surface with a given name.

Arguments

  • const char * name - Surface name.

Return value

Surface number if it is exists; otherwise, -1.

virtual const char * getSurfaceName (int surface) const =0

Returns the name of a given object surface.

Arguments

  • int surface - number of the surface.

Return value

Surface name.

virtual void setEnabled (int enable, int surface) const =0

Enables or disables a given object surface.

Arguments

  • int enable - 1 to enable the surface, 0 to disable it.
  • int surface - Surface number.

virtual int isEnabled () const =0

Returns a value indicating if a given object surface is enabled.

Return value

Returns 1 if the given surface is disabled; otherwise, 0.

virtual void setFolded (int folded, int surface) const =0

Shows or minimizes surface children in the surface hierarchy.

Arguments

  • int folded - Positive number to minimize surface children, 0 to expand the hierarchy.
  • int surface - Surface number.

virtual int isFolded (int surface) const =0

Returns a value indicating if surface children are displayed of minimized in the surface hierarchy.

Arguments

  • int surface - Surface number.

Return value

Positive number if surface children are hidden in the surface hierarchy; otherwise, 0.

virtual void setParent (int parent, int surface) const =0

Sets or clears the number of a parent surface of a given surface.

Arguments

  • int parent - Parent surface number in range from -1 to the number of object surfaces; -1 is used to clear the parent surface.
  • int surface - Surface number in range from 0 to the number of object surfaces.

virtual int getParent (int surface) const =0

Returns the number of a parent surface of a given surface.

Arguments

  • int surface - Surface number in range from 0 to the number of object surfaces.

Return value

Parent surface number. If -1</> is returned, the parent surface is not specified for the given surface.

virtual void setDecal (int enable, int surface) const =0

Sets a surface decal flag, which indicates if a given surface can have decals on itself.

Arguments

  • int enable - Surface decal flag.
  • int surface - Surface number.

virtual int getDecal (int surface) const =0

Returns a surface decal flag, which indicates if a given surface can have decals on itself.

Arguments

  • int surface - Surface number.

Return value

Surface decal flag.

virtual void setCastShadow (int enable, int surface) const =0

Sets a surface cast shadow flag, which indicates if a given object surface should cast shadows from non-world lights.

Arguments

  • int enable - Surface cast shadow flag.
  • int surface - Surface number.

virtual int getCastShadow (int surface) const =0

Returns a surface cast shadow flag, which indicates if a given object surface should cast shadows from non-world lights.

Arguments

  • int surface - Surface number.

Return value

Surface cast shadow flag.

virtual void setReceiveShadow (int enable, int surface) const =0

Sets a surface receive shadow flag, which indicates if a given object surface should receive shadows created with non-world lights.

Arguments

  • int enable - Surface receive shadow flag.
  • int surface - Surface number.

virtual int getReceiveShadow (int surface) const =0

Returns a surface receive shadow flag, which indicates if a given object surface should receive shadows created with non-world lights.

Arguments

  • int surface - Surface number.

Return value

Surface receive shadow flag.

virtual void setCastWorldShadow (int enable, int surface) const =0

Sets a cast world shadow flag for a given surface. This flag indicates if the surface should cast shadows from world lights.

Arguments

  • int enable - Cast world shadow flag to set for the surface.
  • int surface - Surface number.

virtual int getCastWorldShadow (int surface) const =0

Returns a cast world shadow flag for a given surface. This flag indicates if the surface should cast shadows from world lights.

Arguments

  • int surface - Surface number.

Return value

Cast world shadow flag set for the surface.

virtual void setReceiveWorldShadow (int enable, int surface) const =0

Sets a receive world shadow flag for a given surface. This flag indicates if the surface should receive shadows created with world lights.

Arguments

  • int enable - Receive world shadow flag to set for the surface.
  • int surface - Surface number.

virtual int getReceiveWorldShadow (int surface) const =0

Returns a receive world shadow flag for a given surface. This flag indicates if the surface should receive shadows created with world lights.

Arguments

  • int surface - Surface number.

Return value

Receive world shadow flag set for the surface.

virtual void setIntersection (int enable, int surface) const =0

Sets a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • int enable - Surface intersection flag.
  • int surface - Surface number.

virtual int getIntersection (int surface) const =0

Returns a surface intersection flag. This flag indicates if intersections with a given surface are enabled.

Arguments

  • int surface - Surface number.

Return value

Surface intersection flag.

virtual void setCollision (int enable, int surface) const =0

Sets a surface collision flag. This flag indicates if collisions with a given surface are enabled.

Arguments

  • int enable - Surface collision flag.
  • int surface - Surface number.

virtual int getCollision (int surface) const =0

Returns a surface collision flag. This flag indicates if collisions with a given surface are enabled.

Arguments

  • int surface - Surface number.

Return value

Surface collision flag.

virtual void setLightMask (int mask, int surface) const =0

Sets a light mask for a given surface.

Arguments

  • int mask - Surface light mask (integer, each bit of which is a mask).
  • int surface - Surface number.

virtual int getLightMask (int surface) const =0

Returns a light mask for a given surface.

Arguments

  • int surface - Surface number.

Return value

Surface light mask (integer, each bit of which is a mask).

virtual void setDecalMask (int mask, int surface) const =0

Sets a decal mask for a given surface.

Arguments

  • int mask - Surface decal mask (integer, each bit of which is a mask).
  • int surface - Surface number.

virtual int getDecalMask (int surface) const =0

Returns a decal mask for a given surface.

Arguments

  • int surface - Surface number.

Return value

Surface decal mask (integer, each bit of which is a mask).

virtual void setViewportMask (int mask, int surface) const =0

Sets a viewport mask for a given surface. The object surface is rendered, if its mask matches the player (camera), light source and material masks.

Arguments

  • int mask - Surface viewport mask (integer, each bit of which is a mask).
  • int surface - Surface number.

virtual int getViewportMask (int surface) const =0

Returns a viewport mask for a given surface. The object surface is rendered, if its mask matches the player (camera), light source and material masks.

Arguments

  • int surface - Surface number.

Return value

Surface viewport mask.

virtual void setIntersectionMask (int mask, int surface) const =0

Sets an intersection mask for a given surface.

Arguments

  • int mask - Surface intersection mask (integer, each bit of which is a mask).
  • int surface - Surface number.

virtual int getIntersectionMask (int surface) const =0

Return an intersection mask for a given surface.

Arguments

  • int surface - Surface number.

Return value

Surface intersection mask.

virtual void setCollisionMask (int mask, int surface) const =0

Sets a collision mask for a given surface. Two objects collide, if they both have matching masks.

Arguments

  • int mask - Surface collision mask.
  • int surface - Surface number.

virtual int getCollisionMask (int surface) const =0

Returns a collision mask for a given surface. Two objects collide, if they both have matching masks.

Arguments

  • int surface - Surface number.

Return value

Surface collision mask.

virtual void setMinParent (int parent, int surface) const =0

Sets surface minimum LOD parent surface number.

Arguments

  • int parent - Surface minimum LOD parent surface number.
  • int surface - Surface number in range from 0 to number of surfaces.

virtual int getMinParent (int surface) const =0

Return the surface minimum LOD parent surface number.

Arguments

  • int surface - Surface number.

Return value

Surface minimum LOD parent surface number.

virtual void setMinVisibleDistance (float distance, int surface) const =0

Updates minimum visibility distance of a given surface (the distance, starting from which the surface begins fading in and then is completely visible).

Arguments

  • float distance - Minimum visibility distance. The default is -inf.
  • int surface - Surface number in range from 0 to number of surfaces.

virtual float getMinVisibleDistance (int surface) const =0

Returns minimum visibility distance of a given surface (the distance, starting from which the surface begins fading in and then is completely visible).

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Minimum visibility distance.

virtual void setMinFadeDistance (float distance, int surface) const =0

Updates minimum fade-in distance of a given surface. Across this distance the surface smoothly becomes visible due to alpha fading. It is counted off starting from the minimum visibility distance.

Arguments

  • float distance - Minimum fade-in distance. The default is 0.
  • int surface - Surface number in range from 0 to number of surfaces.

virtual float getMinFadeDistance (int surface) const =0

Returns minimum fade-in distance of a given surface. Across this distance the surface smoothly becomes visible due to alpha fading. It is counted off starting from the minimum visibility distance. It is counted off starting from the minimum visibility distance.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Minimum fade-in distance.

virtual void setMaxParent (int parent, int surface) const =0

Sets a surface maximum LOD parent surface number.

Arguments

  • int parent - Surface maximum LOD parent surface number.
  • int surface - Surface number in range from 0 to number of surfaces.

virtual int getMaxParent (int surface) const =0

Returns a surface maximum LOD parent surface number.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Surface maximum LOD parent surface number.

virtual void setMaxVisibleDistance (float distance, int surface) const =0

Updates maximum visibility distance of a given surface (the distance, from which the surface begins fading out until completely invisible).

Arguments

  • float distance - Maximum visibility distance. The default is inf.
  • int surface - Surface number in range from 0 to number of surfaces.

virtual float getMaxVisibleDistance (int surface) const =0

Returns maximum visibility distance of a given surface (the distance, from which the surface begins fading out until completely invisible).

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Maximum visibility distance of the surface.

virtual void setMaxFadeDistance (float distance, int surface) const =0

Updates maximum fade-out distance of a given surface. Across this distance the surface smoothly becomes invisible due to alpha fading. It is counted off starting from the maximum visibility distance.

Arguments

  • float distance - Maximum fade-out distance of the surface. The default is 0.
  • int surface - Surface number in range from 0 to number of surfaces.

virtual float getMaxFadeDistance (int surface) const =0

Returns maximum fade-out distance of a given surface. Across this distance the surface smoothly becomes invisible due to alpha fading. It is counted off starting from the maximum visibility distance.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Maximum fade-out distance of the surface.

virtual void setMaxShadowSplit (int split, int surface) const =0

Sets the maximum shadow split (for shadows from the LightWorld source) rendered for a given surface. It is used to skip rendering of high-detail shadows splits.

Arguments

  • int split - Maximum rendered shadow split of the surface. The default is 4 (no shadow optimization).
  • int surface - Surface number in range from 0 to number of surfaces.

virtual int getMaxShadowSplit (int surface) const =0

Returns the maximum shadow split (for shadows from the LightWorld source) rendered for a given surface. It is used to skip rendering of high-detail shadows splits.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Surface Maximum rendered shadow split of the surface.

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

Sets a material for a specified surface.

Arguments

  • const char * name - Name of the new material.
  • int surface - Surface number in range from 0 to number of surfaces.

virtual void setMaterial (const char * name, const char * pattern) const =0

Sets a material for a specified surface.

Arguments

  • const char * name - Name of the new material.
  • const char * pattern - Surface name pattern, against which surface names will be matched. The pattern is a string with a regular expression.

virtual MaterialPtr getMaterial (int surface) const =0

Returns the material smart pointer.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Material smart pointer.

virtual MaterialPtr getMaterialInherit (int surface) const =0

Inherits the surface material (i.e. creates a material instance). Modifications made in a new material instance will not affect the source material.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Inherited material smart pointer.

virtual int isMaterialInherited (int surface) const =0

Returns a value indicating if a given surface material is inherited. Modifications made in a material instance do not affect the source material.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Returns 1 if the object surface material is inherited.

virtual const char * getMaterialName (int surface) const =0

Returns the name of the material applied to a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Material name.

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

Sets a property for a given surface.

Arguments

  • const char * name - Name of the new property.
  • int surface - Surface number in range from 0 to number of surfaces.

virtual void setProperty (const char * name, const char * pattern) const =0

Sets a property for a given surface.

Arguments

  • const char * name - Name of the new property.
  • const char * pattern - Surface name pattern, against which surface names will be matched. The pattern is a string with a regular expression.

virtual PropertyPtr getProperty (int surface) const =0

Returns the property smart pointer.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Property smart pointer.

virtual PropertyPtr getPropertyInherit (int surface) const =0

Inherits the property for the specific object. All transformations done to the inherited property will not affect the reference one.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Inherited property smart pointer.

virtual int isPropertyInherited (int surface) const =0

Returns a value indicating if a given property is inherited.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Returns 1 if the surface property is inherited.

virtual const char * getPropertyName (int surface) const =0

Returns the name of a property applied to a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Name of the surface property.

virtual BoundBox getBoundBox (int surface) const =0

Returns the bounding box of a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Bounding box.

virtual BoundSphere getBoundSphere (int surface) const =0

Returns the bounding sphere of a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

Bounding sphere.

virtual UNIGINE_BOUND_BOX getWorldBoundBox (int surface) const =0

Returns the world bounding box of a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

World bounding box (in world coordinates).

virtual UNIGINE_BOUND_SPHERE getWorldBoundSphere (int surface) const =0

Returns the world bounding sphere of a given surface.

Arguments

  • int surface - Surface number in range from 0 to number of surfaces.

Return value

World bounding sphere (in world coordinates).
Last update: 2017-07-03