DunGen  1.1
Dungeongenerator library for Irrlicht
DunGen.h
1 // Copyright (C) 2011-2014 by Maximilian Hönig
2 // This file is part of "DunGen - the Dungeongenerator".
3 // For conditions of distribution and use, see licence.txt provided together with DunGen.
4 
5 #ifndef DUNGEN_H
6 #define DUNGEN_H
7 
8 #include "ArchitectCommon.h"
9 #include "CorridorCommon.h"
10 #include "LSystemCommon.h"
11 #include "MeshCaveCommon.h"
12 #include "VoxelCaveCommon.h"
13 #include <irrlicht.h>
14 #include <string>
15 
16 #define DllExport __declspec(dllexport)
17 
19 namespace DunGen
20 {
21  class CDunGenXMLReader;
22  class CDungeonGenerator;
23  class CMaterialProvider;
24 
26  class DllExport CDunGen
27  {
28  public:
31  CDunGen(irr::IrrlichtDevice* irrDevice);
32 
34  ~CDunGen();
35 
37  void StartUp();
38 
40  void ShutDown();
41 
47  void ClearRoomsAndCorridors();
48 
49  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50  // generators
51  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52 
53  // L-system creation functions:
54 
58  unsigned int CreateLSystemDerivation(unsigned int desiredIteration);
59 
60  // Voxel cave creation functions:
61 
63  void CreateVoxelCave();
64 
67  void ErodeVoxelCave(double erosionLikelihood);
68 
70  void RemoveHoveringVoxelFragments();
71 
72  // Mesh cave creation functions:
73 
75  void CreateMeshCave();
76 
77  // Room creation functions:
78 
85  bool CreateRoom(unsigned int roompatternIndex, const irr::core::vector3d<double>& position,
86  const irr::core::vector3d<double>& rotation, const irr::core::vector3d<double>& scaleFactor);
87 
88  // Corridor creation functions:
89 
101  bool CreateCorridorRoomRoom(unsigned int room0, unsigned int dockingSite0, double distance0, double strenght0,
102  unsigned int room1, unsigned int dockingSite1, double distance1, double strenght1,
103  bool& sightBlocking);
104 
117  bool CreateCorridorRoomCave(unsigned int room0, unsigned int dockingSite0, double distance0, double strenght0,
118  const irr::core::vector3d<unsigned int>& minVox1, const irr::core::vector3d<unsigned int>& maxVox1,
119  EDirection::Enum direction1, double distance1, double strenght1,
120  bool& sightBlocking);
121 
135  bool CreateCorridorCaveCave(const irr::core::vector3d<unsigned int>& minVox0, const irr::core::vector3d<unsigned int>& maxVox0,
136  EDirection::Enum direction0, double distance0, double strenght0,
137  const irr::core::vector3d<unsigned int>& minVox1, const irr::core::vector3d<unsigned int>& maxVox1,
138  EDirection::Enum direction1, double distance1, double strenght1,
139  bool& sightBlocking);
140 
141  // Dungeon creation functions:
142 
146  bool ReadDungeonFromFile(const irr::io::path& filename);
147 
151  void AddDungeon(irr::scene::ISceneNode* parentNode, irr::scene::ISceneManager* sceneManager);
152 
153  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
154  // parameters
155  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
156 
162  void RandomGeneratorSetParameters(unsigned int seed, unsigned int a, unsigned int c, unsigned int m);
163 
164  // L-system parameter functions:
165 
169  void LSystemAddRule(char symbol, const std::string& substitution);
170 
172  void LSystemDeleteRules();
173 
176  void LSystemSetStart(const std::string& start);
177 
181  void LSystemSetParameter(ELSystemParameter::Enum parameter, double value);
182 
183  // Voxel cave parameter functions:
184 
188  void VoxelCaveSetParameters(unsigned int border, unsigned int mindrawradius);
189 
192  unsigned int VoxelCaveEstimateMeshComplexity() const;
193 
194  // Mesh cave parameter functions:
195 
201  void MeshCaveSetWarpParameters(bool warpEnabled, bool smoothEnabled, unsigned int warpRandomSeed, double warpStrength);
202 
205  void MeshCaveSetNormalWeightMethod(ENormalWeightMethod::Enum value);
206 
207  // Corridor parameters:
208 
212  void CorridorSetDistances(double distance, double textureDistance);
213 
218  void CorrdidorAddPoint(double x, double y, double textureX);
219 
221  void CorrdidorRemovePoints();
222 
225  void CorrdidorAddDetailObject(const SDetailobjectParameters& parameters);
226 
228  void CorrdidorRemoveDetailobjects();
229 
232  void RoomPatternLoad(const irr::io::path filename);
233 
234  // Material parameters:
235 
240  void MaterialSetCorridor(const irr::io::path& textureFilename, bool backFaceCulling, bool antiAliasing);
241 
246  void MaterialSetCaveSingleColor(const irr::video::SColorf& color, bool backFaceCulling, bool antiAliasing);
247 
251  void MaterialSetCaveMultiColor(bool backFaceCulling, bool antiAliasing);
252 
255  void SetPrintToConsole(bool value);
256 
257  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
258  // other
259  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
260 
269  unsigned char (&GetVoxelSpace())[SVoxelSpace::DimX][SVoxelSpace::DimY][SVoxelSpace::DimZ];
270 
271  private:
273  CDunGen(const CDunGen& other);
275  CDunGen& operator=(const CDunGen& other);
276 
278  CDungeonGenerator* DungeonGenerator;
279 
281  CMaterialProvider* MaterialProvider;
282 
284  CDunGenXMLReader* DunGenXMLReader;
285 
287  irr::IrrlichtDevice* IrrDevice;
288  };
289 
290 } // END NAMESPACE DunGen
291 
292 #undef DllExport
293 
294 #endif
Enum
Definition: ArchitectCommon.h:13
static const unsigned int DimX
X dimension of the Voxel space.
Definition: VoxelCaveCommon.h:14
Enum
Definition: LSystemCommon.h:13
static const unsigned int DimZ
Z dimension of the Voxel space.
Definition: VoxelCaveCommon.h:18
Enum
Definition: MeshCaveCommon.h:13
static const unsigned int DimY
Y dimension of the Voxel space.
Definition: VoxelCaveCommon.h:16
The parameters of a detailobject in a corridor.
Definition: CorridorCommon.h:13
Interfaceclass for the DunGen-DungeonGenerator.
Definition: DunGen.h:26