00001 #include "WaterTexture.h"
00002 #include "PerlinNoise.h"
00003
00004 namespace rcrt
00005 {
00006
00007 WaterTexture::WaterTexture()
00008 {
00009 }
00010
00011 WaterTexture::~WaterTexture()
00012 {
00013 }
00014
00015 Vec3D WaterTexture::getBump(const Point2D& p, const float& scale,const Matrix4D& onb) const
00016 {
00017 Point3D p1 = Point3D(p[0]*width,p[1]*width,0.05f * frame);
00018 Point3D p2 = Point3D(p[1]*width,0.05f * frame,p[0]*width);
00019 return (onb *
00020 Vec3D(intensity * PerlinNoise::turbulence(p1,0.01f,2),
00021 intensity * PerlinNoise::turbulence(p2,0.01f,2),
00022 1)).normalize();
00023 }
00024
00025 RGBAColor WaterTexture::getColor(const Point2D& p) const
00026 {
00027 return RGBAColor(1,1,1,1);
00028 }
00029
00030 void WaterTexture::setWidth(const float& w)
00031 {
00032 width = w;
00033 }
00034
00035 void WaterTexture::setIntensity(const float& i)
00036 {
00037 intensity = i;
00038 }
00039
00040 }