Tramway SDK
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
tram::WorldCell Struct Reference

World streaming unit. More...

#include <framework/worldcell.h>

Public Member Functions

 WorldCell (name_t name)
 
name_t GetName ()
 
bool IsLoaded ()
 
bool IsInterior ()
 
bool HasInteriorLighting ()
 
bool IsDebugDraw ()
 
bool HasAutomaticLoading ()
 
void SetInterior (bool is)
 
void SetInteriorLights (bool is)
 
void SetDebugDraw (bool is)
 
void SetAutomaticLoading (bool is)
 
void Load ()
 Loads the cell. More...
 
void Unload ()
 Unloads the cell. More...
 
void LoadFromDisk ()
 Loads worldcell data from disk. More...
 
void Add (Entity *entity)
 Adds an entity to the worldcell. More...
 
void Remove (Entity *entity)
 Removes an entity from the worldcell. More...
 
size_t GetEntityCount ()
 
void Add (Transition *transition)
 Adds a transition. More...
 
void Link (WorldCell *other)
 Links a worldcell. More...
 
WorldCellFindTransition (vec3 point)
 Finds a transition from a position. More...
 
const std::vector< Entity * > & GetEntities ()
 
const std::vector< Transition * > & GetTransitions ()
 
const std::vector< Transition * > & GetVolume ()
 
bool IsInside (vec3 point)
 Checks if point is inside the worldcell. More...
 

Static Public Member Functions

static WorldCellFind (vec3 point)
 Finds the WorldCell which contains a given point. More...
 
static WorldCellFind (name_t name)
 Finds a WorldCell by its name. More...
 
static WorldCellMake (name_t name)
 Creates a WorldCell by name. More...
 

Protected Types

enum  {
  LOADED = 1 , INTERIOR = 2 , INTERIOR_LIGHTING = 4 , DEBUG_DRAW = 8 ,
  AUTOMATIC_LOADING = 16 , LOADED_FROM_DISK = 32
}
 

Protected Member Functions

void SetFlag (uint32_t flag, bool value)
 

Protected Attributes

name_t name
 
uint32_t flags = AUTOMATIC_LOADING
 
std::vector< Entity * > entities
 
std::vector< Transition * > transitions
 
std::vector< Transition * > volume
 

Detailed Description

World streaming unit.

Contains entities, can be used to load and unload them.

See also
https://racenis.github.io/tram-sdk/documentation/framework/worldcell.html

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
LOADED 
INTERIOR 
INTERIOR_LIGHTING 
DEBUG_DRAW 
AUTOMATIC_LOADING 
LOADED_FROM_DISK 

Constructor & Destructor Documentation

◆ WorldCell()

tram::WorldCell::WorldCell ( name_t  name)
inline

Member Function Documentation

◆ Add() [1/2]

void tram::WorldCell::Add ( Entity entity)

Adds an entity to the worldcell.

◆ Add() [2/2]

void tram::WorldCell::Add ( Transition transition)

Adds a transition.

Adds an outgoing transition to the worldcell.

◆ Find() [1/2]

WorldCell * tram::WorldCell::Find ( name_t  name)
static

Finds a WorldCell by its name.

Returns
Pointer to the cell if found, nullptr otherwise.

◆ Find() [2/2]

WorldCell * tram::WorldCell::Find ( vec3  point)
static

Finds the WorldCell which contains a given point.

This method will iterate through WorldCells and will try to find a WorldCell with a volume that contains the given point. It will first try finding a volume for an interior cell, otherwise it will try finding a volume for an exterior cell. If it can't find a cell, it will return a nullptr.

Returns
Pointer to a WorldCell or a nullptr.

◆ FindTransition()

WorldCell * tram::WorldCell::FindTransition ( vec3  point)

Finds a transition from a position.

This is meant to be used by entities that are seeking a WorldCell into which they can transition into.

◆ GetEntities()

const std::vector< Entity * > & tram::WorldCell::GetEntities ( )
inline

◆ GetEntityCount()

size_t tram::WorldCell::GetEntityCount ( )
inline

◆ GetName()

name_t tram::WorldCell::GetName ( )
inline

◆ GetTransitions()

const std::vector< Transition * > & tram::WorldCell::GetTransitions ( )
inline

◆ GetVolume()

const std::vector< Transition * > & tram::WorldCell::GetVolume ( )
inline

◆ HasAutomaticLoading()

bool tram::WorldCell::HasAutomaticLoading ( )
inline

◆ HasInteriorLighting()

bool tram::WorldCell::HasInteriorLighting ( )
inline

◆ IsDebugDraw()

bool tram::WorldCell::IsDebugDraw ( )
inline

◆ IsInside()

bool tram::WorldCell::IsInside ( vec3  point)

Checks if point is inside the worldcell.

◆ IsInterior()

bool tram::WorldCell::IsInterior ( )
inline

◆ IsLoaded()

bool tram::WorldCell::IsLoaded ( )
inline

◆ Link()

void tram::WorldCell::Link ( WorldCell other)

Links a worldcell.

This method will take the volume transitions assigned to the worldcell in other pointer parameter and assign them as transitions to the given cell.

◆ Load()

void tram::WorldCell::Load ( )

Loads the cell.

This will flag the cell as loaded and will load all of the entities that have been flagged as being automatically loaded.

◆ LoadFromDisk()

void tram::WorldCell::LoadFromDisk ( )

Loads worldcell data from disk.

◆ Make()

WorldCell * tram::WorldCell::Make ( name_t  name)
static

Creates a WorldCell by name.

If a cell with the given name already exists, this method will return that same cell, otherwise a new cell will be created.

Returns
Always returns the pointer to the created WorldCell.

◆ Remove()

void tram::WorldCell::Remove ( Entity entity)

Removes an entity from the worldcell.

◆ SetAutomaticLoading()

void tram::WorldCell::SetAutomaticLoading ( bool  is)
inline

◆ SetDebugDraw()

void tram::WorldCell::SetDebugDraw ( bool  is)
inline

◆ SetFlag()

void tram::WorldCell::SetFlag ( uint32_t  flag,
bool  value 
)
inlineprotected

◆ SetInterior()

void tram::WorldCell::SetInterior ( bool  is)
inline

◆ SetInteriorLights()

void tram::WorldCell::SetInteriorLights ( bool  is)
inline

◆ Unload()

void tram::WorldCell::Unload ( )

Unloads the cell.

This will flag the cell as unloaded and will unload all of the entities that have been flagged as being automatically loaded. It will also delete entities that have been flagged as being non-persistent.

Member Data Documentation

◆ entities

std::vector<Entity*> tram::WorldCell::entities
protected

◆ flags

uint32_t tram::WorldCell::flags = AUTOMATIC_LOADING
protected

◆ name

name_t tram::WorldCell::name
protected

◆ transitions

std::vector<Transition*> tram::WorldCell::transitions
protected

◆ volume

std::vector<Transition*> tram::WorldCell::volume
protected

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