This page has been translated automatically.
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
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::ObjectExternBase Class

Unigine Base ObjectExtern class.

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

Unigine::ObjectExternBase Class

Members


ConstructorFunc Type Definition

Description

Full declaration:
typedef ObjectExternBase*(* Unigine::ObjectExternBase::ConstructorFunc)(void *object)

ObjectExternBase constructor functor.

Arguments

object - ObjectExtern pointer.

Return value

ObjectExternBase class.

ObjectExternBase ()

ObjectExternBase constructor.

ObjectExternBase (void * object)

ObjectExternBase constructor.

Arguments

  • void * object - ObjectExtern pointer.

virtual ~ObjectExternBase ()

Virtual destructor.

void grab () const

Grabs an object. The object should not be handled by the class after this function is called.

void release () const

Releases an object. The object should be handled by the class after this function is called.

int isOwner () const

Returns the "owner" flag.

Return value

The "owner" flag.

virtual int getClassID () =0

Returns a unique class ID.

Return value

Unique class ID.

Ptr< Node > getNode () const

Returns the Node smart pointer.

Return value

Node smart pointer.

Ptr< Object > getObject () const

Returns the Object smart pointer.

Return value

Object smart pointer.

Ptr< ObjectExtern > getObjectExtern () const

Returns the ObjectExtern smart pointer.

Return value

ObjectExtern smart pointer.

virtual int getNumSurfaces () =0

Returns the number of object surfaces.

Return value

The number of object surfaces.

virtual const char * getSurfaceName (int surface) =0

Returns the object surface name.

Arguments

  • int surface - Surface number.

Return value

Surface name.

virtual int findSurface (const char * name)

Returns the number of the object surface by its name.

Arguments

  • const char * name - Surface name.

Return value

Surface number.

void updateSurfaces () const

Updates all of the object surfaces.

void resizeSurfaces () const

Resizes all of the object surfaces.

virtual void updateEnabled (int surface)

Updates enabled.

Arguments

  • int surface - Surface number.

virtual void updateEnabled ()

Updates enabled.

virtual int getResource (int surface)

Returns the unique render resource identifier.

Arguments

  • int surface - Surface number.

Return value

Surface resource identifier.

virtual int getOrder (const UNIGINE_VEC3 & camera, int surface)

Returns the rendering order with respect to the camera position.

Arguments

  • const UNIGINE_VEC3 & camera - World camera position.
  • int surface - Surface number.

Return value

Surface rendering order.

virtual int getSequence (const UNIGINE_VEC3 & camera, int surface)

Returns the rendering sequence with respect to the camera position.

Arguments

  • const UNIGINE_VEC3 & camera - World camera position.
  • int surface - Surface number.

Return value

Surface rendering sequence.

virtual float getOpacityDistance (const UNIGINE_VEC3 & camera, int surface)

Returns the opacity rendering distance.

Arguments

  • const UNIGINE_VEC3 & camera - World camera position.
  • int surface - Surface number.

Return value

Surface rendering distance.

virtual float getTransparentDistance (const UNIGINE_VEC3 & camera, int surface)

Returns the transparent rendering distance.

Arguments

  • const UNIGINE_VEC3 & camera - World camera position.
  • int surface - Surface number.

Return value

Surface rendering distance.

virtual int hasLods ()

Returns a value indicating if the object has LODs.

Return value

Returns 1 if the object has surface LODs.

virtual int getCollision (const BoundBox & bb, Vector< int > & surfaces)

Spatial collision with the bounding box.

Arguments

  • const BoundBox & bb - Bounding box.
  • Vector< int > & surfaces - Return array with surface numbers.

Return value

Returns 1 if the array of surfaces is not empty.

virtual int getCollision (const vec3 & p0, const vec3 & p1, Vector< int > & surfaces)

Spatial collision with the line.

Arguments

  • const vec3 & p0 - Coordinates of the start point of the line.
  • const vec3 & p1 - Coordinates of the end point of the line.
  • Vector< int > & surfaces - Return array with surface numbers.

Return value

Returns 1 if the array of surfaces is not empty.

virtual int getIntersection (const vec3 & p0, const vec3 & p1, vec3 * ret_point, vec3 * ret_normal, vec4 * ret_texcoord, int * ret_index, int surface)

Returns a value indicating that the line intersects the object surface.

Arguments

  • const vec3 & p0 - Coordinates of the start point of the line.
  • const vec3 & p1 - Coordinates of the end point of the line.
  • vec3 * ret_point - Intersection point coordinates.
  • vec3 * ret_normal - Intersection normal vector.
  • vec4 * ret_texcoord - Intersection texture coordinates.
  • int * ret_index - Intersection index number.
  • int surface - Surface number.

Return value

Returns 1 if the intersection occurs.

virtual int getRandomPoint (vec3 & ret_point, vec3 & ret_normal, vec3 & ret_velocity, int surface)

Returns a random point from a surface.

Arguments

  • vec3 & ret_point - Random point coordinates.
  • vec3 & ret_normal - Random normal vector.
  • vec3 & ret_velocity - Random velocity vector.
  • int surface - Surface number.

Return value

Returns 1 if the random point is valid.

virtual int getNumTriangles (int surface)

Returns the number of triangles.

Arguments

  • int surface - Surface number.

Return value

Returns the number of triangles.

virtual const BoundBox & getBoundBox (int surface) =0

Returns the bounding box of the object.

Arguments

  • int surface - Surface number.

Return value

Bounding box.

virtual const BoundSphere & getBoundSphere (int surface) =0

Returns the bounding sphere of the object.

Arguments

  • int surface - Surface number.

Return value

Bounding sphere.

virtual int hasCreate ()

Returns a value indicating that the object has a create function.

Return value

Returns 1 if the object has a create function.

virtual void create (int surface)

Renders a create function.

Arguments

  • int surface - Surface number.

virtual int hasRender ()

Returns a value indicating that the object has a render function.

Return value

Returns 1 if the object has a render function.

virtual void render (int pass, int surface)

Renders a render function.

Arguments

  • int pass - Rendering pass.
  • int surface - Surface number.

virtual int hasShadow ()

Returns a value indicating that the object has a shadow function.

Return value

Returns 1 if the object has a shadow function.

virtual void renderShadow (int pass, int surface)

Renders render function.

Arguments

  • int pass - Rendering pass.
  • int surface - Surface number.

virtual int hasVelocity ()

Returns a value indicating that the object has a velocity function.

Return value

Returns 1 if the object has a velocity function.

virtual void renderVelocity (int pass, int surface)

Renders a velocity function.

Arguments

  • int pass - Rendering pass.
  • int surface - Surface number.

virtual int hasQuery ()

Returns a value indicating that the object has a query function.

Return value

Returns 1 if the object has a query function.

virtual void renderQuery ()

Renders a query function.

virtual void updatePosition ()

Updates a position.

virtual void updateTransform ()

Updates transformation.

virtual void update (float ifps)

Update function.

Arguments

  • float ifps - Inverse FPS value.

virtual void flush (float ifps)

Flush function.

Arguments

  • float ifps - Inverse FPS value.

virtual const BoundBox & getBoundBox () =0

Returns the bounding box of the object.

Return value

Bounding box.

virtual const BoundSphere & getBoundSphere () =0

Returns the bounding sphere of the object.

Return value

Bounding sphere.

virtual const UNIGINE_BOUND_BOX & getWorldBoundBox ()

Returns the world bounding box.

Return value

World bounding box.

virtual const UNIGINE_BOUND_SPHERE & getWorldBoundSphere ()

Returns the world bounding sphere.

Return value

World bounding sphere.

virtual void renderHandler ()

Renders the handler.

virtual void renderVisualizer ()

Renders the visualizer.
Notice
You should enable the engine visualizer by the show_visualizer 1 console command.

virtual void copy (ObjectExternBase * object)

Copies an object state into the other object.

Arguments

  • ObjectExternBase * object - Destination ObjectExternBase pointer.

virtual void swap (ObjectExternBase * object)

Swaps states of the object.

Arguments

  • ObjectExternBase * object - ObjectExternBase pointer.

virtual int loadWorld (const XmlPtr & xml)

Loads an object state from the Xml.

Arguments

  • const XmlPtr & xml - Xml smart pointer.

Return value

Returns 1 if the object state was successfully loaded; otherwise, 0 is returned.

virtual int saveWorld (const XmlPtr & xml)

Saves an object state into the Xml.

Arguments

  • const XmlPtr & xml - Xml smart pointer.

Return value

Returns 1 if the object state was successfully saved; otherwise, 0 is returned.

virtual int saveState (const StreamPtr & stream)

Saves an object state into the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

Return value

Returns 1 if the object state was successfully saved; otherwise, 0 is returned.

virtual int restoreState (const StreamPtr & stream)

Restores an object state from the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

Return value

Returns 1 if the object state was successfully restored; otherwise, 0 is returned.

static void addClassID (int class_id, ConstructorFunc func)

Registers a constructor for a specified class ID.

Arguments

  • int class_id - Unique class ID.
  • ConstructorFunc func - Constructor functor.

static void addClassID (int class_id)

Registers a constructor for a specified class type.

Arguments

  • int class_id - Unique class ID.

static void savePointer (const StreamPtr & stream, ObjectExternBase * object)

Saves an object pointer into the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.
  • ObjectExternBase * object - Object pointer.

static ObjectExternBase * restorePointer (const StreamPtr & stream)

Restores an object pointer from the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

Return value

Object pointer.
Last update: 2017-07-03
Build: ()