![]() |
DunGen
1.0
Dungeongenerator library for Irrlicht
|
Interfaceclass for the DunGen-DungeonGenerator. More...
#include <DunGen.h>
Public Member Functions | |
CDunGen (irr::IrrlichtDevice *irrDevice) | |
~CDunGen () | |
Destructor. More... | |
unsigned int | CreateLSystemDerivation (unsigned int desiredIteration) |
void | CreateVoxelCave () |
Creates the voxel cave from the currently generated L-system iteration. More... | |
void | ErodeVoxelCave (double erosionLikelihood) |
void | RemoveHoveringVoxelFragments () |
Removes all hovering fragments. More... | |
void | CreateMeshCave () |
Creates the mesh cave from the currently generated voxel cave. More... | |
bool | CreateRoom (unsigned int roompatternIndex, const irr::core::vector3d< double > &position, const irr::core::vector3d< double > &rotation, const irr::core::vector3d< double > &scaleFactor) |
bool | CreateCorridorRoomRoom (unsigned int room0, unsigned int dockingSite0, double distance0, double strenght0, unsigned int room1, unsigned int dockingSite1, double distance1, double strenght1, bool &sightBlocking) |
bool | CreateCorridorRoomCave (unsigned int room0, unsigned int dockingSite0, double distance0, double strenght0, const irr::core::vector3d< unsigned int > &minVox1, const irr::core::vector3d< unsigned int > &maxVox1, EDirection::Enum direction1, double distance1, double strenght1, bool &sightBlocking) |
bool | CreateCorridorCaveCave (const irr::core::vector3d< unsigned int > &minVox0, const irr::core::vector3d< unsigned int > &maxVox0, EDirection::Enum direction0, double distance0, double strenght0, const irr::core::vector3d< unsigned int > &minVox1, const irr::core::vector3d< unsigned int > &maxVox1, EDirection::Enum direction1, double distance1, double strenght1, bool &sightBlocking) |
void | AddDungeon (irr::scene::ISceneNode *parentNode, irr::scene::ISceneManager *sceneManager) |
void | RandomGeneratorSetParameters (unsigned int seed, unsigned int a, unsigned int c, unsigned int m) |
void | LSystemAddRule (char symbol, const std::string &substitution) |
void | LSystemDeleteRules () |
Deletes all substitution rules for the L-system. More... | |
void | LSystemSetStart (const std::string &start) |
void | LSystemSetParameter (ELSystemParameter::Enum parameter, double value) |
void | VoxelCaveSetParameters (unsigned int border, unsigned int mindrawradius) |
unsigned int | VoxelCaveEstimateMeshComplexity () const |
void | MeshCaveSetWarpParameters (bool warpEnabled, bool smoothEnabled, unsigned int warpRandomSeed, double warpStrength) |
void | MeshCaveSetNormalWeightMethod (ENormalWeightMethod::Enum value) |
void | CorridorSetDistances (double distance, double textureDistance) |
void | CorrdidorAddPoint (double x, double y, double textureX) |
void | CorrdidorRemovePoints () |
Removes all points from the corridor profile. More... | |
void | CorrdidorAddDetailObject (const SDetailobjectParameters ¶meters) |
void | CorrdidorRemoveDetailobjects () |
Removes all detail object templates. More... | |
void | RoomPatternLoad (const irr::io::path filename) |
void | MaterialSetCorridor (const irr::io::path &textureFilename, bool backFaceCulling, bool antiAliasing) |
void | MaterialSetCaveSingleColor (const irr::video::SColorf &color, bool backFaceCulling, bool antiAliasing) |
void | MaterialSetCaveMultiColor (bool backFaceCulling, bool antiAliasing) |
void | SetPrintToConsole (bool value) |
Interfaceclass for the DunGen-DungeonGenerator.
DunGen::CDunGen::CDunGen | ( | irr::IrrlichtDevice * | irrDevice | ) |
Constructor.
irrDevice | The Irrlicht device. |
DunGen::CDunGen::~CDunGen | ( | ) |
Destructor.
unsigned int DunGen::CDunGen::CreateLSystemDerivation | ( | unsigned int | desiredIteration | ) |
Create a derivation of the L-system.
desiredIteration | The desired iteration. The derivation will eventually be lower if the length of the generated string would exceed 1,000,000 instructions. |
void DunGen::CDunGen::CreateVoxelCave | ( | ) |
Creates the voxel cave from the currently generated L-system iteration.
void DunGen::CDunGen::ErodeVoxelCave | ( | double | erosionLikelihood | ) |
Erodes the voxel cave 1 voxel deep. Can be applied muliple times.
erosionLikelihood | The likelihood, with which the voxels are removed. |
void DunGen::CDunGen::RemoveHoveringVoxelFragments | ( | ) |
Removes all hovering fragments.
void DunGen::CDunGen::CreateMeshCave | ( | ) |
Creates the mesh cave from the currently generated voxel cave.
bool DunGen::CDunGen::CreateRoom | ( | unsigned int | roompatternIndex, |
const irr::core::vector3d< double > & | position, | ||
const irr::core::vector3d< double > & | rotation, | ||
const irr::core::vector3d< double > & | scaleFactor | ||
) |
Creates a room from a room pattern.
roompatternIndex | The index of the room pattern. Refers to the rooms that have been added with DunGen::RoomPatternLoad, starts with 0. |
position | The position of the room. |
rotation | The rotation of the room. |
scaleFactor | The scale factor of the room. |
bool DunGen::CDunGen::CreateCorridorRoomRoom | ( | unsigned int | room0, |
unsigned int | dockingSite0, | ||
double | distance0, | ||
double | strenght0, | ||
unsigned int | room1, | ||
unsigned int | dockingSite1, | ||
double | distance1, | ||
double | strenght1, | ||
bool & | sightBlocking | ||
) |
Creates a corridor between two rooms.
room0 | The index of room 0 which shall be connected. Refers the the rooms, that have been created with DunGen::roompatternIndex, starts with 0. |
dockingSite0 | The docking site of room 0, which shall be used for connecting the corridor. |
distance0 | The distance in which the corridor shall start from docking site 0. The space between the room and the corridor is used by an adapter. |
strenght0 | The strength, with which the corridor direction is influenced by the docking site 0 direction. |
room1 | The index of room 1 which shall be connected. Refers the the rooms, that have been created with DunGen::roompatternIndex, starts with 0. |
dockingSite1 | The docking site of room 1, which shall be used for connecting the corridor. |
distance1 | The distance in which the corridor shall start from docking site 1. The space between the room and the corridor is used by an adapter. |
strenght1 | The strength, with which the corridor direction is influenced by the docking site 1 direction. |
sightBlocking | Is the corridor definitely sight blocking (can you see from one end the the other)? |
bool DunGen::CDunGen::CreateCorridorRoomCave | ( | unsigned int | room0, |
unsigned int | dockingSite0, | ||
double | distance0, | ||
double | strenght0, | ||
const irr::core::vector3d< unsigned int > & | minVox1, | ||
const irr::core::vector3d< unsigned int > & | maxVox1, | ||
EDirection::Enum | direction1, | ||
double | distance1, | ||
double | strenght1, | ||
bool & | sightBlocking | ||
) |
Creates a room corridor between a room and the cave. A docking site for the cave is created automatically with direction -direction1.
room0 | The index of room 0 which shall be connected. Refers the the rooms, that have been created with DunGen::roompatternIndex, starts with 0. |
dockingSite0 | The docking site of room 0, which shall be used for connecting the corridor. |
distance0 | The distance in which the corridor shall start from room 0. The space between the room and the corridor is used by an adapter. |
strenght0 | The strength , with which the corridor direction is influenced by the docking site 0 direction. |
minVox1 | The start voxels, where the cave search begins. Assume you have X-direction, Y and Z define the width of the docking site and have to be the same as for maxVox1. The difference of minVox1.X and maxVox1.X is carved into the cave. |
maxVox1 | The end voxels for cave docking. Assume you have X-direction, Y and Z define the width of the docking site and have to be the same as for minVox1. The difference of minVox1.X and maxVox1.X is carved into the cave. |
direction1 | The direction in which the corridor is connected. |
distance1 | The distance in which the corridor shall start from docking site 1. The space between the room and the corridor is used by an adapter. |
strenght1 | The strength , with which the corridor direction is influenced by the docking site 1 direction. |
sightBlocking | Is the corridor definitely sight blocking (can you see from one end the the other)? |
bool DunGen::CDunGen::CreateCorridorCaveCave | ( | const irr::core::vector3d< unsigned int > & | minVox0, |
const irr::core::vector3d< unsigned int > & | maxVox0, | ||
EDirection::Enum | direction0, | ||
double | distance0, | ||
double | strenght0, | ||
const irr::core::vector3d< unsigned int > & | minVox1, | ||
const irr::core::vector3d< unsigned int > & | maxVox1, | ||
EDirection::Enum | direction1, | ||
double | distance1, | ||
double | strenght1, | ||
bool & | sightBlocking | ||
) |
Creates a room corridor between two cave positions. A docking site for each cave position is created automatically with directions -direction0 and -direction1.
minVox0 | The start voxels, where the cave search begins. Assume you have X-direction, Y and Z define the width of the docking site and have to be the same as for maxVox0. The difference of minVox0.X and maxVox0.X is carved into the cave. |
maxVox0 | The end voxels for cave docking. Assume you have X-direction, Y and Z define the width of the docking site and have to be the same as for minVox0. The difference of minVox0.X and maxVox0.X is carved into the cave. |
direction0 | The direction in which the corridor is connected. |
distance0 | The distance in which the corridor shall start from docking site 0. The space between the room and the corridor is used by an adapter. |
strenght0 | The strength, with which the corridor direction is influenced by the docking site 0 direction. |
minVox1 | The start voxels, where the cave search begins. Assume you have X-direction, Y and Z define the width of the docking site and have to be the same as for maxVox1. The difference of minVox1.X and maxVox1.X is carved into the cave. |
maxVox1 | The end voxels for cave docking. Assume you have X-direction, Y and Z define the width of the docking site and have to be the same as for minVox1. The difference of minVox1.X and maxVox1.X is carved into the cave. |
direction1 | The direction in which the corridor is connected. |
distance1 | The distance in which the corridor shall start from docking site 1. The space between the room and the corridor is used by an adapter. |
strenght1 | The strength , with which the corridor direction is influenced by the docking site 1 direction. |
sightBlocking | Is the corridor definitely sight blocking (can you see from one end the the other)? |
void DunGen::CDunGen::AddDungeon | ( | irr::scene::ISceneNode * | parentNode, |
irr::scene::ISceneManager * | sceneManager | ||
) |
Assembles the dungeon and adds it under the specified node in the specified scene manager.
parentNode | The parent node for the dungeon. |
sceneManager | The scene manager parentNode belongs to. |
void DunGen::CDunGen::RandomGeneratorSetParameters | ( | unsigned int | seed, |
unsigned int | a, | ||
unsigned int | c, | ||
unsigned int | m | ||
) |
Set the parameters for the random generator: linear congruential generator, X[i+1] = (a*X[i]+c) mod m).
seed | The random seed. |
a | The parameter a. |
c | The parameter c. |
m | The parameter m. |
void DunGen::CDunGen::LSystemAddRule | ( | char | symbol, |
const std::string & | substitution | ||
) |
Adds a substitution rule for the L-system.
symbol | The symbol, which shall be replaced. |
substitution | The substitution for the symbol. |
void DunGen::CDunGen::LSystemDeleteRules | ( | ) |
Deletes all substitution rules for the L-system.
void DunGen::CDunGen::LSystemSetStart | ( | const std::string & | start | ) |
Sets the start symbols for the L-system
start | The start symbols. |
void DunGen::CDunGen::LSystemSetParameter | ( | ELSystemParameter::Enum | parameter, |
double | value | ||
) |
Sets a parameter for the L-system.
parameter | The parameter. |
value | The value to be set. |
void DunGen::CDunGen::VoxelCaveSetParameters | ( | unsigned int | border, |
unsigned int | mindrawradius | ||
) |
Sets the parameters of the voxel cave.
border | The border of 0-voxels, which will be preserved. Will be capped to at least SVoxelSpace::MinBorder |
mindrawradius | The minimum drawing radius, which will be not deceeded. |
unsigned int DunGen::CDunGen::VoxelCaveEstimateMeshComplexity | ( | ) | const |
Estimates the mesh complexity for the mesh cave which results from the current voxel cave.
void DunGen::CDunGen::MeshCaveSetWarpParameters | ( | bool | warpEnabled, |
bool | smoothEnabled, | ||
unsigned int | warpRandomSeed, | ||
double | warpStrength | ||
) |
Sets the warp parameters for the mesh cave.
warpEnabled | Shall the voxels be warped, when creating the mesh cave? |
smoothEnabled | Shall the warping smooth the mesh? |
warpRandomSeed | Random seed for the warping. |
warpStrength | Strength of the warping. Will be clamped to [0,0.49]. |
void DunGen::CDunGen::MeshCaveSetNormalWeightMethod | ( | ENormalWeightMethod::Enum | value | ) |
Sets the normal weighting method for the mesh cave.
value | The normal weighting method. |
void DunGen::CDunGen::CorridorSetDistances | ( | double | distance, |
double | textureDistance | ||
) |
Sets the distances for the corridor.
distance | The sampling factor for computing the underlying hermite spline. Lower values will result in more triangles, but a smoother mesh. |
textureDistance | The Y texture coordinate increase per sampling point |
void DunGen::CDunGen::CorrdidorAddPoint | ( | double | x, |
double | y, | ||
double | textureX | ||
) |
Adds a point for the corridor profile. The profile has to have at least 3 points and enclose (0,0), which is the center.
x | X coordinate. |
y | Y coordinate. |
textureX | X texture coordinate. |
void DunGen::CDunGen::CorrdidorRemovePoints | ( | ) |
Removes all points from the corridor profile.
void DunGen::CDunGen::CorrdidorAddDetailObject | ( | const SDetailobjectParameters & | parameters | ) |
Adds a detail object template, which shall be placed along the corridor.
parameters | The parameters of the detail object. |
void DunGen::CDunGen::CorrdidorRemoveDetailobjects | ( | ) |
Removes all detail object templates.
void DunGen::CDunGen::RoomPatternLoad | ( | const irr::io::path | filename | ) |
Loads a room pattern, which has to be a .irr file. See mainpage of documentation of requirements for room patterns.
filename | The filename of the room pattern. |
void DunGen::CDunGen::MaterialSetCorridor | ( | const irr::io::path & | textureFilename, |
bool | backFaceCulling, | ||
bool | antiAliasing | ||
) |
Sets material parameters for the corridor.
textureFilename | The filename of the texture that shall be used. |
backFaceCulling | Shall backface culling be enabled? |
antiAliasing | Shall anti aliasing culling be enabled? |
void DunGen::CDunGen::MaterialSetCaveSingleColor | ( | const irr::video::SColorf & | color, |
bool | backFaceCulling, | ||
bool | antiAliasing | ||
) |
Chooses the single color material for the mesh cave and sets the parameters for it.
color | The color of the cave. |
backFaceCulling | Shall backface culling be enabled? |
antiAliasing | Shall anti aliasing culling be enabled? |
void DunGen::CDunGen::MaterialSetCaveMultiColor | ( | bool | backFaceCulling, |
bool | antiAliasing | ||
) |
Chooses the multi color material for the mesh cave and sets the parameters for it.
backFaceCulling | Shall backface culling be enabled? |
antiAliasing | Shall anti aliasing culling be enabled? |
void DunGen::CDunGen::SetPrintToConsole | ( | bool | value | ) |
Sets if status reports shall be printed to the console.
value | If true, status reports will be printed to the console. |