Radium Engine  1.5.20
Loading...
Searching...
No Matches
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.

Member Typedef Documentation

◆ FloatAttribHandle

◆ Normal

using Ra::Core::Geometry::AttribArrayGeometry::Normal = Vector3

Definition at line 29 of file TriangleMesh.hpp.

◆ NormalAttribHandle

◆ Point

using Ra::Core::Geometry::AttribArrayGeometry::Point = Vector3

Definition at line 28 of file TriangleMesh.hpp.

◆ PointAttribHandle

◆ Vec2AttribHandle

◆ Vec3AttribHandle

◆ Vec4AttribHandle

Constructor & Destructor Documentation

◆ AttribArrayGeometry() [1/3]

Ra::Core::Geometry::AttribArrayGeometry::AttribArrayGeometry ( )
inline

Create an empty geometry.

Definition at line 39 of file TriangleMesh.hpp.

◆ AttribArrayGeometry() [2/3]

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 235 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ AttribArrayGeometry() [3/3]

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 242 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 386 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 393 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 403 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:

◆ clear()

void Ra::Core::Geometry::AttribArrayGeometry::clear ( )
inlineoverridevirtual

Erases all data, making the AttribArrayGeometry empty.

Implements Ra::Core::Geometry::AbstractGeometry.

Reimplemented in Ra::Core::Geometry::MultiIndexedGeometry.

Definition at line 270 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ clearAttributes()

void Ra::Core::Geometry::AttribArrayGeometry::clearAttributes ( )
inline

Erases all attributes, leaving the AttribArrayGeometry with geometry only.

Definition at line 27 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:

◆ computeAabb()

Aabb Ra::Core::Geometry::AttribArrayGeometry::computeAabb ( ) const
inlineoverridevirtual

Compute bounding box.

Implements Ra::Core::Geometry::AbstractGeometry.

Definition at line 302 of file TriangleMesh.hpp.

+ 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 294 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 285 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 277 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 377 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 372 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 353 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 358 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 362 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 367 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 343 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 381 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ isValid()

template<typename T >
bool Ra::Core::Geometry::AttribArrayGeometry::isValid ( const Utils::AttribHandle< T > & h) const
inline

Return true if h refers to an existing attribute in *this.

Definition at line 348 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ normals()

const AttribArrayGeometry::NormalAttribHandle::Container & Ra::Core::Geometry::AttribArrayGeometry::normals ( ) const
inline

Access the vertices normals.

Definition at line 337 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ normalsUnlock()

void Ra::Core::Geometry::AttribArrayGeometry::normalsUnlock ( )
inline

Release lock on vertices normals.

Definition at line 437 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 433 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 259 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ 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 247 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 412 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ setNormals() [1/2]

void Ra::Core::Geometry::AttribArrayGeometry::setNormals ( const PointAttribHandle::Container & normals)
inline

Set normals.

Definition at line 332 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ setNormals() [2/2]

void Ra::Core::Geometry::AttribArrayGeometry::setNormals ( PointAttribHandle::Container && normals)
inline

Set normals.

Definition at line 329 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ setVertices() [1/2]

void Ra::Core::Geometry::AttribArrayGeometry::setVertices ( const PointAttribHandle::Container & vertices)
inline

Set vertices.

Definition at line 319 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ setVertices() [2/2]

void Ra::Core::Geometry::AttribArrayGeometry::setVertices ( PointAttribHandle::Container && vertices)
inline

Set vertices.

Definition at line 314 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 417 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 421 of file TriangleMesh.hpp.

◆ vertices()

const AttribArrayGeometry::PointAttribHandle::Container & Ra::Core::Geometry::AttribArrayGeometry::vertices ( ) const
inline

Access the vertices positions.

Definition at line 325 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ verticesUnlock()

void Ra::Core::Geometry::AttribArrayGeometry::verticesUnlock ( )
inline

Release lock on vertices positions.

Definition at line 429 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

◆ 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 425 of file TriangleMesh.hpp.

+ Here is the call graph for this function:

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