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

#include <RE_Texture3DMap.h>

Public Types

using ScalarType = T
 

Public Member Functions

 UT_VoxelArray ()
 
 ~UT_VoxelArray ()
 
 UT_VoxelArray (const UT_VoxelArray< T > &src)
 Copy constructor: More...
 
const UT_VoxelArray< T > & operator= (const UT_VoxelArray< T > &src)
 Assignment operator: More...
 
void size (int xres, int yres, int zres, bool reset=true)
 
void match (const UT_VoxelArray< T > &src)
 
template<typename S >
bool isMatching (const UT_VoxelArray< S > &src) const
 
int getXRes () const
 
int getYRes () const
 
int getZRes () const
 
int getRes (int axis) const
 
UT_Vector3I getVoxelRes () const
 
int64 getMemoryUsage (bool inclusive) const
 Return the amount of memory used by this array. More...
 
 THREADED_METHOD1 (UT_VoxelArray< T >, numTiles() > 100, constant, T, t) void const antPartial(T t
 
bool isConstant (T *cval=0) const
 
bool hasNan () const
 Returns true if any element of the voxel array is NAN. More...
 
T operator() (UT_Vector3D pos) const
 
T operator() (UT_Vector3F pos) const
 
void evaluateMinMax (T &lerp, T &lmin, T &lmax, UT_Vector3F pos) const
 
SYS_FORCE_INLINE T lerpVoxelCoord (UT_Vector3F pos) const
 
SYS_FORCE_INLINE T lerpVoxel (int x, int y, int z, float fx, float fy, float fz) const
 
template<int AXIS2D>
SYS_FORCE_INLINE T lerpVoxelCoordAxis (UT_Vector3F pos) const
 
template<int AXIS2D>
SYS_FORCE_INLINE T lerpVoxelAxis (int x, int y, int z, float fx, float fy, float fz) const
 
SYS_FORCE_INLINE void lerpVoxelCoordMinMax (T &lerp, T &lmin, T &lmax, UT_Vector3F pos) const
 
template<int AXIS2D>
SYS_FORCE_INLINE void lerpVoxelCoordMinMaxAxis (T &lerp, T &lmin, T &lmax, UT_Vector3F pos) const
 
SYS_FORCE_INLINE void lerpVoxelMinMax (T &lerp, T &lmin, T &lmax, int x, int y, int z, float fx, float fy, float fz) const
 
template<int AXIS2D>
SYS_FORCE_INLINE void lerpVoxelMinMaxAxis (T &lerp, T &lmin, T &lmax, int x, int y, int z, float fx, float fy, float fz) const
 
SYS_FORCE_INLINE bool extractSample (int x, int y, int z, T *sample) const
 
template<int AXIS2D>
SYS_FORCE_INLINE bool extractSampleAxis (int x, int y, int z, T *sample) const
 
SYS_FORCE_INLINE bool extractSamplePlus (int x, int y, int z, T *sample) const
 
SYS_FORCE_INLINE T lerpSample (T *samples, float fx, float fy, float fz) const
 Lerps the given sample using trilinear interpolation. More...
 
template<int AXIS2D>
SYS_FORCE_INLINE T lerpSampleAxis (T *samples, float fx, float fy, float fz) const
 
SYS_FORCE_INLINE void splitVoxelCoord (UT_Vector3F pos, int &x, int &y, int &z, float &fx, float &fy, float &fz) const
 
template<int AXIS2D>
SYS_FORCE_INLINE void splitVoxelCoordAxis (UT_Vector3F pos, int &x, int &y, int &z, float &fx, float &fy, float &fz) const
 
T evaluate (const UT_Vector3 &pos, const UT_Filter &filter, fpreal radius, int clampaxis=-1) const
 
void resample (const UT_VoxelArray< T > &src, UT_FilterType filtertype=UT_FILTER_POINT, float filterwidthscale=1.0f, int clampaxis=-1)
 Fills this by resampling the given voxel array. More...
 
template<typename OP >
void forEachTile (const OP &op, bool shouldthread=true)
 
template<typename OP >
void forEachTileConst (const OP &op, bool shouldthread=true) const
 
 THREADED_METHOD3_CONST (UT_VoxelArray< T >, numTiles() > 16, flatten, T *, flatarray, exint, ystride, exint, zstride) void flattenPartial(T *flatarray
 
template<int AXIS2D>
void flattenPartialAxis (T *flatarray, exint ystride, const UT_JobInfo &info) const
 
 THREADED_METHOD4_CONST (UT_VoxelArray< T >, numTiles() > 16, flattenGLFixed8, uint8 *, flatarray, exint, ystride, exint, zstride, T, dummy) void flattenGLFixed8Partial(uint8 *flatarray
 
 THREADED_METHOD4_CONST (UT_VoxelArray< T >, numTiles() > 16, flattenGL16F, UT_Vector4H *, flatarray, exint, ystride, exint, zstride, T, dummy) void flattenGL16FPartial(UT_Vector4H *flatarray
 
 THREADED_METHOD4_CONST (UT_VoxelArray< T >, numTiles() > 16, flattenGL32F, UT_Vector4F *, flatarray, exint, ystride, exint, zstride, T, dummy) void flattenGL32FPartial(UT_Vector4F *flatarray
 
 THREADED_METHOD3 (UT_VoxelArray< T >, numTiles() > 16, extractFromFlattened, const T *, flatarray, exint, ystride, exint, zstride) void extractFromFlattenedPartial(const T *flatarray
 
void copyWithOffset (const UT_VoxelArray< T > &src, int offx, int offy, int offz)
 
 THREADED_METHOD4 (UT_VoxelArray< T >, numTiles() > 4, copyWithOffsetInternal, const UT_VoxelArray< T > &, src, int, offx, int, offy, int, offz) void copyWithOffsetInternalPartial(const UT_VoxelArray< T > &src
 
void moveTilesWithOffset (UT_VoxelArray< T > &src, int tileoffx, int tileoffy, int tileoffz)
 
template<typename S >
SextractTiles (S *dstdata, int stride, const UT_IntArray &tilelist) const
 
template<typename S , typename IDX >
SextractTiles (S *dstdata, int stride, const IDX *ix, const IDX *iy, const IDX *iz, const UT_Array< UT_VoxelArrayTileDataDescr > &tilelist) const
 
template<int SLICE_AXIS, typename S >
SextractSlice (S *dstdata, int slice, bool half_slice) const
 
template<typename S >
const SwriteTiles (const S *srcdata, int srcstride, const UT_IntArray &tilelist)
 
template<typename S , typename IDX >
const SwriteTiles (const S *srcdata, int srcstride, const IDX *ix, const IDX *iy, const IDX *iz, const UT_Array< UT_VoxelArrayTileDataDescr > &tilelist)
 
bool posToIndex (UT_Vector3 pos, int &x, int &y, int &z) const
 
bool posToIndex (UT_Vector3D pos, exint &x, exint &y, exint &z) const
 
bool posToIndex (UT_Vector3 pos, UT_Vector3 &ipos) const
 
bool posToIndex (UT_Vector3D pos, UT_Vector3D &ipos) const
 
bool indexToPos (int x, int y, int z, UT_Vector3F &pos) const
 
bool indexToPos (exint x, exint y, exint z, UT_Vector3D &pos) const
 
void findexToPos (UT_Vector3F ipos, UT_Vector3F &pos) const
 
void findexToPos (UT_Vector3D ipos, UT_Vector3D &pos) const
 
void clampIndex (int &x, int &y, int &z) const
 
bool isValidIndex (int x, int y, int z) const
 Returns true if the given x, y, z values lie inside the valid index. More...
 
T operator() (UT_Vector3I index) const
 
T operator() (int x, int y, int z) const
 
void setValue (UT_Vector3I index, T value)
 
void setValue (int x, int y, int z, T t)
 
T getValue (int x, int y, int z) const
 
bool getValues (const UT_BoundingBoxI &bbox, T *values, const exint size) const
 
void setBorder (UT_VoxelBorderType type, T t)
 
void setBorderScale (T scalex, T scaley, T scalez)
 
UT_VoxelBorderType getBorder () const
 
T getBorderValue () const
 
T getBorderScale (int axis) const
 
 THREADED_METHOD (UT_VoxelArray< T >, numTiles() > 100, collapseAllTiles) void collapseAllTilesPartial(const UT_JobInfo &info)
 
 THREADED_METHOD (UT_VoxelArray< T >, numTiles() > 100, expandAllTiles) void expandAllTilesPartial(const UT_JobInfo &info)
 
 THREADED_METHOD (UT_VoxelArray< T >, numTiles() > 100, expandAllNonConstTiles) void expandAllNonConstTilesPartial(const UT_JobInfo &info)
 
UT_VoxelTile< T > * getTile (int tx, int ty, int tz) const
 
UT_VoxelTile< T > * getLinearTile (int idx) const
 
void linearTileToXYZ (int idx, int &x, int &y, int &z) const
 
UT_Vector3I linearTileToXYZ (int idx) const
 
int xyzTileToLinear (int x, int y, int z) const
 
int indexToLinearTile (int x, int y, int z) const
 
void getTileVoxels (int idx, UT_Vector3I &start, UT_Vector3I &end) const
 idxth tile represents the voxels indexed [start,end). More...
 
UT_BoundingBoxI getTileBBox (int idx) const
 
int getTileRes (int dim) const
 
int numTiles () const
 
exint numVoxels () const
 
void setCompressionOptions (const UT_VoxelCompressOptions &options)
 
const UT_VoxelCompressOptionsgetCompressionOptions () const
 
void setCompressionTolerance (fpreal tol)
 
fpreal getCompressionTolerance () const
 
void saveData (std::ostream &os) const
 
bool saveData (UT_JSONWriter &w, const char *shared_mem_owner=0) const
 
void loadData (UT_IStream &is)
 Load an array, requires you have already size()d this array. More...
 
bool loadData (UT_JSONParser &p)
 
 THREADED_METHOD1 (UT_VoxelArray< T >, numTiles() > 20, copyData, const UT_VoxelArray< T > &, src) void copyDataPartial(const UT_VoxelArray< T > &src
 
template<int AXIS2D>
T lerpVoxelCoordAxis (UT_Vector3F pos) const
 
template<int AXIS2D>
T lerpVoxelAxis (int x, int y, int z, float fx, float fy, float fz) const
 
template<int AXIS2D>
void lerpVoxelCoordMinMaxAxis (T &lerp, T &lmin, T &lmax, UT_Vector3F pos) const
 
template<int AXIS2D>
void lerpVoxelMinMaxAxis (T &lerp, T &smin, T &smax, int x, int y, int z, float fx, float fy, float fz) const
 
template<int AXIS2D>
bool extractSampleAxis (int x, int y, int z, T *samples) const
 
template<int AXIS2D>
T lerpSampleAxis (T *samples, float fx, float fy, float fz) const
 

Static Public Member Functions

static int mirrorCoordinates (int x, int res)
 

Public Attributes

const UT_JobInfoinfo
 
exint ystride
 
exint exint zstride
 
exint exint const UT_JobInfo &info const
 
exint exint T dummy
 
exint exint T const UT_JobInfo
&info 
const
 
exint exint const UT_JobInfoinfo
 
int offx
 
int int offy
 
int int int offz
 
int int int const UT_JobInfoinfo
 

Detailed Description

template<class T>
class UT_VoxelArray< T >

UT_VoxelArray

This provides data structure to hold a three dimmensional array of data. The data should be some simple arithmetic type, such as uint8, fpreal16, or UT_Vector3.

Some operations, such as gradiants, may make less sense with uint8.

Definition at line 20 of file RE_Texture3DMap.h.

Member Typedef Documentation

template<class T>
using UT_VoxelArray< T >::ScalarType = T

Definition at line 635 of file UT_VoxelArray.h.

Constructor & Destructor Documentation

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

Definition at line 2959 of file UT_VoxelArray.C.

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

Definition at line 2983 of file UT_VoxelArray.C.

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

Copy constructor:

Definition at line 2989 of file UT_VoxelArray.C.

Member Function Documentation

template<class T>
void UT_VoxelArray< T >::clampIndex ( int x,
int y,
int z 
) const
inline

Clamps the given x, y, and z values to lie inside the valid index range.

Definition at line 1003 of file UT_VoxelArray.h.

template<typename T>
void UT_VoxelArray< T >::copyWithOffset ( const UT_VoxelArray< T > &  src,
int  offx,
int  offy,
int  offz 
)

Copies into this voxel array from the source array. Conceptually, this->setValue(x, y, z, src.getValue(x+offx, y+offy, z+offz);

Definition at line 5339 of file UT_VoxelArray.C.

template<typename T >
T UT_VoxelArray< T >::evaluate ( const UT_Vector3 pos,
const UT_Filter filter,
fpreal  radius,
int  clampaxis = -1 
) const

Filtered evaluation of the voxel array. This operation should exhibit the same behavior as IMG3D_Channel::evaluate.

Definition at line 4387 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::evaluateMinMax ( T lerp,
T lmin,
T lmax,
UT_Vector3F  pos 
) const

This convience function lets you sample the voxel array. pos is in the range [0..1]^3. The min/max is the range of the sampled values.

Definition at line 3615 of file UT_VoxelArray.C.

template<typename T>
bool UT_VoxelArray< T >::extractSample ( int  x,
int  y,
int  z,
T sample 
) const

Extracts a sample of [x,y,z] to [x+1,y+1,z+1]. The sample array should have 8 elements, x minor, z major.

Definition at line 3732 of file UT_VoxelArray.C.

template<class T>
template<int AXIS2D>
SYS_FORCE_INLINE bool UT_VoxelArray< T >::extractSampleAxis ( int  x,
int  y,
int  z,
T sample 
) const
template<class T>
template<int AXIS2D>
bool UT_VoxelArray< T >::extractSampleAxis ( int  x,
int  y,
int  z,
T samples 
) const

Definition at line 3792 of file UT_VoxelArray.C.

template<typename T>
bool UT_VoxelArray< T >::extractSamplePlus ( int  x,
int  y,
int  z,
T sample 
) const

Extracts a sample in a plus shape, dx, then dy, then dz, finally the center into 7 voxels.

Definition at line 3894 of file UT_VoxelArray.C.

template<typename T >
template<int SLICE, typename S >
S * UT_VoxelArray< T >::extractSlice ( S dstdata,
int  slice,
bool  half_slice 
) const

Fills dstdata with the voxel data of the slice with the coordinate at component SLICE_AXIS fixed at slice. Returns nullptr if slice is outside the domain. If half_slice is true, the extracted values lie halfway between slice and slice+1.

Definition at line 4786 of file UT_VoxelArray.C.

template<typename T >
template<typename S >
S * UT_VoxelArray< T >::extractTiles ( S dstdata,
int  stride,
const UT_IntArray tilelist 
) const

Fills dstdata with the voxel data of listed tiles. Stride is measured in T. Data order is in tile-order. So, sorted by tilelist, then z, y, x within that tile. The ix/iy/iz variant allows partial tiles. If the number of voxels to write to a tile matches the tile size, however, the ix/iy/iz is ignored and the tile is written in canonical order.

Definition at line 4901 of file UT_VoxelArray.C.

template<typename T >
template<typename S , typename IDX >
S * UT_VoxelArray< T >::extractTiles ( S dstdata,
int  stride,
const IDX *  ix,
const IDX *  iy,
const IDX *  iz,
const UT_Array< UT_VoxelArrayTileDataDescr > &  tilelist 
) const

Definition at line 4918 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelArray< T >::findexToPos ( UT_Vector3F  ipos,
UT_Vector3F pos 
) const

Definition at line 5734 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelArray< T >::findexToPos ( UT_Vector3D  ipos,
UT_Vector3D pos 
) const

Definition at line 5749 of file UT_VoxelArray.C.

template<typename T>
template<int AXIS2D>
void UT_VoxelArray< T >::flattenPartialAxis ( T flatarray,
exint  ystride,
const UT_JobInfo info 
) const

Flattens this into an array. Z major, then Y, then X. Flattens a 2d slice where AXIS2D is constant. If AXIS2D == 2 (ie, z): flatarray[x + y * ystride] = getValue(x, y, 0); Flattens by destination x-major stripes to avoid page collisions on freshly allocated memory buffers.

Definition at line 4570 of file UT_VoxelArray.C.

template<typename T >
template<typename OP >
void UT_VoxelArray< T >::forEachTile ( const OP &  op,
bool  shouldthread = true 
)

Calls [](UT_VoxelTileIterator<T> &vit) -> void in parallel for each tile.

Definition at line 4508 of file UT_VoxelArray.C.

template<class T>
template<typename OP >
void UT_VoxelArray< T >::forEachTileConst ( const OP &  op,
bool  shouldthread = true 
) const
inline

Calls [](UT_VoxelTileIterator<T> &vit) -> void in parallel for each tile. Since TileIterator don't understand const correctness, it is important you do not use setValue in the op.

Definition at line 845 of file UT_VoxelArray.h.

template<class T>
UT_VoxelBorderType UT_VoxelArray< T >::getBorder ( ) const
inline

Definition at line 1267 of file UT_VoxelArray.h.

template<class T>
T UT_VoxelArray< T >::getBorderScale ( int  axis) const
inline

Definition at line 1269 of file UT_VoxelArray.h.

template<class T>
T UT_VoxelArray< T >::getBorderValue ( ) const
inline

Definition at line 1268 of file UT_VoxelArray.h.

template<class T>
const UT_VoxelCompressOptions& UT_VoxelArray< T >::getCompressionOptions ( ) const
inline

Definition at line 1364 of file UT_VoxelArray.h.

template<class T>
fpreal UT_VoxelArray< T >::getCompressionTolerance ( ) const
inline

Definition at line 1369 of file UT_VoxelArray.h.

template<class T>
UT_VoxelTile<T>* UT_VoxelArray< T >::getLinearTile ( int  idx) const
inline

Definition at line 1299 of file UT_VoxelArray.h.

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

Return the amount of memory used by this array.

Definition at line 3214 of file UT_VoxelArray.C.

template<class T>
int UT_VoxelArray< T >::getRes ( int  axis) const
inline

Definition at line 668 of file UT_VoxelArray.h.

template<class T>
UT_VoxelTile<T>* UT_VoxelArray< T >::getTile ( int  tx,
int  ty,
int  tz 
) const
inline

The direct tile access methods are to make TBF writing a bit more efficient.

Definition at line 1297 of file UT_VoxelArray.h.

template<class T>
UT_BoundingBoxI UT_VoxelArray< T >::getTileBBox ( int  idx) const
inline

Definition at line 1347 of file UT_VoxelArray.h.

template<class T>
int UT_VoxelArray< T >::getTileRes ( int  dim) const
inline

Number of tiles along that axis. Not to be confused with the resolution of the individual tiles.

Definition at line 1356 of file UT_VoxelArray.h.

template<class T>
void UT_VoxelArray< T >::getTileVoxels ( int  idx,
UT_Vector3I start,
UT_Vector3I end 
) const
inline

idxth tile represents the voxels indexed [start,end).

Definition at line 1332 of file UT_VoxelArray.h.

template<class T>
T UT_VoxelArray< T >::getValue ( int  x,
int  y,
int  z 
) const
inline

This will clamp the bounds to fit within the voxel array, using the border type to resolve out of range values.

Definition at line 1061 of file UT_VoxelArray.h.

template<class T>
bool UT_VoxelArray< T >::getValues ( const UT_BoundingBoxI bbox,
T values,
const exint  size 
) const
inline

Gets values in the box [bbox.minvec(), bbox.maxvec()) Values are stored in the array values of size size that has to be at least bbox.volume() The order of values is give by: i + bbox.xsize() * (j + bbox.ysize() * k)

If returns true, values in bbox are constant and only values[0] is guaranteed to be assigned.

Definition at line 1134 of file UT_VoxelArray.h.

template<class T>
UT_Vector3I UT_VoxelArray< T >::getVoxelRes ( ) const
inline

Definition at line 670 of file UT_VoxelArray.h.

template<class T>
int UT_VoxelArray< T >::getXRes ( ) const
inline

Definition at line 665 of file UT_VoxelArray.h.

template<class T>
int UT_VoxelArray< T >::getYRes ( ) const
inline

Definition at line 666 of file UT_VoxelArray.h.

template<class T>
int UT_VoxelArray< T >::getZRes ( ) const
inline

Definition at line 667 of file UT_VoxelArray.h.

template<typename T >
bool UT_VoxelArray< T >::hasNan ( ) const

Returns true if any element of the voxel array is NAN.

Definition at line 3288 of file UT_VoxelArray.C.

template<class T>
int UT_VoxelArray< T >::indexToLinearTile ( int  x,
int  y,
int  z 
) const
inline

Definition at line 1328 of file UT_VoxelArray.h.

template<typename T >
bool UT_VoxelArray< T >::indexToPos ( int  x,
int  y,
int  z,
UT_Vector3F pos 
) const

Converts an index into a position. Returns false if the source index was out of range, in which case pos will be outside [0..1]^3

Definition at line 5694 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::indexToPos ( exint  x,
exint  y,
exint  z,
UT_Vector3D pos 
) const

Definition at line 5714 of file UT_VoxelArray.C.

template<typename T>
bool UT_VoxelArray< T >::isConstant ( T cval = 0) const

If this voxel array is all constant tiles, returns true. The optional pointer is initialized to the constant value iff the array is constant. (Note by constant we mean made of constant tiles of the same value - if some tiles are uncompressed but constant, it will still return false)

Definition at line 3248 of file UT_VoxelArray.C.

template<class T>
template<typename S >
bool UT_VoxelArray< T >::isMatching ( const UT_VoxelArray< S > &  src) const
inline

Definition at line 658 of file UT_VoxelArray.h.

template<class T>
bool UT_VoxelArray< T >::isValidIndex ( int  x,
int  y,
int  z 
) const
inline

Returns true if the given x, y, z values lie inside the valid index.

Definition at line 1011 of file UT_VoxelArray.h.

template<typename T>
T UT_VoxelArray< T >::lerpSample ( T samples,
float  fx,
float  fy,
float  fz 
) const

Lerps the given sample using trilinear interpolation.

Definition at line 4019 of file UT_VoxelArray.C.

template<class T>
template<int AXIS2D>
SYS_FORCE_INLINE T UT_VoxelArray< T >::lerpSampleAxis ( T samples,
float  fx,
float  fy,
float  fz 
) const
template<class T>
template<int AXIS2D>
T UT_VoxelArray< T >::lerpSampleAxis ( T samples,
float  fx,
float  fy,
float  fz 
) const

Definition at line 4081 of file UT_VoxelArray.C.

template<typename T >
T UT_VoxelArray< T >::lerpVoxel ( int  x,
int  y,
int  z,
float  fx,
float  fy,
float  fz 
) const

Evaluate using voxel coords, from 0,0,0 to resx,resy,resz. Allows out of range evaluation

Definition at line 3349 of file UT_VoxelArray.C.

template<class T>
template<int AXIS2D>
SYS_FORCE_INLINE T UT_VoxelArray< T >::lerpVoxelAxis ( int  x,
int  y,
int  z,
float  fx,
float  fy,
float  fz 
) const
template<class T>
template<int AXIS2D>
T UT_VoxelArray< T >::lerpVoxelAxis ( int  x,
int  y,
int  z,
float  fx,
float  fy,
float  fz 
) const

Definition at line 3447 of file UT_VoxelArray.C.

template<typename T >
T UT_VoxelArray< T >::lerpVoxelCoord ( UT_Vector3F  pos) const

Evaluate using voxel coords, from 0,0,0 to resx,resy,resz. Allows out of range evaluation

Definition at line 3322 of file UT_VoxelArray.C.

template<class T>
template<int AXIS2D>
SYS_FORCE_INLINE T UT_VoxelArray< T >::lerpVoxelCoordAxis ( UT_Vector3F  pos) const
template<class T>
template<int AXIS2D>
T UT_VoxelArray< T >::lerpVoxelCoordAxis ( UT_Vector3F  pos) const

Definition at line 3336 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::lerpVoxelCoordMinMax ( T lerp,
T lmin,
T lmax,
UT_Vector3F  pos 
) const

Evaluate using voxel coords, from 0,0,0 to resx,resy,resz. Allows out of range evaluation. Also computes min/max of interpolated samples.

Definition at line 3632 of file UT_VoxelArray.C.

template<class T>
template<int AXIS2D>
SYS_FORCE_INLINE void UT_VoxelArray< T >::lerpVoxelCoordMinMaxAxis ( T lerp,
T lmin,
T lmax,
UT_Vector3F  pos 
) const
template<class T>
template<int AXIS2D>
void UT_VoxelArray< T >::lerpVoxelCoordMinMaxAxis ( T lerp,
T lmin,
T lmax,
UT_Vector3F  pos 
) const

Definition at line 3648 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::lerpVoxelMinMax ( T lerp,
T lmin,
T lmax,
int  x,
int  y,
int  z,
float  fx,
float  fy,
float  fz 
) const

Evaluate using voxel coords, from 0,0,0 to resx,resy,resz. Allows out of range evaluation. Also computes min/max of interpolated samples.

Definition at line 3663 of file UT_VoxelArray.C.

template<class T>
template<int AXIS2D>
SYS_FORCE_INLINE void UT_VoxelArray< T >::lerpVoxelMinMaxAxis ( T lerp,
T lmin,
T lmax,
int  x,
int  y,
int  z,
float  fx,
float  fy,
float  fz 
) const
template<class T>
template<int AXIS2D>
void UT_VoxelArray< T >::lerpVoxelMinMaxAxis ( T lerp,
T smin,
T smax,
int  x,
int  y,
int  z,
float  fx,
float  fy,
float  fz 
) const

Definition at line 3692 of file UT_VoxelArray.C.

template<class T>
void UT_VoxelArray< T >::linearTileToXYZ ( int  idx,
int x,
int y,
int z 
) const
inline

Definition at line 1301 of file UT_VoxelArray.h.

template<class T>
UT_Vector3I UT_VoxelArray< T >::linearTileToXYZ ( int  idx) const
inline

Definition at line 1311 of file UT_VoxelArray.h.

template<typename T >
void UT_VoxelArray< T >::loadData ( UT_IStream is)

Load an array, requires you have already size()d this array.

Definition at line 5855 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::loadData ( UT_JSONParser p)

Definition at line 5967 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::match ( const UT_VoxelArray< T > &  src)

This will ensure this voxel array matches the given voxel array in terms of dimensions & border conditions. It may invoke a size() and hence reset the field to 0.

Definition at line 3195 of file UT_VoxelArray.C.

template<class T>
static int UT_VoxelArray< T >::mirrorCoordinates ( int  x,
int  res 
)
inlinestatic

Mirrors the coordinate for the given resolution. This is effectively like using one reflection then repeating that with twice the resolution.

Definition at line 1048 of file UT_VoxelArray.h.

template<typename T>
void UT_VoxelArray< T >::moveTilesWithOffset ( UT_VoxelArray< T > &  src,
int  tileoffx,
int  tileoffy,
int  tileoffz 
)

Moves data from the source voxel array into this array. The offsets should be in terms of tiles. Source may be modified as this array steals its data buffers in such a way that no dynamic memory will leak when these arrays are freed. Conceptually, this function performs the same operation as copyWithOffset, but with offsets specified in terms of tiles: this->setValue(x, y, z, src.getValue(x+off_v_x, y+off_v_y, z+off_v_z) where off_v_A=tileoffA*TILESIZE for A in {x, y, z}.

Definition at line 5223 of file UT_VoxelArray.C.

template<class T>
int UT_VoxelArray< T >::numTiles ( ) const
inline

Definition at line 1357 of file UT_VoxelArray.h.

template<class T>
exint UT_VoxelArray< T >::numVoxels ( ) const
inline

Definition at line 1359 of file UT_VoxelArray.h.

template<typename T >
T UT_VoxelArray< T >::operator() ( UT_Vector3D  pos) const

This convience function lets you sample the voxel array. pos is in the range [0..1]^3. T value trilinearly interpolated. Edges are determined by the border mode. The cells are sampled at the center of the voxels.

Definition at line 4140 of file UT_VoxelArray.C.

template<typename T >
T UT_VoxelArray< T >::operator() ( UT_Vector3F  pos) const

Definition at line 3306 of file UT_VoxelArray.C.

template<class T>
T UT_VoxelArray< T >::operator() ( UT_Vector3I  index) const
inline

This allows you to read & write the raw data. Out of bound reads are illegal.

Definition at line 1019 of file UT_VoxelArray.h.

template<class T>
T UT_VoxelArray< T >::operator() ( int  x,
int  y,
int  z 
) const
inline

Definition at line 1023 of file UT_VoxelArray.h.

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

Assignment operator:

Definition at line 3024 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::posToIndex ( UT_Vector3  pos,
int x,
int y,
int z 
) const

Converts a 3d position in range [0..1]^3 into the closest index value. Returns false if the resulting index was out of range. The index will still be set.

Definition at line 5598 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::posToIndex ( UT_Vector3D  pos,
exint x,
exint y,
exint z 
) const

Definition at line 5646 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::posToIndex ( UT_Vector3  pos,
UT_Vector3 ipos 
) const

Convertes a 3d position in [0..1]^3 into the equivalent in the integer cell space. Does not clamp to the closest value.

Definition at line 5619 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::posToIndex ( UT_Vector3D  pos,
UT_Vector3D ipos 
) const

Definition at line 5667 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::resample ( const UT_VoxelArray< T > &  src,
UT_FilterType  filtertype = UT_FILTER_POINT,
float  filterwidthscale = 1.0f,
int  clampaxis = -1 
)

Fills this by resampling the given voxel array.

Definition at line 4484 of file UT_VoxelArray.C.

template<typename T >
void UT_VoxelArray< T >::saveData ( std::ostream &  os) const

Saves only the data of this array to the given stream. To reload it you will have to have a matching array in tiles dimensions and size.

Definition at line 5821 of file UT_VoxelArray.C.

template<typename T >
bool UT_VoxelArray< T >::saveData ( UT_JSONWriter w,
const char *  shared_mem_owner = 0 
) const

Definition at line 5891 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::setBorder ( UT_VoxelBorderType  type,
T  t 
)

Definition at line 5764 of file UT_VoxelArray.C.

template<typename T>
void UT_VoxelArray< T >::setBorderScale ( T  scalex,
T  scaley,
T  scalez 
)

Definition at line 5772 of file UT_VoxelArray.C.

template<class T>
void UT_VoxelArray< T >::setCompressionOptions ( const UT_VoxelCompressOptions options)
inline

Definition at line 1362 of file UT_VoxelArray.h.

template<class T>
void UT_VoxelArray< T >::setCompressionTolerance ( fpreal  tol)
inline

Definition at line 1367 of file UT_VoxelArray.h.

template<class T>
void UT_VoxelArray< T >::setValue ( UT_Vector3I  index,
T  value 
)
inline

Definition at line 1032 of file UT_VoxelArray.h.

template<class T>
void UT_VoxelArray< T >::setValue ( int  x,
int  y,
int  z,
T  t 
)
inline

Definition at line 1037 of file UT_VoxelArray.h.

template<typename T >
void UT_VoxelArray< T >::size ( int  xres,
int  yres,
int  zres,
bool  reset = true 
)

This sets the voxelarray to have the given resolution. If resolution is changed, all elements will be set to 0. If resolution is already equal to the arguments, all elements will be set to 0 only if reset is true; otherwise, the voxel array will be left untouched.

Definition at line 3083 of file UT_VoxelArray.C.

template<class T>
SYS_FORCE_INLINE void UT_VoxelArray< T >::splitVoxelCoord ( UT_Vector3F  pos,
int x,
int y,
int z,
float fx,
float fy,
float fz 
) const
inline

Definition at line 772 of file UT_VoxelArray.h.

template<class T>
template<int AXIS2D>
SYS_FORCE_INLINE void UT_VoxelArray< T >::splitVoxelCoordAxis ( UT_Vector3F  pos,
int x,
int y,
int z,
float fx,
float fy,
float fz 
) const
inline

Definition at line 784 of file UT_VoxelArray.h.

template<class T>
UT_VoxelArray< T >::THREADED_METHOD ( UT_VoxelArray< T ,
numTiles()  ,
100  ,
collapseAllTiles   
) const

This tries to compress or collapse each tile. This can be expensive (ie, converting a tile to constant), so should be saved until modifications are complete.

template<class T>
UT_VoxelArray< T >::THREADED_METHOD ( UT_VoxelArray< T ,
numTiles()  ,
100  ,
expandAllTiles   
) const

Uncompresses all tiles into non-constant tiles. Useful if you have a multithreaded algorithm that may need to both read and write, if you write to a collapsed tile while someone else reads from it, bad stuff happens. Instead, you can expandAllTiles. This may have serious consequences in memory use, however.

template<class T>
UT_VoxelArray< T >::THREADED_METHOD ( UT_VoxelArray< T ,
numTiles()  ,
100  ,
expandAllNonConstTiles   
) const

Uncompresses all tiles, but leaves constant tiles alone. Useful for cleaning out any non-standard compression algorithm that some external program can't handle.

template<class T>
UT_VoxelArray< T >::THREADED_METHOD1 ( UT_VoxelArray< T ,
numTiles()  ,
100  ,
constant  ,
T  ,
t   
) const

Sets this voxel array to the given constant value. All tiles are turned into constant tiles.

template<class T>
UT_VoxelArray< T >::THREADED_METHOD1 ( UT_VoxelArray< T ,
numTiles()  ,
20  ,
copyData  ,
const UT_VoxelArray< T > &  ,
src   
) const

Copy only the data from the source array. Note that it is an error to call this unless isMatching(src).

template<class T>
UT_VoxelArray< T >::THREADED_METHOD3 ( UT_VoxelArray< T ,
numTiles()  ,
16  ,
extractFromFlattened  ,
const T ,
flatarray  ,
exint  ,
ystride  ,
exint  ,
zstride   
) const

Fills this from a flattened array. Z major, then Y, then X. setValue(x,y,z, flatarray[x + y * ystride + z * zstride];

template<class T>
UT_VoxelArray< T >::THREADED_METHOD3_CONST ( UT_VoxelArray< T ,
numTiles()  ,
16  ,
flatten  ,
T ,
flatarray  ,
exint  ,
ystride  ,
exint  ,
zstride   
)

Flattens this into an array. Z major, then Y, then X. flatarray[x + y * ystride + z * zstride] = getValue(x, y, z);

template<class T>
UT_VoxelArray< T >::THREADED_METHOD4 ( UT_VoxelArray< T ,
numTiles()  ,
,
copyWithOffsetInternal  ,
const UT_VoxelArray< T > &  ,
src  ,
int  ,
offx  ,
int  ,
offy  ,
int  ,
offz   
) const
template<class T>
UT_VoxelArray< T >::THREADED_METHOD4_CONST ( UT_VoxelArray< T ,
numTiles()  ,
16  ,
flattenGLFixed8  ,
uint8 ,
flatarray  ,
exint  ,
ystride  ,
exint  ,
zstride  ,
T  ,
dummy   
)

Flattens this into an array suitable for a GL 8bit texture. Z major, then Y, then X. flatarray[x + y * ystride + z * zstride] = getValue(x, y, z);

template<class T>
UT_VoxelArray< T >::THREADED_METHOD4_CONST ( UT_VoxelArray< T ,
numTiles()  ,
16  ,
flattenGL16F  ,
UT_Vector4H ,
flatarray  ,
exint  ,
ystride  ,
exint  ,
zstride  ,
T  ,
dummy   
)

Flattens this into an array suitable for a GL 16bit FP texture. Z major, then Y, then X. flatarray[x + y * ystride + z * zstride] = getValue(x, y, z);

template<class T>
UT_VoxelArray< T >::THREADED_METHOD4_CONST ( UT_VoxelArray< T ,
numTiles()  ,
16  ,
flattenGL32F  ,
UT_Vector4F ,
flatarray  ,
exint  ,
ystride  ,
exint  ,
zstride  ,
T  ,
dummy   
)

Flattens this into an array suitable for a GL 32b FP texture. Note that this also works around an older Nvidia driver bug that caused very small valued texels (<1e-9) to appear as huge random values in the texture. Z major, then Y, then X. flatarray[x + y * ystride + z * zstride] = getValue(x, y, z);

template<typename T >
template<typename S >
const S * UT_VoxelArray< T >::writeTiles ( const S srcdata,
int  srcstride,
const UT_IntArray tilelist 
)

Overwrites our tiles with the given data. Does checking for constant tiles. Input srcdata stream should match that of extractTiles.

Definition at line 5001 of file UT_VoxelArray.C.

template<typename T >
template<typename S , typename IDX >
const S * UT_VoxelArray< T >::writeTiles ( const S srcdata,
int  srcstride,
const IDX *  ix,
const IDX *  iy,
const IDX *  iz,
const UT_Array< UT_VoxelArrayTileDataDescr > &  tilelist 
)

Definition at line 5021 of file UT_VoxelArray.C.

template<class T>
int UT_VoxelArray< T >::xyzTileToLinear ( int  x,
int  y,
int  z 
) const
inline

Definition at line 1325 of file UT_VoxelArray.h.

Member Data Documentation

template<class T>
exint exint T const UT_JobInfo &info UT_VoxelArray< T >::const

Definition at line 857 of file UT_VoxelArray.h.

template<class T>
exint exint T const UT_JobInfo& info UT_VoxelArray< T >::const

Definition at line 879 of file UT_VoxelArray.h.

template<class T>
exint exint T UT_VoxelArray< T >::dummy

Definition at line 879 of file UT_VoxelArray.h.

template<class T>
const UT_JobInfo & UT_VoxelArray< T >::info

Definition at line 684 of file UT_VoxelArray.h.

template<class T>
exint exint const UT_JobInfo& UT_VoxelArray< T >::info

Definition at line 921 of file UT_VoxelArray.h.

template<class T>
int int int const UT_JobInfo& UT_VoxelArray< T >::info

Definition at line 936 of file UT_VoxelArray.h.

template<class T>
int UT_VoxelArray< T >::offx

Definition at line 936 of file UT_VoxelArray.h.

template<class T>
int int UT_VoxelArray< T >::offy

Definition at line 936 of file UT_VoxelArray.h.

template<class T>
int int int UT_VoxelArray< T >::offz

Definition at line 936 of file UT_VoxelArray.h.

template<class T>
exint UT_VoxelArray< T >::ystride

Definition at line 857 of file UT_VoxelArray.h.

template<class T>
exint exint UT_VoxelArray< T >::zstride

Definition at line 857 of file UT_VoxelArray.h.


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