Workspace 6.21.5
|
Holds a mesh model plus optional sub-items defining its appearance. More...
#include <Rendering/SceneComponents/Models/meshmodelinstance.h>
Public Member Functions | |
MeshModelInstance (const MeshModelInstance &pm) | |
MeshModelInstance (const QString &id="") | |
~MeshModelInstance () override | |
void | addGlypher (Glypher &item) |
bool | addLod (double distance, const QString &modelId) |
void | clearGlyphers () |
MeshModelInstance * | clone () const override |
const QDateTime & | getClearCacheIndicator () const |
double | getEdgeBreakAngle () const |
Glypher & | getGlypher (unsigned i) |
const Glypher & | getGlypher (unsigned i) const |
const QDateTime & | getLastUpdated () const |
double | getLodDistance (size_t lod) const |
const QString & | getLodModelId (double distance) const |
const QString & | getLodModelId (size_t lod) const |
const QString & | getModelId () const |
int | getNumLods () const |
Mesh::MeshModelSource * | getPrivateSource () const |
Shader * | getShader () const |
const QString & | getShaderId () |
bool | hasLods () const |
bool | haveGlypher (const Glypher &item) const |
bool | haveGlyphers () const |
bool | isDepthTested () const |
bool | isInteractive () const |
bool | isSymbol () const |
bool | localBoundingBoxIsInitialized () const |
unsigned int | numGlyphers () const |
MeshModelInstance & | operator= (const MeshModelInstance &proxy) |
void | removeGlypher (Glypher &item) |
void | removeLod (const QString &modelId) |
void | removeLod (size_t lod) |
void | setClearCacheIndicator (const QDateTime &timeStamp) |
void | setDepthTested (bool b) |
void | setEdgeBreakAngle (double theta) |
void | setInteractive (bool b) |
void | setLastUpdated (const QDateTime &timeStamp) |
void | setLocalBoundingBox (const Mesh::BoundingBoxMinimal &bb) override |
void | setModelId (const QString &id) |
void | setPrivateSource (Mesh::MeshModelSource *source) |
void | setShader (Shader *shader) |
void | setShaderId (const QString &id) |
void | setSymbol (bool b) |
bool | visit (SceneProcessor &processor) override |
Public Member Functions inherited from SceneItem | |
~SceneItem () override | |
SceneItem * | clone () const override=0 |
bool | getEnabled () const |
const QString & | getId () const |
const Mesh::BoundingBoxMinimal & | getLocalBoundingBox () const |
virtual Mesh::TransformMatrix | getMatrixGlobal () const |
virtual Mesh::TransformMatrix | getMatrixLocal () const |
const QString & | getName () const |
Mesh::TransformMatrix | getParentMatrixGlobal () const |
Transform * | getParentTransform () |
void | setEnabled (bool b) |
void | setId (const QString &itemId) |
virtual void | setLocalBoundingBox (const Mesh::BoundingBoxMinimal &bb) |
void | setName (const QString &name) |
virtual Transform * | toTransform () |
virtual const Transform * | toTransform () const |
virtual void | updateGlobalMatrix () |
virtual bool | visit (SceneProcessor &processor)=0 |
Public Member Functions inherited from Observable | |
virtual | ~Observable () |
void | attachObserver (Observer &observer) |
void | destroy () |
void | detachObserver (Observer &observer) |
void | notifyEvent (const ObservableEvent &event) |
Public Member Functions inherited from Clonable | |
virtual | ~Clonable ()=default |
virtual Clonable * | clone () const =0 |
Additional Inherited Members | |
Protected Member Functions inherited from SceneItem | |
SceneItem (const QString &id) | |
SceneItem (const SceneItem &item) | |
virtual void | addToScene (Scene &scene, const QString &opIdPath="") |
bool | isTransformModified () const |
SceneItem & | operator= (const SceneItem &item) |
void | setTransformModified (bool b) |
Protected Member Functions inherited from Observable | |
Observable () | |
Observable (const Observable &) | |
A MeshModelInstance is essentially a thin proxy for a MeshModel. It supplies a String id instead of the MeshModel itself so that the the loading of the MeshModel can be delayed until it is actually needed, or possibly avoided altogether. See setModelId() for more details.
MeshModelInstance | ( | const QString & | id = "" | ) |
MeshModelInstance | ( | const MeshModelInstance & | pm | ) |
pm | The model instance to copy. All its glyphers are also cloned to ensure that the new copy shares no data with pm. |
|
override |
void addGlypher | ( | Glypher & | item | ) |
item | The glypher to add to this model instance. It must not already have been added to the model instance. |
bool addLod | ( | double | distance, |
const QString & | modelId | ||
) |
distance | |
modelId |
void clearGlyphers | ( | ) |
Clears the list of Glyphers associated with this model instance. The items themselves are not deleted, since it is assumed that they are owned by something else, not the model instance.
|
overridevirtual |
const QDateTime & getClearCacheIndicator | ( | ) | const |
double getEdgeBreakAngle | ( | ) | const |
Glypher & getGlypher | ( | unsigned | index | ) |
index | The index of the item to retrieve. It must be less than the number of items returned from numGlyphers(). |
const Glypher & getGlypher | ( | unsigned | index | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const QDateTime & getLastUpdated | ( | ) | const |
double getLodDistance | ( | size_t | lod | ) | const |
lod |
const QString & getLodModelId | ( | double | distance | ) | const |
distance |
const QString & getLodModelId | ( | size_t | lod | ) | const |
lod |
const QString & getModelId | ( | ) | const |
int getNumLods | ( | ) | const |
Mesh::MeshModelSource * getPrivateSource | ( | ) | const |
Shader * getShader | ( | ) | const |
const QString & getShaderId | ( | ) |
bool hasLods | ( | ) | const |
bool haveGlypher | ( | const Glypher & | item | ) | const |
item | The glypher to look for. |
bool haveGlyphers | ( | ) | const |
bool isDepthTested | ( | ) | const |
bool isInteractive | ( | ) | const |
bool isSymbol | ( | ) | const |
bool localBoundingBoxIsInitialized | ( | ) | const |
unsigned numGlyphers | ( | ) | const |
MeshModelInstance & operator= | ( | const MeshModelInstance & | proxy | ) |
proxy | The object to assign to this one. |
void removeGlypher | ( | Glypher & | item | ) |
item | The glypher to remove from this model instance. It must have been added to the model instance. It is an error to ask to remove an item that is not present. |
void removeLod | ( | const QString & | modelId | ) |
modelId |
void removeLod | ( | size_t | lod | ) |
lod |
void setClearCacheIndicator | ( | const QDateTime & | timeStamp | ) |
void setDepthTested | ( | bool | b | ) |
b | If true, the instance will be treated as an "overlay" (i.e. depth testing will be turned off). |
void setEdgeBreakAngle | ( | double | theta | ) |
The edge break angle of this mesh model instance. This edge break angle will be used to calculate the surface normals for the model when it is rendered. The angle is used to determine whether or not an edge is a 'soft' or 'hard' edge on the surface.
theta | The angle to use as the edge break angle. |
void setInteractive | ( | bool | b | ) |
b | If true, the MeshModelInstance will be interactive; it will be able to be interacted with via widgets like the WSGLWidget. |
void setLastUpdated | ( | const QDateTime & | timeStamp | ) |
|
overridevirtual |
bb | The bounding box we are assigning to this model instance (in local (to the source) coordinates). |
Reimplemented from SceneItem.
void setModelId | ( | const QString & | id | ) |
id | The ID string for this mesh model instance. |
The id string should always be obtained from a MeshModelSource which will supply the appropriate MeshModel when requested. All the hard work of supplying a MeshModel is done by MeshModelLibrary and MeshModelSource. The MeshModelInstance class merely holds the id string as an identifier for SceneProcessor implementations to use with a MeshModelLibrary so that they can request the MeshModel only when it is needed. If a given SceneProcessor doesn't actually need the mesh data, then it simply never requests it from the MeshModelLibrary and potentially the MeshModel never needs to actually be loaded. This can be a significant efficiency gain if the SceneProcessor is intelligent enough to figure out things it doesn't need or if certain parts of the scene have been "switched off". It also allows for efficient caching strategies to be used with the id being a suitable hash key that is also likely to be reasonably human readable.
void setPrivateSource | ( | Mesh::MeshModelSource * | source | ) |
void setShader | ( | Shader * | shader | ) |
shader | The shader to attach to this MeshModelInstance for use at render time. |
Attaching a shader to a MeshModelInstance modifies the way which it is rendered There are two ways that shaders can be attached to a MeshModelInstance:
void setShaderId | ( | const QString & | id | ) |
id | The shader ID that will be used to retrieve a shader at render time using the ShaderLibrary attached to the scene. |
The appearance of a MeshModelInstance can be controlled with a Shader. A shader can be either directly attached to the MeshModelInstance (see setShader) or the shader can be retrieved at render time from a ShaderLibrary using the ShaderId specified here.
void setSymbol | ( | bool | b | ) |
b | If true, the instance will be treated as a symbol in the scene. |
|
overridevirtual |
Implements SceneItem.