Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShUtil Namespace Reference

The main ShUtil namespace. More...


Classes

class  ShMesh
 ShMesh class stores a mesh using a half-edge data structure. More...
class  ShNoise
 A Perlin noise/turbulence generator. M = dimensions of the result (1 <= M <= 4 currently) P = period of the noise texture. More...

[NOHEADER]

template<int N, int M, typename T>
ShGeneric< N, T > perlin (const ShGeneric< M, T > &p, bool useTexture=true)
template<int N, int M, int K, typename T1, typename T2>
ShGeneric< N, CT1T2 > perlin (const ShGeneric< M, T1 > &p, const ShGeneric< K, T2 > &amp, bool useTexture=true)

[NOHEADER]

template<int N, int M, typename T>
ShGeneric< N, T > sperlin (const ShGeneric< M, T > &p, bool useTexture=true)
template<int N, int M, int K, typename T1, typename T2>
ShGeneric< N, CT1T2 > sperlin (const ShGeneric< M, T1 > &p, const ShGeneric< K, T2 > &amp, bool useTexture=true)

[NOHEADER]

template<int N, int M, typename T>
ShGeneric< N, T > cellnoise (const ShGeneric< M, T > &p, bool useTexture=true)
template<int N, int M, int K, typename T1, typename T2>
ShGeneric< N, CT1T2 > cellnoise (const ShGeneric< M, T1 > &p, const ShGeneric< K, T2 > &amp, bool useTexture=true)

[NOHEADER]

template<int N, int M, typename T>
ShGeneric< N, T > scellnoise (const ShGeneric< M, T > &p, bool useTexture=true)
template<int N, int M, int K, typename T1, typename T2>
ShGeneric< N, CT1T2 > scellnoise (const ShGeneric< M, T1 > &p, const ShGeneric< K, T2 > &amp, bool useTexture=true)

[NOHEADER]

template<int N, int M, typename T>
ShGeneric< N, T > turbulence (const ShGeneric< M, T > &p, bool useTexture=true)
template<int N, int M, int K, typename T1, typename T2>
ShGeneric< N, CT1T2 > turbulence (const ShGeneric< M, T1 > &p, const ShGeneric< K, T2 > &amp, bool useTexture=true)

Typedefs

typedef std::vector< Triple > ShObjIndexedFace

Functions

template<int N, typename T>
ShGeneric< N, T > smoothstep (const ShGeneric< N, T > &a, const ShGeneric< N, T > &b, const ShGeneric< N, T > x)
 Cubic interpolated step between 0 and 1. Returns 0 if x < a, 1 if x > b, cubic interpolation between 0 and 1 otherwise.
template<int N, typename T>
ShGeneric< 1, T > distance (const ShGeneric< N, T > &a, const ShGeneric< N, T > &b)
 Euclidean distance between two points.
template<int N, typename T>
ShGeneric< 1, T > lOneDistance (const ShGeneric< N, T > &a, const ShGeneric< N, T > &b)
 L1 distance between two points The L1 distance is a sum of the absolute component-wise differences.
template<int N, typename T>
ShGeneric< 1, T > lInfDistance (const ShGeneric< N, T > &a, const ShGeneric< N, T > &b)
 Linfinity distance between two points Linfinity distance is the maximum absolute component-wise difference.
template<int N, typename T>
ShGeneric< N, T > hashlcg (const ShGeneric< N, T > &p)
 Parallel linear congruential generator.
template<int N, typename T>
ShGeneric< N, T > hashmrg (const ShGeneric< N, T > &p)
 MRG style pseudorandom vector generator.
template<int N, ShBindingType Binding, typename T>
ShAttrib< N, Binding, T > evenOddSort (const ShAttrib< N, Binding, T > &v)
 Sorts components of an n-tuple Uses an even-odd transposition sort to sort the components of an n-tuple. (Ordered from smallest to largset).
template<int S, int N, ShBindingType Binding, typename T>
void groupEvenOddSort (ShAttrib< N, Binding, T > v[])
 Sorts groups of components v[i](j), 0 <= i < S * by the components in v[0](j) 0 <= j < N. * This also uses an even-odd transposition sort.
template<typename T>
ShGeneric< 3, T > changeBasis (const ShGeneric< 3, T > &b0, const ShGeneric< 3, T > &b1, const ShGeneric< 3, T > &b2, const ShGeneric< 3, T > &v)
 Given 3 orthonormal basis vectors b0, b1, b2, specified relative to a coordinate space C, this does a change of basis on a vector v in space C to the orthonormal basis.
template<int S, int N, ShBindingType Binding, typename T>
void groupBitonicSort (ShAttrib< N, Binding, T > v[])
template<int N, int M, typename T>
ShGeneric< N, T > sturbulence (const ShGeneric< M, T > &p, bool useTexture=true)
 Turbulence functions sum several octaves of Perlin noise.
template<int N, int M, int K, typename T1, typename T2>
ShGeneric< N, CT1T2 > sturbulence (const ShGeneric< M, T1 > &p, const ShGeneric< K, T2 > &amp, bool useTexture=true)
template<int M, typename T>
ShGeneric< M, T > _psmootht (const ShGeneric< M, T > &t)
 SHNOISE_WITH_AMP (perlin)
 SHNOISE_WITH_AMP (sperlin)
 SHNOISE_WITH_AMP (cellnoise)
 SHNOISE_WITH_AMP (scellnoise)
 SHNOISE_WITH_AMP (turbulence)
 SHNOISE_WITH_AMP (sturbulence)
std::istream & operator>> (std::istream &in, ShObjMesh &mesh)
template<typename P1, typename P2>
PropertyFactory< P1::NUM_PROPS+P2::NUM_PROPS, P1::DIM, typename
P1::PropType > * 
combine (const P1 *propFactory1, const P2 *propFactory2)
template<int K, int D, typename T>
ShGeneric< K, T > worley (const ShGeneric< D, T > &p, bool useTexture=true)
 Worley texture generator. This uses the DefaultGeneratorFactory and DistSqPropFactory TODO allow arbitrary distance function.
template<int K, int L, int P, int D, typename T>
void worley (ShGeneric< K, T > result[], const ShGeneric< D, T > &p, const GeneratorFactory< P, D, T > *genFactory, const PropertyFactory< L, D, T > *propFactory)
 Worley texture generator. This uses a GeneratorFactory and PropertyFactory of your choice.
template<int K, int D, typename T>
ShProgram shWorley (bool useTexture)
 Makes a shader that takes IN(1) ShTexCoord<D,T> texcoord; // texture lookup coordinates.
template<int K, int N, int P, int D, typename T>
ShProgram shWorley (const GeneratorFactory< P, D, T > *genFactory, const PropertyFactory< N, D, T > *propFactory)
template<int N, int K, int P, typename T>
void kSelect (const ShGeneric< P, T > vals[N], ShGeneric< K, T > result[N], float LARGE=1e10)
template<int K, int L, int P, int D, typename T>
ShProgram shWorley (const GeneratorFactory< P, D, T > *genFactory, const PropertyFactory< L, D, T > *propFactory)

Variables

struct struct typedef ShMeshType<
ShObjVertex, ShObjFace, ShObjEdge > 
ShObjMeshType


Detailed Description

The main ShUtil namespace.

All the extra Sh utility functions and objects reside within this namespace.


Function Documentation

template<int N, typename T>
ShGeneric< N, T > ShUtil::hashlcg const ShGeneric< N, T > &  p  ) 
 

Parallel linear congruential generator.

This does not work very well right now. Use hashmrg instead.

See also:
template<int N, typename T> ShGeneric<N, T> hashmrg(const ShGeneric<N, T>& p)

Definition at line 91 of file ShFuncImpl.hpp.

References SH::frac(), and SH::mad().

template<int N, typename T>
ShGeneric< N, T > ShUtil::hashmrg const ShGeneric< N, T > &  p  ) 
 

MRG style pseudorandom vector generator.

Generates a random vector using a multiple-recursive generator style. (LCG on steroids) Treat x,y,z,w as seeds a0, a1, a2, a3 and repeatedly apply an = b * (an-1, an-2, an-3, an-4), where b is a vector Take as output (an, an-1, an-2, an3) after suitable number of iterations.

This appears to reduce correlation in the output components when input components are similar, but the behaviour needs to be studied further.

See also:
template<int N, typename T> ShGeneric<N, T> hashlcg(const ShGeneric<N, T>& p)

Definition at line 121 of file ShFuncImpl.hpp.

References SH::dot(), and SH::frac().

Referenced by ShUtil::ShNoise< M, T, P >::cellnoise(), and ShUtil::ShNoise< M, T, P >::perlin().

template<int K, int D, typename T>
ShProgram ShUtil::shWorley bool  useTexture  ) 
 

Makes a shader that takes IN(1) ShTexCoord<D,T> texcoord; // texture lookup coordinates.

TODO make Output a struct of some kind when Sh supports structs OUT(0) ShAttrib<K, T> result[N]; // properties of k-nearest neighbours

Definition at line 277 of file ShWorleyImpl.hpp.


Generated on Mon Jan 24 18:38:28 2005 for Sh by  doxygen 1.4.1