ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Scene Class Reference

Manages a collection of 3D objects and applies optional screen-space effects. More...

#include <Scene.h>

Collaboration diagram for Scene:

Public Member Functions

 Scene (unsigned int maxObjects)
 Constructs a Scene instance.
 
 ~Scene ()
 Destructor for Scene, freeing allocated resources.
 
bool UseEffect ()
 Checks if an effect is enabled for the scene.
 
void EnableEffect ()
 Enables the screen-space effect for the scene.
 
void DisableEffect ()
 Disables the screen-space effect for the scene.
 
EffectGetEffect ()
 Retrieves the current screen-space effect.
 
void SetEffect (Effect *effect)
 Sets the screen-space effect for the scene.
 
void AddObject (Object3D *object)
 Adds a 3D object to the scene.
 
void RemoveObject (unsigned int i)
 Removes a 3D object from the scene by its index.
 
void RemoveObject (Object3D *object)
 Removes a specific 3D object from the scene.
 
Object3D ** GetObjects ()
 Retrieves all objects in the scene.
 
uint8_t GetObjectCount ()
 Retrieves the current number of objects in the scene.
 

Private Member Functions

void RemoveElement (unsigned int element)
 Removes an object from the scene by its index.
 

Private Attributes

const int maxObjects
 Maximum number of objects allowed in the scene.
 
Object3D ** objects
 Array of pointers to the Object3D instances in the scene.
 
unsigned int numObjects = 0
 Current number of objects in the scene.
 
Effecteffect
 Pointer to the screen-space Effect applied to the scene.
 
bool doesUseEffect = false
 Flag indicating whether the effect is enabled.
 

Detailed Description

Manages a collection of 3D objects and applies optional screen-space effects.

The Scene class allows for the addition, removal, and management of 3D objects. It also supports applying screen-space effects to modify the appearance of the entire scene.

Definition at line 25 of file Scene.h.

Constructor & Destructor Documentation

◆ Scene()

Scene ( unsigned int  maxObjects)

Constructs a Scene instance.

Parameters
maxObjectsMaximum number of objects the scene can hold.

Definition at line 3 of file Scene.cpp.

References maxObjects, and objects.

◆ ~Scene()

~Scene ( )

Destructor for Scene, freeing allocated resources.

Definition at line 7 of file Scene.cpp.

References objects.

Member Function Documentation

◆ AddObject()

◆ DisableEffect()

void DisableEffect ( )

Disables the screen-space effect for the scene.

Definition at line 19 of file Scene.cpp.

References doesUseEffect.

◆ EnableEffect()

void EnableEffect ( )

Enables the screen-space effect for the scene.

Definition at line 15 of file Scene.cpp.

References doesUseEffect.

Referenced by ProtogenProject::ProtogenProject().

◆ GetEffect()

Effect * GetEffect ( )

Retrieves the current screen-space effect.

Returns
Pointer to the current Effect, or nullptr if no effect is set.

Definition at line 23 of file Scene.cpp.

References effect.

Referenced by RenderingEngine::Rasterize().

◆ GetObjectCount()

uint8_t GetObjectCount ( )

Retrieves the current number of objects in the scene.

Returns
Number of objects in the scene.

Definition at line 62 of file Scene.cpp.

References numObjects.

Referenced by Rasterizer::Rasterize().

◆ GetObjects()

Object3D ** GetObjects ( )

Retrieves all objects in the scene.

Returns
Pointer to the array of Object3D pointers.

Definition at line 58 of file Scene.cpp.

References objects.

Referenced by Rasterizer::Rasterize().

◆ RemoveElement()

void RemoveElement ( unsigned int  element)
private

Removes an object from the scene by its index.

This method adjusts the internal array to maintain order.

Parameters
elementIndex of the object to remove.

Definition at line 36 of file Scene.cpp.

References numObjects, and objects.

Referenced by RemoveObject(), and RemoveObject().

◆ RemoveObject() [1/2]

void RemoveObject ( Object3D object)

Removes a specific 3D object from the scene.

Parameters
objectPointer to the Object3D to remove.

Definition at line 49 of file Scene.cpp.

References numObjects, objects, and RemoveElement().

◆ RemoveObject() [2/2]

void RemoveObject ( unsigned int  i)

Removes a 3D object from the scene by its index.

Parameters
iIndex of the object to remove.

Definition at line 42 of file Scene.cpp.

References numObjects, and RemoveElement().

◆ SetEffect()

void SetEffect ( Effect effect)

Sets the screen-space effect for the scene.

Parameters
effectPointer to the Effect to apply.

Definition at line 27 of file Scene.cpp.

References effect.

Referenced by ProtogenProject::UpdateFace().

◆ UseEffect()

bool UseEffect ( )

Checks if an effect is enabled for the scene.

Returns
true if an effect is enabled, otherwise false.

Definition at line 11 of file Scene.cpp.

References doesUseEffect.

Referenced by RenderingEngine::Rasterize().

Member Data Documentation

◆ doesUseEffect

bool doesUseEffect = false
private

Flag indicating whether the effect is enabled.

Definition at line 32 of file Scene.h.

Referenced by DisableEffect(), EnableEffect(), and UseEffect().

◆ effect

Effect* effect
private

Pointer to the screen-space Effect applied to the scene.

Definition at line 31 of file Scene.h.

Referenced by GetEffect(), and SetEffect().

◆ maxObjects

const int maxObjects
private

Maximum number of objects allowed in the scene.

Definition at line 28 of file Scene.h.

Referenced by Scene().

◆ numObjects

unsigned int numObjects = 0
private

Current number of objects in the scene.

Definition at line 30 of file Scene.h.

Referenced by AddObject(), GetObjectCount(), RemoveElement(), RemoveObject(), and RemoveObject().

◆ objects

Object3D** objects
private

Array of pointers to the Object3D instances in the scene.

Definition at line 29 of file Scene.h.

Referenced by AddObject(), GetObjects(), RemoveElement(), RemoveObject(), Scene(), and ~Scene().


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