ScummVM API documentation
scene_lights_xml_parser.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TETRAEDGE_GAME_SCENE_LIGHTS_XML_PARSER_H
23 #define TETRAEDGE_GAME_SCENE_LIGHTS_XML_PARSER_H
24 
25 #include "common/formats/xmlparser.h"
26 #include "tetraedge/te/te_light.h"
27 #include "tetraedge/te/te_vector3f32.h"
28 #include "tetraedge/te/te_xml_parser.h"
29 
30 namespace Tetraedge {
31 
33 public:
35  _lights(lights), _shadowLightNo(-1), _shadowFarPlane(0),
36  _shadowNearPlane(0), _shadowFov(0), _parent(ParentNone) {}
37 
38  TeColor getShadowColor() { return _shadowColor; }
39  int getShadowLightNo() { return _shadowLightNo; }
40  float getShadowFarPlane() { return _shadowFarPlane; }
41  float getShadowNearPlane() { return _shadowNearPlane; }
42  float getShadowFov() { return _shadowFov; }
43 
44  // Parser
45  CUSTOM_XML_PARSER(SceneLightsXmlParser) {
46  XML_KEY(Global)
47  XML_KEY(Ambient)
48  XML_PROP(r, true)
49  XML_PROP(g, true)
50  XML_PROP(b, true)
51  KEY_END()
52  KEY_END()
53  XML_KEY(Lights)
54  XML_KEY(Light)
55  XML_PROP(Type, true)
56  XML_KEY(Position)
57  XML_PROP(x, true)
58  XML_PROP(y, true)
59  XML_PROP(z, true)
60  KEY_END()
61  XML_KEY(Direction)
62  XML_PROP(h, true)
63  XML_PROP(v, true)
64  KEY_END()
65  XML_KEY(Ambient)
66  XML_PROP(r, true)
67  XML_PROP(g, true)
68  XML_PROP(b, true)
69  KEY_END()
70  XML_KEY(Diffuse)
71  XML_PROP(r, true)
72  XML_PROP(g, true)
73  XML_PROP(b, true)
74  KEY_END()
75  XML_KEY(Specular)
76  XML_PROP(r, true)
77  XML_PROP(g, true)
78  XML_PROP(b, true)
79  KEY_END()
80  XML_KEY(Attenuation)
81  XML_PROP(constant, true)
82  XML_PROP(linear, true)
83  XML_PROP(quadratic, true)
84  KEY_END()
85  XML_KEY(Cutoff)
86  XML_PROP(value, true)
87  KEY_END()
88  XML_KEY(Exponent)
89  XML_PROP(value, true)
90  KEY_END()
91  XML_KEY(DisplaySize)
92  XML_PROP(value, true)
93  KEY_END()
94  KEY_END()
95  KEY_END()
96  XML_KEY(Shadow)
97  XML_KEY(SourceLight)
98  XML_PROP(number, true)
99  KEY_END()
100  XML_KEY(Fov)
101  XML_PROP(value, true)
102  KEY_END()
103  XML_KEY(NearPlane)
104  XML_PROP(value, true)
105  KEY_END()
106  XML_KEY(FarPlane)
107  XML_PROP(value, true)
108  KEY_END()
109  XML_KEY(Color)
110  XML_PROP(r, true)
111  XML_PROP(g, true)
112  XML_PROP(b, true)
113  XML_PROP(a, true)
114  KEY_END()
115  KEY_END()
116  } PARSER_END()
117 
118 private:
120 
121  enum ParentNodeType {
122  ParentNone,
123  ParentGlobal,
124  ParentLight,
125  ParentShadow
126  };
127 
128  TeColor _shadowColor;
129  int _shadowLightNo;
130  float _shadowFarPlane;
131  float _shadowNearPlane;
132  float _shadowFov;
133  ParentNodeType _parent;
134 
135  // Parser callback methods
136  bool parserCallback_Global(ParserNode *node);
137  bool parserCallback_Ambient(ParserNode *node);
138 
139  bool parserCallback_Lights(ParserNode *node);
140  bool parserCallback_Light(ParserNode *node);
141  bool parserCallback_Position(ParserNode *node);
142  bool parserCallback_Direction(ParserNode *node);
143  //bool parserCallback_Ambient(ParserNode *node);
144  bool parserCallback_Diffuse(ParserNode *node);
145  bool parserCallback_Specular(ParserNode *node);
146  bool parserCallback_Attenuation(ParserNode *node);
147  bool parserCallback_Cutoff(ParserNode *node);
148  bool parserCallback_Exponent(ParserNode *node);
149  bool parserCallback_DisplaySize(ParserNode *node);
150 
151  bool parserCallback_Shadow(ParserNode *node);
152  bool parserCallback_SourceLight(ParserNode *node);
153  bool parserCallback_Fov(ParserNode *node);
154  bool parserCallback_NearPlane(ParserNode *node);
155  bool parserCallback_FarPlane(ParserNode *node);
156  bool parserCallback_Color(ParserNode *node);
157 
158 };
159 
160 } // end namespace Tetraedge
161 
162 #endif // TETRAEDGE_GAME_SCENE_LIGHTS_XML_PARSER_H
Definition: detection.h:27
Definition: array.h:52
Definition: te_color.h:30
Definition: xmlparser.h:145
Type
Definition: log.h:33
Definition: te_xml_parser.h:38
Definition: ptr.h:159
Definition: scene_lights_xml_parser.h:32