DunGen  1.0
Dungeongenerator library for Irrlicht
DunGen.h
1 // Copyright (C) 2011-2013 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 CDungeonGenerator;
22 
24  class DllExport CDunGen
25  {
26  public:
29  CDunGen(irr::IrrlichtDevice* irrDevice);
30 
32  ~CDunGen();
33 
34  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35  // generators
36  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 
38  // L-system creation functions:
39 
43  unsigned int CreateLSystemDerivation(unsigned int desiredIteration);
44 
45  // Voxel cave creation functions:
46 
48  void CreateVoxelCave();
49 
52  void ErodeVoxelCave(double erosionLikelihood);
53 
55  void RemoveHoveringVoxelFragments();
56 
57  // Mesh cave creation functions:
58 
60  void CreateMeshCave();
61 
62  // Room creation functions:
63 
70  bool CreateRoom(unsigned int roompatternIndex, const irr::core::vector3d<double>& position,
71  const irr::core::vector3d<double>& rotation, const irr::core::vector3d<double>& scaleFactor);
72 
73  // Corridor creation functions:
74 
86  bool CreateCorridorRoomRoom(unsigned int room0, unsigned int dockingSite0, double distance0, double strenght0,
87  unsigned int room1, unsigned int dockingSite1, double distance1, double strenght1,
88  bool& sightBlocking);
89 
102  bool CreateCorridorRoomCave(unsigned int room0, unsigned int dockingSite0, double distance0, double strenght0,
103  const irr::core::vector3d<unsigned int>& minVox1, const irr::core::vector3d<unsigned int>& maxVox1,
104  EDirection::Enum direction1, double distance1, double strenght1,
105  bool& sightBlocking);
106 
120  bool CreateCorridorCaveCave(const irr::core::vector3d<unsigned int>& minVox0, const irr::core::vector3d<unsigned int>& maxVox0,
121  EDirection::Enum direction0, double distance0, double strenght0,
122  const irr::core::vector3d<unsigned int>& minVox1, const irr::core::vector3d<unsigned int>& maxVox1,
123  EDirection::Enum direction1, double distance1, double strenght1,
124  bool& sightBlocking);
125 
126  // Dungeon creation functions:
127 
131  void AddDungeon(irr::scene::ISceneNode* parentNode, irr::scene::ISceneManager* sceneManager);
132 
133  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
134  // parameters
135  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
136 
142  void RandomGeneratorSetParameters(unsigned int seed, unsigned int a, unsigned int c, unsigned int m);
143 
144  // L-system parameter functions:
145 
149  void LSystemAddRule(char symbol, const std::string& substitution);
150 
152  void LSystemDeleteRules();
153 
156  void LSystemSetStart(const std::string& start);
157 
161  void LSystemSetParameter(ELSystemParameter::Enum parameter, double value);
162 
163  // Voxel cave parameter functions:
164 
168  void VoxelCaveSetParameters(unsigned int border, unsigned int mindrawradius);
169 
172  unsigned int VoxelCaveEstimateMeshComplexity() const;
173 
174  // Mesh cave parameter functions:
175 
181  void MeshCaveSetWarpParameters(bool warpEnabled, bool smoothEnabled, unsigned int warpRandomSeed, double warpStrength);
182 
185  void MeshCaveSetNormalWeightMethod(ENormalWeightMethod::Enum value);
186 
187  // Corridor parameters:
188 
192  void CorridorSetDistances(double distance, double textureDistance);
193 
198  void CorrdidorAddPoint(double x, double y, double textureX);
199 
201  void CorrdidorRemovePoints();
202 
205  void CorrdidorAddDetailObject(const SDetailobjectParameters& parameters);
206 
208  void CorrdidorRemoveDetailobjects();
209 
212  void RoomPatternLoad(const irr::io::path filename);
213 
214  // Material parameters:
215 
220  void MaterialSetCorridor(const irr::io::path& textureFilename, bool backFaceCulling, bool antiAliasing);
221 
226  void MaterialSetCaveSingleColor(const irr::video::SColorf& color, bool backFaceCulling, bool antiAliasing);
227 
231  void MaterialSetCaveMultiColor(bool backFaceCulling, bool antiAliasing);
232 
235  void SetPrintToConsole(bool value);
236 
237  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
238  // other
239  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
240 
249  unsigned char (&GetVoxelSpace())[SVoxelSpace::DimX][SVoxelSpace::DimY][SVoxelSpace::DimZ];
250 
251  private:
253  CDunGen(const CDunGen& other);
255  CDunGen& operator=(const CDunGen& other);
256 
258  CDungeonGenerator* DungeonGenerator;
259  };
260 
261 } // END NAMESPACE DunGen
262 
263 #undef DllExport
264 
265 #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:24