Radium Engine
1.5.20
|
AbstractGeometry with per-vertex attributes and layers of indices. Each layer represents a different topology or indexing logic, e.g. triangle/line/quad meshes, point-clouds. More...
#include <Core/Geometry/IndexedGeometry.hpp>
Public Member Functions | |
MultiIndexedGeometry (const MultiIndexedGeometry &other) | |
MultiIndexedGeometry (MultiIndexedGeometry &&other) | |
MultiIndexedGeometry (const AttribArrayGeometry &other) | |
MultiIndexedGeometry (AttribArrayGeometry &&other) | |
MultiIndexedGeometry & | operator= (const MultiIndexedGeometry &other) |
MultiIndexedGeometry & | operator= (MultiIndexedGeometry &&other) |
void | clear () override |
Erases all data, making the AttribArrayGeometry empty. | |
void | copy (const MultiIndexedGeometry &other) |
Copy geometry and indices from others . | |
void | checkConsistency () const |
Check that the MultiIndexedGeometry is well built, asserting when it is not. | |
bool | append (const MultiIndexedGeometry &other) |
bool | containsLayer (const LayerKeyType &layerKey) const |
Check if at least one layer with such properties exists. | |
bool | containsLayer (const LayerSemanticCollection &semantics, const std::string &layerName) const |
Check if at least one layer with such properties exists. | |
bool | containsLayer (const LayerSemanticCollection &semantics) const |
Check if at least one layer with such properties exists. | |
bool | containsLayer (const LayerSemantic &semanticName) const |
Check if at least one layer with such properties exists. | |
size_t | countLayers (const LayerKeyType &layerKey) const |
Count the number of layer matching the input parameters. | |
size_t | countLayers (const LayerSemanticCollection &semantics, const std::string &layerName) const |
Count the number of layer matching the input parameters. | |
size_t | countLayers (const LayerSemanticCollection &semantics) const |
Count the number of layer matching the input parameters. | |
size_t | countLayers (const LayerSemantic &semanticName) const |
Count the number of layer matching the input parameters. | |
const GeometryIndexLayerBase & | getLayer (const LayerKeyType &layerKey) const |
Read-only access to a layer. | |
const GeometryIndexLayerBase & | getLayer (const LayerSemanticCollection &semantics, const std::string &layerName) const |
Read-only access to a layer. | |
std::pair< LayerKeyType, const GeometryIndexLayerBase & > | getFirstLayerOccurrence (const LayerSemanticCollection &semantics) const |
Read-only access to a layer. | |
std::pair< LayerKeyType, const GeometryIndexLayerBase & > | getFirstLayerOccurrence (const LayerSemantic &semanticName) const |
Read-only access to a layer. | |
GeometryIndexLayerBase & | getLayerWithLock (const LayerKeyType &layerKey) |
Write access to a layer. | |
GeometryIndexLayerBase & | getLayerWithLock (const LayerSemanticCollection &semantics, const std::string &layerName) |
Write access to a layer. | |
std::pair< LayerKeyType, GeometryIndexLayerBase & > | getFirstLayerOccurrenceWithLock (const LayerSemanticCollection &semantics) |
Write access to a layer. | |
std::pair< LayerKeyType, GeometryIndexLayerBase & > | getFirstLayerOccurrenceWithLock (const LayerSemantic &semanticName) |
Write access to a layer. | |
void | unlockLayer (const LayerKeyType &layerKey) |
Unlock layer with write acces, notify observers of the update. | |
void | unlockLayer (const LayerSemanticCollection &semantics, const std::string &layerName) |
Unlock layer with write acces, notify observers of the update. | |
std::pair< bool, GeometryIndexLayerBase & > | addLayer (std::unique_ptr< GeometryIndexLayerBase > &&layer, const bool withLock=false, const std::string &layerName="") |
Add layer. | |
auto | layerKeys () const |
Range on layer keys (read-only) | |
Public Member Functions inherited from Ra::Core::Geometry::AttribArrayGeometry | |
AttribArrayGeometry () | |
Create an empty geometry. | |
AttribArrayGeometry (const AttribArrayGeometry &other) | |
AttribArrayGeometry (AttribArrayGeometry &&other) | |
AttribArrayGeometry & | operator= (const AttribArrayGeometry &other) |
AttribArrayGeometry & | operator= (AttribArrayGeometry &&other) |
bool | append (const AttribArrayGeometry &other) |
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::AttribManager & | vertexAttribs () |
const Utils::AttribManager & | vertexAttribs () const |
PointAttribHandle::Container & | verticesWithLock () |
void | verticesUnlock () |
Release lock on vertices positions. | |
NormalAttribHandle::Container & | normalsWithLock () |
void | normalsUnlock () |
Release lock on vertices normals. | |
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::AttribBase * | getAttribBase (const std::string &name) |
const Utils::AttribBase * | getAttribBase (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) | |
AbstractGeometry & | operator= (const AbstractGeometry &other) |
Ra::Core::Utils::ObservableVoid & | getAabbObservable () |
Protected Member Functions | |
void | unlockFirstLayerOccurrence (const LayerSemanticCollection &semantics) |
Unlock layer with write acces, notify observers of the update. | |
void | unlockFirstLayerOccurrence (const LayerSemantic &semanticName) |
Unlock layer with write acces, notify observers of the update. | |
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 |
AbstractGeometry with per-vertex attributes and layers of indices. Each layer represents a different topology or indexing logic, e.g. triangle/line/quad meshes, point-clouds.
Multiple layers are useful to share and maintain consistency of per-vertex attributes between different meshes representing the same geometry, e.g., a quad and triangle mesh layers connecting the same set of vertices.
It is designed as follow:
Example of adding a PointCloudIndexLayer to an existing MultiIndexedGeometry geo
:
Each layer is also associated with a lock
state, used to give read-only or to lock write access.
Layers can be accessed in different ways (see containsLayer, countLayers, getFirstLayerOccurrence, and getLayer):
Definition at line 131 of file IndexedGeometry.hpp.
using Ra::Core::Geometry::MultiIndexedGeometry::FloatAttribHandle = AttribArrayGeometry::FloatAttribHandle |
Definition at line 140 of file IndexedGeometry.hpp.
using Ra::Core::Geometry::MultiIndexedGeometry::LayerKeyType = std::pair<LayerSemanticCollection, std::string> |
Definition at line 136 of file IndexedGeometry.hpp.
using Ra::Core::Geometry::MultiIndexedGeometry::LayerSemantic = Utils::ObjectWithSemantic::SemanticName |
Definition at line 135 of file IndexedGeometry.hpp.
using Ra::Core::Geometry::MultiIndexedGeometry::LayerSemanticCollection = Utils::ObjectWithSemantic::SemanticNameCollection |
Definition at line 134 of file IndexedGeometry.hpp.
using Ra::Core::Geometry::MultiIndexedGeometry::NormalAttribHandle = AttribArrayGeometry::NormalAttribHandle |
Definition at line 139 of file IndexedGeometry.hpp.
using Ra::Core::Geometry::MultiIndexedGeometry::PointAttribHandle = AttribArrayGeometry::PointAttribHandle |
Definition at line 138 of file IndexedGeometry.hpp.
using Ra::Core::Geometry::MultiIndexedGeometry::Vec2AttribHandle = AttribArrayGeometry::Vec2AttribHandle |
Definition at line 141 of file IndexedGeometry.hpp.
using Ra::Core::Geometry::MultiIndexedGeometry::Vec3AttribHandle = AttribArrayGeometry::Vec3AttribHandle |
Definition at line 142 of file IndexedGeometry.hpp.
using Ra::Core::Geometry::MultiIndexedGeometry::Vec4AttribHandle = AttribArrayGeometry::Vec4AttribHandle |
Definition at line 143 of file IndexedGeometry.hpp.
|
explicit |
Definition at line 8 of file IndexedGeometry.cpp.
|
explicit |
Definition at line 13 of file IndexedGeometry.cpp.
|
explicit |
Definition at line 16 of file IndexedGeometry.cpp.
|
explicit |
Definition at line 19 of file IndexedGeometry.cpp.
|
inlinevirtual |
Definition at line 651 of file IndexedGeometry.hpp.
std::pair< bool, GeometryIndexLayerBase & > Ra::Core::Geometry::MultiIndexedGeometry::addLayer | ( | std::unique_ptr< GeometryIndexLayerBase > && | layer, |
const bool | withLock = false, | ||
const std::string & | layerName = "" ) |
Add layer.
Notify observers of the update.
If not inserted, the pointer is deleted. So the caller must ensure this possible deletion is safe before calling this method.
Definition at line 214 of file IndexedGeometry.cpp.
bool Ra::Core::Geometry::MultiIndexedGeometry::append | ( | const MultiIndexedGeometry & | other | ) |
Append another MultiIndexedGeometry to this one. Layers with same name/semantics are concatenated, and other layers are ignored
Definition at line 58 of file IndexedGeometry.cpp.
void Ra::Core::Geometry::MultiIndexedGeometry::checkConsistency | ( | ) | const |
Check that the MultiIndexedGeometry is well built, asserting when it is not.
Definition at line 53 of file IndexedGeometry.cpp.
|
overridevirtual |
Erases all data, making the AttribArrayGeometry empty.
Reimplemented from Ra::Core::Geometry::AttribArrayGeometry.
Definition at line 38 of file IndexedGeometry.cpp.
|
inline |
Check if at least one layer with such properties exists.
layerKey | layer key |
Definition at line 657 of file IndexedGeometry.hpp.
bool Ra::Core::Geometry::MultiIndexedGeometry::containsLayer | ( | const LayerSemantic & | semanticName | ) | const |
Check if at least one layer with such properties exists.
Convenience function.
semanticName | layer one semantic associated with the layer |
Definition at line 89 of file IndexedGeometry.cpp.
bool Ra::Core::Geometry::MultiIndexedGeometry::containsLayer | ( | const LayerSemanticCollection & | semantics | ) | const |
Check if at least one layer with such properties exists.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
Definition at line 96 of file IndexedGeometry.cpp.
|
inline |
Check if at least one layer with such properties exists.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
layerName | layer name |
Definition at line 662 of file IndexedGeometry.hpp.
void Ra::Core::Geometry::MultiIndexedGeometry::copy | ( | const MultiIndexedGeometry & | other | ) |
Copy geometry and indices from others
.
Definition at line 45 of file IndexedGeometry.cpp.
|
inline |
Count the number of layer matching the input parameters.
layerKey | layer key |
Definition at line 668 of file IndexedGeometry.hpp.
size_t Ra::Core::Geometry::MultiIndexedGeometry::countLayers | ( | const LayerSemantic & | semanticName | ) | const |
Count the number of layer matching the input parameters.
Convenience function.
semanticName | layer one semantic associated with the layer |
Definition at line 106 of file IndexedGeometry.cpp.
size_t Ra::Core::Geometry::MultiIndexedGeometry::countLayers | ( | const LayerSemanticCollection & | semantics | ) | const |
Count the number of layer matching the input parameters.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
Definition at line 114 of file IndexedGeometry.cpp.
|
inline |
Count the number of layer matching the input parameters.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
layerName | layer name |
Definition at line 673 of file IndexedGeometry.hpp.
std::pair< MultiIndexedGeometry::LayerKeyType, const GeometryIndexLayerBase & > Ra::Core::Geometry::MultiIndexedGeometry::getFirstLayerOccurrence | ( | const LayerSemantic & | semanticName | ) | const |
Read-only access to a layer.
Convenience function.
semanticName | layer one semantic associated with the layer |
std::out_of_range |
Definition at line 126 of file IndexedGeometry.cpp.
std::pair< MultiIndexedGeometry::LayerKeyType, const GeometryIndexLayerBase & > Ra::Core::Geometry::MultiIndexedGeometry::getFirstLayerOccurrence | ( | const LayerSemanticCollection & | semantics | ) | const |
Read-only access to a layer.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
std::out_of_range |
Definition at line 135 of file IndexedGeometry.cpp.
std::pair< MultiIndexedGeometry::LayerKeyType, GeometryIndexLayerBase & > Ra::Core::Geometry::MultiIndexedGeometry::getFirstLayerOccurrenceWithLock | ( | const LayerSemantic & | semanticName | ) |
Write access to a layer.
Convenience function.
semanticName | layer one semantic associated with the layer |
std::out_of_range |
Definition at line 146 of file IndexedGeometry.cpp.
std::pair< MultiIndexedGeometry::LayerKeyType, GeometryIndexLayerBase & > Ra::Core::Geometry::MultiIndexedGeometry::getFirstLayerOccurrenceWithLock | ( | const LayerSemanticCollection & | semantics | ) |
Write access to a layer.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
std::out_of_range |
Definition at line 158 of file IndexedGeometry.cpp.
|
inline |
Read-only access to a layer.
layerKey | layer key |
std::out_of_range |
Definition at line 679 of file IndexedGeometry.hpp.
|
inline |
Read-only access to a layer.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
layerName | layer name |
std::out_of_range |
GeometryIndexLayerBase & Ra::Core::Geometry::MultiIndexedGeometry::getLayerWithLock | ( | const LayerKeyType & | layerKey | ) |
Write access to a layer.
Lock the layer for the caller, which needs to unlock after use, in order to release for other users and notify observers.
layerKey | layer key |
std::out_of_range |
Definition at line 169 of file IndexedGeometry.cpp.
|
inline |
Write access to a layer.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
layerName | layer name |
std::out_of_range |
Definition at line 683 of file IndexedGeometry.hpp.
|
inlinenodiscard |
Range on layer keys (read-only)
Usage:
Definition at line 695 of file IndexedGeometry.hpp.
MultiIndexedGeometry & Ra::Core::Geometry::MultiIndexedGeometry::operator= | ( | const MultiIndexedGeometry & | other | ) |
Definition at line 22 of file IndexedGeometry.cpp.
MultiIndexedGeometry & Ra::Core::Geometry::MultiIndexedGeometry::operator= | ( | MultiIndexedGeometry && | other | ) |
Definition at line 30 of file IndexedGeometry.cpp.
|
protected |
Unlock layer with write acces, notify observers of the update.
Convenience function.
semanticName | layer one semantic associated with the layer |
std::out_of_range |
Definition at line 179 of file IndexedGeometry.cpp.
|
protected |
Unlock layer with write acces, notify observers of the update.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
std::out_of_range |
Definition at line 191 of file IndexedGeometry.cpp.
void Ra::Core::Geometry::MultiIndexedGeometry::unlockLayer | ( | const LayerKeyType & | layerKey | ) |
Unlock layer with write acces, notify observers of the update.
layerKey | layer key |
std::out_of_range |
Definition at line 203 of file IndexedGeometry.cpp.
|
inline |
Unlock layer with write acces, notify observers of the update.
Convenience function.
semantics | collection of semantics associated with the layer (they should all match) |
layerName | layer name |
std::out_of_range |
Definition at line 690 of file IndexedGeometry.hpp.