Ejemplo n.º 1
0
 inline void operator() (ustring name, Dual2<R> &result,
                         const Dual2<S> &s, const Dual2<T> &t,
                         const S &sp, const T &tp,
                         ShaderGlobals *sg, const NoiseParams *opt) const {
     if (name == Strings::uperlin || name == Strings::noise) {
         PeriodicNoise noise;
         noise(result, s, t, sp, tp);
     } else if (name == Strings::perlin || name == Strings::snoise) {
         PeriodicSNoise snoise;
         snoise(result, s, t, sp, tp);
     } else if (name == Strings::cell) {
         PeriodicCellNoise cellnoise;
         cellnoise(result.val(), s.val(), t.val(), sp, tp);
         result.clear_d();
     } else if (name == Strings::gabor) {
         GaborPNoise gnoise;
         gnoise (name, result, s, t, sp, tp, sg, opt);
     } else if (name == Strings::hash) {
         PeriodicHashNoise hashnoise;
         hashnoise(result.val(), s.val(), t.val(), sp, tp);
         result.clear_d();
     } else {
         ((ShadingContext *)sg->context)->error ("Unknown noise type \"%s\"", name.c_str());
     }
 }
Ejemplo n.º 2
0
 inline void operator() (ustring name, Dual2<R> &result,
                         const Dual2<S> &s, const Dual2<T> &t,
                         ShaderGlobals *sg, const NoiseParams *opt) const {
     if (name == Strings::uperlin || name == Strings::noise) {
         Noise noise;
         noise(result, s, t);
     } else if (name == Strings::perlin || name == Strings::snoise) {
         SNoise snoise;
         snoise(result, s, t);
     } else if (name == Strings::simplexnoise || name == Strings::simplex) {
         SimplexNoise simplexnoise;
         simplexnoise(result, s, t);
     } else if (name == Strings::usimplexnoise || name == Strings::usimplex) {
         USimplexNoise usimplexnoise;
         usimplexnoise(result, s, t);
     } else if (name == Strings::cell) {
         CellNoise cellnoise;
         cellnoise(result.val(), s.val(), t.val());
         result.clear_d();
     } else if (name == Strings::gabor) {
         GaborNoise gnoise;
         gnoise (name, result, s, t, sg, opt);
     } else if (name == Strings::null) {
         NullNoise noise; noise(result, s, t);
     } else if (name == Strings::unull) {
         UNullNoise noise; noise(result, s, t);
     } else if (name == Strings::hash) {
         HashNoise hashnoise;
         hashnoise(result.val(), s.val(), t.val());
         result.clear_d();
     } else {
         ((ShadingContext *)sg->context)->error ("Unknown noise type \"%s\"", name.c_str());
     }
 }