Files
XCEngine/editor/src/Core/ISceneManager.h

79 lines
3.2 KiB
C++

#pragma once
#include "SceneSnapshot.h"
#include <string>
#include <vector>
#include <cstdint>
#include <XCEngine/Components/GameObject.h>
namespace XCEngine {
namespace Components {
class Scene;
}
namespace Editor {
struct SceneLoadProgressSnapshot {
std::uint64_t revision = 0;
bool inProgress = false;
bool success = false;
bool firstFramePresented = false;
bool streamingCompleted = false;
bool interactive = false;
bool startupScene = false;
std::string operation;
std::string scenePath;
std::string message;
std::uint64_t startedAtMs = 0;
std::uint64_t structureReadyAtMs = 0;
std::uint64_t firstFrameAtMs = 0;
std::uint64_t streamingCompletedAtMs = 0;
std::uint64_t interactiveAtMs = 0;
std::uint32_t currentPendingAsyncLoads = 0;
std::uint32_t peakPendingAsyncLoads = 0;
bool HasValue() const {
return revision != 0;
}
};
class ISceneManager {
public:
virtual ~ISceneManager() = default;
virtual ::XCEngine::Components::GameObject* CreateEntity(const std::string& name, ::XCEngine::Components::GameObject* parent = nullptr) = 0;
virtual void DeleteEntity(::XCEngine::Components::GameObject::ID id) = 0;
virtual void RenameEntity(::XCEngine::Components::GameObject::ID id, const std::string& newName) = 0;
virtual ::XCEngine::Components::GameObject* GetEntity(::XCEngine::Components::GameObject::ID id) = 0;
virtual const std::vector<::XCEngine::Components::GameObject*>& GetRootEntities() const = 0;
virtual void CopyEntity(::XCEngine::Components::GameObject::ID id) = 0;
virtual ::XCEngine::Components::GameObject::ID PasteEntity(::XCEngine::Components::GameObject::ID parent = 0) = 0;
virtual ::XCEngine::Components::GameObject::ID DuplicateEntity(::XCEngine::Components::GameObject::ID id) = 0;
virtual void MoveEntity(::XCEngine::Components::GameObject::ID id, ::XCEngine::Components::GameObject::ID newParent) = 0;
virtual bool HasClipboardData() const = 0;
virtual void NewScene(const std::string& name = "Untitled Scene") = 0;
virtual bool LoadScene(const std::string& filePath) = 0;
virtual bool SaveScene() = 0;
virtual bool SaveSceneAs(const std::string& filePath) = 0;
virtual bool LoadStartupScene(const std::string& projectPath) = 0;
virtual bool HasActiveScene() const = 0;
virtual bool IsSceneDirty() const = 0;
virtual void MarkSceneDirty() = 0;
virtual void SetSceneDocumentDirtyTrackingEnabled(bool enabled) = 0;
virtual bool IsSceneDocumentDirtyTrackingEnabled() const = 0;
virtual const std::string& GetCurrentScenePath() const = 0;
virtual const std::string& GetCurrentSceneName() const = 0;
virtual ::XCEngine::Components::Scene* GetScene() = 0;
virtual const ::XCEngine::Components::Scene* GetScene() const = 0;
virtual SceneLoadProgressSnapshot GetSceneLoadProgress() const = 0;
virtual void NotifySceneViewportFramePresented(std::uint32_t pendingAsyncLoads) = 0;
virtual void NotifyExternalSceneMutation(::XCEngine::Components::GameObject::ID primaryEntityId = 0) {}
virtual SceneSnapshot CaptureSceneSnapshot() const = 0;
virtual bool RestoreSceneSnapshot(const SceneSnapshot& snapshot) = 0;
virtual void CreateDemoScene() = 0;
};
}
}