erebus

diff liberebus/src/brdf.h @ 2:474a0244f57d

fixed specialization mistake fixed line endings added makefiles
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 28 Apr 2014 06:31:10 +0300
parents 4abdce1361b9
children 93894c232d65
line diff
     1.1 --- a/liberebus/src/brdf.h	Mon Apr 28 05:58:22 2014 +0300
     1.2 +++ b/liberebus/src/brdf.h	Mon Apr 28 06:31:10 2014 +0300
     1.3 @@ -1,67 +1,67 @@
     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;
    1.68 -};
    1.69 -
    1.70 -#endif	// BRDF_H_
    1.71 \ No newline at end of file
    1.72 +#ifndef BRDF_H_
    1.73 +#define BRDF_H_
    1.74 +
    1.75 +#include <map>
    1.76 +#include <string>
    1.77 +#include "color.h"
    1.78 +#include "texture.h"
    1.79 +
    1.80 +class ReflAttrib {
    1.81 +private:
    1.82 +	float value;
    1.83 +	Color color;
    1.84 +	Texture *map;
    1.85 +
    1.86 +public:
    1.87 +
    1.88 +	ReflAttrib();
    1.89 +	explicit ReflAttrib(const Color &color, Texture *tex = 0);
    1.90 +
    1.91 +	void set_value(float val);
    1.92 +	void set_color(const Color &col);
    1.93 +
    1.94 +	void set_map(Texture *tex);
    1.95 +	Texture *get_map() const;
    1.96 +
    1.97 +	float get_value() const;
    1.98 +	float get_value(float u, float v) const;
    1.99 +	const Color &get_color() const;
   1.100 +	Color get_color(float u, float v) const;
   1.101 +};
   1.102 +
   1.103 +
   1.104 +class Reflectance {
   1.105 +private:
   1.106 +	static ReflAttrib def_attrib;
   1.107 +	std::map<std::string, ReflAttrib> attrib;
   1.108 +
   1.109 +	virtual void set_default_attribs();
   1.110 +
   1.111 +public:
   1.112 +	Reflectance();
   1.113 +	virtual ~Reflectance() = default;
   1.114 +
   1.115 +	virtual void set_attrib(const char *name, const Color &color, Texture *tex = 0);
   1.116 +	virtual ReflAttrib &get_attrib(const char *name);
   1.117 +	virtual const ReflAttrib &get_attrib(const char *name) const;
   1.118 +
   1.119 +	virtual float get_attrib_value(const char *name) const;
   1.120 +	virtual float get_attrib_value(const char *name, float u, float v) const;
   1.121 +	virtual Color get_attrib_color(const char *name) const;
   1.122 +	virtual Color get_attrib_color(const char *name, float u, float v) const;
   1.123 +
   1.124 +	virtual Vector3 sample_dir(const Vector3 &norm, const Vector3 &outdir) const = 0;
   1.125 +	virtual float sample(const Vector3 &norm, const Vector3 &outdir, Vector3 *indir) const;
   1.126 +	virtual float eval(const Vector3 &norm, const Vector3 &outdir, const Vector3 &indir) const = 0;
   1.127 +};
   1.128 +
   1.129 +class LambertRefl : public Reflectance {
   1.130 +private:
   1.131 +	void set_default_attribs() override;
   1.132 +
   1.133 +public:
   1.134 +	Vector3 sample_dir(const Vector3 &norm, const Vector3 &outdir) const override;
   1.135 +	float eval(const Vector3 &norm, const Vector3 &outdir, const Vector3 &indir) const override;
   1.136 +};
   1.137 +
   1.138 +#endif	// BRDF_H_