erebus
diff liberebus/src/brdf.h @ 4:93894c232d65
more changes across the board
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 29 Apr 2014 07:38:40 +0300 |
parents | 474a0244f57d |
children | e49f4d7ad04c |
line diff
1.1 --- a/liberebus/src/brdf.h Mon Apr 28 15:44:59 2014 +0300 1.2 +++ b/liberebus/src/brdf.h Tue Apr 29 07:38:40 2014 +0300 1.3 @@ -1,64 +1,19 @@ 1.4 #ifndef BRDF_H_ 1.5 #define BRDF_H_ 1.6 1.7 -#include <map> 1.8 -#include <string> 1.9 -#include "color.h" 1.10 #include "texture.h" 1.11 1.12 -class ReflAttrib { 1.13 -private: 1.14 - float value; 1.15 - Color color; 1.16 - Texture *map; 1.17 - 1.18 -public: 1.19 - 1.20 - ReflAttrib(); 1.21 - explicit ReflAttrib(const Color &color, Texture *tex = 0); 1.22 - 1.23 - void set_value(float val); 1.24 - void set_color(const Color &col); 1.25 - 1.26 - void set_map(Texture *tex); 1.27 - Texture *get_map() const; 1.28 - 1.29 - float get_value() const; 1.30 - float get_value(float u, float v) const; 1.31 - const Color &get_color() const; 1.32 - Color get_color(float u, float v) const; 1.33 -}; 1.34 - 1.35 - 1.36 class Reflectance { 1.37 -private: 1.38 - static ReflAttrib def_attrib; 1.39 - std::map<std::string, ReflAttrib> attrib; 1.40 - 1.41 - virtual void set_default_attribs(); 1.42 - 1.43 public: 1.44 Reflectance(); 1.45 virtual ~Reflectance() = default; 1.46 1.47 - virtual void set_attrib(const char *name, const Color &color, Texture *tex = 0); 1.48 - virtual ReflAttrib &get_attrib(const char *name); 1.49 - virtual const ReflAttrib &get_attrib(const char *name) const; 1.50 - 1.51 - virtual float get_attrib_value(const char *name) const; 1.52 - virtual float get_attrib_value(const char *name, float u, float v) const; 1.53 - virtual Color get_attrib_color(const char *name) const; 1.54 - virtual Color get_attrib_color(const char *name, float u, float v) const; 1.55 - 1.56 virtual Vector3 sample_dir(const Vector3 &norm, const Vector3 &outdir) const = 0; 1.57 virtual float sample(const Vector3 &norm, const Vector3 &outdir, Vector3 *indir) const; 1.58 virtual float eval(const Vector3 &norm, const Vector3 &outdir, const Vector3 &indir) const = 0; 1.59 }; 1.60 1.61 class LambertRefl : public Reflectance { 1.62 -private: 1.63 - void set_default_attribs() override; 1.64 - 1.65 public: 1.66 Vector3 sample_dir(const Vector3 &norm, const Vector3 &outdir) const override; 1.67 float eval(const Vector3 &norm, const Vector3 &outdir, const Vector3 &indir) const override;