1 /** @file material.h  Material definition accessor.
2  *
3  * @authors Copyright © 2015 Daniel Swanson <danij@dengine.net>
4  *
5  * @par License
6  * GPL: http://www.gnu.org/licenses/gpl.html
7  *
8  * <small>This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version. This program is distributed in the hope that it
12  * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details. You should have received a copy of the GNU
15  * General Public License along with this program; if not, see:
16  * http://www.gnu.org/licenses</small>
17  */
18 
19 #ifndef LIBDOOMSDAY_DEFN_MATERIAL_H
20 #define LIBDOOMSDAY_DEFN_MATERIAL_H
21 
22 #include "definition.h"
23 #include <de/RecordAccessor>
24 
25 namespace defn {
26 
27 /**
28  * Utility for handling material-decoration definitions.
29  */
30 class LIBDOOMSDAY_PUBLIC MaterialDecoration : public Definition
31 {
32 public:
MaterialDecoration()33     MaterialDecoration()                                : Definition() {}
MaterialDecoration(MaterialDecoration const & other)34     MaterialDecoration(MaterialDecoration const &other) : Definition(other) {}
MaterialDecoration(de::Record & d)35     MaterialDecoration(de::Record &d)                   : Definition(d) {}
MaterialDecoration(de::Record const & d)36     MaterialDecoration(de::Record const &d)             : Definition(d) {}
37 
38     void resetToDefaults();
39 
40     int stageCount() const;
41     bool hasStage(int index) const;
42 
43     de::Record       &stage(int index);
44     de::Record const &stage(int index) const;
45 
46     de::Record &addStage();
47 };
48 
49 /**
50  * Utility for handling material-layer definitions.
51  */
52 class LIBDOOMSDAY_PUBLIC MaterialLayer : public Definition
53 {
54 public:
MaterialLayer()55     MaterialLayer()                           : Definition() {}
MaterialLayer(MaterialLayer const & other)56     MaterialLayer(MaterialLayer const &other) : Definition(other) {}
MaterialLayer(de::Record & d)57     MaterialLayer(de::Record &d)              : Definition(d) {}
MaterialLayer(de::Record const & d)58     MaterialLayer(de::Record const &d)        : Definition(d) {}
59 
60     void resetToDefaults();
61 
62     int stageCount() const;
63     bool hasStage(int index) const;
64 
65     de::Record       &stage(int index);
66     de::Record const &stage(int index) const;
67 
68     de::Record &addStage();
69 };
70 
71 /**
72  * Utility for handling material definitions.
73  */
74 class LIBDOOMSDAY_PUBLIC Material : public Definition
75 {
76 public:
Material()77     Material()                      : Definition() {}
Material(Material const & other)78     Material(Material const &other) : Definition(other) {}
Material(de::Record & d)79     Material(de::Record &d)         : Definition(d) {}
Material(de::Record const & d)80     Material(de::Record const &d)   : Definition(d) {}
81 
82     void resetToDefaults();
83 
84 public:  // Layers: -----------------------------------------------------
85 
86     int layerCount() const;
87     bool hasLayer(int index) const;
88 
89     de::Record       &layer(int index);
90     de::Record const &layer(int index) const;
91 
92     de::Record &addLayer();
93 
94 public:  // Decorations: ------------------------------------------------
95 
96     int decorationCount() const;
97     bool hasDecoration(int index) const;
98 
99     de::Record       &decoration(int index);
100     de::Record const &decoration(int index) const;
101 
102     de::Record &addDecoration();
103 };
104 
105 }  // namespace defn
106 
107 #endif  // LIBDOOMSDAY_DEFN_MATERIAL_H
108