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. More...

Typedefs

typedef std::vector< Triple > ShObjIndexedFace
typedef ShMeshType< ShObjVertex,
ShObjFace, ShObjEdge > 
ShObjMeshType

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.
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<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 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)
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)
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)
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)
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)
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.
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.
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)


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 58 of file ShFuncImpl.hpp.

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

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 88 of file ShFuncImpl.hpp.

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

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 274 of file ShWorleyImpl.hpp.

template<int N, typename T>
ShGeneric< N, T > ShUtil::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

Definition at line 40 of file ShFuncImpl.hpp.

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

template<int K, int L, int P, int D, typename T>
void ShUtil::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.

Definition at line 235 of file ShWorleyImpl.hpp.

template<int K, int D, typename T>
ShGeneric< K, T > ShUtil::worley const ShGeneric< D, T > &  p,
bool  useTexture = true
 

Worley texture generator.

This uses the DefaultGeneratorFactory and DistSqPropFactory TODO allow arbitrary distance function

Definition at line 261 of file ShWorleyImpl.hpp.


Generated on Thu Apr 21 17:35:39 2005 for Sh by  doxygen 1.4.2