Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Scene.cpp
Go to the documentation of this file.
2
6
7namespace EngineCore {
8 Scene::Scene() : sceneGraph(std::make_unique<SceneGraph>(NodeFactory::createRoot())) {
10 // Initialize assetManager from Engine if available (backwards compatibility)
11 if (engine != nullptr) {
12 assetManager = engine->getAssetManager().get();
13 }
14 }
15
17 if (actor == nullptr) {
18 return;
19 }
20
21 actor->endPlay();
22 }
23
25 }
26
28 TRACY_ZONE_SCOPED_NAMED("Unloading scene content");
29 }
30
31 std::vector<Entity *> Scene::getEntities() const {
32 std::vector<Entity *> entityPtrs;
33 entityPtrs.reserve(entities.size());
34 for (const auto& entity : entities) {
35 entityPtrs.push_back(entity);
36 }
37 return entityPtrs;
38 }
39
41 for (const auto entity : getEntities()) {
42 if (const auto actorPtr = dynamic_cast<Actor*>(entity)) {
43 actorPtr->endPlay();
44 }
45 }
46 entities.clear();
47 }
48
50 return engine->getSceneManager().get();
51 }
52
56
58 assetManager = manager;
59 }
60
61 Scene::~Scene() = default;
62}
#define TRACY_ZONE_SCOPED_NAMED(name)
An Actor is similar to an EngineCore::Entity. An actor is an Entity with a transform.
Definition Actor.h:24
virtual void endPlay()
Definition Actor.cpp:39
EngineCore::Engine * getEngineModule()
gets the pointer to the engine object
Definition Engine.cpp:1140
static EngineManager & getInstance()
gets a reference to the engine manager
Definition Engine.cpp:1135
Factory class for creating SceneNodes with proper parent-child relationships. This ensures that nodes...
Definition SceneGraph.h:310
Represents the entire scene as a graph (specifically, a tree) of SceneNode objects....
Definition SceneGraph.h:266
Manages game objects within a scene, handling registration, ID allocation, and GPU buffer synchroniza...
Engine * engine
Definition Scene.h:84
void setAssetManager(AssetManager *manager)
Sets the asset manager for this scene (used for dependency injection in tests)
Definition Scene.cpp:57
SceneManager * getSceneManager() const
Definition Scene.cpp:49
void destroyActor(Actor *actor)
Definition Scene.cpp:16
virtual void unloadContent()
Definition Scene.cpp:27
AssetManager * getAssetManager() const
Gets the asset manager for this scene.
Definition Scene.cpp:53
AssetManager * assetManager
Definition Scene.h:85
virtual void loadContent()
Definition Scene.cpp:24
std::vector< Entity * > getEntities() const
Definition Scene.cpp:31
std::unique_ptr< SceneGraph > sceneGraph
Definition Scene.h:88
std::vector< Entity * > entities
Definition Scene.h:90
Log category system implementation.
STL namespace.