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_WRINKLED_H
00029 #define PBRT_TEXTURES_WRINKLED_H
00030
00031
00032 #include "pbrt.h"
00033 #include "texture.h"
00034 #include "paramset.h"
00035
00036
00037 template <typename T> class WrinkledTexture : public Texture<T> {
00038 public:
00039
00040 ~WrinkledTexture() {
00041 delete mapping;
00042 }
00043 WrinkledTexture(int oct, float roughness, TextureMapping3D *map) {
00044 omega = roughness;
00045 octaves = oct;
00046 mapping = map;
00047 }
00048 T Evaluate(const DifferentialGeometry &dg) const {
00049 Vector dpdx, dpdy;
00050 Point P = mapping->Map(dg, &dpdx, &dpdy);
00051 return Turbulence(P, dpdx, dpdy, omega, octaves);
00052 }
00053 private:
00054
00055 int octaves;
00056 float omega;
00057 TextureMapping3D *mapping;
00058 };
00059
00060
00061 WrinkledTexture<float> *CreateWrinkledFloatTexture(const Transform &tex2world,
00062 const TextureParams &tp);
00063 WrinkledTexture<Spectrum> *CreateWrinkledSpectrumTexture(const Transform &tex2world,
00064 const TextureParams &tp);
00065
00066 #endif // PBRT_TEXTURES_WRINKLED_H