1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2011
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D is free software; you can redistribute it and/or modify
7 //    it under the terms of the GNU General Public License as published by
8 //    the Free Software Foundation; either version 2 of the License, or
9 //    (at your option) any later version.
10 //
11 //    Scorched3D is distributed in the hope that it will be useful,
12 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //    GNU General Public License for more details.
15 //
16 //    You should have received a copy of the GNU General Public License along
17 //    with this program; if not, write to the Free Software Foundation, Inc.,
18 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #if !defined(__INCLUDE_LandscapeTexh_INCLUDE__)
22 #define __INCLUDE_LandscapeTexh_INCLUDE__
23 
24 #include <landscapedef/LandscapeTexDefn.h>
25 #include <common/ModelID.h>
26 #include <XML/XMLFile.h>
27 #include <string>
28 #include <vector>
29 
30 class ScorchedContext;
31 class LandscapeTexType
32 {
33 public:
34 	enum TexType
35 	{
36 		eNone,
37 		ePrecipitationRain,
38 		ePrecipitationSnow,
39 		eWater,
40 		eTextureGenerate,
41 		eTextureFile
42 	};
43 
44 	virtual bool readXML(XMLNode *node) = 0;
45 	virtual TexType getType() = 0;
46 };
47 
48 class LandscapeTexTypeNone : public LandscapeTexType
49 {
50 public:
51 	virtual bool readXML(XMLNode *node);
getType()52 	virtual TexType getType() { return eNone; }
53 };
54 
55 class LandscapeTexPrecipitation : public LandscapeTexType
56 {
57 public:
58 	int particles;
59 
60 	virtual bool readXML(XMLNode *node);
61 };
62 
63 class LandscapeTexPrecipitationRain : public LandscapeTexPrecipitation
64 {
65 public:
getType()66 	virtual TexType getType() { return ePrecipitationRain; }
67 };
68 
69 class LandscapeTexPrecipitationSnow : public LandscapeTexPrecipitation
70 {
71 public:
getType()72 	virtual TexType getType() { return ePrecipitationSnow; }
73 };
74 
75 class LandscapeTexBorderWater : public LandscapeTexType
76 {
77 public:
78 	// Non-shader
79 	std::string reflection;
80 	std::string texture;
81 	std::string foam;
82 
83 	// Shader
84 	Vector wavetopa;
85 	Vector wavetopb;
86 	Vector wavebottoma;
87 	Vector wavebottomb;
88 	Vector wavelight;
89 
90 	// Both
91 	fixed height;
92 	float waterTransparency;
93 
94 	virtual bool readXML(XMLNode *node);
getType()95 	virtual TexType getType() { return eWater; }
96 };
97 
98 class LandscapeTexTextureGenerate : public LandscapeTexType
99 {
100 public:
101 	std::string roof;
102 	std::string rockside;
103 	std::string shore;
104 	std::string texture0;
105 	std::string texture1;
106 	std::string texture2;
107 	std::string texture3;
108 
109 	virtual bool readXML(XMLNode *node);
getType()110 	virtual TexType getType() { return eTextureGenerate; }
111 };
112 
113 class LandscapeTexTextureFile : public LandscapeTexType
114 {
115 public:
116 	std::string texture;
117 	std::string surroundTexture;
118 
119 	virtual bool readXML(XMLNode *node);
getType()120 	virtual TexType getType() { return eTextureFile; }
121 };
122 
123 class LandscapeTex
124 {
125 public:
126 	LandscapeTex();
127 	virtual ~LandscapeTex();
128 
129 	unsigned int seed;
130 	std::string detail;
131 	std::string magmasmall;
132 	std::string scorch;
133 	Vector fog;
134 	Vector suncolor;
135 	bool nosunfog;
136 	bool nohorizonglow;
137 	bool nosunblend;
138 	std::string suntexture;
139 	std::string suntexturemask;
140 	float fogdensity;
141 	std::string skytexture;
142 	std::string skytexturestatic;
143 	std::string skytexturemask;
144 	std::string skycolormap;
145 	std::string skyline;
146 	std::string skylinemask;
147 	int skytimeofday;
148 	float skysunxy;
149 	float skysunyz;
150 	Vector skydiffuse;
151 	Vector skyambience;
152 
153 	LandscapeTexType *border;
154 	LandscapeTexType *texture;
155 	LandscapeTexType *precipitation;
156 	LandscapeTexDefn texDefn;
157 
158 	bool readXML(LandscapeDefinitions *definitions, XMLNode *node);
159 
160 private:
161 	LandscapeTex(const LandscapeTex &other);
162 	LandscapeTex &operator=(LandscapeTex &other);
163 };
164 
165 #endif
166