Carna  Version 3.0.1
Public Member Functions | Public Attributes | List of all members
Carna::base::Geometry Class Reference

Defines scene graph leafs. Instances of this class represent visible geometry that can be rendered. The way of rendering is defined by the geometry rendering stage with matching geometryType. More...

#include <Geometry.h>

+ Inheritance diagram for Carna::base::Geometry:
+ Collaboration diagram for Carna::base::Geometry:

Public Member Functions

 Geometry (unsigned int geometryType, const std::string &tag="")
 Instantiates. More...
 
virtual ~Geometry ()
 Deletes.
 
void putFeature (unsigned int role, GeometryFeature &feature)
 Adds the feature to this geometry node using role in \(\mathcal O\left(\log n\right)\). The concept of geometry features and roles is explained here. More...
 
void removeFeature (GeometryFeature &feature)
 Removes feature from this geometry node in \(\mathcal O\left(\log n\right)\). The concept of geometry features and roles is explained here. More...
 
void removeFeature (unsigned int role)
 Removes the geometry feature from this node that is associated with role in \(\mathcal O\left(\log n\right)\). More...
 
void clearFeatures ()
 Removes all geometry feature from this node. More...
 
bool hasFeature (const GeometryFeature &feature) const
 Tells whether feature is attached to this node in \(\mathcal O\left(\log n\right)\).
 
bool hasFeature (unsigned int role) const
 Tells whether this node has a feature with role attached in \(\mathcal O\left(\log n\right)\).
 
GeometryFeaturefeature (unsigned int role) const
 References the feature with role attached to this node in \(\mathcal O\left(\log n\right)\). More...
 
std::size_t featuresCount () const
 Tells number of geometry features attached.
 
void visitFeatures (const std::function< void(GeometryFeature &gf, unsigned int role) > &visit) const
 Invokes visit once on each attached geometry feature.
 
void setBoundingVolume (BoundingVolume *boundingVolume)
 Sets boundingVolume as the minimum boundary volume of this node. Supply nullptr for boundingVolume to remove it.
 
bool hasBoundingVolume () const
 Tells whether a minimum boundary volume is set on this node.
 
BoundingVolumeboundingVolume ()
 References the previously set minimum boundary volume. More...
 
const BoundingVolumeboundingVolume () const
 
- Public Member Functions inherited from Carna::base::Spatial
 Spatial (const std::string &tag="")
 Instantiates. More...
 
virtual ~Spatial ()
 Does nothing.
 
bool hasParent () const
 Tells whether this spatial has a parent node.
 
SpatialdetachFromParent ()
 Detaches this spatial from it's parent node in \(\mathcal O\left(\log n\right)\) where \(n\) is the number of parent's children. The caller takes possession of this spatial. More...
 
void updateParent (Node &parent)
 Fixes tree consistency by updating parent of this spatial. This method is for internal usage only.
 
Nodeparent ()
 References the parent node. More...
 
const Nodeparent () const
 
NodefindRoot ()
 References the root node this spatial belongs to.
 
const NodefindRoot () const
 References the root node this spatial belongs to.
 
virtual void updateWorldTransform ()
 Computes the transformation to world space for this spatial. More...
 
const math::Matrix4fworldTransform () const
 Tells the transformation to world space for this spatial that was last computed.
 
template<typename UserDataType >
void setUserData (const UserDataType &userData)
 Links an arbitrary object with this Spatial instance. More...
 
void removeUserData ()
 Removes any object that has been linked with this Spatial instance through setUserData previously. More...
 
bool hasUserData () const
 Tells whether an object has been linked with this Spatial instance through setUserData previously.
 
template<typename UserDataType >
const UserDataType & userData () const
 Retrieves the object previously linked with this Spatial instance. More...
 
void setMovable (bool movable)
 Sets whether this spatial may be displaced w.r.t. it's parent through user interaction. Usually this will be false when this spatial represents a component of it's parent, like the shaft of an arrow. More...
 
bool isMovable () const
 Tells whether this spatial may be displaced w.r.t. it's parent through user interaction. Usually this will be false when this spatial represents a component of it's parent, like the shaft of an arrow. More...
 
virtual void invalidate ()
 Notifies all listeners of its parent nodes that their subtrees have changed. This may include changes of the tree structure as well as updated materials and suchlike.
 
void setTag (const std::string &tag)
 Sets an arbitrary tag that may be used to identify this object.
 
const std::string & tag () const
 Tells the tag set previously.
 

Public Attributes

const unsigned int geometryType
 Holds the geometry type of this geometry node.
 
- Public Attributes inherited from Carna::base::Spatial
math::Matrix4f localTransform
 Defines the location, rotation and scale of this spatial in relation to it's parent. If this spatial has no parent, the value has no meaning. More...
 

Additional Inherited Members

- Public Types inherited from Carna::base::Spatial
typedef std::function< void(Spatial &) > MutableVisitor
 Declares an entity that visits mutable Spatial instances.
 
typedef std::function< void(const Spatial &) > ImmutableVisitor
 Declares an entity that visits mutable Spatial instances.
 

Detailed Description

Defines scene graph leafs. Instances of this class represent visible geometry that can be rendered. The way of rendering is defined by the geometry rendering stage with matching geometryType.

Usually the corresponding rendering stage will query particular features from this geometry object: Features are like components that make up the geometry object in it's entirety, but the geometry object aggregates them, i.e. does not take their possession. Rendering stages identify features through the roles they take when associated with a geometry object.

Note
Conventionally, the default role for 3D textures that represent HU data, such as presets::DRRStage::ROLE_HU_VOLUME or presets::CuttingPlanesStage::ROLE_HU_VOLUME, is 0.

What features a geometry object aggregates depends on the geometryType and what the corresponding rendering stage expects. Typical examples are meshes, materials and volume textures.

Author
Leonid Kostrykin
Date
21.2.15 - 6.3.15

Definition at line 59 of file Geometry.h.

Constructor & Destructor Documentation

Carna::base::Geometry::Geometry ( unsigned int  geometryType,
const std::string &  tag = "" 
)
explicit

Instantiates.

Parameters
geometryTypesets the geometry type of this geometry node.
tagis an arbitrary string that may be used to identify this node.

Member Function Documentation

BoundingVolume& Carna::base::Geometry::boundingVolume ( )

References the previously set minimum boundary volume.

Precondition
hasBoundingVolume() == true
const BoundingVolume& Carna::base::Geometry::boundingVolume ( ) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void Carna::base::Geometry::clearFeatures ( )

Removes all geometry feature from this node.

Invalidates all parent subtrees if the features were not an empty set.

GeometryFeature& Carna::base::Geometry::feature ( unsigned int  role) const

References the feature with role attached to this node in \(\mathcal O\left(\log n\right)\).

Precondition
hasFeature(role) == true
void Carna::base::Geometry::putFeature ( unsigned int  role,
GeometryFeature feature 
)

Adds the feature to this geometry node using role in \(\mathcal O\left(\log n\right)\). The concept of geometry features and roles is explained here.

Postcondition
hasFeature(feature) == true
hasFeature(role) == true
&feature(role) == &feature

If feature was already added to this node, than its role is updated. If role is already taken by another feature, then the older one is overridden.

Invalidates all parent subtrees.

void Carna::base::Geometry::removeFeature ( GeometryFeature feature)

Removes feature from this geometry node in \(\mathcal O\left(\log n\right)\). The concept of geometry features and roles is explained here.

Nothing happens if feature was not added to this geometry node previously. Invalidates all parent subtrees otherwise.

void Carna::base::Geometry::removeFeature ( unsigned int  role)

Removes the geometry feature from this node that is associated with role in \(\mathcal O\left(\log n\right)\).

Nothing happens if no feature is associated with role at the moment. Invalidates all parent subtrees otherwise.


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