110 lines
2.7 KiB
C++
110 lines
2.7 KiB
C++
#ifndef CSCENE_HPP
|
|
#define CSCENE_HPP
|
|
|
|
#include "../Entity/EntityComponentManager.hpp"
|
|
#include "../../Utils/JsonParser/CSerializable.hpp"
|
|
#include <string>
|
|
#include <vulkan/vulkan_raii.hpp>
|
|
#include "../Systems/Physics/CTangibleWorld.hpp"
|
|
#include "../Systems/Audio/CAudioWorld.hpp"
|
|
#include "Core/Systems/Scripts/CScriptWorld.hpp"
|
|
|
|
namespace CosmicCore {
|
|
class CEntity;
|
|
class CScene : public CSerializable {
|
|
private:
|
|
// The name of the scene.
|
|
std::string m_name;
|
|
EntityComponentManager m_ecManager;
|
|
CTangibleWorld m_tangibleWorld;
|
|
CAudioWorld m_audioWorld;
|
|
CScriptWorld m_scriptWorld;
|
|
public:
|
|
CScene() = delete;
|
|
CScene(std::string name);
|
|
CScene(CScene&&) = delete;
|
|
CScene& operator=(CScene&&) = delete;
|
|
CScene(const CScene&) = delete;
|
|
CScene& operator=(const CScene&) = delete;
|
|
|
|
virtual ~CScene();
|
|
|
|
unsigned int getNumEntity() const;
|
|
|
|
CEntity createEntity();
|
|
|
|
std::string getName() const;
|
|
|
|
EntityComponentManager& getECManager(){return m_ecManager;};
|
|
|
|
void removeEntity(unsigned int index, bool destroy = true);
|
|
|
|
CTangibleWorld& getTangibleWorld() {return m_tangibleWorld;};
|
|
|
|
CAudioWorld& getAudioWorld() {return m_audioWorld;};
|
|
|
|
CScriptWorld& getScriptWorld() {return m_scriptWorld;};
|
|
|
|
//CEntity* getActiveCamera();
|
|
//void setActiveCamera(CEntity* newCamera);
|
|
|
|
/**
|
|
* @brief Getter to the light.
|
|
* @return The pointer m_mainLight.
|
|
*/
|
|
//CEntity* getMainLight();
|
|
|
|
/**
|
|
* @brief Setter of the light.
|
|
* @param light : The light to set as main light.
|
|
*/
|
|
//void setMainLight(CEntity* light);
|
|
|
|
/**
|
|
* @brief Setter of the ODE world handling class.
|
|
* @param[in, out] world The pointer to the physical world.
|
|
*/
|
|
//void setTangibleWorld(CTangibleWorld* world);
|
|
|
|
/**
|
|
* @brief Getter to the physical world of the environment.
|
|
* @return The pointer m_tangibleWorld.
|
|
*/
|
|
//std::weak_ptr<CAbstractTangibleWorld> getTangibleWorld();
|
|
|
|
/**
|
|
* @brief Setter of the layer mask.
|
|
* @param[in] mask The new mask value.
|
|
*/
|
|
void setMask(unsigned int mask);
|
|
|
|
/**
|
|
* @brief Getter to the layer mask.
|
|
* @return The value of m_maskLayer.
|
|
*/
|
|
//unsigned int getMask();
|
|
|
|
void render(vk::raii::CommandBuffer& cmd, uint32_t frameIndex);
|
|
//void updateScript();
|
|
|
|
nlohmann::json to_json();
|
|
|
|
/*static CScene* from_json(nlohmann::json& j)
|
|
{
|
|
CScene* s = new CScene(j["Name"]);
|
|
for (nlohmann::json& entity : j["Entities"])
|
|
{
|
|
CEntity* e = CEntity::from_json(s, entity);
|
|
s->addEntity(e);
|
|
}
|
|
return s;
|
|
};*/
|
|
|
|
static std::unique_ptr<CScene> load(const std::string& path);
|
|
static void save(CScene* scene, const std::string& path);
|
|
|
|
void save(const std::string& path);
|
|
|
|
};
|
|
}
|
|
#endif |