Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::Scene Class Reference

Represents a scene containing entities and handles their lifecycle and rendering. More...

#include <Scene.h>

Public Member Functions

 Scene (SceneRenderer &renderer)
 Constructs a Scene instance linked to a specific SceneRenderer.
 ~Scene ()=default
void Shutdown ()
 Cleans up scene resources and entity-related data.
Entity CreateEntity (const std::string &name="")
 Creates a new entity with an optional name.
Entity CreateEntityWithUUID (UUID uuid, const std::string &name)
 Creates a new entity with a specified UUID and name.
void DestroyEntity (Entity entity)
 Destroys the specified entity, removing it from the scene.
void OnUpdateEditor (Timestep ts)
 Called every editor frame to update and render the scene.
std::vector< EntityGetAllEntities ()
 Retrieves all entities currently in the scene.
template<typename First, typename... Rest>
std::vector< EntityGetAllEntitiesWith ()
 Retrieves all entities that have the specified component(s).
template<typename T>
void OnComponentAdded (Entity entity, T &component)
template<>
void OnComponentAdded (Entity entity, TagComponent &component)
template<>
void OnComponentAdded (Entity entity, TransformComponent &component)
template<>
void OnComponentAdded (Entity entity, StaticMeshComponent &component)
template<>
void OnComponentAdded (Entity entity, PointLightComponent &component)
template<>
void OnComponentAdded (Entity entity, SkylightComponent &component)

Detailed Description

Represents a scene containing entities and handles their lifecycle and rendering.

Manages entity creation, destruction, and updates. Provides access to all entities, supports filtering entities by components, and integrates with the rendering system.

Constructor & Destructor Documentation

◆ Scene()

Raven::Scene::Scene ( SceneRenderer & renderer)
explicit

Constructs a Scene instance linked to a specific SceneRenderer.

Parameters
rendererReference to the scene renderer used for rendering entities.

◆ ~Scene()

Raven::Scene::~Scene ( )
default

Member Function Documentation

◆ CreateEntity()

Entity Raven::Scene::CreateEntity ( const std::string & name = "")

Creates a new entity with an optional name.

Parameters
nameThe optional name of the entity. Defaults to empty string.
Returns
Entity The newly created entity.

◆ CreateEntityWithUUID()

Entity Raven::Scene::CreateEntityWithUUID ( UUID uuid,
const std::string & name )

Creates a new entity with a specified UUID and name.

Parameters
uuidThe unique identifier for the entity.
nameThe name for the entity.
Returns
Entity The newly created entity.

◆ DestroyEntity()

void Raven::Scene::DestroyEntity ( Entity entity)

Destroys the specified entity, removing it from the scene.

Parameters
entityThe entity to destroy.

◆ GetAllEntities()

std::vector< Entity > Raven::Scene::GetAllEntities ( )
inline

Retrieves all entities currently in the scene.

Returns
std::vector<Entity> Vector containing all entities.

◆ GetAllEntitiesWith()

template<typename First, typename... Rest>
std::vector< Entity > Raven::Scene::GetAllEntitiesWith ( )
inline

Retrieves all entities that have the specified component(s).

Template Parameters
FirstThe first component type to filter by.
RestAdditional component types to filter by.
Returns
std::vector<Entity> Vector of entities matching the component filter.

◆ OnComponentAdded() [1/6]

template<>
void Raven::Scene::OnComponentAdded ( Entity entity,
PointLightComponent & component )

◆ OnComponentAdded() [2/6]

template<>
void Raven::Scene::OnComponentAdded ( Entity entity,
SkylightComponent & component )

◆ OnComponentAdded() [3/6]

template<>
void Raven::Scene::OnComponentAdded ( Entity entity,
StaticMeshComponent & component )

◆ OnComponentAdded() [4/6]

template<typename T>
void Raven::Scene::OnComponentAdded ( Entity entity,
T & component )

◆ OnComponentAdded() [5/6]

template<>
void Raven::Scene::OnComponentAdded ( Entity entity,
TagComponent & component )

◆ OnComponentAdded() [6/6]

template<>
void Raven::Scene::OnComponentAdded ( Entity entity,
TransformComponent & component )

◆ OnUpdateEditor()

void Raven::Scene::OnUpdateEditor ( Timestep ts)

Called every editor frame to update and render the scene.

Parameters
tsThe timestep representing elapsed time since last update.

◆ Shutdown()

void Raven::Scene::Shutdown ( )

Cleans up scene resources and entity-related data.


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