00001
00002
00003
00004
00005
00006 #ifndef TURBULENCE_H
00007 #define TURBULENCE_H
00008
00009 #include<ColorMap.h>
00010 #include<Shade.h>
00011 #include<Image.h>
00012 #include<Matrix4.h>
00013
00014 #include<string>
00015
00018 class Turbulence : public Shade
00019 {
00020 DYNAMIC_OBJECT;
00021 public:
00022 typedef enum Type {
00023 SolidNoise,
00024 Linear,
00025 Circular,
00026 Spherical
00027 };
00028 Turbulence(real tur = 1.0, real b = 2.0, unsigned int oct = 5)
00029 : beta(b), scale(1.0), octaves(oct), type(Linear),
00030 turbulence(tur), color(Color4(1, 1, 1, 1))
00031 {
00032 M.identity();
00033 }
00034
00035 Color4 getColor(const Vertex3 &v) const;
00036
00037
00038 Color4 calculateColor(const SurfaceInfo &s, Scene &scene);
00039 void transform(Matrix4 &m);
00040
00041
00042 void parseSymbol(Token &t, ObjectFile &file);
00043 void writeParams(ostream &stream);
00044
00045 private:
00046
00047 void createSymbols();
00048
00049 real beta;
00050 real turbulence;
00051 real scale;
00052 unsigned int octaves;
00053 Type type;
00054 Color4 color;
00055 ColorMap table;
00056 Matrix4 M;
00057
00058 private:
00059 typedef Shade super;
00060 };
00061 #endif