Radium Engine  1.5.20
Loading...
Searching...
No Matches
TriangleMesh.cpp
1#include <Core/Geometry/StandardAttribNames.hpp>
2#include <Core/Geometry/TriangleMesh.hpp>
3#include <Core/Types.hpp>
4
5namespace Ra {
6namespace Core {
7namespace Geometry {
8
9/****/
10
12 // check same attributes through names
13 if ( !m_vertexAttribs.hasSameAttribs( other.m_vertexAttribs ) ) return false;
14 // Deal with all attributes the same way (vertices and normals too)
15 other.m_vertexAttribs.for_each_attrib( [this]( const auto& attr ) {
16 if ( attr->isFloat() ) this->append_attrib<Scalar>( attr );
17 if ( attr->isVector2() ) this->append_attrib<Vector2>( attr );
18 if ( attr->isVector3() ) this->append_attrib<Vector3>( attr );
19 if ( attr->isVector4() ) this->append_attrib<Vector4>( attr );
20 } );
21
22 invalidateAabb();
23
24 return true;
25}
26
28 PointAttribHandle::Container v = vertices();
29 NormalAttribHandle::Container n = normals();
30 m_vertexAttribs.clear();
31 initDefaultAttribs();
32 setVertices( v );
33 setNormals( n );
34
35 invalidateAabb();
36}
37
39 auto colorAttribHandle = addAttrib<Core::Vector4>( getAttribName( MeshAttrib::VERTEX_COLOR ) );
40 getAttrib( colorAttribHandle ).setData( Vector4Array( vertices().size(), color ) );
41}
42
43} // namespace Geometry
44} // namespace Core
45} // 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:754
@ 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:3