VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
makVrv::DtModel Class Reference

A model which owns a single model instance. More...

Inheritance diagram for makVrv::DtModel:
Inheritance graph
[legend]

Classes

struct  ObjectTransform

Public Member Functions

 DtModel (DtDe &de, DtUniqueID id)
 CTOR.
virtual ~DtModel ()
 DTOR.
virtual void setModelDefinition (const std::string &str)
 Set the model definition.
virtual void saveModelToFile (const std::string &filename)
virtual std::string className () const
 Get the class name of the model instance owner.
unsigned int transformSize () const
 Get the number of position/orientations this model has.
virtual void setPosition (int vtx, const DtVector &position)
 Set the position of a control vertex in the model.
virtual void removePosition (int vtx)
 Remove a transform at the given position.
const DtVectorposition (int vtx=0) const
 Get the Position of a given point.
const DtTaitBryan & orientation (int vtx=0) const
 Get the Orientation of a given point.
virtual void setOrientation (int vtx, const DtTaitBryan &orientation)
 Set the orientation of a vertex in the model.
virtual void enableColorBlending (bool b)
 Enable / disable color blending for this model.
virtual void setBlendColor (float r, float g, float b, float a)
 Set color to use if color blending is enabled.
virtual void getBlendColor (float &r, float &g, float &b, float &a)
 Returns the blend color.
virtual bool colorBlendingEnabled () const
 Returns whether or not blending is enabled.
virtual void setColor (float r, float g, float b, float a)
 set the model's color
virtual void enableLighting (bool l)
 set whether the model is lit; this may not be an option on all models
virtual int modelSet () const
 Get the model set this model is part of.
const DtVectorboundingBoxExtents () const
 Get the bounding box extents of the model instance.
void getBoundingBoxExtents (double &x, double &y, double &z) const
 Get the bounding box extents of the model instance.
const DtVectorboundingBoxCenter () const
 Get the bounding box center of the model instance.
virtual void getBoundingBoxCenter (double &x, double &y, double &z) const
 Get the bounding box center of the model instance.
virtual void getBoundingBoxComponents (DtVector &minimum, DtVector &maximum)
 Get the minimum and maximum X,Y,Z components of the bounding box.
void setContributesToBound (bool trueOrFalse)
 Set whether this model instance contributes to an object's overall bounding volume.
bool contributesToBound () const
 Get whether this model instance contributes to an object's overall bounding volume.
DtDede ()
 Get the DtDe object.
virtual void setModelInstance (DtModelInstance *modelInstance)
 Internally set the model instance pointer.
virtual void setVisible (bool isVisible)
 Set the visible state of the model.
virtual bool visible () const
 Get the visible state of the model.
DtUniqueID parentSceneObjectID () const
 Parent of the model.
virtual void addedToSceneObjectAsProp (const DtUniqueID &sceneObj)
 Called when a scene object added the model as a prop.
virtual void addedToSceneObject (const DtUniqueID &sceneObj, int modelSet, int visualizerType)
 Called when a scene object added the model with the given model set and visualizer type.
virtual void setElementId (DtUniqueID id)
 Called when the element ID of the model's parent object is set.
virtual void removedFromSceneObject ()
 Called when the model was removed from a scene object.
virtual void setIsSupportModel (bool isSupport)=0
 Is this model part of the support group? (determines whether or not other scene objects can ground clamp to this model)
virtual void setSolid (bool isSolid)
 Set whether or not other this model is drawn filled in.
virtual bool isProp ()
 Return whether or not this model was added as a prop.
virtual DtModelInstancemodelInstance ()
 Get the model instance.
virtual const DtModelInstancemodelInstance () const
int visualizerType () const
 The visualizer type determines which channel-specific group node this model will be parented to, and consequently, which observer setting will cause it to be rendered in which channel.

Public Attributes

boost::signal< void(DtModel *)> signal_modelToBeDestroyed
 Signal emitted when the model is to be destroyed.
boost::signal< void(DtModel *)> signal_modelChanged
boost::signal< bool(DtModel
*, bool), SlotReturnOR
signal_visibilityChangeRequested
 Signal when the visibility has been requested, if any slot returns false, it will not change.
boost::signal< void(DtModelInstance
*, DtModel *)> 
signal_modelInstanceCreated
 Signal emitted when the model instance is created.
boost::signal< void(DtModelInstance
*, DtModel *)> 
signal_modelInstanceToBeDestroyed
 Signal emitted when the model instance is to be destroyed.

Protected Types

typedef std::vector
< ObjectTransform
TransformList

Protected Member Functions

virtual void addToScene (const DtUniqueID &sceneObjectId, int modelSet, int visualizerType)=0
 Virtual Functions to be implemented, add this model to the scene.
virtual void addToSceneAsProp (const DtUniqueID &sceneObjectId)
 Add this model to the scene as a prop.
virtual void removeFromScene ()=0
 Virtual Functions to be implemented, remove this model from the scene.
virtual void initializeModelInstance ()
 Push any state maintained by the model to the model instance.
void slot_modelInstanceChanged (DtModelInstance *instance)
 Called when the model instance changed.

Protected Attributes

DtDemyDe
const DtUniqueID myUniqueId
bool myColorBlendingEnabled

Private Member Functions

void deleteModelInstance ()
 Delete the model instance (and emit signal_modelToBeDestroyed)

Private Attributes

TransformList myTransforms
 We keep our own copy in case we get updates before we get a model instance.
DtModelInstancemyModelInstance
int myModelSet
int myVisualizerType
bool myContributesToBound
DtUniqueID myParentSceneObjectID
bool myIsPropFlag
float myBlendColor [4]
bool myVisibleFlag

Detailed Description

A model which owns a single model instance.

A DtModel is a managing container for a single DtModelInstance, providing more attributes about how the DtModelInstance should be rendered. Initialization of a DtModel starts with giving it a model-definition. Unlike the DtModelInstance which can be handed a model-definition identifying the model to load, the DtModel retrieves a model-definition which has been pre-loaded into a definition-manager. Usually DtModelDefinition objects are automatically loaded from disk to populate the definition-manager.

Member Typedef Documentation

typedef std::vector<ObjectTransform> makVrv::DtModel::TransformList
protected

Constructor & Destructor Documentation

makVrv::DtModel::DtModel ( DtDe de,
DtUniqueID  id 
)

CTOR.

virtual makVrv::DtModel::~DtModel ( )
virtual

DTOR.

Member Function Documentation

virtual void makVrv::DtModel::setModelDefinition ( const std::string &  str)
virtual
virtual void makVrv::DtModel::saveModelToFile ( const std::string &  filename)
virtual
virtual std::string makVrv::DtModel::className ( ) const
virtual
virtual DtModelInstance* makVrv::DtModel::modelInstance ( )
virtual

Get the model instance.

virtual const DtModelInstance* makVrv::DtModel::modelInstance ( ) const
virtual
unsigned int makVrv::DtModel::transformSize ( ) const

Get the number of position/orientations this model has.

virtual void makVrv::DtModel::setPosition ( int  vtx,
const DtVector position 
)
virtual
virtual void makVrv::DtModel::removePosition ( int  vtx)
virtual
const DtVector& makVrv::DtModel::position ( int  vtx = 0) const

Get the Position of a given point.

Exceptions
DtCorruptedStateif the vtx is not with-in the normal bounds.
const DtTaitBryan& makVrv::DtModel::orientation ( int  vtx = 0) const

Get the Orientation of a given point.

Exceptions
DtCorruptedStateif the vtx is not with-in the normal bounds.
virtual void makVrv::DtModel::setOrientation ( int  vtx,
const DtTaitBryan &  orientation 
)
virtual
virtual void makVrv::DtModel::enableColorBlending ( bool  b)
virtual

Enable / disable color blending for this model.

Reimplemented in makVrv::DtOsgArticulatedModel, makVrv::DtOsgSimpleModel, and makVrv::DtOsgPolygonModel.

virtual void makVrv::DtModel::setBlendColor ( float  r,
float  g,
float  b,
float  a 
)
virtual

Set color to use if color blending is enabled.

Reimplemented in makVrv::DtOsgArticulatedModel, and makVrv::DtOsgSimpleModel.

virtual void makVrv::DtModel::getBlendColor ( float &  r,
float &  g,
float &  b,
float &  a 
)
virtual

Returns the blend color.

virtual bool makVrv::DtModel::colorBlendingEnabled ( ) const
virtual

Returns whether or not blending is enabled.

virtual void makVrv::DtModel::setColor ( float  r,
float  g,
float  b,
float  a 
)
virtual
virtual void makVrv::DtModel::enableLighting ( bool  l)
virtual

set whether the model is lit; this may not be an option on all models

Reimplemented in makVrv::DtOsgPolygonModel.

virtual int makVrv::DtModel::modelSet ( ) const
virtual

Get the model set this model is part of.

const DtVector& makVrv::DtModel::boundingBoxExtents ( ) const

Get the bounding box extents of the model instance.

void makVrv::DtModel::getBoundingBoxExtents ( double x,
double y,
double z 
) const

Get the bounding box extents of the model instance.

const DtVector& makVrv::DtModel::boundingBoxCenter ( ) const

Get the bounding box center of the model instance.

virtual void makVrv::DtModel::getBoundingBoxCenter ( double x,
double y,
double z 
) const
virtual

Get the bounding box center of the model instance.

virtual void makVrv::DtModel::getBoundingBoxComponents ( DtVector minimum,
DtVector maximum 
)
virtual

Get the minimum and maximum X,Y,Z components of the bounding box.

Reimplemented in makVrv::DtOsgArticulatedModel, and makVrv::DtOsgSimpleModel.

void makVrv::DtModel::setContributesToBound ( bool  trueOrFalse)

Set whether this model instance contributes to an object's overall bounding volume.

bool makVrv::DtModel::contributesToBound ( ) const

Get whether this model instance contributes to an object's overall bounding volume.

int makVrv::DtModel::visualizerType ( ) const

The visualizer type determines which channel-specific group node this model will be parented to, and consequently, which observer setting will cause it to be rendered in which channel.

DtDe& makVrv::DtModel::de ( )
inline

Get the DtDe object.

virtual void makVrv::DtModel::setModelInstance ( DtModelInstance modelInstance)
virtual

Internally set the model instance pointer.

If an existing model instance is set, it will be deleted. To clear the current model instance only, passing a Null pointer 0 is supported.

Warning
Only public for internal use
Parameters
Input
modelInstancepointer to a model instance.

Reimplemented in makVrv::MyParticleSystemModel, makVrv::DtOsg3DTextModel, makVrv::DtOsgRibbonModel, and makVrv::DtOsgDecalModel.

virtual void makVrv::DtModel::setVisible ( bool  isVisible)
virtual
virtual bool makVrv::DtModel::visible ( ) const
virtual

Get the visible state of the model.

Return values
trueif set visible.
falseotherwise.
See Also
setVisible()
DtUniqueID makVrv::DtModel::parentSceneObjectID ( ) const

Parent of the model.

virtual void makVrv::DtModel::addedToSceneObjectAsProp ( const DtUniqueID sceneObj)
virtual

Called when a scene object added the model as a prop.

virtual void makVrv::DtModel::addedToSceneObject ( const DtUniqueID sceneObj,
int  modelSet,
int  visualizerType 
)
virtual

Called when a scene object added the model with the given model set and visualizer type.

virtual void makVrv::DtModel::setElementId ( DtUniqueID  id)
virtual

Called when the element ID of the model's parent object is set.

No-op by default

Reimplemented in makVrv::DtOsgArticulatedModel, and makVrv::DtOsgSimpleModel.

virtual void makVrv::DtModel::removedFromSceneObject ( )
virtual

Called when the model was removed from a scene object.

virtual void makVrv::DtModel::setIsSupportModel ( bool  isSupport)
pure virtual
virtual void makVrv::DtModel::setSolid ( bool  isSolid)
virtual
virtual bool makVrv::DtModel::isProp ( )
virtual

Return whether or not this model was added as a prop.

virtual void makVrv::DtModel::addToScene ( const DtUniqueID sceneObjectId,
int  modelSet,
int  visualizerType 
)
protectedpure virtual
virtual void makVrv::DtModel::addToSceneAsProp ( const DtUniqueID sceneObjectId)
inlineprotectedvirtual

Add this model to the scene as a prop.

All models are not required to re-implement this

Reimplemented in makVrv::DtOsgScribeBoxModel, makVrv::DtOsgParticleSystemModel, and makVrv::DtOsgSimpleModel.

virtual void makVrv::DtModel::removeFromScene ( )
protectedpure virtual
virtual void makVrv::DtModel::initializeModelInstance ( )
protectedvirtual

Push any state maintained by the model to the model instance.

Reimplemented in makVrv::DtOsgRibbonModel, makVrv::DtOsgDecalModel, and makVrv::DtOsgDrawModel.

void makVrv::DtModel::slot_modelInstanceChanged ( DtModelInstance instance)
protected

Called when the model instance changed.

void makVrv::DtModel::deleteModelInstance ( )
private

Delete the model instance (and emit signal_modelToBeDestroyed)

Member Data Documentation

boost::signal<void (DtModel*)> makVrv::DtModel::signal_modelToBeDestroyed

Signal emitted when the model is to be destroyed.

boost::signal<void (DtModel*)> makVrv::DtModel::signal_modelChanged
boost::signal<bool (DtModel*,bool ), SlotReturnOR> makVrv::DtModel::signal_visibilityChangeRequested

Signal when the visibility has been requested, if any slot returns false, it will not change.

boost::signal<void (DtModelInstance*, DtModel*)> makVrv::DtModel::signal_modelInstanceCreated

Signal emitted when the model instance is created.

boost::signal<void (DtModelInstance*, DtModel*)> makVrv::DtModel::signal_modelInstanceToBeDestroyed

Signal emitted when the model instance is to be destroyed.

DtDe& makVrv::DtModel::myDe
protected
const DtUniqueID makVrv::DtModel::myUniqueId
protected
bool makVrv::DtModel::myColorBlendingEnabled
protected
TransformList makVrv::DtModel::myTransforms
private

We keep our own copy in case we get updates before we get a model instance.

DtModelInstance* makVrv::DtModel::myModelInstance
private
int makVrv::DtModel::myModelSet
private
int makVrv::DtModel::myVisualizerType
private
bool makVrv::DtModel::myContributesToBound
private
DtUniqueID makVrv::DtModel::myParentSceneObjectID
private
bool makVrv::DtModel::myIsPropFlag
private
float makVrv::DtModel::myBlendColor[4]
private
bool makVrv::DtModel::myVisibleFlag
private

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)