Loading [MathJax]/extensions/TeX/AMSmath.js
Radium Engine  1.5.24
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TriangleMesh.cpp
1#include <Core/Containers/VectorArray.hpp>
2#include <Core/Geometry/StandardAttribNames.hpp>
3#include <Core/Geometry/TriangleMesh.hpp>
4#include <Core/Types.hpp>
5
6namespace Ra {
7namespace Core {
8namespace Geometry {
9
10/****/
11
13 // check same attributes through names
14 if ( !m_vertexAttribs.hasSameAttribs( other.m_vertexAttribs ) ) return false;
15 // Deal with all attributes the same way (vertices and normals too)
16 other.m_vertexAttribs.for_each_attrib( [this]( const auto& attr ) {
17 if ( attr->isFloat() ) this->append_attrib<Scalar>( attr );
18 if ( attr->isVector2() ) this->append_attrib<Vector2>( attr );
19 if ( attr->isVector3() ) this->append_attrib<Vector3>( attr );
20 if ( attr->isVector4() ) this->append_attrib<Vector4>( attr );
21 } );
22
23 invalidateAabb();
24
25 return true;
26}
27
29 PointAttribHandle::Container v = vertices();
30 NormalAttribHandle::Container n = normals();
31 m_vertexAttribs.clear();
32 initDefaultAttribs();
33 setVertices( v );
34 setNormals( n );
35
36 invalidateAabb();
37}
38
40 auto colorAttribHandle = addAttrib<Core::Vector4>( getAttribName( MeshAttrib::VERTEX_COLOR ) );
41 getAttrib( colorAttribHandle ).setData( Vector4Array( vertices().size(), color ) );
42}
43
44} // namespace Geometry
45} // namespace Core
46} // namespace Ra
This class represents vertex + attributes per vertex. Toplogy is handled in MultiIndexedGeometry subc...
void colorize(const Utils::Color &c)
void setNormals(PointAttribHandle::Container &&normals)
Set normals.
void setVertices(PointAttribHandle::Container &&vertices)
Set vertices.
const NormalAttribHandle::Container & normals() const
Access the vertices normals.
const PointAttribHandle::Container & vertices() const
Access the vertices positions.
bool append(const AttribArrayGeometry &other)
void clearAttributes()
Erases all attributes, leaving the AttribArrayGeometry with geometry only.
Utils::AttribHandle< T > addAttrib(const std::string &name)
Utils::Attrib< T > & getAttrib(const Utils::AttribHandle< T > &h)
bool hasSameAttribs(const AttribManager &other)
Definition Attribs.cpp:33
void clear()
clear all attribs, invalidate handles.
Definition Attribs.cpp:17
void for_each_attrib(const F &func) const
Definition Attribs.hpp:762
@ Geometry
"Geometry" render objects are those loaded using Radium::IO and generated by GeometrySystem
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:4