Slippers Engine
 
Loading...
Searching...
No Matches
Scene Class Reference

Responsible for Scene functions. More...

#include <Scene.h>

Collaboration diagram for Scene:
Collaboration graph

Protected Member Functions

template<typename C1, typename C2>
void SetCollisionPair ()
 Creates a test pair for a GameObject to collide with different typed GameObjects.
 
template<typename C1>
void SetCollisionSelf ()
 Creates a test pair for a GameObject to collide with same typed GameObjects.
 
template<typename C1>
void SetCollisionTerrain (int threshold)
 Creates a test pair for a GameObject to collide with the Terrain.
 
void SetTerrain (std::string TerrainName)
 Sets the Terrain for a given Scene.
 

Private Member Functions

Camera * GetCurrCam ()
 Gets Current Camera. For more information go to CameraManager.
 
Camera * GetCam2D ()
 Gets Current 2D Camera. For more information go to CameraManager.
 
void SetCurrCam (Camera *newCam)
 Changes Current Camera. For more information go to CameraManager.
 
float GetCamNearClipPersp ()
 Gets Near Clip Plane. For more information go to CameraManager.
 
float GetCamFarClipPersp ()
 Gets Far Clip Plane. For more information go to CameraManager.
 
float GetFOV ()
 Gets FOV. For more information go to CameraManager.
 
void SetCamNearClipPersp (float c)
 Sets Near Clip Plane. For more information go to CameraManager.
 
void SetCamFarClipPersp (float c)
 Sets Far Clip Plane. For more information go to CameraManager.
 
void SetFOV (float f)
 Sets FOV. For more information go to CameraManager.
 
void MoveCam (Vect up, Vect lookAt, Vect pos)
 Moves Current Camera. For more information go to CameraManager.
 
void UpdateCam ()
 Updates Current Camera. For more information go to CameraManager.
 
Vect GetListenerPos ()
 Gets Listener Position. For more information go to Listener.
 
void SetListenerPos (Vect p)
 Sets Listener Position. For more information go to Listener.
 
Vect GetListenerLookAt ()
 Gets Listener Look At Vect. For more information go to Listener.
 
Vect GetListenerUp ()
 Gets Listener Up Vect. For more information go to Listeners.
 
void SetListenerOrientation (Vect lookAt, Vect up)
 Gets Listener Position. For more information go to Listener.
 
void MuteAllSounds ()
 Mutes all current and future sounds.
 
void UnmuteAllSounds ()
 Unmutes all current and future sounds.
 
SoundSourceWorldCreateSourceWorld ()
 Used to create a SoundSourceWorld.
 
SoundSourceListenerCreateSourceListener ()
 Used to create a SoundSourceListener.
 
void ReturnSoundSource (SoundSourceWorld *w)
 Used to return a sound to a scene.
 
void ReturnSoundSource (SoundSourceListener *l)
 Used to return a sound to a scene.
 
bool IsInsideReverbSpace ()
 Returns true if inside a ReverbSpace.
 
ReverbSpaceCreateReverbSpace (const ALuint &reverb)
 Used to create a ReverbSpace with a reverb from ReverbManager.
 
ReverbSpaceCreateReverbSpace (const float &wMat, const float &fMat, const float &cMat)
 Used to create a ReverbSpace with a dynamic reverb.
 
void ReturnReverbSpace (ReverbSpace *s)
 Used to return a ReverbSpace to a scene.
 
void SetTerrainMaterial (float m)
 Sets the Terrain Material for occlusion. Defaults to no occlusion.
 
void GetTerrainHeightAndNormal (const Vect &pos, float &h, Vect &n)
 Used to determine the height and normal of a specific point on the terrain.
 
virtual void Initialize ()
 Function automatically called on scene starting.
 
virtual void SceneEnd ()
 Function automatically called on scene ending.
 

Detailed Description

Responsible for Scene functions.

Game objects are held by scenes. Scenes manage the back end of update, draw, draw2d, object registration, and setting up collision testing.

Member Function Documentation

◆ CreateReverbSpace() [1/2]

ReverbSpace * Scene::CreateReverbSpace ( const ALuint & reverb)
private

Used to create a ReverbSpace with a reverb from ReverbManager.

static const ALuint & GetReverb(DefaultReverbs key)
Returns Reverb from DEFAULT REVERBS.
Definition ReverbManager.h:85
@ CAVE
Definition ReverbManager.h:21
ReverbSpace * CreateReverbSpace(const ALuint &reverb)
Used to create a ReverbSpace with a reverb from ReverbManager.
Definition Scene.cpp:185
static Scene * GetCurrScene()
Returns pointer to current scene.
Definition SceneManager.h:51
Parameters
reverb
Returns
ReverbSpace*

◆ CreateReverbSpace() [2/2]

ReverbSpace * Scene::CreateReverbSpace ( const float & wMat,
const float & fMat,
const float & cMat )
private

Used to create a ReverbSpace with a dynamic reverb.

static const float Wood
Definition MaterialsCommon.h:18
static const float Dirt
Definition MaterialsCommon.h:23
static const float Brick
Definition MaterialsCommon.h:15
Parameters
wMat
fMat
cMat
Returns

◆ CreateSourceListener()

SoundSourceListener * Scene::CreateSourceListener ( )
private

Used to create a SoundSourceListener.

SoundSourceListener * CreateSourceListener()
Used to create a SoundSourceListener.
Definition Scene.cpp:169
Returns
SoundSourceListener*

◆ CreateSourceWorld()

SoundSourceWorld * Scene::CreateSourceWorld ( )
private

Used to create a SoundSourceWorld.

SoundSourceWorld * CreateSourceWorld()
Used to create a SoundSourceWorld.
Definition Scene.cpp:165
Returns
SoundSourceWorld*

◆ GetCam2D()

Camera * Scene::GetCam2D ( )
private

Gets Current 2D Camera. For more information go to CameraManager.

◆ GetCamFarClipPersp()

float Scene::GetCamFarClipPersp ( )
private

Gets Far Clip Plane. For more information go to CameraManager.

◆ GetCamNearClipPersp()

float Scene::GetCamNearClipPersp ( )
private

Gets Near Clip Plane. For more information go to CameraManager.

◆ GetCurrCam()

Camera * Scene::GetCurrCam ( )
private

Gets Current Camera. For more information go to CameraManager.

◆ GetFOV()

float Scene::GetFOV ( )
private

Gets FOV. For more information go to CameraManager.

◆ GetListenerLookAt()

Vect Scene::GetListenerLookAt ( )
private

Gets Listener Look At Vect. For more information go to Listener.

◆ GetListenerPos()

Vect Scene::GetListenerPos ( )
private

Gets Listener Position. For more information go to Listener.

◆ GetListenerUp()

Vect Scene::GetListenerUp ( )
private

Gets Listener Up Vect. For more information go to Listeners.

◆ GetTerrainHeightAndNormal()

void Scene::GetTerrainHeightAndNormal ( const Vect & pos,
float & h,
Vect & n )
private

Used to determine the height and normal of a specific point on the terrain.

Returns 0 and Vect(0, 1, 0) if no terrain is set.

float h;
Vect n;
GetTerrainHeightAndNormal(Vect(0, 0, 0), h, n);
Matrix tmpWorld = pGObj_DemoObjOne->getWorld();
Vect r = n.cross(tmpWorld.get(ROW_2));
Vect up = r.cross(n);
tmpWorld = Matrix(ROT_ORIENT, up, n) * Matrix(TRANS, Vect(0, h, 0));
pGObj_DemoObjOne->SetWorld(tmpWorld);
void GetTerrainHeightAndNormal(const Vect &pos, float &h, Vect &n)
Used to determine the height and normal of a specific point on the terrain.
Definition Scene.cpp:201
Parameters
pos
h
n

◆ Initialize()

virtual void Scene::Initialize ( )
privatevirtual

Function automatically called on scene starting.

This function gets called whenever a scene is started or swapped to. This is a good location to create Game Objects as well as Collision Pairs and Collision Selfs.

◆ IsInsideReverbSpace()

bool Scene::IsInsideReverbSpace ( )
private

Returns true if inside a ReverbSpace.

◆ MoveCam()

void Scene::MoveCam ( Vect up,
Vect lookAt,
Vect pos )
private

Moves Current Camera. For more information go to CameraManager.

◆ MuteAllSounds()

void Scene::MuteAllSounds ( )
private

Mutes all current and future sounds.

◆ ReturnReverbSpace()

void Scene::ReturnReverbSpace ( ReverbSpace * s)
private

Used to return a ReverbSpace to a scene.

void ReturnReverbSpace(ReverbSpace *s)
Used to return a ReverbSpace to a scene.
Definition Scene.cpp:193
Warning
All reverb spaces must be returned on scene end.
Parameters
s

◆ ReturnSoundSource() [1/2]

void Scene::ReturnSoundSource ( SoundSourceListener * l)
private

Used to return a sound to a scene.

void ReturnSoundSource(SoundSourceWorld *w)
Used to return a sound to a scene.
Definition Scene.cpp:173
Warning
All sounds must be returned on scene end.
Parameters
w

◆ ReturnSoundSource() [2/2]

void Scene::ReturnSoundSource ( SoundSourceWorld * w)
private

Used to return a sound to a scene.

Warning
All sounds must be returned on scene end.
Parameters
w

◆ SceneEnd()

virtual void Scene::SceneEnd ( )
privatevirtual

Function automatically called on scene ending.

This function gets called whenever a scene is swapped from or ended. This is a good location to delete Game Objects.

◆ SetCamFarClipPersp()

void Scene::SetCamFarClipPersp ( float c)
private

Sets Far Clip Plane. For more information go to CameraManager.

◆ SetCamNearClipPersp()

void Scene::SetCamNearClipPersp ( float c)
private

Sets Near Clip Plane. For more information go to CameraManager.

◆ SetCollisionPair()

template<typename C1, typename C2>
void Scene::SetCollisionPair ( )
protected

Creates a test pair for a GameObject to collide with different typed GameObjects.

Sets up a collision testing pair between different typed GameObjects using templates. Go to Collidable for more information.

GameObjOne* objOne = new GameObjOne();
GameObjTwo* objTwo = new GameObjTwo();
void SetCollisionPair()
Creates a test pair for a GameObject to collide with different typed GameObjects.
Definition Scene.h:328
Template Parameters
C1
C2

◆ SetCollisionSelf()

template<typename C1>
void Scene::SetCollisionSelf ( )
protected

Creates a test pair for a GameObject to collide with same typed GameObjects.

Sets up a collision testing pair between same typed GameObjects using templates. Go to Collidable for more information.

GameObjOne* objOne = new GameObjOne();
GameObjOne* objTwo = new GameObjOne();
void SetCollisionSelf()
Creates a test pair for a GameObject to collide with same typed GameObjects.
Definition Scene.h:346
Template Parameters
C1
C2

◆ SetCollisionTerrain()

template<typename C1>
void Scene::SetCollisionTerrain ( int threshold)
protected

Creates a test pair for a GameObject to collide with the Terrain.

Sets up a collision testing pair between a GameObjects and the Terrain using templates. Go to Collidable for more information. Will returna a hit if the amount of terrain cells equals or exceeds the given threshold.

GameObjOne* objOne = new GameObjOne();
GameObjTwo* objTwo = new GameObjTwo();
Template Parameters
C1
Parameters
threshold

◆ SetCurrCam()

void Scene::SetCurrCam ( Camera * newCam)
private

Changes Current Camera. For more information go to CameraManager.

◆ SetFOV()

void Scene::SetFOV ( float f)
private

Sets FOV. For more information go to CameraManager.

◆ SetListenerOrientation()

void Scene::SetListenerOrientation ( Vect lookAt,
Vect up )
private

Gets Listener Position. For more information go to Listener.

◆ SetListenerPos()

void Scene::SetListenerPos ( Vect p)
private

Sets Listener Position. For more information go to Listener.

◆ SetTerrain()

void Scene::SetTerrain ( std::string TerrainName)
protected

Sets the Terrain for a given Scene.

SceneDemo::Initialize(){
SetTerrain("Demo Terrain");
}
void SetTerrain(std::string TerrainName)
Sets the Terrain for a given Scene.
Definition Scene.cpp:210
Parameters
TerrainName

◆ SetTerrainMaterial()

void Scene::SetTerrainMaterial ( float m)
private

Sets the Terrain Material for occlusion. Defaults to no occlusion.

◆ UnmuteAllSounds()

void Scene::UnmuteAllSounds ( )
private

Unmutes all current and future sounds.

◆ UpdateCam()

void Scene::UpdateCam ( )
private

Updates Current Camera. For more information go to CameraManager.