00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __UT_Noise_h__
00028 #define __UT_Noise_h__
00029
00030 #include "UT_API.h"
00031 #include <SYS/SYS_Types.h>
00032
00033
00034
00035
00036
00037
00038 class UT_Vector3;
00039
00040 class UT_API ut_NoiseVector {
00041 public:
00042 ut_NoiseVector();
00043 virtual ~ut_NoiseVector() {}
00044 virtual void initNoise(unsigned seed) = 0;
00045 virtual fpreal noise(const UT_Vector3 &pos) const = 0;
00046 virtual void noise(const UT_Vector3 &pos, UT_Vector3 &val) const = 0;
00047
00048
00049 virtual int getNumTextures() = 0;
00050 virtual void *getTextureData(int tex_index,
00051 int &xsize, int &ysize,
00052 int &comps, bool &fp) = 0;
00053 };
00054
00055
00056 class UT_API UT_Noise {
00057 public:
00058 explicit UT_Noise(unsigned seed = 0);
00059 ~UT_Noise();
00060
00061
00062
00063 enum UT_NoiseType
00064 {
00065 FAST,
00066 SPARSE,
00067 FAST_FIX,
00068 ALLIGATOR
00069 };
00070
00071
00072
00073 void setType(UT_NoiseType type = FAST);
00074 void setSeed(unsigned seed = 0);
00075 void initialize(unsigned seed, UT_NoiseType type)
00076 {
00077 setType(type);
00078 setSeed(seed);
00079 }
00080
00081
00082
00083 UT_NoiseType getType() const { return myType; }
00084 int getSeed() const { return mySeed; }
00085
00086
00087
00088 fpreal turbulence(const UT_Vector3 &pos, unsigned fractalDepth,
00089 fpreal rough = 0.5F, fpreal atten=1) const;
00090 void turbulence(const UT_Vector3 &pos, unsigned fractalDepth,
00091 UT_Vector3 &noise,
00092 fpreal rough = 0.5F, fpreal atten=1) const;
00093
00094 ut_NoiseVector *getNoiseVector() { return noise; }
00095 private:
00096 int mySeed;
00097 UT_NoiseType myType;
00098 ut_NoiseVector *noise;
00099 };
00100
00101 #endif