00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #if defined(_MSC_VER)
00025 #pragma once
00026 #endif
00027
00028 #ifndef PBRT_TEXTURES_FBM_H
00029 #define PBRT_TEXTURES_FBM_H
00030
00031
00032 #include "pbrt.h"
00033 #include "texture.h"
00034 #include "paramset.h"
00035
00036
00037 template <typename T> class FBmTexture : public Texture<T> {
00038 public:
00039
00040 ~FBmTexture() {
00041 delete mapping;
00042 }
00043 FBmTexture(int oct, float roughness, TextureMapping3D *map)
00044 : omega(roughness), octaves(oct), mapping(map) { }
00045 T Evaluate(const DifferentialGeometry &dg) const {
00046 Vector dpdx, dpdy;
00047 Point P = mapping->Map(dg, &dpdx, &dpdy);
00048 return FBm(P, dpdx, dpdy, omega, octaves);
00049 }
00050 private:
00051
00052 float omega;
00053 int octaves;
00054 TextureMapping3D *mapping;
00055 };
00056
00057
00058 FBmTexture<float> *CreateFBmFloatTexture(const Transform &tex2world,
00059 const TextureParams &tp);
00060 FBmTexture<Spectrum> *CreateFBmSpectrumTexture(const Transform &tex2world,
00061 const TextureParams &tp);
00062
00063 #endif // PBRT_TEXTURES_FBM_H