Lysa  0.0
Lysa 3D Engine
Scene Class Reference

Detailed Description

Represents a 3D scene containing lights and mesh instances.

The Scene class manages the high-level representation of a scene, including its environment, lights, and mesh instances. It handles deferred operations for adding/removing instances across multiple frames.

+ Inheritance diagram for Scene:

Public Member Functions

 Scene (const SceneConfiguration &config={})
 
 ~Scene () override
 
void setEnvironment (const Environment &environment)
 
bool haveInstance (const MeshInstance &meshInstance) const
 
void addInstance (const MeshInstance &meshInstance, bool async=false)
 
void updateInstance (const MeshInstance &meshInstance)
 
void removeInstance (const MeshInstance &meshInstance, bool async=false)
 
void addLight (const Light &light)
 
void removeLight (const Light &light)
 
void processDeferredOperations (uint32 frameIndex)
 
SceneFrameDataget (const uint32 frameIndex) const
 
- Public Member Functions inherited from UniqueResource
 UniqueResource () = default
 
 UniqueResource (UniqueResource &) = delete
 
UniqueResource & operator= (UniqueResource &) = delete
 
- Public Member Functions inherited from UnmanagedResource
 UnmanagedResource ()
 
 UnmanagedResource (const Resource &other)
 
- Public Member Functions inherited from Resource
bool operator== (const Resource &other) const
 
 Resource () = default
 
 Resource (const unique_id id)
 
virtual ~Resource () = default
 

Protected Attributes

ImageManagerimageManager
 
MaterialManagermaterialManager
 
MeshManagermeshManager
 

Additional Inherited Members

- Public Attributes inherited from Resource
unique_id id {INVALID_ID}
 

Constructor & Destructor Documentation

Scene ( const SceneConfiguration config = {})

Constructs a Scene with a given configuration.

Parameters
configScene configuration settings.
~Scene ( )
override

Virtual destructor for Scene.

Member Function Documentation

void addInstance ( const MeshInstance meshInstance,
bool  async = false 
)

Adds a mesh instance to the scene.

Parameters
meshInstanceThe mesh instance to add.
asyncWhether to add the instance asynchronously.
void addLight ( const Light light)

Adds a light to the scene.

Parameters
lightThe light to add.
SceneFrameData& get ( const uint32  frameIndex) const
inline

Gets the frame-specific data for a given frame index.

Parameters
frameIndexThe index of the frame.
Returns
A reference to the SceneFrameData for the frame.
bool haveInstance ( const MeshInstance meshInstance) const

Checks if a mesh instance is present in the scene.

Parameters
meshInstanceThe mesh instance to check.
Returns
True if the instance is in the scene, false otherwise.
void processDeferredOperations ( uint32  frameIndex)

Processes deferred scene operations for a specific frame.

Parameters
frameIndexThe index of the frame to process.
void removeInstance ( const MeshInstance meshInstance,
bool  async = false 
)

Removes a mesh instance from the scene.

Parameters
meshInstanceThe mesh instance to remove.
asyncWhether to remove the instance asynchronously.
void removeLight ( const Light light)

Removes a light from the scene.

Parameters
lightThe light to remove.
void setEnvironment ( const Environment environment)

Sets the environment for the scene.

Parameters
environmentThe environment settings to apply.
void updateInstance ( const MeshInstance meshInstance)

Updates an existing mesh instance.

Parameters
meshInstanceThe mesh instance to update.

Member Data Documentation

ImageManager& imageManager
protected

Reference to the image manager.

MaterialManager& materialManager
protected

Reference to the material manager.

MeshManager& meshManager
protected

Reference to the mesh manager.