HDK
|
#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 |
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.
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.
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.
UT_VoxelMipMap< T >::UT_VoxelMipMap | ( | ) |
Definition at line 6254 of file UT_VoxelArray.C.
UT_VoxelMipMap< T >::~UT_VoxelMipMap | ( | ) |
Definition at line 6260 of file UT_VoxelArray.C.
UT_VoxelMipMap< T >::UT_VoxelMipMap | ( | const UT_VoxelMipMap< T > & | src | ) |
Copy constructor.
Definition at line 6266 of file UT_VoxelArray.C.
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.
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.
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.
|
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.
|
inlineprotected |
Definition at line 1554 of file UT_VoxelArray.h.
|
inline |
Definition at line 1515 of file UT_VoxelArray.h.
const UT_VoxelMipMap< T > & UT_VoxelMipMap< T >::operator= | ( | const UT_VoxelMipMap< T > & | src | ) |
Assignment operator:
Definition at line 6275 of file UT_VoxelArray.C.
void UT_VoxelMipMap< T >::traverseTopDown | ( | Callback | function, |
void * | data | ||
) | const |
Definition at line 6433 of file UT_VoxelArray.C.
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.
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.
|
protected |
This stores the base most level that was provided externally.
Definition at line 1574 of file UT_VoxelArray.h.
|
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.
|
protected |
Tracks the number of levels which we used to represent this hierarchy.
Definition at line 1580 of file UT_VoxelArray.h.
|
protected |
If true, we will delete the base level when we are done.
Definition at line 1576 of file UT_VoxelArray.h.