HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_VoxelMipMap< T > Class Template Reference

#include <UT_VoxelArray.h>

Public Types

enum  mipmaptype { MIPMAP_MAXIMUM =0, MIPMAP_AVERAGE =1, MIPMAP_MINIMUM =2 }
 
typedef bool(* Callback )(const T *funcs, const UT_BoundingBox &box, bool baselevel, void *data)
 

Public Member Functions

 UT_VoxelMipMap ()
 
 ~UT_VoxelMipMap ()
 
 UT_VoxelMipMap (const UT_VoxelMipMap< T > &src)
 Copy constructor. More...
 
const UT_VoxelMipMap< T > & operator= (const UT_VoxelMipMap< T > &src)
 Assignment operator: More...
 
void build (UT_VoxelArray< T > *baselevel, mipmaptype function)
 
void build (UT_VoxelArray< T > *baselevel, const UT_Array< mipmaptype > &functions)
 
void traverseTopDown (Callback function, void *data) const
 
template<typename OP >
void traverseTopDown (OP &op) const
 
template<typename OP >
void traverseTopDownSorted (OP &op) const
 
int64 getMemoryUsage (bool inclusive) const
 Return the amount of memory used by this mipmap. More...
 
int numLevels () const
 
const UT_VoxelArray< T > * level (int level, int function) const
 

Protected Member Functions

T mixValues (T t1, T t2, mipmaptype function) const
 

Protected Attributes

UT_VoxelArray< T > * myBaseLevel
 
bool myOwnBase
 If true, we will delete the base level when we are done. More...
 
int myNumLevels
 
UT_ValArray< UT_VoxelArray< T > ** > myLevels
 

Detailed Description

template<typename T>
class UT_VoxelMipMap< T >

UT_VoxelMipMap

This provides a mip-map type structure for a voxel array. It manages the different levels of voxels arrays that are needed. You can create different types of mip maps: average, maximum, etc, which can allow different tricks. Each level is one half the previous level, rounded up. Out of bound voxels are ignored from the lower levels.

Definition at line 1450 of file UT_VoxelArray.h.

Member Typedef Documentation

template<typename T>
typedef bool(* UT_VoxelMipMap< T >::Callback)(const T *funcs, const UT_BoundingBox &box, bool baselevel, void *data)

This does a top down traversal of the implicit octree defined by the voxel array. Returning false will abort that branch of the octree. The bounding box given is in cell space and is an exclusive box of the included cells (ie: (0..1)^3 means just cell 0,0,0) Note that each bounding box will not be square, unless you have the good fortune of starting with a power of 2 cube. The boolean goes true when the the callback is invoked on a base level.

Definition at line 1487 of file UT_VoxelArray.h.

Member Enumeration Documentation

template<typename T>
enum UT_VoxelMipMap::mipmaptype

The different types of functions that can be used for constructing a mip map.

Enumerator
MIPMAP_MAXIMUM 
MIPMAP_AVERAGE 
MIPMAP_MINIMUM 

Definition at line 1455 of file UT_VoxelArray.h.

Constructor & Destructor Documentation

template<typename T >
UT_VoxelMipMap< T >::UT_VoxelMipMap ( )

Definition at line 6254 of file UT_VoxelArray.C.

template<typename T >
UT_VoxelMipMap< T >::~UT_VoxelMipMap ( )

Definition at line 6260 of file UT_VoxelArray.C.

template<typename T>
UT_VoxelMipMap< T >::UT_VoxelMipMap ( const UT_VoxelMipMap< T > &  src)

Copy constructor.

Definition at line 6266 of file UT_VoxelArray.C.

Member Function Documentation

template<typename T>
void UT_VoxelMipMap< T >::build ( UT_VoxelArray< T > *  baselevel,
mipmaptype  function 
)

Builds from a given voxel array. The ownership flag determines if we gain ownership of the voxel array and should delete it. In any case, the new levels are owned by us.

Definition at line 6309 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelMipMap< T >::build ( UT_VoxelArray< T > *  baselevel,
const UT_Array< mipmaptype > &  functions 
)

Same as above but construct mipmaps simultaneously for more than one function. The order of the functions will correspond to the order of the data values passed to the traversal callback.

Definition at line 6320 of file UT_VoxelArray.C.

template<typename T >
int64 UT_VoxelMipMap< T >::getMemoryUsage ( bool  inclusive) const

Return the amount of memory used by this mipmap.

Definition at line 6416 of file UT_VoxelArray.C.

template<typename T>
const UT_VoxelArray<T>* UT_VoxelMipMap< T >::level ( int  level,
int  function 
) const
inline

level 0 is the original grid, each level higher is a power of two smaller.

Definition at line 1519 of file UT_VoxelArray.h.

template<typename T>
T UT_VoxelMipMap< T >::mixValues ( T  t1,
T  t2,
mipmaptype  function 
) const
inlineprotected

Definition at line 1554 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelMipMap< T >::numLevels ( ) const
inline

Definition at line 1515 of file UT_VoxelArray.h.

template<typename T>
const UT_VoxelMipMap< T > & UT_VoxelMipMap< T >::operator= ( const UT_VoxelMipMap< T > &  src)

Assignment operator:

Definition at line 6275 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelMipMap< T >::traverseTopDown ( Callback  function,
void data 
) const

Definition at line 6433 of file UT_VoxelArray.C.

template<typename T >
template<typename OP >
void UT_VoxelMipMap< T >::traverseTopDown ( OP &  op) const

Top down traversal on op. OP is invoked with bool op(const UT_BoundingBoxI &indexbox, int level)

indexbox is half-inclusive (0..1)^3 means cell 0,0,0 level 0 means the base level. (box.min.x()>>level, box.min.y()>>level, box.min.z()>>level) gives the index to extract the value from level..

Definition at line 6543 of file UT_VoxelArray.C.

template<typename T >
template<typename OP >
void UT_VoxelMipMap< T >::traverseTopDownSorted ( OP &  op) const

Top down traversal, but which quad tree is visited first is controlled by float op.sortValue(UT_BoundingBoxI &indexbox, int level); Lower values are visited first.

Definition at line 6632 of file UT_VoxelArray.C.

Member Data Documentation

template<typename T>
UT_VoxelArray<T>* UT_VoxelMipMap< T >::myBaseLevel
protected

This stores the base most level that was provided externally.

Definition at line 1574 of file UT_VoxelArray.h.

template<typename T>
UT_ValArray<UT_VoxelArray<T> **> UT_VoxelMipMap< T >::myLevels
protected

The array of VoxelArrays, one per level. myLevels[0] is a 1x1x1 array. Each successive layer is twice as big in each each dimension. However, every layer is clamped against the resolution of the base layer. We own all these layers.

Definition at line 1586 of file UT_VoxelArray.h.

template<typename T>
int UT_VoxelMipMap< T >::myNumLevels
protected

Tracks the number of levels which we used to represent this hierarchy.

Definition at line 1580 of file UT_VoxelArray.h.

template<typename T>
bool UT_VoxelMipMap< T >::myOwnBase
protected

If true, we will delete the base level when we are done.

Definition at line 1576 of file UT_VoxelArray.h.


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