erebus

diff liberebus/src/material.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
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/liberebus/src/material.h	Tue Apr 29 07:38:40 2014 +0300
     1.3 @@ -0,0 +1,50 @@
     1.4 +#ifndef MATERIAL_H_
     1.5 +#define MATERIAL_H_
     1.6 +
     1.7 +#include <string>
     1.8 +#include <map>
     1.9 +#include "color.h"
    1.10 +#include "texture.h"
    1.11 +
    1.12 +class MatAttrib {
    1.13 +private:
    1.14 +	float value;
    1.15 +	Color color;
    1.16 +	Texture *map;
    1.17 +
    1.18 +public:
    1.19 +	MatAttrib();
    1.20 +	explicit MatAttrib(const Color &color, Texture *tex = 0);
    1.21 +
    1.22 +	void set_value(float val);
    1.23 +	void set_color(const Color &col);
    1.24 +
    1.25 +	void set_map(Texture *tex);
    1.26 +	Texture *get_map() const;
    1.27 +
    1.28 +	float get_value() const;
    1.29 +	float get_value(float u, float v) const;
    1.30 +	const Color &get_color() const;
    1.31 +	Color get_color(float u, float v) const;
    1.32 +};
    1.33 +
    1.34 +class Material {
    1.35 +private:
    1.36 +	static MatAttrib def_attrib;
    1.37 +	std::map<std::string, MatAttrib> attrib;
    1.38 +
    1.39 +public:
    1.40 +	Material();
    1.41 +
    1.42 +	void set_attrib(const char *name, const Color &color, Texture *tex = 0);
    1.43 +	MatAttrib &get_attrib(const char *name);
    1.44 +	const MatAttrib &get_attrib(const char *name) const;
    1.45 +
    1.46 +	float get_attrib_value(const char *name) const;
    1.47 +	float get_attrib_value(const char *name, float u, float v) const;
    1.48 +	Color get_attrib_color(const char *name) const;
    1.49 +	Color get_attrib_color(const char *name, float u, float v) const;
    1.50 +};
    1.51 +
    1.52 +
    1.53 +#endif	// MATERIAL_H_