1#include <Core/Geometry/IndexedGeometry.hpp>
2#include <Core/Geometry/TriangleMesh.hpp>
3#include <Core/Utils/Attribs.hpp>
12MultiIndexedGeometry::MultiIndexedGeometry(
const MultiIndexedGeometry& other ) :
13 AttribArrayGeometry( other ) {
17MultiIndexedGeometry::MultiIndexedGeometry( MultiIndexedGeometry&& other ) :
18 AttribArrayGeometry(
std::
move( other ) ), m_indices(
std::
move( other.m_indices ) ) {}
20MultiIndexedGeometry::MultiIndexedGeometry(
const AttribArrayGeometry& other ) :
21 AttribArrayGeometry( other ) {}
23MultiIndexedGeometry::MultiIndexedGeometry( AttribArrayGeometry&& other ) :
24 AttribArrayGeometry(
std::
move( other ) ) {}
26MultiIndexedGeometry& MultiIndexedGeometry::operator=(
const MultiIndexedGeometry& other ) {
28 AttribArrayGeometry::operator=( other );
34MultiIndexedGeometry& MultiIndexedGeometry::operator=( MultiIndexedGeometry&& other ) {
36 AttribArrayGeometry::operator=(
std::move( other ) );
42void MultiIndexedGeometry::clear() {
44 AttribArrayGeometry::clear();
42void MultiIndexedGeometry::clear() {
…}
51 AttribArrayGeometry::copyBaseGeometry( other );
57void MultiIndexedGeometry::checkConsistency()
const {}
60 bool dataHasBeenCopied =
false;
61 for (
const auto& [key, value] : other.m_indices ) {
62 auto it = m_indices.find( key );
63 if ( it == m_indices.end() )
68 dataHasBeenCopied =
true;
72 if ( it->second.second->append( *( value.second ) ) ) { dataHasBeenCopied =
true; }
75 "Inconsistency: layers with different semantics shares the same key" );
80 if ( dataHasBeenCopied ) {
90bool MultiIndexedGeometry::containsLayer(
const LayerSemantic& semanticName )
const {
91 for (
const auto& [key, value] : m_indices ) {
92 if ( key.first.find( semanticName ) != key.first.end() )
return true;
90bool MultiIndexedGeometry::containsLayer(
const LayerSemantic& semanticName )
const {
…}
98 for (
const auto& [key, value] : m_indices ) {
99 if ( key.first == semantics )
return true;
107size_t MultiIndexedGeometry::countLayers(
const LayerSemantic& semanticName )
const {
109 for (
const auto& [key, value] : m_indices ) {
110 if ( key.first.find( semanticName ) != key.first.end() ) ++c;
107size_t MultiIndexedGeometry::countLayers(
const LayerSemantic& semanticName )
const {
…}
117 for (
const auto& [key, value] : m_indices ) {
118 if ( key.first == semantics ) ++c;
127MultiIndexedGeometry::getFirstLayerOccurrence(
const LayerSemantic& semanticName )
const {
128 for (
const auto& [key, value] : m_indices ) {
129 if ( key.first.find( semanticName ) != key.first.end() )
130 return { key, *( value.second.get() ) };
127MultiIndexedGeometry::getFirstLayerOccurrence(
const LayerSemantic& semanticName )
const {
…}
137 for (
const auto& [key, value] : m_indices ) {
138 if ( key.first == semantics )
return { key, *( value.second.get() ) };
147MultiIndexedGeometry::getFirstLayerOccurrenceWithLock(
const LayerSemantic& semanticName ) {
148 for (
auto& [key, value] : m_indices ) {
149 if ( key.first.find( semanticName ) != key.first.end() ) {
150 CORE_ASSERT( !value.first,
"try to get already locked layer" );
152 return { key, *( value.second.get() ) };
147MultiIndexedGeometry::getFirstLayerOccurrenceWithLock(
const LayerSemantic& semanticName ) {
…}
160 for (
auto& [key, value] : m_indices ) {
161 if ( key.first == semantics ) {
162 CORE_ASSERT( !value.first,
"try to get already locked layer" );
164 return { key, *( value.second.get() ) };
171 auto& p = m_indices.at( layerKey );
172 CORE_ASSERT( !p.first,
"try to get already locked layer" );
174 return *( p.second.get() );
180void MultiIndexedGeometry::unlockFirstLayerOccurrence(
const LayerSemantic& semanticName ) {
181 for (
auto& [key, value] : m_indices ) {
182 if ( key.first.find( semanticName ) != key.first.end() ) {
183 CORE_ASSERT( value.first,
"try to release unlocked layer" );
180void MultiIndexedGeometry::unlockFirstLayerOccurrence(
const LayerSemantic& semanticName ) {
…}
193 for (
auto& [key, value] : m_indices ) {
194 if ( key.first == semantics ) {
195 CORE_ASSERT( value.first,
"try to release unlocked layer" );
204void MultiIndexedGeometry::unlockLayer(
const LayerKeyType& layerKey ) {
205 auto& p = m_indices.at( layerKey );
206 CORE_ASSERT( p.first,
"try to release unlocked layer" );
220 auto [pos, inserted] = m_indices.insert(
std::move( elt ) );
224 CORE_ASSERT( !pos->second.first,
"try to get already locked layer" );
225 pos->second.first =
true;
230 return { inserted, *( pos->second.second ) };
236 for (
const auto& [key, value] : other.m_indices ) {
242void MultiIndexedGeometry::deepClear() {
249std::size_t MultiIndexedGeometry::KeyHash::operator()(
const LayerKeyType& k )
const {
264 auto nbVert = attr.
vertices().size();
265 collection().resize( nbVert );
266 collection().getMap() = IndexContainerType::Matrix::LinSpaced( nbVert, 0, nbVert - 1 );
This class represents vertex + attributes per vertex. Toplogy is handled in MultiIndexedGeometry subc...
const PointAttribHandle::Container & vertices() const
Access the vertices positions.
Base class for index collections stored in MultiIndexedGeometry.
AbstractGeometry with per-vertex attributes and layers of indices. Each layer represents a different ...
@ Geometry
"Geometry" render objects are those loaded using Radium::IO and generated by GeometrySystem
hepler function to manage enum as underlying types in VariableSet