Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MapWriter.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2013 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "precompiled.h"
19 
20 #include "Camera.h"
21 #include "CinemaTrack.h"
22 #include "GameView.h"
23 #include "LightEnv.h"
24 #include "MapReader.h"
25 #include "MapWriter.h"
26 #include "Patch.h"
27 #include "Terrain.h"
28 #include "TerrainTextureEntry.h"
29 #include "TerrainTextureManager.h"
30 
31 #include "maths/MathUtil.h"
32 #include "maths/NUSpline.h"
33 #include "ps/CLogger.h"
34 #include "ps/Loader.h"
35 #include "ps/Filesystem.h"
36 #include "ps/XML/XMLWriter.h"
38 #include "renderer/SkyManager.h"
39 #include "renderer/WaterManager.h"
47 
48 ///////////////////////////////////////////////////////////////////////////////////////////////////
49 // CMapWriter constructor: nothing to do at the minute
51 {
52 }
53 
54 ///////////////////////////////////////////////////////////////////////////////////////////////////
55 // SaveMap: try to save the current map to the given file
56 void CMapWriter::SaveMap(const VfsPath& pathname, CTerrain* pTerrain,
57  WaterManager* pWaterMan, SkyManager* pSkyMan,
58  CLightEnv* pLightEnv, CCamera* pCamera, CCinemaManager* pCinema,
59  CPostprocManager* pPostproc,
60  CSimulation2* pSimulation2)
61 {
62  CFilePacker packer(FILE_VERSION, "PSMP");
63 
64  // build necessary data
65  PackMap(packer, pTerrain);
66 
67  try
68  {
69  // write it out
70  packer.Write(pathname);
71  }
73  {
74  LOGERROR(L"Failed to write map '%ls'", pathname.string().c_str());
75  return;
76  }
77 
78  VfsPath pathnameXML = pathname.ChangeExtension(L".xml");
79  WriteXML(pathnameXML, pWaterMan, pSkyMan, pLightEnv, pCamera, pCinema, pPostproc, pSimulation2);
80 }
81 
82 ///////////////////////////////////////////////////////////////////////////////////////////////////
83 // GetHandleIndex: return the index of the given handle in the given list; or 0xFFFF if
84 // handle isn't in list
85 static u16 GetEntryIndex(const CTerrainTextureEntry* entry, const std::vector<CTerrainTextureEntry*>& entries)
86 {
87  const size_t limit = std::min(entries.size(), size_t(0xFFFEu)); // paranoia
88  for (size_t i=0;i<limit;i++) {
89  if (entries[i]==entry) {
90  return (u16)i;
91  }
92  }
93 
94  return 0xFFFF;
95 }
96 
97 ///////////////////////////////////////////////////////////////////////////////////////////////////
98 // EnumTerrainTextures: build lists of textures used by map, and tile descriptions for
99 // each tile on the terrain
101  std::vector<CStr>& textures,
102  std::vector<STileDesc>& tiles)
103 {
104  // the list of all handles in use
105  std::vector<CTerrainTextureEntry*> entries;
106 
107  // resize tile array to required size
108  tiles.resize(SQR(pTerrain->GetVerticesPerSide()-1));
109  STileDesc* tileptr=&tiles[0];
110 
111  // now iterate through all the tiles
112  const ssize_t patchesPerSide=pTerrain->GetPatchesPerSide();
113  for (ssize_t j=0;j<patchesPerSide;j++) {
114  for (ssize_t i=0;i<patchesPerSide;i++) {
115  for (ssize_t m=0;m<PATCH_SIZE;m++) {
116  for (ssize_t k=0;k<PATCH_SIZE;k++) {
117  CMiniPatch& mp=pTerrain->GetPatch(i,j)->m_MiniPatches[m][k]; // can't fail
118  u16 index=u16(GetEntryIndex(mp.GetTextureEntry(),entries));
119  if (index==0xFFFF) {
120  index=(u16)entries.size();
121  entries.push_back(mp.GetTextureEntry());
122  }
123 
124  tileptr->m_Tex1Index=index;
125  tileptr->m_Tex2Index=0xFFFF;
126  tileptr->m_Priority=mp.GetPriority();
127  tileptr++;
128  }
129  }
130  }
131  }
132 
133  // now find the texture names for each handle
134  for (size_t i=0;i<entries.size();i++) {
135  CStr texturename;
136  CTerrainTextureEntry* texentry=entries[i];
137  if (!texentry) {
138  // uh-oh, this shouldn't happen; set texturename to empty string
139  texturename="";
140  } else {
141  texturename=texentry->GetTag();
142  }
143  textures.push_back(texturename);
144  }
145 }
146 
147 ///////////////////////////////////////////////////////////////////////////////////////////////////
148 // PackMap: pack the current world into a raw data stream
149 void CMapWriter::PackMap(CFilePacker& packer, CTerrain* pTerrain)
150 {
151  // now pack everything up
152  PackTerrain(packer, pTerrain);
153 }
154 
155 ///////////////////////////////////////////////////////////////////////////////////////////////////
156 // PackTerrain: pack the terrain onto the end of the output data stream
157 // - data: map size, heightmap, list of textures used by map, texture tile assignments
159 {
160  // pack map size
161  const ssize_t mapsize = pTerrain->GetPatchesPerSide();
162  packer.PackSize(mapsize);
163 
164  // pack heightmap
165  packer.PackRaw(pTerrain->GetHeightMap(),sizeof(u16)*SQR(pTerrain->GetVerticesPerSide()));
166 
167  // the list of textures used by map
168  std::vector<CStr> terrainTextures;
169  // descriptions of each tile
170  std::vector<STileDesc> tiles;
171 
172  // build lists by scanning through the terrain
173  EnumTerrainTextures(pTerrain, terrainTextures, tiles);
174 
175  // pack texture names
176  const size_t numTextures = terrainTextures.size();
177  packer.PackSize(numTextures);
178  for (size_t i=0;i<numTextures;i++)
179  packer.PackString(terrainTextures[i]);
180 
181  // pack tile data
182  packer.PackRaw(&tiles[0],sizeof(STileDesc)*tiles.size());
183 }
184 
185 void CMapWriter::WriteXML(const VfsPath& filename,
186  WaterManager* pWaterMan, SkyManager* pSkyMan,
187  CLightEnv* pLightEnv, CCamera* pCamera, CCinemaManager* pCinema,
188  CPostprocManager* pPostproc,
189  CSimulation2* pSimulation2)
190 {
191  XML_Start();
192 
193  {
194  XML_Element("Scenario");
195  XML_Attribute("version", (int)FILE_VERSION);
196 
197  if (pSimulation2 && !pSimulation2->GetStartupScript().empty())
198  {
199  XML_Element("Script");
200  XML_CDATA(pSimulation2->GetStartupScript().c_str());
201  }
202 
203  {
204  XML_Element("Environment");
205 
206  XML_Setting("SkySet", pSkyMan->GetSkySet());
207  {
208  XML_Element("SunColour");
209  XML_Attribute("r", pLightEnv->m_SunColor.X); // yes, it's X/Y/Z...
210  XML_Attribute("g", pLightEnv->m_SunColor.Y);
211  XML_Attribute("b", pLightEnv->m_SunColor.Z);
212  }
213  {
214  XML_Element("SunElevation");
215  XML_Attribute("angle", pLightEnv->m_Elevation);
216  }
217  {
218  XML_Element("SunRotation");
219  XML_Attribute("angle", pLightEnv->m_Rotation);
220  }
221  {
222  XML_Element("TerrainAmbientColour");
223  XML_Attribute("r", pLightEnv->m_TerrainAmbientColor.X);
224  XML_Attribute("g", pLightEnv->m_TerrainAmbientColor.Y);
225  XML_Attribute("b", pLightEnv->m_TerrainAmbientColor.Z);
226  }
227  {
228  XML_Element("UnitsAmbientColour");
229  XML_Attribute("r", pLightEnv->m_UnitsAmbientColor.X);
230  XML_Attribute("g", pLightEnv->m_UnitsAmbientColor.Y);
231  XML_Attribute("b", pLightEnv->m_UnitsAmbientColor.Z);
232  }
233  {
234  XML_Element("Fog");
235  XML_Setting("FogFactor", pLightEnv->m_FogFactor);
236  XML_Setting("FogThickness", pLightEnv->m_FogMax);
237  {
238  XML_Element("FogColour");
239  XML_Attribute("r", pLightEnv->m_FogColor.X);
240  XML_Attribute("g", pLightEnv->m_FogColor.Y);
241  XML_Attribute("b", pLightEnv->m_FogColor.Z);
242  }
243  }
244 
245  {
246  XML_Element("Water");
247  {
248  XML_Element("WaterBody");
249  XML_Setting("Type", "default");
250  {
251  XML_Element("Colour");
252  XML_Attribute("r", pWaterMan->m_WaterColor.r);
253  XML_Attribute("g", pWaterMan->m_WaterColor.g);
254  XML_Attribute("b", pWaterMan->m_WaterColor.b);
255  }
256  CmpPtr<ICmpWaterManager> cmpWaterManager(*pSimulation2, SYSTEM_ENTITY);
257  ENSURE(cmpWaterManager);
258  XML_Setting("Height", cmpWaterManager->GetExactWaterLevel(0, 0));
259  XML_Setting("Shininess", pWaterMan->m_Shininess);
260  XML_Setting("Waviness", pWaterMan->m_Waviness);
261  XML_Setting("Murkiness", pWaterMan->m_Murkiness);
262  {
263  XML_Element("Tint");
264  XML_Attribute("r", pWaterMan->m_WaterTint.r);
265  XML_Attribute("g", pWaterMan->m_WaterTint.g);
266  XML_Attribute("b", pWaterMan->m_WaterTint.b);
267  }
268  {
269  XML_Element("ReflectionTint");
270  XML_Attribute("r", pWaterMan->m_ReflectionTint.r);
271  XML_Attribute("g", pWaterMan->m_ReflectionTint.g);
272  XML_Attribute("b", pWaterMan->m_ReflectionTint.b);
273  }
274  XML_Setting("ReflectionTintStrength", pWaterMan->m_ReflectionTintStrength);
275  }
276  }
277 
278  {
279  XML_Element("Postproc");
280  {
281  XML_Setting("Brightness", pLightEnv->m_Brightness);
282  XML_Setting("Contrast", pLightEnv->m_Contrast);
283  XML_Setting("Saturation", pLightEnv->m_Saturation);
284  XML_Setting("Bloom", pLightEnv->m_Bloom);
285  XML_Setting("PostEffect", pPostproc->GetPostEffect());
286  }
287  }
288  }
289 
290  {
291  XML_Element("Camera");
292 
293  {
294  XML_Element("Position");
295  CVector3D pos = pCamera->m_Orientation.GetTranslation();
296  XML_Attribute("x", pos.X);
297  XML_Attribute("y", pos.Y);
298  XML_Attribute("z", pos.Z);
299  }
300 
301  CVector3D in = pCamera->m_Orientation.GetIn();
302  // Convert to spherical coordinates
303  float rotation = atan2(in.X, in.Z);
304  float declination = atan2(sqrt(in.X*in.X + in.Z*in.Z), in.Y) - (float)M_PI/2;
305 
306  {
307  XML_Element("Rotation");
308  XML_Attribute("angle", rotation);
309  }
310  {
311  XML_Element("Declination");
312  XML_Attribute("angle", declination);
313  }
314  }
315 
316  if (pSimulation2)
317  {
318  std::string settings = pSimulation2->GetMapSettingsString();
319  if (!settings.empty())
320  {
321  XML_Element("ScriptSettings");
322  XML_CDATA(("\n" + settings + "\n").c_str());
323  }
324  }
325 
326  {
327  XML_Element("Entities");
328 
329  CSimulation2& sim = *pSimulation2;
330 
331  CmpPtr<ICmpTemplateManager> cmpTemplateManager(sim, SYSTEM_ENTITY);
332  ENSURE(cmpTemplateManager);
333 
334  // This will probably need to be changed in the future, but for now we'll
335  // just save all entities that have a position
337  for (CSimulation2::InterfaceList::const_iterator it = ents.begin(); it != ents.end(); ++it)
338  {
339  entity_id_t ent = it->first;
340 
341  // Don't save local entities (placement previews etc)
342  if (ENTITY_IS_LOCAL(ent))
343  continue;
344 
345  XML_Element("Entity");
346  XML_Attribute("uid", ent);
347 
348  XML_Setting("Template", cmpTemplateManager->GetCurrentTemplateName(ent));
349 
350  CmpPtr<ICmpOwnership> cmpOwnership(sim, ent);
351  if (cmpOwnership)
352  XML_Setting("Player", (int)cmpOwnership->GetOwner());
353 
354  CmpPtr<ICmpPosition> cmpPosition(sim, ent);
355  if (cmpPosition)
356  {
357  CFixedVector3D pos = cmpPosition->GetPosition();
358  CFixedVector3D rot = cmpPosition->GetRotation();
359  {
360  XML_Element("Position");
361  XML_Attribute("x", pos.X);
362  XML_Attribute("z", pos.Z);
363  // TODO: height offset etc
364  }
365  {
366  XML_Element("Orientation");
367  XML_Attribute("y", rot.Y);
368  // TODO: X, Z maybe
369  }
370  }
371 
372  CmpPtr<ICmpObstruction> cmpObstruction(sim, ent);
373  if (cmpObstruction)
374  {
375  // TODO: Currently only necessary because Atlas
376  // does not set up control groups for its walls.
377  cmpObstruction->ResolveFoundationCollisions();
378 
379  entity_id_t group = cmpObstruction->GetControlGroup();
380  entity_id_t group2 = cmpObstruction->GetControlGroup2();
381 
382  // Don't waste space writing the default control groups.
383  if (group != ent || group2 != INVALID_ENTITY)
384  {
385  XML_Element("Obstruction");
386  if (group != ent)
387  XML_Attribute("group", group);
388  if (group2 != INVALID_ENTITY)
389  XML_Attribute("group2", group2);
390  }
391  }
392 
393  CmpPtr<ICmpVisual> cmpVisual(sim, ent);
394  if (cmpVisual)
395  {
396  u32 seed = cmpVisual->GetActorSeed();
397  if (seed != (u32)ent)
398  {
399  XML_Element("Actor");
400  XML_Attribute("seed", seed);
401  }
402  // TODO: variation/selection strings
403  }
404  }
405  }
406 
407  const std::map<CStrW, CCinemaPath>& paths = pCinema->GetAllPaths();
408  std::map<CStrW, CCinemaPath>::const_iterator it = paths.begin();
409 
410  {
411  XML_Element("Paths");
412 
413  for ( ; it != paths.end(); ++it )
414  {
415  CStrW name = it->first;
416  float timescale = it->second.GetTimescale();
417 
418  XML_Element("Path");
419  XML_Attribute("name", name);
420  XML_Attribute("timescale", timescale);
421 
422  const std::vector<SplineData>& nodes = it->second.GetAllNodes();
423  const CCinemaData* data = it->second.GetData();
424 
425  {
426  XML_Element("Distortion");
427  XML_Attribute("mode", data->m_Mode);
428  XML_Attribute("style", data->m_Style);
429  XML_Attribute("growth", data->m_Growth);
430  XML_Attribute("switch", data->m_Switch);
431  }
432 
433  for ( ssize_t j=nodes.size()-1; j >= 0; --j )
434  {
435  XML_Element("Node");
436 
437  {
438  XML_Element("Position");
439  XML_Attribute("x", nodes[j].Position.X);
440  XML_Attribute("y", nodes[j].Position.Y);
441  XML_Attribute("z", nodes[j].Position.Z);
442  }
443 
444  {
445  XML_Element("Rotation");
446  XML_Attribute("x", nodes[j].Rotation.X);
447  XML_Attribute("y", nodes[j].Rotation.Y);
448  XML_Attribute("z", nodes[j].Rotation.Z);
449  }
450 
451  XML_Setting("Time", nodes[j].Distance);
452  }
453  }
454  }
455  }
456  if (!XML_StoreVFS(g_VFS, filename))
457  LOGERROR(L"Failed to write map '%ls'", filename.string().c_str());
458 }
459 
460 /*
461 void CMapWriter::WriteTriggerGroup(XMLWriter_File& xml_file_, const MapTriggerGroup& group, const std::list<MapTriggerGroup>& groupList)
462 {
463  XML_Element("Group");
464  XML_Attribute("name", group.name);
465 
466  for ( std::list<CStrW>::const_iterator it = group.childGroups.begin();
467  it != group.childGroups.end(); ++it )
468  {
469  //Not very efficient...
470  std::list<MapTriggerGroup>::const_iterator it2 = std::find(groupList.begin(), groupList.end(), *it);
471  if ( it2 != groupList.end() )
472  WriteTriggerGroup(xml_file_, *it2, groupList);
473  else
474  debug_warn(L"Invalid trigger group ID while writing map");
475  }
476 
477  for ( std::list<MapTrigger>::const_iterator it = group.triggers.begin(); it != group.triggers.end(); ++it )
478  {
479  WriteTrigger(xml_file_, *it);
480  }
481 }
482 
483 void CMapWriter::WriteTrigger(XMLWriter_File& xml_file_, const MapTrigger& trigger)
484 {
485  XML_Element("Trigger");
486  XML_Attribute("name", trigger.name);
487 
488  {
489  if ( trigger.active )
490  XML_Setting("Active", "true");
491  else
492  XML_Setting("Active", "false");
493  XML_Setting("MaxRunCount", trigger.maxRunCount);
494  XML_Setting("Delay", trigger.timeValue);
495  }
496 
497  {
498  XML_Element("Conditions");
499  for ( std::list<MapTriggerCondition>::const_iterator it2 = trigger.conditions.begin();
500  it2 != trigger.conditions.end(); ++it2 )
501  {
502  size_t distance = std::distance( trigger.conditions.begin(), it2 );
503  std::set<MapTriggerLogicBlock>::const_iterator logicIter;
504 
505  if ( ( logicIter = trigger.logicBlocks.find(MapTriggerLogicBlock(distance)) )
506  != trigger.logicBlocks.end() )
507  {
508  XML_Element("LogicBlock");
509  if ( logicIter->negated )
510  XML_Attribute("not", "true");
511  else
512  XML_Attribute("not", "false");
513  }
514 
515  {
516  XML_Element("Condition");
517  XML_Attribute("name", it2->name);
518 
519  XML_Attribute("function", it2->functionName);
520  XML_Attribute("display", it2->displayName);
521 
522  if ( it2->negated )
523  XML_Attribute("not", "true");
524  else
525  XML_Attribute("not", "false");
526 
527  for ( std::list<CStrW>::const_iterator paramIter = it2->parameters.begin();
528  paramIter != it2->parameters.end(); ++paramIter )
529  {
530  CStrW paramString(*paramIter);
531  //paramString.Replace(L"<", L"&lt;");
532  //paramString.Replace(L">", L"&gt;");
533  XML_Setting("Parameter", paramString);
534  }
535  if ( it2->linkLogic == 1 )
536  XML_Setting("LinkLogic", "AND");
537  else if ( it2->linkLogic == 2 )
538  XML_Setting("LinkLogic", "OR");
539 
540  if ( trigger.logicBlockEnds.find(distance) != trigger.logicBlockEnds.end() )
541  {
542  XML_Element("LogicBlockEnd");
543  }
544  }
545  } //Read all conditions
546  } //Conditions' scope
547 
548  {
549  XML_Element("Effects");
550  for ( std::list<MapTriggerEffect>::const_iterator it2 = trigger.effects.begin();
551  it2 != trigger.effects.end(); ++it2 )
552  {
553  XML_Element("Effect");
554  XML_Attribute("name", it2->name);
555  {
556  XML_Setting("function", it2->functionName);
557  XML_Setting("display", it2->displayName);
558 
559  for ( std::list<CStrW>::const_iterator paramIter = it2->parameters.begin();
560  paramIter != it2->parameters.end(); ++paramIter )
561  {
562  XML_Setting("Parameter", *paramIter);
563  }
564  }
565  }
566  } //Effects' scope
567 }
568 */
#define M_PI
Definition: wposix.h:64
CTerrainTextureEntry * GetTextureEntry()
Definition: MiniPatch.h:42
float m_Switch
Definition: CinemaTrack.h:49
float g
Definition: Overlay.h:57
float m_Shininess
Definition: WaterManager.h:118
float m_Growth
Definition: CinemaTrack.h:48
#define LOGERROR
Definition: CLogger.h:35
#define XML_Start()
Definition: XMLWriter.h:71
static u16 GetEntryIndex(const CTerrainTextureEntry *entry, const std::vector< CTerrainTextureEntry * > &entries)
Definition: MapWriter.cpp:85
#define ENTITY_IS_LOCAL(id)
Definition: Entity.h:60
int GetPriority()
Definition: MiniPatch.h:43
void WriteXML(const VfsPath &pathname, WaterManager *pWaterMan, SkyManager *pSkyMan, CLightEnv *pLightEnv, CCamera *pCamera, CCinemaManager *pCinema, CPostprocManager *pPostproc, CSimulation2 *pSimulation2)
Definition: MapWriter.cpp:185
void SaveMap(const VfsPath &pathname, CTerrain *pTerr, WaterManager *pWaterMan, SkyManager *pSkyMan, CLightEnv *pLightEnv, CCamera *pCamera, CCinemaManager *pCinema, CPostprocManager *pPostproc, CSimulation2 *pSimulation2)
Definition: MapWriter.cpp:56
RGBColor m_TerrainAmbientColor
Definition: LightEnv.h:70
float m_Waviness
Definition: WaterManager.h:120
#define XML_Element(name)
Definition: XMLWriter.h:80
#define XML_Setting(name, value)
Definition: XMLWriter.h:92
ssize_t GetVerticesPerSide() const
Definition: Terrain.h:65
static Node nodes[os_cpu_MaxProcessors]
Definition: wnuma.cpp:56
void PackRaw(const void *rawData, size_t rawDataSize)
pack given number of bytes onto the end of the data stream
Definition: FileIo.cpp:78
#define SQR(x)
Definition: MathUtil.h:23
virtual void ResolveFoundationCollisions()=0
Detects collisions between foundation-blocking entities and tries to fix them by setting control grou...
RGBColor m_SunColor
Definition: LightEnv.h:69
u32 m_Priority
Definition: MapIO.h:37
std::string GetMapSettingsString()
Get the current map settings as a UTF-8 JSON string.
helper class for writing binary files.
Definition: FileIo.h:52
const entity_id_t SYSTEM_ENTITY
Entity ID for singleton &#39;system&#39; components.
Definition: Entity.h:44
Public API for simulation system.
Definition: Simulation2.h:46
void PackTerrain(CFilePacker &packer, CTerrain *pTerrain)
Definition: MapWriter.cpp:158
float m_Elevation
Height of sun above the horizon, in radians.
Definition: LightEnv.h:46
RGBColor m_UnitsAmbientColor
Definition: LightEnv.h:71
RGBColor m_FogColor
Definition: LightEnv.h:72
u16 m_Tex2Index
Definition: MapIO.h:35
CVector3D GetIn() const
Definition: Matrix3D.cpp:253
void EnumTerrainTextures(CTerrain *pTerrain, std::vector< CStr > &textures, std::vector< STileDesc > &tileIndices)
Definition: MapWriter.cpp:100
u16 m_Tex1Index
Definition: MapIO.h:33
std::vector< std::pair< entity_id_t, IComponent * > > InterfaceList
Definition: Simulation2.h:196
float m_Murkiness
Definition: WaterManager.h:121
#define ENSURE(expr)
ensure the expression &lt;expr&gt; evaluates to non-zero.
Definition: debug.h:282
float b
Definition: Overlay.h:57
float X
Definition: Vector3D.h:31
Definition: path.h:75
CColor m_WaterTint
Definition: WaterManager.h:116
virtual entity_id_t GetControlGroup2()=0
float m_FogMax
Definition: LightEnv.h:75
float m_Rotation
Direction of sun on the compass, in radians.
Definition: LightEnv.h:54
float Y
Definition: Vector3D.h:31
const String & string() const
Definition: path.h:123
virtual u32 GetActorSeed()=0
Get actor seed used for random variations.
float m_Bloom
Definition: LightEnv.h:77
Definition: Camera.h:39
const std::map< CStrW, CCinemaPath > & GetAllPaths()
Definition: CinemaTrack.h:153
virtual float GetExactWaterLevel(float x, float z)=0
Get the current water level at the given point.
float m_Contrast
Definition: LightEnv.h:77
A simplified syntax for accessing entity components.
Definition: CmpPtr.h:55
intptr_t ssize_t
Definition: wposix_types.h:82
#define XML_StoreVFS(vfs, pathname)
Definition: XMLWriter.h:98
#define u16
Definition: types.h:40
const CStrW & GetPostEffect() const
#define u32
Definition: types.h:41
Path ChangeExtension(Path extension) const
Definition: path.h:185
float m_ReflectionTintStrength
Definition: WaterManager.h:123
CPatch * GetPatch(ssize_t i, ssize_t j) const
Definition: Terrain.cpp:283
const CCinemaData * GetData() const
Definition: CinemaTrack.h:44
InterfaceList GetEntitiesWithInterface(int iid)
Returns a list of components implementing the given interface, and their associated entities...
float m_FogFactor
Definition: LightEnv.h:74
void Write(const VfsPath &filename)
write out to file all packed data added so far.
Definition: FileIo.cpp:62
const CStrW & GetSkySet() const
GetSkySet(): Return the currently selected sky set name.
Definition: SkyManager.h:47
CColor m_WaterColor
Definition: WaterManager.h:74
float m_Saturation
Definition: LightEnv.h:77
CMiniPatch m_MiniPatches[PATCH_SIZE][PATCH_SIZE]
Definition: Patch.h:66
CMatrix3D m_Orientation
Definition: Camera.h:112
float m_Brightness
Definition: LightEnv.h:77
void PackSize(size_t value)
convenience: convert a number (almost always a size type) to little-endian u32 and pack that...
Definition: FileIo.cpp:83
float Z
Definition: Vector3D.h:31
#define XML_Attribute(name, value)
Definition: XMLWriter.h:89
virtual entity_id_t GetControlGroup()=0
See SetControlGroup.
u16 * GetHeightMap() const
Definition: Terrain.h:103
CVector3D GetTranslation() const
Definition: Matrix3D.cpp:195
Class CLightEnv: description of a lighting environment - contains all the necessary parameters for re...
Definition: LightEnv.h:36
virtual std::string GetCurrentTemplateName(entity_id_t ent)=0
Returns the name of the template most recently specified for the entity &#39;ent&#39;.
ssize_t GetPatchesPerSide() const
Definition: Terrain.h:69
const entity_id_t INVALID_ENTITY
Invalid entity ID.
Definition: Entity.h:36
PIVFS g_VFS
Definition: Filesystem.cpp:30
void PackMap(CFilePacker &packer, CTerrain *pTerrain)
Definition: MapWriter.cpp:149
u32 entity_id_t
Entity ID type.
Definition: Entity.h:24
void PackString(const CStr &str)
pack a string onto the end of the data stream (encoded as a 32-bit length followed by the characters)...
Definition: FileIo.cpp:89
const std::string & GetStartupScript()
Get the current startup script.
#define XML_CDATA(text)
Definition: XMLWriter.h:86
const ssize_t PATCH_SIZE
Definition: Patch.h:34
float r
Definition: Overlay.h:57
Class WaterManager: Maintain water settings and textures.
Definition: WaterManager.h:49
CColor m_ReflectionTint
Definition: WaterManager.h:122
Class SkyManager: Maintain sky settings and textures, and render the sky.
Definition: SkyManager.h:30