All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
PrimvarRefinerReal< REAL > Class Template Reference

Applies refinement operations to generic primvar data. More...

#include <primvarRefiner.h>

Public Member Functions

 PrimvarRefinerReal (TopologyRefiner const &refiner)
 
 ~PrimvarRefinerReal ()
 
TopologyRefiner const & GetTopologyRefiner () const
 
Primvar data interpolation

Note
Interpolation methods template both the source and destination data buffer classes. Client-code is expected to provide interfaces that implement the functions specific to its primitive variable data layout. Template APIs must implement the following:

class MySource {
MySource & operator[](int index);
};
class MyDestination {
void Clear();
void AddWithWeight(MySource const & value, float weight);
void AddWithWeight(MyDestination const & value, float weight);
};

It is possible to implement a single interface only and use it as both source and destination.

Primitive variable buffers are expected to be arrays of instances, passed either as direct pointers or with a container (ex. std::vector<MyVertex>). Some interpolation methods however allow passing the buffers by reference: this allows to work transparently with arrays and containers (or other schemes that overload the '[]' operator)

See the Far tutorials for code examples.
template<class T , class U >
void Interpolate (int level, T const &src, U &dst) const
 Apply vertex interpolation weights to a primvar buffer for a single level of refinement. More...
 
template<class T , class U >
void InterpolateVarying (int level, T const &src, U &dst) const
 Apply only varying interpolation weights to a primvar buffer for a single level of refinement. More...
 
template<class T , class U >
void InterpolateFaceUniform (int level, T const &src, U &dst) const
 Refine uniform (per-face) primvar data between levels. More...
 
template<class T , class U >
void InterpolateFaceVarying (int level, T const &src, U &dst, int channel=0) const
 Apply face-varying interpolation weights to a primvar buffer associated with a particular face-varying channel. More...
 
template<class T , class U >
void Limit (T const &src, U &dstPos) const
 Apply limit weights to a primvar buffer. More...
 
template<class T , class U , class U1 , class U2 >
void Limit (T const &src, U &dstPos, U1 &dstTan1, U2 &dstTan2) const
 
template<class T , class U >
void LimitFaceVarying (T const &src, U &dst, int channel=0) const
 

Detailed Description

template<typename REAL>
class OpenSubdiv::OPENSUBDIV_VERSION::Far::PrimvarRefinerReal< REAL >

Applies refinement operations to generic primvar data.

Definition at line 56 of file primvarRefiner.h.

Constructor & Destructor Documentation

PrimvarRefinerReal ( TopologyRefiner const &  refiner)
inline

Definition at line 59 of file primvarRefiner.h.

~PrimvarRefinerReal ( )
inline

Definition at line 60 of file primvarRefiner.h.

Member Function Documentation

TopologyRefiner const& GetTopologyRefiner ( ) const
inline

Definition at line 62 of file primvarRefiner.h.

void Interpolate ( int  level,
T const &  src,
U &  dst 
) const
inline

Apply vertex interpolation weights to a primvar buffer for a single level of refinement.

The destination buffer must allocate an array of data for all the refined vertices, i.e. at least refiner.GetLevel(level).GetNumVertices()

Parameters
levelThe refinement level
srcSource primvar buffer (templating control vertex data)
dstDestination primvar buffer (templating refined vertex data)

Definition at line 267 of file primvarRefiner.h.

void InterpolateFaceUniform ( int  level,
T const &  src,
U &  dst 
) const
inline

Refine uniform (per-face) primvar data between levels.

Data is simply copied from a parent face to its child faces and does not involve any weighting. Setting the source primvar data for the base level to be the index of each face allows the propagation of the base face to primvar data for child faces in all levels.

The destination buffer must allocate an array of data for all the refined faces, i.e. at least refiner.GetLevel(level).GetNumFaces()

Parameters
levelThe refinement level
srcSource primvar buffer
dstDestination primvar buffer

Definition at line 394 of file primvarRefiner.h.

void InterpolateFaceVarying ( int  level,
T const &  src,
U &  dst,
int  channel = 0 
) const
inline

Apply face-varying interpolation weights to a primvar buffer associated with a particular face-varying channel.

Unlike vertex and varying primvar buffers, there is not a 1-to-1 correspondence between vertices and face-varying values – typically there are more face-varying values than vertices. Each face-varying channel is also independent in how its values relate to the vertices.

The destination buffer must allocate an array of data for all the refined values, i.e. at least refiner.GetLevel(level).GetNumFVarValues(channel).

Definition at line 293 of file primvarRefiner.h.

void InterpolateVarying ( int  level,
T const &  src,
U &  dst 
) const
inline

Apply only varying interpolation weights to a primvar buffer for a single level of refinement.

This method can useful if the varying primvar data does not need to be re-computed over time.

The destination buffer must allocate an array of data for all the refined vertices, i.e. at least refiner.GetLevel(level).GetNumVertices()

Parameters
levelThe refinement level
srcSource primvar buffer (templating control vertex data)
dstDestination primvar buffer (templating refined vertex data)

Definition at line 412 of file primvarRefiner.h.

void Limit ( T const &  src,
U &  dstPos 
) const
inline

Apply limit weights to a primvar buffer.

The source buffer must refer to an array of previously interpolated vertex data for the last refinement level. The destination buffer must allocate an array for all vertices at the last refinement level, i.e. at least refiner.GetLevel(refiner.GetMaxLevel()).GetNumVertices()

Parameters
srcSource primvar buffer (refined data) for last level
dstPosDestination primvar buffer (data at the limit)

Definition at line 319 of file primvarRefiner.h.

void Limit ( T const &  src,
U &  dstPos,
U1 &  dstTan1,
U2 &  dstTan2 
) const
inline

Definition at line 344 of file primvarRefiner.h.

void LimitFaceVarying ( T const &  src,
U &  dst,
int  channel = 0 
) const
inline

Definition at line 369 of file primvarRefiner.h.


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