Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Core::Geometry::CatmullClarkSubdivider Class Reference

#include <Core/Geometry/CatmullClarkSubdivider.hpp>

+ Collaboration diagram for Ra::Core::Geometry::CatmullClarkSubdivider:

Public Member Functions

 CatmullClarkSubdivider (deprecated::TopologicalMesh &mesh)
 
const char * name (void) const override
 
void recompute (const Vector3Array &newCoarseVertices, const Vector3Array &newCoarseNormals, Vector3Array &newSubdivVertices, Vector3Array &newSubdivNormals, deprecated::TopologicalMesh &mesh)
 

Protected Member Functions

bool prepare (deprecated::TopologicalMesh &_m) override
 
bool cleanup (deprecated::TopologicalMesh &_m) override
 
bool subdivide (deprecated::TopologicalMesh &_m, size_t _n, const bool _update_points=true) override
 

Detailed Description

This class implements the Catmull-Clark subdivision algorithm

This class extends OpenMesh's CatmullClarkT subdivider to handle attributes.

Note
We here consider that boundary halfedges do not store attributes.

Definition at line 17 of file CatmullClarkSubdivider.hpp.

Constructor & Destructor Documentation

◆ CatmullClarkSubdivider() [1/2]

Ra::Core::Geometry::CatmullClarkSubdivider::CatmullClarkSubdivider ( )
inline

Definition at line 29 of file CatmullClarkSubdivider.hpp.

◆ CatmullClarkSubdivider() [2/2]

Ra::Core::Geometry::CatmullClarkSubdivider::CatmullClarkSubdivider ( deprecated::TopologicalMesh & mesh)
inlineexplicit

Definition at line 31 of file CatmullClarkSubdivider.hpp.

◆ ~CatmullClarkSubdivider()

Ra::Core::Geometry::CatmullClarkSubdivider::~CatmullClarkSubdivider ( )
inline

Definition at line 35 of file CatmullClarkSubdivider.hpp.

Member Function Documentation

◆ cleanup()

bool Ra::Core::Geometry::CatmullClarkSubdivider::cleanup ( deprecated::TopologicalMesh & _m)
overrideprotected

Definition at line 27 of file CatmullClarkSubdivider.cpp.

◆ name()

const char * Ra::Core::Geometry::CatmullClarkSubdivider::name ( void ) const
inlineoverride

Definition at line 38 of file CatmullClarkSubdivider.hpp.

◆ prepare()

bool Ra::Core::Geometry::CatmullClarkSubdivider::prepare ( deprecated::TopologicalMesh & _m)
overrideprotected

Definition at line 7 of file CatmullClarkSubdivider.cpp.

◆ recompute()

void Ra::Core::Geometry::CatmullClarkSubdivider::recompute ( const Vector3Array & newCoarseVertices,
const Vector3Array & newCoarseNormals,
Vector3Array & newSubdivVertices,
Vector3Array & newSubdivNormals,
deprecated::TopologicalMesh & mesh )

In the case one wants to apply the subdivision on the same mesh topology, but with a different geometry (e.g. for an animated character), one may want to just reapply the subdivision operations instead for performance reasons. This can be achieved with the following code:

// 1- apply subdivision once
Ra::Core::Geometry::TriangleMesh triangleMesh;
Ra::Core::CatmullClarkSubdivider subdiv( topoMesh );
subdiv( 2 );
// get back to TriangleMesh (mandatory before re-applying)
TriangleMesh subdividedMesh = topoMesh.toTriangleMesh();
// 2- re-apply operations on new geometry (new_vertices, new_normals)
m_subdivider.recompute( new_vertices, new_normals, subdividedMesh.vertices(),
subdividedMesh.normals(), topoMesh );
const NormalAttribHandle::Container & normals() const
Access the vertices normals.
const PointAttribHandle::Container & vertices() const
Access the vertices positions.

Definition at line 431 of file CatmullClarkSubdivider.cpp.

+ Here is the call graph for this function:

◆ subdivide()

bool Ra::Core::Geometry::CatmullClarkSubdivider::subdivide ( deprecated::TopologicalMesh & _m,
size_t _n,
const bool _update_points = true )
overrideprotected

Definition at line 37 of file CatmullClarkSubdivider.cpp.


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