Public Member Functions

GeomObject Class Reference

This reference page is linked to from the following overview topics: Object Plug-ins, Lesson 2: The Scene Graph and Nodes, Lesson 5: Geometric Objects, Overview: Scene Graph and Nodes, Plug-in Architecture, Plug-in Base Classes, Geometric Objects, Mental Ray Classes, Translation of Object Plug-ins, Writing Simple Geometric Object Plug-Ins.


Search for all occurrences

Detailed Description

This is the base class for the creation of Geometric Object plug-ins.

This class represents an object that has geometry and is renderable.

See also:
Class Object, Class Mesh

#include <object.h>

Inheritance diagram for GeomObject:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void  InitNodeName (MSTR &s)
  This is the default name of the node when it is created.
SClass_ID  SuperClassID ()
  Retrieves a constant representing the type of the plugin.
virtual int  IsRenderable ()
  Indicates whether the object may be rendered.
virtual int  IsInstanceDependent ()
  If an object creates different meshes depending on the particular instance (view-dependent) it should return nonzero; otherwise 0.
virtual CoreExport Mesh GetRenderMesh (TimeValue t, INode *inode, View &view, BOOL &needDelete)
  This method should be implemented by all renderable GeomObjects.
virtual int  NumberOfRenderMeshes ()
  Objects may supply multiple render meshes ( e.g.
virtual Mesh GetMultipleRenderMesh (TimeValue t, INode *inode, View &view, BOOL &needDelete, int meshNumber)
  For multiple render meshes, this method must be implemented.
virtual void  GetMultipleRenderMeshTM (TimeValue t, INode *inode, View &view, int meshNumber, Matrix3 &meshTM, Interval &meshTMValid)
  For multiple render meshes, this method must be implemented.
virtual CoreExport PatchMesh GetRenderPatchMesh (TimeValue t, INode *inode, View &view, BOOL &needDelete)
  This method provides a patch mesh representation of the object for use by the renderer.
CoreExport Class_ID  PreferredCollapseType ()
  This method allows objects to specify the class that is the best class to convert to when the user collapses the stack.
virtual BOOL  CanDoDisplacementMapping ()
  Returns TRUE if this object can do displacement mapping; otherwise FALSE.

Member Function Documentation

virtual void InitNodeName ( MSTR s ) [inline, virtual]

This is the default name of the node when it is created.

Parameters:
s The default name of the node is stored here.

Implements Object.

Reimplemented in ShapeObject, SimpleObject, SimpleParticle, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, MSShapeXtnd, MSSimpleObjectXtnd, MSPluginObject< ShapeObject >, MSPluginObject< GeomObject >, MSObjectXtnd< GeomObject, MSPluginGeomObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.

{ s = _M("Object"); }
SClass_ID SuperClassID ( ) [inline, virtual]

Retrieves a constant representing the type of the plugin.

Returns:
A super class id that uniquely identifies the type (category) of the plugin. Note that several plugin classes can be of the same type, thus return the same super class id. Plugins are uniquely identified by their class ids. List of Super Class IDs.
See also:
SClass_ID

Reimplemented from ReferenceTarget.

Reimplemented in ShapeObject, MSPluginShape, and MSShapeXtnd.

{ return GEOMOBJECT_CLASS_ID; }
virtual int IsRenderable ( ) [inline, virtual]

Indicates whether the object may be rendered.

Some objects such as construction grids and helpers should not be rendered and can return zero.

Returns:
Nonzero if the object may be rendered; otherwise 0.

Implements Object.

Reimplemented in ShapeObject, MSPluginGeomObject, MSGeomObjectXtnd, MSPluginShape, and MSShapeXtnd.

{ return(1); }               
virtual int IsInstanceDependent ( ) [inline, virtual]

If an object creates different meshes depending on the particular instance (view-dependent) it should return nonzero; otherwise 0.

Reimplemented in PatchObject.

{ return 0; }
virtual CoreExport Mesh* GetRenderMesh ( TimeValue  t,
INode inode,
View view,
BOOL &  needDelete 
) [virtual]

This method should be implemented by all renderable GeomObjects.

It provides a mesh representation of the object for use by the renderer. Primitives that already have a mesh cached can just return a pointer to it (and set needDelete to FALSE). Implementations of this method which take a long time should periodically call View::CheckForRenderAbort() to see if the user has canceled the render. If canceled, the function can either return NULL, or return a non null pointer with the appropriate value for needDelete. (If needDelete is TRUE a non-null mesh will be deleted.)

Parameters:
t The time to get the mesh.
inode The node in the scene.
view If the renderer calls this method it will pass the view information here. See Class View.
needDelete Set to TRUE if the renderer should delete the mesh, FALSE otherwise.
Returns:
A pointer to the mesh object.

Reimplemented in ShapeObject, PatchObject, PolyObject, SimpleObject, TriObject, MSPluginGeomObject, MSGeomObjectXtnd, MSPluginShape, and MSShapeXtnd.

virtual int NumberOfRenderMeshes ( ) [inline, virtual]

Objects may supply multiple render meshes ( e.g.

particle systems). If this method returns a positive number, then GetMultipleRenderMesh and GetMultipleRenderMeshTM will be called for each mesh, instead of calling GetRenderMesh.

Returns:
The number of render meshes, or 0 to indicate that multiple meshes aren't supported.
{ return 0; } // 0 indicates multiple meshes not supported.
virtual Mesh* GetMultipleRenderMesh ( TimeValue  t,
INode inode,
View view,
BOOL &  needDelete,
int  meshNumber 
) [inline, virtual]

For multiple render meshes, this method must be implemented.

set needDelete to TRUE if the render should delete the mesh, FALSE otherwise.

Parameters:
t The time at which to obtain the mesh.
inode The pointer to the node.
view A reference to the view.
needDelete TRUE if the mesh needs to be deleted, otherwise FALSE.
meshNumber Specifies which of the multiplie meshes is being asked for.
{ return NULL; }
virtual void GetMultipleRenderMeshTM ( TimeValue  t,
INode inode,
View view,
int  meshNumber,
Matrix3 meshTM,
Interval meshTMValid 
) [inline, virtual]

For multiple render meshes, this method must be implemented.

Parameters:
t The time at which to obtain the mesh.
inode The pointer to the node.
view A reference to the view.
meshNumber Specifies which of the multiplie meshes is being asked for.
meshTM Should be returned with the transform defining the offset of the particular mesh in object space.
meshTMValid Should contain the validity interval of meshTM.
                                                { return;  }
virtual CoreExport PatchMesh* GetRenderPatchMesh ( TimeValue  t,
INode inode,
View view,
BOOL &  needDelete 
) [virtual]

This method provides a patch mesh representation of the object for use by the renderer.

If this method returns NULL, then GetRenderMesh() will be called.

Parameters:
t The time to get the patch mesh.
inode The node in the scene.
view If the renderer calls this method it will pass the view information here. See Class View.
needDelete Set to TRUE if the renderer should delete the patch mesh, FALSE otherwise.
Returns:
A pointer to the patch mesh. See Class PatchMesh.
CoreExport Class_ID PreferredCollapseType ( ) [virtual]

This method allows objects to specify the class that is the best class to convert to when the user collapses the stack.

The main base classes have default implementations. For example, GeomObject specifies TriObjects as its preferred collapse type and shapes specify splines as their preferred collapse type

Returns:
The Class_ID of the preferred object type. See List of Class_IDs.

Reimplemented from Object.

Reimplemented in ShapeObject, MSPluginShape, and MSShapeXtnd.

virtual BOOL CanDoDisplacementMapping ( ) [inline, virtual]

Returns TRUE if this object can do displacement mapping; otherwise FALSE.

Reimplemented in PolyObject, and TriObject.

{ return 0; }

GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject
GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject GeomObject