Radium Engine  1.5.0
Ra::Core::Geometry::AttribArrayGeometry Class Reference

This class represents vertex + attributes per vertex. Toplogy is handled in MultiIndexedGeometry subclass. More...

#include <Core/Geometry/TriangleMesh.hpp>

+ Inheritance diagram for Ra::Core::Geometry::AttribArrayGeometry:
+ Collaboration diagram for Ra::Core::Geometry::AttribArrayGeometry:

Public Types

using Point = Vector3
 
using Normal = Vector3
 
using PointAttribHandle = Utils::AttribHandle< Point >
 
using NormalAttribHandle = Utils::AttribHandle< Normal >
 
using FloatAttribHandle = Utils::AttribHandle< Scalar >
 
using Vec2AttribHandle = Utils::AttribHandle< Vector2 >
 
using Vec3AttribHandle = Utils::AttribHandle< Vector3 >
 
using Vec4AttribHandle = Utils::AttribHandle< Vector4 >
 

Public Member Functions

 AttribArrayGeometry ()
 Create an empty geometry.
 
 AttribArrayGeometry (const AttribArrayGeometry &other)
 
 AttribArrayGeometry (AttribArrayGeometry &&other)
 
AttribArrayGeometryoperator= (const AttribArrayGeometry &other)
 
AttribArrayGeometryoperator= (AttribArrayGeometry &&other)
 
bool append (const AttribArrayGeometry &other)
 
void clear () override
 Erases all data, making the AttribArrayGeometry empty.
 
void setVertices (PointAttribHandle::Container &&vertices)
 Set vertices.
 
void setVertices (const PointAttribHandle::Container &vertices)
 Set vertices.
 
const PointAttribHandle::Container & vertices () const
 Access the vertices positions.
 
void setNormals (PointAttribHandle::Container &&normals)
 Set normals.
 
void setNormals (const PointAttribHandle::Container &normals)
 Set normals.
 
const NormalAttribHandle::Container & normals () const
 Access the vertices normals.
 
template<typename T >
Utils::AttribHandle< T > getAttribHandle (const std::string &name) const
 
template<typename T >
bool isValid (const Utils::AttribHandle< T > &h) const
 Return true if h refers to an existing attribute in *this.
 
bool hasAttrib (const std::string &name) const
 
template<typename T >
void removeAttrib (Utils::AttribHandle< T > &h)
 
void clearAttributes ()
 Erases all attributes, leaving the AttribArrayGeometry with geometry only.
 
virtual void copyBaseGeometry (const AttribArrayGeometry &other)
 
template<typename... Handles>
bool copyAttributes (const AttribArrayGeometry &input, Handles... attribs)
 
bool copyAllAttributes (const AttribArrayGeometry &input)
 
Aabb computeAabb () const override
 Compute bounding box.
 
void colorize (const Utils::Color &c)
 
Utils::AttribManagervertexAttribs ()
 
const Utils::AttribManagervertexAttribs () const
 
PointAttribHandle::Container & verticesWithLock ()
 
void verticesUnlock ()
 Release lock on vertices positions.
 
NormalAttribHandle::Container & normalsWithLock ()
 
void normalsUnlock ()
 Release lock on vertices normals.
 
Wrappers to Utils::AttribManager.
template<typename T >
Utils::Attrib< T > & getAttrib (const Utils::AttribHandle< T > &h)
 
template<typename T >
const Utils::Attrib< T > & getAttrib (const Utils::AttribHandle< T > &h) const
 
template<typename T >
Utils::Attrib< T > & getAttrib (const std::string &name)
 
template<typename T >
const Utils::Attrib< T > & getAttrib (const std::string &name) const
 
template<typename T >
Utils::Attrib< T > * getAttribPtr (const Utils::AttribHandle< T > &h)
 
template<typename T >
const Utils::Attrib< T > * getAttribPtr (const Utils::AttribHandle< T > &h) const
 
Utils::AttribBasegetAttribBase (const std::string &name)
 
const Utils::AttribBasegetAttribBase (const std::string &name) const
 
template<typename T >
Utils::AttribHandle< T > addAttrib (const std::string &name)
 
template<typename T >
Utils::AttribHandle< T > addAttrib (const std::string &name, const typename Core::VectorArray< T > &data)
 
template<typename T >
Utils::AttribHandle< T > addAttrib (const std::string &name, const typename Utils::Attrib< T >::Container &&data)
 
- Public Member Functions inherited from Ra::Core::Geometry::AbstractGeometry
 AbstractGeometry (const AbstractGeometry &other)
 
AbstractGeometryoperator= (const AbstractGeometry &other)
 
Ra::Core::Utils::ObservableVoid & getAabbObservable ()
 

Additional Inherited Members

- Protected Member Functions inherited from Ra::Core::Geometry::AbstractGeometry
bool isAabbValid () const
 
Core::Aabb getAabb () const
 
void invalidateAabb () const
 
void setAabb (const Core::Aabb &aabb) const
 

Detailed Description

This class represents vertex + attributes per vertex. Toplogy is handled in MultiIndexedGeometry subclass.

Attributes are unique per vertex, so that same position with different normals are two vertices. Points and Normals, defining the geometry, are always present. They can be accessed through vertices() and normals(). Other attribs could be added with addAttrib() and accesssed with getAttrib().

Note
Mesh attribute VERTEX_POSITION and VERTEX_NORMAL are reserved and pre-allocated.

Definition at line 25 of file TriangleMesh.hpp.

Constructor & Destructor Documentation

◆ AttribArrayGeometry() [1/2]

Ra::Core::Geometry::AttribArrayGeometry::AttribArrayGeometry ( const AttribArrayGeometry other)
inlineexplicit

Copy constructor, copy all the data (geometry, attributes).

Note
Handles on other are not valid for *this.

Definition at line 237 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ AttribArrayGeometry() [2/2]

Ra::Core::Geometry::AttribArrayGeometry::AttribArrayGeometry ( AttribArrayGeometry &&  other)
inlineexplicit

Move constructor, copy all the data (geometry, attributes).

Note
Handles on other are also valid for *this.

Definition at line 244 of file TriangleMesh.hpp.

Member Function Documentation

◆ addAttrib() [1/3]

template<typename T >
Utils::AttribHandle< T > Ra::Core::Geometry::AttribArrayGeometry::addAttrib ( const std::string &  name)
inline

Add attribute with the given name.

See also
AttribManager::addAttrib() for more info.
Parameters
nameattrib name, uniquely identify the attrib
Returns
handle to set the attrib data with getAttrib(handle).setData()

Definition at line 388 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ addAttrib() [2/3]

template<typename T >
Utils::AttribHandle< T > Ra::Core::Geometry::AttribArrayGeometry::addAttrib ( const std::string &  name,
const typename Core::VectorArray< T > &  data 
)
inline

Add attribute with the given name.

See also
AttribManager::addAttrib() for more info.
Parameters
nameattrib name, uniquely identify the attrib
dataan array defining the attrib data

Definition at line 395 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ addAttrib() [3/3]

template<typename T >
Utils::AttribHandle< T > Ra::Core::Geometry::AttribArrayGeometry::addAttrib ( const std::string &  name,
const typename Utils::Attrib< T >::Container &&  data 
)
inline

Add attribute with the given name.

See also
AttribManager::addAttrib() for more info.
Parameters
nameattrib name, uniquely identify the attrib
dataan array defining the attrib data, the data is moved to the attrib

Definition at line 405 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ append()

bool Ra::Core::Geometry::AttribArrayGeometry::append ( const AttribArrayGeometry other)

Appends another AttribArrayGeometry to this one, but only if they have the same attributes. Return True if other has been successfully appended.

Warning
There is no error check on the handles attribute type.

Definition at line 11 of file TriangleMesh.cpp.

+ Here is the call graph for this function:

◆ colorize()

void Ra::Core::Geometry::AttribArrayGeometry::colorize ( const Utils::Color c)

Utility function colorzing the AttribArrayGeometry with a given color.

Note
Add the color attribute if needed.

Definition at line 38 of file TriangleMesh.cpp.

+ Here is the call graph for this function:

◆ copyAllAttributes()

bool Ra::Core::Geometry::AttribArrayGeometry::copyAllAttributes ( const AttribArrayGeometry input)
inline

Copy all the attributes from input. Existing attributes are kept untouched, except if overwritten by attributes copied from other.

Returns
True if the attributes have been sucessfully copied, false otherwise.
Note
*this and input must have the same number of vertices.
Warning
The original handles are not valid for the AttribArrayGeometry copy.

Definition at line 296 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ copyAttributes()

template<typename... Handles>
bool Ra::Core::Geometry::AttribArrayGeometry::copyAttributes ( const AttribArrayGeometry input,
Handles...  attribs 
)
inline

Copy only the required attributes from input. Existing attributes are kept untouched, except if overwritten by attributes copied from other.

Returns
True if the attributes have been sucessfully copied, false otherwise.
Note
*this and input must have the same number of vertices.
Warning
The original handles are not valid for the AttribArrayGeometry copy.

Definition at line 287 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ copyBaseGeometry()

void Ra::Core::Geometry::AttribArrayGeometry::copyBaseGeometry ( const AttribArrayGeometry other)
inlinevirtual

Copy only the geometry. The needed attributes can be copied through copyAttributes().

Warning
Deletes all attributes of *this.

Definition at line 279 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ getAttrib() [1/4]

template<typename T >
Utils::Attrib< T > & Ra::Core::Geometry::AttribArrayGeometry::getAttrib ( const std::string &  name)
inline
See also
Utils::AttribManager::getAttrib

Definition at line 379 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ getAttrib() [2/4]

template<typename T >
const Utils::Attrib< T > & Ra::Core::Geometry::AttribArrayGeometry::getAttrib ( const std::string &  name) const
inline
See also
Utils::AttribManager::getAttrib

Definition at line 374 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ getAttrib() [3/4]

template<typename T >
Utils::Attrib< T > & Ra::Core::Geometry::AttribArrayGeometry::getAttrib ( const Utils::AttribHandle< T > &  h)
inline
See also
Utils::AttribManager::getAttrib

Definition at line 355 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ getAttrib() [4/4]

template<typename T >
const Utils::Attrib< T > & Ra::Core::Geometry::AttribArrayGeometry::getAttrib ( const Utils::AttribHandle< T > &  h) const
inline
See also
Utils::AttribManager::getAttrib

Definition at line 360 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ getAttribBase() [1/2]

Utils::AttribBase * Ra::Core::Geometry::AttribArrayGeometry::getAttribBase ( const std::string &  name)
inline
See also
Utils::AttribManager::getAttribBase

Definition at line 364 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ getAttribBase() [2/2]

const Utils::AttribBase * Ra::Core::Geometry::AttribArrayGeometry::getAttribBase ( const std::string &  name) const
inline
See also
Utils::AttribManager::getAttribBase

Definition at line 369 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ getAttribHandle()

template<typename T >
Utils::AttribHandle< T > Ra::Core::Geometry::AttribArrayGeometry::getAttribHandle ( const std::string &  name) const
inline

Return the Handle to the attribute with the given name if it exists, an invalid handle otherwise.

See also
AttribManager::getAttribHandle() for more info.

Definition at line 345 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ getAttribPtr() [1/2]

template<typename T >
Utils::Attrib<T>* Ra::Core::Geometry::AttribArrayGeometry::getAttribPtr ( const Utils::AttribHandle< T > &  h)
inline
See also
Utils::AttribManager::getAttribPtr

◆ getAttribPtr() [2/2]

template<typename T >
const Utils::Attrib<T>* Ra::Core::Geometry::AttribArrayGeometry::getAttribPtr ( const Utils::AttribHandle< T > &  h) const
inline
See also
Utils::AttribManager::getAttribPtr

◆ hasAttrib()

bool Ra::Core::Geometry::AttribArrayGeometry::hasAttrib ( const std::string &  name) const
inline

Check if an attribute exists with the given name.

See also
AttribManager::contains for more info.

Definition at line 383 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ normalsWithLock()

AttribArrayGeometry::NormalAttribHandle::Container & Ra::Core::Geometry::AttribArrayGeometry::normalsWithLock ( )
inline

Read/write access the vertices normals.

Warning
need to call normalsUnlock when job done.

Definition at line 435 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ operator=() [1/2]

AttribArrayGeometry & Ra::Core::Geometry::AttribArrayGeometry::operator= ( AttribArrayGeometry &&  other)
inline

Move assignment, copy all the data (geometry, attributes).

Note
Handles on other are also valid for *this.

Definition at line 261 of file TriangleMesh.hpp.

◆ operator=() [2/2]

AttribArrayGeometry & Ra::Core::Geometry::AttribArrayGeometry::operator= ( const AttribArrayGeometry other)
inline

Assignment operator, copy all the data (geometry, attributes).

Warning
Handles on other are not valid for *this.

Definition at line 249 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ removeAttrib()

template<typename T >
void Ra::Core::Geometry::AttribArrayGeometry::removeAttrib ( Utils::AttribHandle< T > &  h)
inline

Remove attribute by handle.

See also
AttribManager::removeAttrib() for more info.

Definition at line 414 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ vertexAttribs() [1/2]

Utils::AttribManager & Ra::Core::Geometry::AttribArrayGeometry::vertexAttribs ( )
inline

Return the vertexAttribs manager. In case you want to have direct access to Utils::AttribManager functionality.

Todo:
rename to getAttribManager ?

Definition at line 419 of file TriangleMesh.hpp.

◆ vertexAttribs() [2/2]

const Utils::AttribManager & Ra::Core::Geometry::AttribArrayGeometry::vertexAttribs ( ) const
inline

Return the vertexAttribs manager. In case you want to have direct access to Utils::AttribManager functionality.

Definition at line 423 of file TriangleMesh.hpp.

◆ verticesWithLock()

AttribArrayGeometry::PointAttribHandle::Container & Ra::Core::Geometry::AttribArrayGeometry::verticesWithLock ( )
inline

Read/write access to the vertices positions.

Warning
need to call verticesUnlock when job done.

Definition at line 427 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

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