PCG Lib
Library for procedural content generation
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
skr::pcg::Room Class Reference

specifies position, extends and relations to neighboring rooms More...

#include <Room.h>

Public Member Functions

 Room ()
 
 Room (RoomType rt, Point3d center, float width, float length, float height=PCG_DEFAULT_ROOM_HEIGHT)
 
Point3d LLB ()
 Point: LowerLeftBottom. More...
 
Point3d URB ()
 Point: UpperRightBottom. More...
 
Point3d ULB ()
 Point: UpperLeftBottom. More...
 
Point3d LRB ()
 Point: LowerRightBottom. More...
 
Point3d LLT ()
 Point: LowerLeftTop. More...
 
Point3d URT ()
 Point: UpperRightTop. More...
 
Point3d ULT ()
 Point: UpperLeftTop. More...
 
Point3d LRT ()
 Point: LowerRightTop. More...
 
std::string PrintRoomMeasurements (bool extensive=false)
 
std::vector< FaceGenerateGeometry3D ()
 
std::vector< FaceGenerateGeometry3DIndexed ()
 
void GenerateTargets (RNG *rng)
 

Static Public Member Functions

static std::vector< DoorDirectionDetermineClosedWalls (std::vector< DoorDirection > doors)
 

Public Attributes

Point3d _center
 center of room More...
 
float _width
 width of room More...
 
float _length
 length of room More...
 
float _height
 height rom room More...
 
RoomType _roomType
 type of room More...
 
std::vector< DoorDirection_doors
 doors leading to hallways or special rooms More...
 
std::vector< Room_adjecentRooms
 list of adjecent rooms More...
 
std::vector< Target_targets
 list of targets in room More...
 

Private Member Functions

std::vector< uint32_t > GenerateClosedWallIndices3D (std::vector< DoorDirection > closedWalls)
 
std::vector< FaceGenerateClosedWallFaces3D (std::vector< DoorDirection > closedWalls, Vec3 maxTextureCoordinates=Vec3{1.0f, 1.0f, 1.0f})
 
void SetRoomTexture (Face &face, FaceType ft)
 
std::vector< TargetGenerateTargets2 (RNG *rng)
 

Detailed Description

specifies position, extends and relations to neighboring rooms

Constructor & Destructor Documentation

◆ Room() [1/2]

skr::pcg::Room::Room ( )

default constrcutor uses default values: Center at 0/0/0, Typr Room, width and lenght 5.0, height PCG_DEFAULT_ROOM_HEIGHT

◆ Room() [2/2]

skr::pcg::Room::Room ( RoomType  rt,
Point3d  center,
float  width,
float  length,
float  height = PCG_DEFAULT_ROOM_HEIGHT 
)

Constructor

Parameters
rtType of new room
centerCenter of new room
widthWidth of new room
lengthLength of new room
heightHEIGHT of new room. Default PCG_DEFAULT_ROOM_HEIGHT

Member Function Documentation

◆ DetermineClosedWalls()

std::vector< DoorDirection > skr::pcg::Room::DetermineClosedWalls ( std::vector< DoorDirection doors)
static

Determines closed walls of this room based on given doors

Parameters
doorslist of DoorDirections
Returns
list of DoorDirections, but meaning the closed walls

◆ GenerateClosedWallFaces3D()

std::vector< Face > skr::pcg::Room::GenerateClosedWallFaces3D ( std::vector< DoorDirection closedWalls,
Vec3  maxTextureCoordinates = Vec3{1.0f, 1.0f, 1.0f} 
)
private

Generates faces for closed walls

Parameters
closedWallsList of DoorDirections, but meaning closed walls
maxTextureCoordinatesspecifies maximum texture coordinates aligned to the faces. Defaults to 1.0/1.0/1.0

◆ GenerateClosedWallIndices3D()

std::vector< uint32_t > skr::pcg::Room::GenerateClosedWallIndices3D ( std::vector< DoorDirection closedWalls)
private

Generate indices for vertices of closed walls

Parameters
closedWallslist of DoorDirections meaning the closed walls
Returns
list of indices

◆ GenerateGeometry3D()

std::vector< Face > skr::pcg::Room::GenerateGeometry3D ( )

Generates room 3D vertices for this room array of indices is present, but empty return list of faces

◆ GenerateGeometry3DIndexed()

std::vector< Face > skr::pcg::Room::GenerateGeometry3DIndexed ( )

Generates indexed 3D verticse for this room return list of faces

◆ GenerateTargets()

void skr::pcg::Room::GenerateTargets ( RNG rng)

Sets _targets for this room with given RNG

Parameters
rngpointer to current random number generator

◆ GenerateTargets2()

std::vector< Target > skr::pcg::Room::GenerateTargets2 ( RNG rng)
private

Generates targets for this give with given RNG makes sure that targets don't overlap, even when moving param rng pointer to current random number generator returns list of targets

◆ LLB()

Point3d skr::pcg::Room::LLB ( )
inline

Point: LowerLeftBottom.

◆ LLT()

Point3d skr::pcg::Room::LLT ( )
inline

Point: LowerLeftTop.

◆ LRB()

Point3d skr::pcg::Room::LRB ( )
inline

Point: LowerRightBottom.

◆ LRT()

Point3d skr::pcg::Room::LRT ( )
inline

Point: LowerRightTop.

◆ PrintRoomMeasurements()

std::string skr::pcg::Room::PrintRoomMeasurements ( bool  extensive = false)

Gets a string of the measurements of this room in a human readable way

Parameters
extensivetrue to enable more detailed output, default false return string with human readable text

◆ SetRoomTexture()

void skr::pcg::Room::SetRoomTexture ( Face face,
FaceType  ft 
)
private

Sets color, textures and texture parameters based on type of Room for given face

Parameters
face[out] reference to a face
fttype of face: wall, ceiling, floor

◆ ULB()

Point3d skr::pcg::Room::ULB ( )
inline

Point: UpperLeftBottom.

◆ ULT()

Point3d skr::pcg::Room::ULT ( )
inline

Point: UpperLeftTop.

◆ URB()

Point3d skr::pcg::Room::URB ( )
inline

Point: UpperRightBottom.

◆ URT()

Point3d skr::pcg::Room::URT ( )
inline

Point: UpperRightTop.

Member Data Documentation

◆ _adjecentRooms

std::vector<Room> skr::pcg::Room::_adjecentRooms

list of adjecent rooms

◆ _center

Point3d skr::pcg::Room::_center

center of room

◆ _doors

std::vector<DoorDirection> skr::pcg::Room::_doors

doors leading to hallways or special rooms

◆ _height

float skr::pcg::Room::_height

height rom room

◆ _length

float skr::pcg::Room::_length

length of room

◆ _roomType

RoomType skr::pcg::Room::_roomType

type of room

◆ _targets

std::vector<Target> skr::pcg::Room::_targets

list of targets in room

◆ _width

float skr::pcg::Room::_width

width of room


The documentation for this class was generated from the following files: