goat3d

view src/material.h @ 54:dad392c710df

added copyright headers and license files + readme
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 17 Apr 2014 08:50:36 +0300
parents 498ca7ac7047
children
line source
1 /*
2 goat3d - 3D scene, character, and animation file format library.
3 Copyright (C) 2013-2014 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef MATERIAL_H_
19 #define MATERIAL_H_
21 #include <string>
22 #include <map>
23 #include <vmath/vmath.h>
25 namespace g3dimpl {
27 struct MaterialAttrib {
28 Vector4 value;
29 std::string map;
31 MaterialAttrib() : value(1, 1, 1, 1) {}
32 };
34 class Material {
35 private:
36 static MaterialAttrib def_attr;
38 std::map<std::string, MaterialAttrib> attrib;
40 public:
41 std::string name;
43 int get_attrib_count() const;
44 const char *get_attrib_name(int idx) const;
46 MaterialAttrib &operator [](int idx);
47 const MaterialAttrib &operator [](int idx) const;
49 MaterialAttrib &operator [](const std::string &name);
50 const MaterialAttrib &operator [](const std::string &name) const;
51 };
53 } // namespace g3dimpl
55 #endif // MATERIAL_H_