CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::Scene Class Reference

A resource that stores scene information. More...

#include <CeresEngine/Scene/Scene.hpp>

Inheritance diagram for CeresEngine::Scene:
CeresEngine::TResource< Scene > CeresEngine::Resource CeresEngine::IReflectable

Public Member Functions

 ~Scene () noexcept override
 
void update (const double dt)
 Runs a single simulation step on the world.
 
const SceneSettingsgetSettings () const
 
void setSettings (const SceneSettings &settings)
 
const RendererSceneSettingsgetRendererSettings () const
 
void setRendererSettings (const RendererSceneSettings &rendererSettings)
 
template<CInvocable< RendererSceneSettings & > Func>
decltype(autoupdateRendererSettings (Func &&func) noexcept
 
SceneObject create ()
 Creates a new empty SceneObject.
 
Vector< SceneObjectcreate (UInt32 n)
 Creates n empty SceneObjects.
 
template<typename E , typename... Args>
E create (Args &&... args)
 Creates a new SceneObject with type E.
 
template<typename E , typename Block , typename... Args>
E createWith (Block &&block, Args &&... args)
 Creates a new SceneObject with type E.
 
Camera createCamera ()
 Creates a new camera on the scene.
 
Light createLight ()
 Creates a new light on the scene.
 
Renderable createRenderable ()
 Creates a new renderable on the scene.
 
Generator< SceneObjectenumerateChildren () const
 Enumerates all children scene objects.
 
Entity copyObjects (Scene &otherScene, const Entity &parent=nullptr)
 Copies the objects from another scene.
 
WorldgetWorld () noexcept
 The Entity-Component system world.
 
const WorldgetWorld () const noexcept
 The Entity-Component system world.
 
- Public Member Functions inherited from CeresEngine::TResource< Scene >
ResourceHandle< ScenegetResourceHandle () const noexcept
 Generates a hash for the provided type.
 
SPtr< ScenegetShared () noexcept
 Gets a shared pointer to the resource.
 
SPtr< const ScenegetShared () const noexcept
 Gets a shared pointer to the resource.
 
const ResourceTypeInfogetResourceType () const noexcept override
 Returns the resource type information descriptor.
 
 TResource (ResourceData &data, InputStream &dataStream)
 
void serialize (OutputStream &dataStream) const override
 Serializes a resource by writing data to dataStream.
 
- Public Member Functions inherited from CeresEngine::Resource
 Resource ()
 Default constructor for the Resource class.
 
 Resource (ResourceData &data)
 Creates a new Resource instance by passing a ResourceData instance.
 
virtual ~Resource () noexcept=default
 Resource virtual destructor.
 
ResourceManagergetResourceManager () const noexcept
 
HResource getResourceHandle () const noexcept
 Generates a hash for the provided type.
 
UUID getResourceID () const noexcept
 
HResource getParentResource () const noexcept
 A parent resource to which this resource is attached to.
 
SPtr< ResourceMetadatagetResourceMetadata () const noexcept
 A pointer to the user-defined resource metadata.
 
const PackagePtrgetPackage () const noexcept
 The package from which the resource was loaded from.
 
template<typename T = Resource>
SPtr< TgetShared () noexcept
 Gets a shared pointer to the resource.
 
template<typename T = Resource>
SPtr< const TgetShared () const noexcept
 Gets a shared pointer to the resource.
 
 Resource (ResourceData &data, InputStream &dataStream)
 Creates a new resource by reading data from dataStream.
 
- Public Member Functions inherited from CeresEngine::IReflectable
virtual ~IReflectable () noexcept=default
 

Static Public Member Functions

static Scenefind (const SceneObject &sceneObject)
 Finds the scene that a scene object is attached to.
 
template<typename Processor >
static constexpr void reflect (Processor &&RTTI)
 Executes the given processor for every field of the struct.
 
- Static Public Member Functions inherited from CeresEngine::Resource
template<typename Processor >
static constexpr void reflect (Processor &&RTTI)
 Executes the given processor for every field of the struct.
 

Private Types

using super = TResource< Scene >
 

Private Attributes

SceneManagermSceneManager = nullptr
 The scene manager this scene is registered to, if registered.
 
World mWorld {*this}
 The Entity-Component system world.
 
SceneSettings mSettings
 A structure that contains settings for the scene.
 
RendererSceneSettings mRendererSettings
 A set of settings that should be used by renderer when rendering the scene.
 

Friends

class SceneManager
 
class TUserTypeInfo< Scene >
 

Additional Inherited Members

- Protected Member Functions inherited from CeresEngine::Resource
HResourceStream createStream (const ResourceStreamFlags &flags=ResourceStreamFlag::Default)
 Creates a new resource stream.
 
void destroyStream (HResourceStream &stream)
 Destroys a stream.
 
void markAsDirty ()
 Marks the resource as dirty.
 

Detailed Description

A resource that stores scene information.

The scene simulation is backed by an ECS world and can be simulated using systems.

Member Typedef Documentation

◆ super

Constructor & Destructor Documentation

◆ ~Scene()

CeresEngine::Scene::~Scene ( )
overridenoexcept

Member Function Documentation

◆ copyObjects()

Entity CeresEngine::Scene::copyObjects ( Scene otherScene,
const Entity parent = nullptr 
)

Copies the objects from another scene.

Parameters
otherSceneThe scene to copy objects from.
parentThe entity to parent the copied scene objects to.
Returns
The root of the copied objects.

◆ create() [1/3]

SceneObject CeresEngine::Scene::create ( )

Creates a new empty SceneObject.

◆ create() [2/3]

template<typename E , typename... Args>
E CeresEngine::Scene::create ( Args &&...  args)
inline

Creates a new SceneObject with type E.

All components defined in the SceneObject of type E are default-initialized. After default initializing all components, the constructor of E is called by forwarding args to it.

Template Parameters
EThe SceneObject type
ArgsThe scene object E constructor argument types
Parameters
argsThe scene object E constructor arguments
Returns
The newly created scene object E object handle.

◆ create() [3/3]

Vector< SceneObject > CeresEngine::Scene::create ( UInt32  n)

Creates n empty SceneObjects.

Parameters
nThe number of SceneObject to be created.
Returns
A vector that contains all the created SceneObjects.

◆ createCamera()

Camera CeresEngine::Scene::createCamera ( )

Creates a new camera on the scene.

This is equivalent to calling create<Camera>().

Returns
The handle to the newly created camera.

◆ createLight()

Light CeresEngine::Scene::createLight ( )

Creates a new light on the scene.

This is equivalent to calling create<Light>().

Returns
The handle to the newly created light.

◆ createRenderable()

Renderable CeresEngine::Scene::createRenderable ( )

Creates a new renderable on the scene.

This is equivalent to calling create<Renderable>().

Returns
The handle to the newly created renderable.

◆ createWith()

template<typename E , typename Block , typename... Args>
E CeresEngine::Scene::createWith ( Block &&  block,
Args &&...  args 
)
inline

Creates a new SceneObject with type E.

All components defined in the SceneObject of type E are default-initialized. After default initializing all components, the constructor of E is called by forwarding args to it. After creation and default component initialization, block is called with the newly created scene object.

Template Parameters
EThe SceneObject type
BlockA functor type that takes E as an argument and allows to perform post-initialization operations on the newly created scene object.
ArgsThe scene object E constructor argument types
Parameters
argsThe scene object E constructor arguments
blockA functor object that takes E as an argument and allows to perform post-initialization operations on the newly created scene object.
Returns
The newly created scene object E object handle.

◆ enumerateChildren()

Generator< SceneObject > CeresEngine::Scene::enumerateChildren ( ) const

Enumerates all children scene objects.

Returns
A generator that enumerates all children in the scene.

◆ find()

static Scene * CeresEngine::Scene::find ( const SceneObject sceneObject)
static

Finds the scene that a scene object is attached to.

Parameters
sceneObjectThe scene object to locate the parent scene for.
Returns
The parent scene of gameObject or nullptr if it is not attached to any scene.

◆ getRendererSettings()

const RendererSceneSettings & CeresEngine::Scene::getRendererSettings ( ) const
inline

◆ getSettings()

const SceneSettings & CeresEngine::Scene::getSettings ( ) const
inline

◆ getWorld() [1/2]

const World & CeresEngine::Scene::getWorld ( ) const
inlinenoexcept

The Entity-Component system world.

Owns all entities in the scene as well as manages the simulation of the scene.

◆ getWorld() [2/2]

World & CeresEngine::Scene::getWorld ( )
inlinenoexcept

The Entity-Component system world.

Owns all entities in the scene as well as manages the simulation of the scene.

◆ reflect()

template<typename Processor >
static constexpr void CeresEngine::Scene::reflect ( Processor &&  RTTI)
inlinestaticconstexpr

Executes the given processor for every field of the struct.

Parameters
RTTIThe processor to be ran for every field.

◆ setRendererSettings()

void CeresEngine::Scene::setRendererSettings ( const RendererSceneSettings rendererSettings)

◆ setSettings()

void CeresEngine::Scene::setSettings ( const SceneSettings settings)

◆ update()

void CeresEngine::Scene::update ( const double  dt)
inline

Runs a single simulation step on the world.

Parameters
dtThe time step since the last call to update.

◆ updateRendererSettings()

template<CInvocable< RendererSceneSettings & > Func>
decltype(auto) CeresEngine::Scene::updateRendererSettings ( Func &&  func)
inlinenoexcept

Friends And Related Symbol Documentation

◆ SceneManager

◆ TUserTypeInfo< Scene >

Member Data Documentation

◆ mRendererSettings

RendererSceneSettings CeresEngine::Scene::mRendererSettings
private

A set of settings that should be used by renderer when rendering the scene.

◆ mSceneManager

SceneManager* CeresEngine::Scene::mSceneManager = nullptr
private

The scene manager this scene is registered to, if registered.

◆ mSettings

SceneSettings CeresEngine::Scene::mSettings
private

A structure that contains settings for the scene.

◆ mWorld

World CeresEngine::Scene::mWorld {*this}
private

The Entity-Component system world.

Owns all entities in the scene as well as manages the simulation of the scene.


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