93 lines
2.1 KiB
C++
93 lines
2.1 KiB
C++
|
|
#ifndef CSCENE_HPP
|
||
|
|
#define CSCENE_HPP
|
||
|
|
|
||
|
|
#include "../Component/Geometry/CTransform.hpp"
|
||
|
|
#include "../Component/Meta/CMetaData.hpp"
|
||
|
|
|
||
|
|
#include <entt/entt.hpp>
|
||
|
|
#include <string>
|
||
|
|
|
||
|
|
namespace CosmicCore {;
|
||
|
|
class CScene : public CSerializable {
|
||
|
|
using ECManager = entt::registry;
|
||
|
|
private:
|
||
|
|
// The name of the scene.
|
||
|
|
std::string m_name;
|
||
|
|
ECManager m_ecManager;
|
||
|
|
|
||
|
|
public:
|
||
|
|
CScene() = delete;
|
||
|
|
CScene(std::string name);
|
||
|
|
~CScene() = default;
|
||
|
|
|
||
|
|
unsigned int getNumEntity() const;
|
||
|
|
|
||
|
|
CEntity addEntity(std::string name, std::string description){
|
||
|
|
auto handle = m_ecManager.create();
|
||
|
|
CEntity handler(m_ecManager, handle);
|
||
|
|
m_ecManager.emplace<CTransform>(handle, handler);
|
||
|
|
m_ecManager.emplace<CMetaData>(handle, handler, std::move(name), std::move(description));
|
||
|
|
return handler;
|
||
|
|
}
|
||
|
|
|
||
|
|
std::string getName() const;
|
||
|
|
|
||
|
|
void removeEntity(unsigned int index, bool destroy = true);
|
||
|
|
|
||
|
|
//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();
|
||
|
|
//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;
|
||
|
|
};*/
|
||
|
|
};
|
||
|
|
}
|
||
|
|
#endif
|