Compare commits
2 Commits
67b316a70b
...
9e6ee7b2e2
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e6ee7b2e2 | |||
| f246d0e227 |
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#ifdef DEER_RENDER
|
#ifdef DEER_RENDER
|
||||||
#include "DeerRender/Render/FrameBuffer.h"
|
#include "DeerRender/Render/FrameBuffer.h"
|
||||||
#include "DeerRender/Scene.h"
|
#include "DeerRender/World.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -20,22 +20,22 @@
|
|||||||
namespace Deer {
|
namespace Deer {
|
||||||
class Entity;
|
class Entity;
|
||||||
|
|
||||||
class Environment {
|
class EntityEnvironment {
|
||||||
// Note: Outdated note
|
// Note: Outdated note
|
||||||
///////// NOTES ///////////
|
///////// NOTES ///////////
|
||||||
// - The entity id means the position in a array defined in Environment
|
// - The entity id means the position in a array defined in EntityEnvironment
|
||||||
// - The entity id is relative to a Environment so it can be a complete
|
// - The entity id is relative to a EntityEnvironment so it can be a complete
|
||||||
// diferent entity in other environments
|
// diferent entity in other environments
|
||||||
// - The entity number 0 is allways the root
|
// - The entity number 0 is allways the root
|
||||||
// - There is a limit defined by ENVIRONMENT_MAX_ENTITIES of how many
|
// - There is a limit defined by ENVIRONMENT_MAX_ENTITIES of how many
|
||||||
// entities can be in an Environment
|
// entities can be in an EntityEnvironment
|
||||||
///////// NOTES ///////////
|
///////// NOTES ///////////
|
||||||
public:
|
public:
|
||||||
Environment();
|
EntityEnvironment();
|
||||||
~Environment();
|
~EntityEnvironment();
|
||||||
// This class can not be copyed
|
// This class can not be copyed
|
||||||
Environment(const Environment&) = delete;
|
EntityEnvironment(const EntityEnvironment&) = delete;
|
||||||
Environment& operator=(Environment&) = delete;
|
EntityEnvironment& operator=(EntityEnvironment&) = delete;
|
||||||
|
|
||||||
// Clears all entities
|
// Clears all entities
|
||||||
void clear();
|
void clear();
|
||||||
@ -63,7 +63,7 @@ namespace Deer {
|
|||||||
// Obtains the entity that is on the root of the environment
|
// Obtains the entity that is on the root of the environment
|
||||||
inline Entity& getRoot() { return getEntity(0); }
|
inline Entity& getRoot() { return getEntity(0); }
|
||||||
#ifdef DEER_RENDER
|
#ifdef DEER_RENDER
|
||||||
void render(const SceneCamera& camera);
|
void render(const WorldCamera& camera);
|
||||||
#endif
|
#endif
|
||||||
Scope<entt::registry> m_registry;
|
Scope<entt::registry> m_registry;
|
||||||
|
|
||||||
@ -80,15 +80,15 @@ namespace Deer {
|
|||||||
int toDo;
|
int toDo;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EnvironmentData {
|
struct EntityEnvironmentData {
|
||||||
std::vector<EntityData> entities;
|
std::vector<EntityData> entities;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
class ResourceBuilder<Environment> {
|
class ResourceBuilder<EntityEnvironment> {
|
||||||
public:
|
public:
|
||||||
using BaseDataType = EnvironmentData;
|
using BaseDataType = EntityEnvironmentData;
|
||||||
static Scope<Environment> buildResource(const BaseDataType& baseData);
|
static Scope<EntityEnvironment> buildResource(const BaseDataType& baseData);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Warning: This calss does not initialize for performance
|
// Warning: This calss does not initialize for performance
|
||||||
@ -111,7 +111,7 @@ namespace Deer {
|
|||||||
void setParent(Entity& parent);
|
void setParent(Entity& parent);
|
||||||
bool isDescendantOf(Entity& parent) const;
|
bool isDescendantOf(Entity& parent) const;
|
||||||
|
|
||||||
Environment* getEnvironment() const { return environment; }
|
EntityEnvironment* getEntityEnvironment() const { return environment; }
|
||||||
|
|
||||||
bool isRoot() const { return entId == 0; }
|
bool isRoot() const { return entId == 0; }
|
||||||
glm::mat4 getWorldMatrix() const;
|
glm::mat4 getWorldMatrix() const;
|
||||||
@ -123,14 +123,14 @@ namespace Deer {
|
|||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Environment* environment = nullptr;
|
EntityEnvironment* environment = nullptr;
|
||||||
entt::entity entHandle = entt::null;
|
entt::entity entHandle = entt::null;
|
||||||
uint16_t entId = 0;
|
uint16_t entId = 0;
|
||||||
uint16_t parentId = 0;
|
uint16_t parentId = 0;
|
||||||
|
|
||||||
Entity(entt::entity handle, Environment* scene, uint16_t entityID);
|
Entity(entt::entity handle, EntityEnvironment* scene, uint16_t entityID);
|
||||||
|
|
||||||
friend class Environment;
|
friend class EntityEnvironment;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
@ -2,14 +2,12 @@
|
|||||||
#include "DeerCore/Tools/TypeDefs.h"
|
#include "DeerCore/Tools/TypeDefs.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
class Environment;
|
class EntityEnvironment;
|
||||||
class SceneCamera;
|
class WorldCamera;
|
||||||
class GizmoRenderer;
|
class GizmoRenderer;
|
||||||
|
|
||||||
// A scene is a 3d simulation with its environment and voxel world in case
|
namespace World {
|
||||||
// of initialized, here things can be simulated
|
// Clears all the assets and memory the World had conained
|
||||||
namespace Scene {
|
|
||||||
// Clears all the assets and memory the Scene had conained
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
// This is the cycle to execution of scripts and physics
|
// This is the cycle to execution of scripts and physics
|
||||||
@ -23,10 +21,10 @@ namespace Deer {
|
|||||||
#ifdef DEER_RENDER
|
#ifdef DEER_RENDER
|
||||||
// This function renders with the default camera in the environment
|
// This function renders with the default camera in the environment
|
||||||
void render();
|
void render();
|
||||||
void render(const SceneCamera&);
|
void render(const WorldCamera&);
|
||||||
|
|
||||||
extern GizmoRenderer gizmoRenderer;
|
extern GizmoRenderer gizmoRenderer;
|
||||||
#endif
|
#endif
|
||||||
extern Environment environment;
|
extern EntityEnvironment environment;
|
||||||
} // namespace Scene
|
} // namespace World
|
||||||
} // namespace Deer
|
} // namespace Deer
|
||||||
2
Deer/Include/DeerRender/EntityEnviroment.h
Normal file
2
Deer/Include/DeerRender/EntityEnviroment.h
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "DeerCore/EntityEnviroment.h"
|
||||||
@ -1,2 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "DeerCore/Enviroment.h"
|
|
||||||
@ -1,22 +1,23 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "DeerRender/EntityEnviroment.h"
|
||||||
#include "DeerRender/Render/FrameBuffer.h"
|
#include "DeerRender/Render/FrameBuffer.h"
|
||||||
#include "DeerRender/Tools/Memory.h"
|
#include "DeerRender/Tools/Memory.h"
|
||||||
#include "DeerRender/Enviroment.h"
|
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
class RenderPiperline {
|
class RenderPiperline {
|
||||||
public:
|
public:
|
||||||
RenderPiperline(RenderPiperline&) = delete;
|
RenderPiperline(RenderPiperline&) = delete;
|
||||||
RenderPiperline(PiperlineOptions);
|
RenderPiperline(PiperlineOptions);
|
||||||
|
|
||||||
void render(const Environment&);
|
void render(const EntityEnvironment&);
|
||||||
private:
|
|
||||||
Scope<FrameBuffer> resultImage;
|
|
||||||
PiperlineOptions options;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct PiperlineOptions {
|
private:
|
||||||
int width = 100;
|
Scope<FrameBuffer> resultImage;
|
||||||
int height = 100;
|
PiperlineOptions options;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
struct PiperlineOptions {
|
||||||
|
int width = 100;
|
||||||
|
int height = 100;
|
||||||
|
};
|
||||||
|
} // namespace Deer
|
||||||
@ -1,13 +1,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "DeerCore/Scene.h"
|
#include "DeerCore/World.h"
|
||||||
#include "DeerRender/Components.h"
|
#include "DeerRender/Components.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
struct SceneCamera {
|
struct WorldCamera {
|
||||||
TransformComponent transform;
|
TransformComponent transform;
|
||||||
CameraComponent camera;
|
CameraComponent camera;
|
||||||
|
|
||||||
SceneCamera() {}
|
WorldCamera() {}
|
||||||
SceneCamera(TransformComponent _transform, CameraComponent _camera) : transform(_transform), camera(_camera) {}
|
WorldCamera(TransformComponent _transform, CameraComponent _camera) : transform(_transform), camera(_camera) {}
|
||||||
};
|
};
|
||||||
} // namespace Deer
|
} // namespace Deer
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#include "DeerCore/Enviroment.h"
|
|
||||||
|
|
||||||
namespace Deer {
|
|
||||||
Scope<Environment> ResourceBuilder<Environment>::buildResource(const BaseDataType& baseData) {
|
|
||||||
Scope<Environment> env = MakeScope<Environment>();
|
|
||||||
return env;
|
|
||||||
}
|
|
||||||
} // namespace Deer
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#include "DeerCore/Enviroment.h"
|
|
||||||
#include "DeerCore/Tools/Memory.h"
|
|
||||||
|
|
||||||
namespace Deer {
|
|
||||||
namespace Scene {
|
|
||||||
Environment environment;
|
|
||||||
bool isExecuting = false;
|
|
||||||
} // namespace Scene
|
|
||||||
|
|
||||||
} // namespace Deer
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "cereal/cereal.hpp"
|
|
||||||
#include "cereal/types/string.hpp"
|
|
||||||
#include "cereal/types/vector.hpp"
|
|
||||||
|
|
||||||
// Serialization Vars
|
|
||||||
#include "DeerCore/Scene/Serialization/SerializationGlobalVars.h"
|
|
||||||
|
|
||||||
// GENERICS
|
|
||||||
#include "DeerCore/Scene/Serialization/QuatSerialization.h"
|
|
||||||
#include "DeerCore/Scene/Serialization/Vec3Serialization.h"
|
|
||||||
|
|
||||||
// SCENE SPECIFIC
|
|
||||||
#include "DeerCore/Scene/Serialization/EntitySerialization.h"
|
|
||||||
#include "DeerCore/Scene/Serialization/EnvironmentSerialization.h"
|
|
||||||
|
|
||||||
// COMPONENTS SPECIFIC
|
|
||||||
#include "DeerCore/Scene/Serialization/Components/RelationshipComponentSerialization.h"
|
|
||||||
#include "DeerCore/Scene/Serialization/Components/TransformComponentSerialization.h"
|
|
||||||
|
|
||||||
// RENDER SPECIFIC
|
|
||||||
#ifdef DEER_RENDER
|
|
||||||
#include "DeerRender/Scene/Serialization/Components/CameraSerializationComponent.h"
|
|
||||||
#include "DeerRender/Scene/Serialization/Components/MeshRenderComponentSerialization.h"
|
|
||||||
#include "DeerRender/Scene/Serialization/Components/TextureBindingSerializationComponent.h"
|
|
||||||
#endif
|
|
||||||
@ -1,9 +1,9 @@
|
|||||||
#include "DeerCore/Components.h"
|
#include "DeerCore/Components.h"
|
||||||
#include "DeerCore/Enviroment.h"
|
#include "DeerCore/EntityEnviroment.h"
|
||||||
#include "DeerCore/Log.h"
|
#include "DeerCore/Log.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
Entity::Entity(entt::entity handle, Environment* scene, uint16_t entityID)
|
Entity::Entity(entt::entity handle, EntityEnvironment* scene, uint16_t entityID)
|
||||||
: entHandle(handle),
|
: entHandle(handle),
|
||||||
environment(scene),
|
environment(scene),
|
||||||
entId(entityID) {}
|
entId(entityID) {}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
#include "DeerCore/Enviroment.h"
|
#include "DeerCore/EntityEnviroment.h"
|
||||||
|
|
||||||
#include "DeerCore/Application.h"
|
#include "DeerCore/Application.h"
|
||||||
#include "DeerCore/Components.h"
|
#include "DeerCore/Components.h"
|
||||||
@ -7,14 +7,14 @@
|
|||||||
#include "DeerRender/Render/Texture.h"
|
#include "DeerRender/Render/Texture.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
Environment::Environment() {
|
EntityEnvironment::EntityEnvironment() {
|
||||||
m_registry = MakeScope<entt::registry>();
|
m_registry = MakeScope<entt::registry>();
|
||||||
createEntityWithId(0, "root");
|
createEntityWithId(0, "root");
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment::~Environment() {}
|
EntityEnvironment::~EntityEnvironment() {}
|
||||||
|
|
||||||
void Environment::clear() {
|
void EntityEnvironment::clear() {
|
||||||
// Clear all existing entities and map
|
// Clear all existing entities and map
|
||||||
m_registry->clear();
|
m_registry->clear();
|
||||||
|
|
||||||
@ -26,23 +26,23 @@ namespace Deer {
|
|||||||
createEntityWithId(0, "root");
|
createEntityWithId(0, "root");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Environment::getEntityCount() const {
|
uint16_t EntityEnvironment::getEntityCount() const {
|
||||||
return entities.size() - unused_entities_spaces.size();
|
return entities.size() - unused_entities_spaces.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity& Environment::getEntity(uint16_t id) {
|
Entity& EntityEnvironment::getEntity(uint16_t id) {
|
||||||
DEER_CORE_ASSERT(entityExists(id), "Entity id {0} does not exist", id);
|
DEER_CORE_ASSERT(entityExists(id), "Entity id {0} does not exist", id);
|
||||||
return entities[id];
|
return entities[id];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Environment::entityExists(uint16_t id) const {
|
bool EntityEnvironment::entityExists(uint16_t id) const {
|
||||||
if (id >= entities.size())
|
if (id >= entities.size())
|
||||||
return false;
|
return false;
|
||||||
const Entity& refEntity = entities[id];
|
const Entity& refEntity = entities[id];
|
||||||
return refEntity.isValid();
|
return refEntity.isValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity& Environment::createEntity(const std::string& name) {
|
Entity& EntityEnvironment::createEntity(const std::string& name) {
|
||||||
uint16_t id;
|
uint16_t id;
|
||||||
|
|
||||||
entt::entity entityID = m_registry->create();
|
entt::entity entityID = m_registry->create();
|
||||||
@ -67,7 +67,7 @@ namespace Deer {
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity& Environment::createEntityWithId(uint16_t id, const std::string& name) {
|
Entity& EntityEnvironment::createEntityWithId(uint16_t id, const std::string& name) {
|
||||||
entt::entity entityID = m_registry->create();
|
entt::entity entityID = m_registry->create();
|
||||||
|
|
||||||
// We allocate all the memory until that id
|
// We allocate all the memory until that id
|
||||||
@ -118,7 +118,7 @@ namespace Deer {
|
|||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Environment::destroyEntity(uint16_t entityID) {
|
void EntityEnvironment::destroyEntity(uint16_t entityID) {
|
||||||
DEER_CORE_ASSERT(entityExists(entityID), "Entity id {0} does not exist", entityID);
|
DEER_CORE_ASSERT(entityExists(entityID), "Entity id {0} does not exist", entityID);
|
||||||
DEER_CORE_ASSERT(entityID != 0, "Cannot destroy root");
|
DEER_CORE_ASSERT(entityID != 0, "Cannot destroy root");
|
||||||
|
|
||||||
@ -141,9 +141,9 @@ namespace Deer {
|
|||||||
unused_entities_spaces.push(entityID);
|
unused_entities_spaces.push(entityID);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Environment::tryGetMainCamera() const { return m_mainCamera; }
|
uint16_t EntityEnvironment::tryGetMainCamera() const { return m_mainCamera; }
|
||||||
|
|
||||||
void Environment::setMainCamera(Entity& entity) {
|
void EntityEnvironment::setMainCamera(Entity& entity) {
|
||||||
if (!entity.isValid())
|
if (!entity.isValid())
|
||||||
m_mainCamera = 0;
|
m_mainCamera = 0;
|
||||||
|
|
||||||
8
Deer/src/DeerCore/World/EnvironmentBuilder.cpp
Normal file
8
Deer/src/DeerCore/World/EnvironmentBuilder.cpp
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include "DeerCore/EntityEnviroment.h"
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
Scope<EntityEnvironment> ResourceBuilder<EntityEnvironment>::buildResource(const BaseDataType& baseData) {
|
||||||
|
Scope<EntityEnvironment> env = MakeScope<EntityEnvironment>();
|
||||||
|
return env;
|
||||||
|
}
|
||||||
|
} // namespace Deer
|
||||||
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "DeerCore/Components.h"
|
#include "DeerCore/Components.h"
|
||||||
#include "DeerCore/Enviroment.h"
|
#include "DeerCore/EntityEnviroment.h"
|
||||||
#include "DeerCore/Scene/Serialization/SerializationGlobalVars.h"
|
#include "DeerCore/World/Serialization/SerializationGlobalVars.h"
|
||||||
#include "EntitySerializationStruct.h"
|
#include "EntitySerializationStruct.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
@ -2,9 +2,9 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
class Environment;
|
class EntityEnvironment;
|
||||||
struct EntitySerializationStruct {
|
struct EntitySerializationStruct {
|
||||||
uint16_t entityID;
|
uint16_t entityID;
|
||||||
Environment* env;
|
EntityEnvironment* env;
|
||||||
};
|
};
|
||||||
} // namespace Deer
|
} // namespace Deer
|
||||||
@ -2,29 +2,29 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "DeerCore/Enviroment.h"
|
#include "DeerCore/EntityEnviroment.h"
|
||||||
#include "EntitySerializationStruct.h"
|
#include "EntitySerializationStruct.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
struct EnvironmentEntity {
|
struct EntityEnvironmentEntity {
|
||||||
Environment& environment;
|
EntityEnvironment& environment;
|
||||||
EnvironmentEntity(Environment& env) : environment(env) {}
|
EntityEnvironmentEntity(EntityEnvironment& env) : environment(env) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
void save(Archive& archive, const Deer::Environment& environment) {
|
void save(Archive& archive, const Deer::EntityEnvironment& environment) {
|
||||||
EnvironmentEntity envEnt(const_cast<Deer::Environment&>(environment));
|
EntityEnvironmentEntity envEnt(const_cast<Deer::EntityEnvironment&>(environment));
|
||||||
archive(cereal::make_nvp("entities", envEnt));
|
archive(cereal::make_nvp("entities", envEnt));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
void load(Archive& archive, Deer::Environment& environment) {
|
void load(Archive& archive, Deer::EntityEnvironment& environment) {
|
||||||
EnvironmentEntity envEnt(environment);
|
EntityEnvironmentEntity envEnt(environment);
|
||||||
archive(cereal::make_nvp("entities", envEnt));
|
archive(cereal::make_nvp("entities", envEnt));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
void save(Archive& archive, EnvironmentEntity const& m_entities) {
|
void save(Archive& archive, EntityEnvironmentEntity const& m_entities) {
|
||||||
archive(cereal::make_size_tag(static_cast<cereal::size_type>(
|
archive(cereal::make_size_tag(static_cast<cereal::size_type>(
|
||||||
m_entities.environment.getEntityCount())));
|
m_entities.environment.getEntityCount())));
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ namespace Deer {
|
|||||||
|
|
||||||
EntitySerializationStruct serializationStruct;
|
EntitySerializationStruct serializationStruct;
|
||||||
serializationStruct.env =
|
serializationStruct.env =
|
||||||
const_cast<Environment*>(&m_entities.environment);
|
const_cast<EntityEnvironment*>(&m_entities.environment);
|
||||||
serializationStruct.entityID = i;
|
serializationStruct.entityID = i;
|
||||||
|
|
||||||
archive(serializationStruct);
|
archive(serializationStruct);
|
||||||
@ -43,7 +43,7 @@ namespace Deer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
void load(Archive& archive, EnvironmentEntity& m_entities) {
|
void load(Archive& archive, EntityEnvironmentEntity& m_entities) {
|
||||||
cereal::size_type size;
|
cereal::size_type size;
|
||||||
archive(cereal::make_size_tag(size));
|
archive(cereal::make_size_tag(size));
|
||||||
|
|
||||||
27
Deer/src/DeerCore/World/Serialization/Serialization.h
Executable file
27
Deer/src/DeerCore/World/Serialization/Serialization.h
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cereal/cereal.hpp"
|
||||||
|
#include "cereal/types/string.hpp"
|
||||||
|
#include "cereal/types/vector.hpp"
|
||||||
|
|
||||||
|
// Serialization Vars
|
||||||
|
#include "DeerCore/World/Serialization/SerializationGlobalVars.h"
|
||||||
|
|
||||||
|
// GENERICS
|
||||||
|
#include "DeerCore/World/Serialization/QuatSerialization.h"
|
||||||
|
#include "DeerCore/World/Serialization/Vec3Serialization.h"
|
||||||
|
|
||||||
|
// SCENE SPECIFIC
|
||||||
|
#include "DeerCore/World/Serialization/EntityEnvironmentSerialization.h"
|
||||||
|
#include "DeerCore/World/Serialization/EntitySerialization.h"
|
||||||
|
|
||||||
|
// COMPONENTS SPECIFIC
|
||||||
|
#include "DeerCore/World/Serialization/Components/RelationshipComponentSerialization.h"
|
||||||
|
#include "DeerCore/World/Serialization/Components/TransformComponentSerialization.h"
|
||||||
|
|
||||||
|
// RENDER SPECIFIC
|
||||||
|
#ifdef DEER_RENDER
|
||||||
|
#include "DeerRender/World/Serialization/Components/CameraSerializationComponent.h"
|
||||||
|
#include "DeerRender/World/Serialization/Components/MeshRenderComponentSerialization.h"
|
||||||
|
#include "DeerRender/World/Serialization/Components/TextureBindingSerializationComponent.h"
|
||||||
|
#endif
|
||||||
@ -1,10 +1,10 @@
|
|||||||
#include "DeerCore/Scene.h"
|
#include "DeerCore/World.h"
|
||||||
|
|
||||||
#include "DeerCore/Components.h"
|
#include "DeerCore/Components.h"
|
||||||
#include "DeerCore/Enviroment.h"
|
#include "DeerCore/EntityEnviroment.h"
|
||||||
#include "DeerCore/Log.h"
|
#include "DeerCore/Log.h"
|
||||||
#include "DeerCore/Scene/SceneData.h"
|
|
||||||
#include "DeerCore/Tools/Memory.h"
|
#include "DeerCore/Tools/Memory.h"
|
||||||
|
#include "DeerCore/World/WorldData.h"
|
||||||
|
|
||||||
#ifdef DEER_RENDER
|
#ifdef DEER_RENDER
|
||||||
#include "DeerRender/FrameBuffer.h"
|
#include "DeerRender/FrameBuffer.h"
|
||||||
@ -13,29 +13,30 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
void Scene::clear() {
|
void World::clear() {
|
||||||
environment.clear();
|
environment.clear();
|
||||||
|
|
||||||
#ifdef DEER_RENDER
|
#ifdef DEER_RENDER
|
||||||
ResourceManager<Shader>::unloadResources();
|
ResourceManager<Shader>::unloadResources();
|
||||||
ResourceManager<GPUMesh>::unloadResources();
|
ResourceManager<GPUMesh>::unloadResources();
|
||||||
ResourceManager<FrameBuffer>::unloadResources();
|
ResourceManager<FrameBuffer>::unloadResources();
|
||||||
|
ResourceManager<Texture>::unloadResources();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scene::getExecutingState() {
|
bool World::getExecutingState() {
|
||||||
return isExecuting;
|
return isExecuting;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::initExecution() {
|
void World::initExecution() {
|
||||||
DEER_CORE_ASSERT(!isExecuting, "Deer scene is already executing");
|
DEER_CORE_ASSERT(!isExecuting, "Deer scene is already executing");
|
||||||
isExecuting = true;
|
isExecuting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::tickExecution() {
|
void World::tickExecution() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::endExecution() {
|
void World::endExecution() {
|
||||||
DEER_CORE_ASSERT(isExecuting, "Deer scene is not executing");
|
DEER_CORE_ASSERT(isExecuting, "Deer scene is not executing");
|
||||||
isExecuting = false;
|
isExecuting = false;
|
||||||
}
|
}
|
||||||
10
Deer/src/DeerCore/World/WorldData.cpp
Normal file
10
Deer/src/DeerCore/World/WorldData.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "DeerCore/EntityEnviroment.h"
|
||||||
|
#include "DeerCore/Tools/Memory.h"
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
namespace World {
|
||||||
|
EntityEnvironment environment;
|
||||||
|
bool isExecuting = false;
|
||||||
|
} // namespace World
|
||||||
|
|
||||||
|
} // namespace Deer
|
||||||
@ -2,11 +2,11 @@
|
|||||||
#include "DeerCore/Tools/Memory.h"
|
#include "DeerCore/Tools/Memory.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
class Environment;
|
class EntityEnvironment;
|
||||||
|
|
||||||
namespace Scene {
|
namespace World {
|
||||||
extern Environment environment;
|
extern EntityEnvironment environment;
|
||||||
extern bool isExecuting;
|
extern bool isExecuting;
|
||||||
} // namespace Scene
|
} // namespace World
|
||||||
|
|
||||||
} // namespace Deer
|
} // namespace Deer
|
||||||
@ -1,4 +1,4 @@
|
|||||||
#include "DeerRender/Enviroment.h"
|
#include "DeerRender/EntityEnviroment.h"
|
||||||
|
|
||||||
#include "DeerRender/Application.h"
|
#include "DeerRender/Application.h"
|
||||||
|
|
||||||
@ -13,7 +13,7 @@
|
|||||||
#include "DeerRender/Log.h"
|
#include "DeerRender/Log.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
void Environment::render(const SceneCamera& camera) {
|
void EntityEnvironment::render(const WorldCamera& camera) {
|
||||||
glm::mat4 camMatrix = glm::inverse(camera.transform.getMatrix());
|
glm::mat4 camMatrix = glm::inverse(camera.transform.getMatrix());
|
||||||
glm::mat4 projectionMatrix = camera.camera.getMatrix();
|
glm::mat4 projectionMatrix = camera.camera.getMatrix();
|
||||||
glm::mat4 invertZ = glm::scale(glm::mat4(1.0f), glm::vec3(1, 1, -1));
|
glm::mat4 invertZ = glm::scale(glm::mat4(1.0f), glm::vec3(1, 1, -1));
|
||||||
@ -1,25 +1,25 @@
|
|||||||
#include "DeerRender/Scene.h"
|
#include "DeerRender/World.h"
|
||||||
|
|
||||||
#include "DeerRender/Components.h"
|
#include "DeerRender/Components.h"
|
||||||
#include "DeerRender/Enviroment.h"
|
#include "DeerRender/EntityEnviroment.h"
|
||||||
#include "DeerRender/Render/RenderCommand.h"
|
#include "DeerRender/Render/RenderCommand.h"
|
||||||
#include "DeerRender/Scene.h"
|
#include "DeerRender/World.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
void Scene::render() {
|
void World::render() {
|
||||||
uint32_t mainCamera = environment.tryGetMainCamera();
|
uint32_t mainCamera = environment.tryGetMainCamera();
|
||||||
if (mainCamera == 0)
|
if (mainCamera == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity& m_cameraEntity = environment.getEntity(mainCamera);
|
Entity& m_cameraEntity = environment.getEntity(mainCamera);
|
||||||
SceneCamera sceneCamera;
|
WorldCamera sceneCamera;
|
||||||
sceneCamera.camera = m_cameraEntity.getComponent<CameraComponent>();
|
sceneCamera.camera = m_cameraEntity.getComponent<CameraComponent>();
|
||||||
sceneCamera.transform = m_cameraEntity.getComponent<TransformComponent>();
|
sceneCamera.transform = m_cameraEntity.getComponent<TransformComponent>();
|
||||||
|
|
||||||
Scene::render(sceneCamera);
|
World::render(sceneCamera);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::render(const SceneCamera& sceneCamera) {
|
void World::render(const WorldCamera& sceneCamera) {
|
||||||
RenderCommand::setDepthBuffer(true);
|
RenderCommand::setDepthBuffer(true);
|
||||||
environment.render(sceneCamera);
|
environment.render(sceneCamera);
|
||||||
|
|
||||||
20
DeerStudio/headers/DeerStudio/StudioAPI/EntityEnvironment.h
Normal file
20
DeerStudio/headers/DeerStudio/StudioAPI/EntityEnvironment.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "GenericRefStructs.h"
|
||||||
|
#include <string>
|
||||||
|
// #include "DeerRender/World.h"
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
class WorldCamera;
|
||||||
|
|
||||||
|
namespace StudioAPI {
|
||||||
|
struct EntityEnvironmentStruct : EntityEnvironmentHandleStruct {
|
||||||
|
void render(FrameBufferHandleStruct, WorldCamera&);
|
||||||
|
|
||||||
|
EntityHandleStruct getRootEntity();
|
||||||
|
EntityHandleStruct getEntity(int);
|
||||||
|
};
|
||||||
|
|
||||||
|
EntityEnvironmentHandleStruct getMainEntityEnvironment();
|
||||||
|
EntityEnvironmentHandleStruct createLoadEntityEnvironment(std::string& envId);
|
||||||
|
} // namespace StudioAPI
|
||||||
|
} // namespace Deer
|
||||||
@ -1,20 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "GenericRefStructs.h"
|
|
||||||
#include <string>
|
|
||||||
// #include "DeerRender/Scene.h"
|
|
||||||
|
|
||||||
namespace Deer {
|
|
||||||
class SceneCamera;
|
|
||||||
|
|
||||||
namespace StudioAPI {
|
|
||||||
struct EnvironmentStruct : EnvironmentHandleStruct {
|
|
||||||
void render(FrameBufferHandleStruct, SceneCamera&);
|
|
||||||
|
|
||||||
EntityHandleStruct getRootEntity();
|
|
||||||
EntityHandleStruct getEntity(int);
|
|
||||||
};
|
|
||||||
|
|
||||||
EnvironmentHandleStruct getMainEnvironment();
|
|
||||||
EnvironmentHandleStruct createLoadEnvironment(std::string& envId);
|
|
||||||
} // namespace StudioAPI
|
|
||||||
} // namespace Deer
|
|
||||||
@ -2,11 +2,11 @@
|
|||||||
#include "DeerRender/Tools/TypeDefs.h"
|
#include "DeerRender/Tools/TypeDefs.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
class Environment;
|
class EntityEnvironment;
|
||||||
|
|
||||||
namespace StudioAPI {
|
namespace StudioAPI {
|
||||||
struct EnvironmentHandleStruct {
|
struct EntityEnvironmentHandleStruct {
|
||||||
EnvironmentHandleStruct(int32_t _id = -1) : environmentId(_id) {}
|
EntityEnvironmentHandleStruct(int32_t _id = -1) : environmentId(_id) {}
|
||||||
|
|
||||||
int32_t environmentId;
|
int32_t environmentId;
|
||||||
};
|
};
|
||||||
@ -18,7 +18,7 @@ namespace Deer {
|
|||||||
int32_t environmentId;
|
int32_t environmentId;
|
||||||
|
|
||||||
bool assertEntity(const char* funcName);
|
bool assertEntity(const char* funcName);
|
||||||
Environment* getEntityEnvironment();
|
EntityEnvironment* getEntityEntityEnvironment();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FrameBufferHandleStruct {
|
struct FrameBufferHandleStruct {
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
#include "glm/gtc/quaternion.hpp"
|
#include "glm/gtc/quaternion.hpp"
|
||||||
|
|
||||||
#include "DeerRender/Components.h"
|
#include "DeerRender/Components.h"
|
||||||
#include "DeerRender/Scene.h"
|
#include "DeerRender/World.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
namespace StudioAPI {
|
namespace StudioAPI {
|
||||||
@ -26,7 +26,7 @@ namespace Deer {
|
|||||||
|
|
||||||
void transform_construct(TransformComponent*);
|
void transform_construct(TransformComponent*);
|
||||||
void camera_construct(CameraComponent*);
|
void camera_construct(CameraComponent*);
|
||||||
void sceneCamera_Construct(SceneCamera*);
|
void sceneCamera_Construct(WorldCamera*);
|
||||||
|
|
||||||
glm::vec3 transform_relative(glm::vec3, TransformComponent*);
|
glm::vec3 transform_relative(glm::vec3, TransformComponent*);
|
||||||
|
|
||||||
|
|||||||
@ -13,21 +13,7 @@ namespace Deer {
|
|||||||
extern CScriptAny* payload;
|
extern CScriptAny* payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sameline();
|
// Text & titles
|
||||||
void separator();
|
|
||||||
void disablePanelPadding(bool);
|
|
||||||
|
|
||||||
int getAvailableSizeX();
|
|
||||||
int getAvailableSizeY();
|
|
||||||
|
|
||||||
bool button(std::string&);
|
|
||||||
bool buttonCenter(std::string&);
|
|
||||||
bool buttonEnd(std::string&);
|
|
||||||
|
|
||||||
bool cartIconButton(const std::string& label, const std::string& icon, int iconSize, int width);
|
|
||||||
bool cartIconButton_frameBuffer(const std::string& label, FrameBufferHandleStruct frameBuffer, int iconSize, int width);
|
|
||||||
|
|
||||||
|
|
||||||
void text(std::string&);
|
void text(std::string&);
|
||||||
void textCenter(std::string&);
|
void textCenter(std::string&);
|
||||||
void textEnd(std::string&);
|
void textEnd(std::string&);
|
||||||
@ -38,6 +24,15 @@ namespace Deer {
|
|||||||
void titleEnd(std::string&);
|
void titleEnd(std::string&);
|
||||||
void titleCenterY(std::string&, int);
|
void titleCenterY(std::string&, int);
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
bool button(std::string&);
|
||||||
|
bool buttonCenter(std::string&);
|
||||||
|
bool buttonEnd(std::string&);
|
||||||
|
|
||||||
|
bool cartIconButton(const std::string& label, const std::string& icon, int iconSize, int width);
|
||||||
|
bool cartIconButton_frameBuffer(const std::string& label, FrameBufferHandleStruct frameBuffer, int iconSize, int width);
|
||||||
|
|
||||||
|
// Icons
|
||||||
void drawIcon(std::string& iconId, int size);
|
void drawIcon(std::string& iconId, int size);
|
||||||
void drawIconCentered(std::string& iconId, int size);
|
void drawIconCentered(std::string& iconId, int size);
|
||||||
void drawIconHighlight(std::string& iconId, int size);
|
void drawIconHighlight(std::string& iconId, int size);
|
||||||
@ -48,9 +43,22 @@ namespace Deer {
|
|||||||
void drawIconHighlight_resource(Resource<Texture> texture, int size);
|
void drawIconHighlight_resource(Resource<Texture> texture, int size);
|
||||||
void drawIconCenteredHighlight_resource(Resource<Texture> texture, int size);
|
void drawIconCenteredHighlight_resource(Resource<Texture> texture, int size);
|
||||||
|
|
||||||
void drawFrameBuffer(FrameBufferHandleStruct frameBuffer, int sizeX, int sizeY);
|
int getIconId(const std::string& name);
|
||||||
void drawFrameBufferCentered(FrameBufferHandleStruct frameBuffer, int sizeX, int sizeY);
|
|
||||||
|
|
||||||
|
// Layout & panel
|
||||||
|
void sameline();
|
||||||
|
void separator();
|
||||||
|
void disablePanelPadding(bool);
|
||||||
|
|
||||||
|
void space();
|
||||||
|
void space_params(int x, int y);
|
||||||
|
|
||||||
|
int getAvailableSizeX();
|
||||||
|
int getAvailableSizeY();
|
||||||
|
|
||||||
|
bool isPanelActive();
|
||||||
|
|
||||||
|
// Input widgets
|
||||||
bool inputText(std::string& label, std::string&, std::string&);
|
bool inputText(std::string& label, std::string&, std::string&);
|
||||||
bool checkbox(std::string& label, bool);
|
bool checkbox(std::string& label, bool);
|
||||||
bool checkboxDisabled(std::string& label, bool);
|
bool checkboxDisabled(std::string& label, bool);
|
||||||
@ -61,30 +69,31 @@ namespace Deer {
|
|||||||
float magicSlider(std::string&, float, float);
|
float magicSlider(std::string&, float, float);
|
||||||
glm::vec3 magicSlider3(std::string&, glm::vec3, float);
|
glm::vec3 magicSlider3(std::string&, glm::vec3, float);
|
||||||
|
|
||||||
|
// Menus
|
||||||
bool menuItem(std::string&);
|
bool menuItem(std::string&);
|
||||||
void menuItemDisabled(std::string&);
|
void menuItemDisabled(std::string&);
|
||||||
void subMenu(std::string&, asIScriptFunction*);
|
void subMenu(std::string&, asIScriptFunction*);
|
||||||
|
|
||||||
|
// Drag & Drop
|
||||||
void dragDropSource(std::string&, CScriptAny*, std::string&);
|
void dragDropSource(std::string&, CScriptAny*, std::string&);
|
||||||
void dragDropTarget(std::string&, asIScriptFunction*);
|
void dragDropTarget(std::string&, asIScriptFunction*);
|
||||||
|
|
||||||
|
// Mouse & keyboard input state
|
||||||
bool isItemClicked(int mouse);
|
bool isItemClicked(int mouse);
|
||||||
bool isMouseDoubleClicked(int mouse);
|
bool isMouseDoubleClicked(int mouse);
|
||||||
|
|
||||||
bool isKeyDown(int);
|
|
||||||
bool isKeyPressed(int);
|
|
||||||
|
|
||||||
bool isMouseDragging(int);
|
bool isMouseDragging(int);
|
||||||
float getMouseDragDeltaX();
|
float getMouseDragDeltaX();
|
||||||
float getMouseDragDeltaY();
|
float getMouseDragDeltaY();
|
||||||
float getMouseDeltaX();
|
float getMouseDeltaX();
|
||||||
float getMouseDeltaY();
|
float getMouseDeltaY();
|
||||||
|
|
||||||
bool isPanelActive();
|
bool isKeyDown(int);
|
||||||
|
bool isKeyPressed(int);
|
||||||
|
|
||||||
void space();
|
// Rendering helpers
|
||||||
void space_params(int x, int y);
|
void drawFrameBuffer(FrameBufferHandleStruct frameBuffer, int sizeX, int sizeY);
|
||||||
|
void drawFrameBufferCentered(FrameBufferHandleStruct frameBuffer, int sizeX, int sizeY);
|
||||||
|
|
||||||
int getIconId(const std::string& name);
|
|
||||||
} // namespace StudioAPI
|
} // namespace StudioAPI
|
||||||
} // namespace Deer
|
} // namespace Deer
|
||||||
|
|||||||
@ -98,7 +98,7 @@ namespace Deer {
|
|||||||
void AngelScriptEngine::registerStructs() {
|
void AngelScriptEngine::registerStructs() {
|
||||||
registerMathStructs();
|
registerMathStructs();
|
||||||
registerResourceStructs();
|
registerResourceStructs();
|
||||||
registerEnvironmentStructs();
|
registerEntityEnvironmentStructs();
|
||||||
registerEntityStructs();
|
registerEntityStructs();
|
||||||
registerEngineStructs();
|
registerEngineStructs();
|
||||||
registerFrameBufferStructs();
|
registerFrameBufferStructs();
|
||||||
@ -109,7 +109,7 @@ namespace Deer {
|
|||||||
registerUIFunctions();
|
registerUIFunctions();
|
||||||
registerMathFunctions();
|
registerMathFunctions();
|
||||||
registerResourceFunctions();
|
registerResourceFunctions();
|
||||||
registerEnvironmentFunctions();
|
registerEntityEnvironmentFunctions();
|
||||||
registerEntityFunctions();
|
registerEntityFunctions();
|
||||||
registerEngineFunctions();
|
registerEngineFunctions();
|
||||||
registerFrameBufferFunctions();
|
registerFrameBufferFunctions();
|
||||||
|
|||||||
@ -33,7 +33,7 @@ namespace Deer {
|
|||||||
void registerUIFunctions();
|
void registerUIFunctions();
|
||||||
void registerMathFunctions();
|
void registerMathFunctions();
|
||||||
void registerResourceFunctions();
|
void registerResourceFunctions();
|
||||||
void registerEnvironmentFunctions();
|
void registerEntityEnvironmentFunctions();
|
||||||
void registerEntityFunctions();
|
void registerEntityFunctions();
|
||||||
void registerEngineFunctions();
|
void registerEngineFunctions();
|
||||||
void registerFrameBufferFunctions();
|
void registerFrameBufferFunctions();
|
||||||
@ -41,7 +41,7 @@ namespace Deer {
|
|||||||
void registerMathStructs();
|
void registerMathStructs();
|
||||||
void registerUIStructs();
|
void registerUIStructs();
|
||||||
void registerResourceStructs();
|
void registerResourceStructs();
|
||||||
void registerEnvironmentStructs();
|
void registerEntityEnvironmentStructs();
|
||||||
void registerEntityStructs();
|
void registerEntityStructs();
|
||||||
void registerEngineStructs();
|
void registerEngineStructs();
|
||||||
void registerFrameBufferStructs();
|
void registerFrameBufferStructs();
|
||||||
|
|||||||
@ -273,7 +273,7 @@ namespace Deer {
|
|||||||
stream.clear();
|
stream.clear();
|
||||||
stream.str("");
|
stream.str("");
|
||||||
str.clear();
|
str.clear();
|
||||||
stream << "// This file is autogenerated";
|
stream << "// This file is autogenerated\n";
|
||||||
|
|
||||||
printFuncList(*scriptEngine);
|
printFuncList(*scriptEngine);
|
||||||
printEnumList(*scriptEngine);
|
printEnumList(*scriptEngine);
|
||||||
|
|||||||
@ -22,11 +22,9 @@ namespace Deer {
|
|||||||
|
|
||||||
AS_RET_CHECK(scriptEngine->RegisterInterface("Service"));
|
AS_RET_CHECK(scriptEngine->RegisterInterface("Service"));
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterFuncdef("void Callback()"));
|
AS_CHECK(scriptEngine->RegisterFuncdef("void SimpleFunction()"));
|
||||||
AS_CHECK(scriptEngine->RegisterFuncdef("void AnyCallback(any@)"));
|
AS_CHECK(scriptEngine->RegisterFuncdef("void ReciverFunction(any@)"));
|
||||||
|
AS_CHECK(scriptEngine->RegisterFuncdef("void TransferFunction(any@, any@)"));
|
||||||
AS_CHECK(scriptEngine->RegisterFuncdef("void ReciverFunc(any@)"));
|
|
||||||
AS_CHECK(scriptEngine->RegisterFuncdef("void TransferFunc(any@, any@)"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AngelScriptEngine::extractBaseTypes() {
|
void AngelScriptEngine::extractBaseTypes() {
|
||||||
|
|||||||
@ -1,22 +1,22 @@
|
|||||||
#include "DeerStudio/StudioAPI/Environment.h"
|
|
||||||
#include "DeerStudio/AngelScriptEngine/AngelScriptRegisters.h"
|
#include "DeerStudio/AngelScriptEngine/AngelScriptRegisters.h"
|
||||||
|
#include "DeerStudio/StudioAPI/EntityEnvironment.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
void registerEnvironmentStructs();
|
void registerEntityEnvironmentStructs();
|
||||||
void registerEnvironmentFunctions();
|
void registerEntityEnvironmentFunctions();
|
||||||
|
|
||||||
void AngelScriptEngine::registerEnvironmentStructs() {
|
void AngelScriptEngine::registerEntityEnvironmentStructs() {
|
||||||
AS_CHECK(scriptEngine->RegisterObjectType("Environment", sizeof(StudioAPI::EnvironmentStruct), asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<StudioAPI::EnvironmentStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
AS_CHECK(scriptEngine->RegisterObjectType("EntityEnvironment", sizeof(StudioAPI::EntityEnvironmentStruct), asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<StudioAPI::EntityEnvironmentStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AngelScriptEngine::registerEnvironmentFunctions() {
|
void AngelScriptEngine::registerEntityEnvironmentFunctions() {
|
||||||
scriptEngine->SetDefaultNamespace("Resource");
|
scriptEngine->SetDefaultNamespace("Resource");
|
||||||
REGISTER_GLOBAL_FUNC("Environment getMainEnvironment()", StudioAPI::getMainEnvironment);
|
REGISTER_GLOBAL_FUNC("EntityEnvironment getMainEntityEnvironment()", StudioAPI::getMainEntityEnvironment);
|
||||||
REGISTER_GLOBAL_FUNC("Environment createLoadEnvironment(const string&in envId)", StudioAPI::createLoadEnvironment);
|
REGISTER_GLOBAL_FUNC("EntityEnvironment createLoadEntityEnvironment(const string&in envId)", StudioAPI::createLoadEntityEnvironment);
|
||||||
scriptEngine->SetDefaultNamespace("");
|
scriptEngine->SetDefaultNamespace("");
|
||||||
|
|
||||||
REGISTER_OBJECT_METHOD("Environment", "void render(FrameBuffer, SceneCamera&in)", StudioAPI::EnvironmentStruct, render);
|
REGISTER_OBJECT_METHOD("EntityEnvironment", "void render(FrameBuffer, WorldCamera&in)", StudioAPI::EntityEnvironmentStruct, render);
|
||||||
REGISTER_OBJECT_METHOD("Environment", "Entity getRootEntity()", StudioAPI::EnvironmentStruct, getRootEntity);
|
REGISTER_OBJECT_METHOD("EntityEnvironment", "Entity getRootEntity()", StudioAPI::EntityEnvironmentStruct, getRootEntity);
|
||||||
REGISTER_OBJECT_METHOD("Environment", "Entity getEntity(int)", StudioAPI::EnvironmentStruct, getEntity);
|
REGISTER_OBJECT_METHOD("EntityEnvironment", "Entity getEntity(int)", StudioAPI::EntityEnvironmentStruct, getEntity);
|
||||||
}
|
}
|
||||||
} // namespace Deer
|
} // namespace Deer
|
||||||
@ -27,9 +27,9 @@ namespace Deer {
|
|||||||
AS_CHECK(scriptEngine->RegisterObjectProperty("Camera", "float nearZ", asOFFSET(CameraComponent, nearZ)));
|
AS_CHECK(scriptEngine->RegisterObjectProperty("Camera", "float nearZ", asOFFSET(CameraComponent, nearZ)));
|
||||||
AS_CHECK(scriptEngine->RegisterObjectProperty("Camera", "float farZ", asOFFSET(CameraComponent, farZ)));
|
AS_CHECK(scriptEngine->RegisterObjectProperty("Camera", "float farZ", asOFFSET(CameraComponent, farZ)));
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterObjectType("SceneCamera", sizeof(SceneCamera), asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<SceneCamera>()));
|
AS_CHECK(scriptEngine->RegisterObjectType("WorldCamera", sizeof(WorldCamera), asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<WorldCamera>()));
|
||||||
AS_CHECK(scriptEngine->RegisterObjectProperty("SceneCamera", "Camera camera", asOFFSET(SceneCamera, camera)));
|
AS_CHECK(scriptEngine->RegisterObjectProperty("WorldCamera", "Camera camera", asOFFSET(WorldCamera, camera)));
|
||||||
AS_CHECK(scriptEngine->RegisterObjectProperty("SceneCamera", "Transform transform", asOFFSET(SceneCamera, transform)));
|
AS_CHECK(scriptEngine->RegisterObjectProperty("WorldCamera", "Transform transform", asOFFSET(WorldCamera, transform)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AngelScriptEngine::registerMathFunctions() {
|
void AngelScriptEngine::registerMathFunctions() {
|
||||||
@ -49,7 +49,7 @@ namespace Deer {
|
|||||||
|
|
||||||
REGISTER_EXT_OBJECT_CONSTRUCTOR("Transform", "void f()", StudioAPI::transform_construct);
|
REGISTER_EXT_OBJECT_CONSTRUCTOR("Transform", "void f()", StudioAPI::transform_construct);
|
||||||
REGISTER_EXT_OBJECT_CONSTRUCTOR("Camera", "void f()", StudioAPI::camera_construct);
|
REGISTER_EXT_OBJECT_CONSTRUCTOR("Camera", "void f()", StudioAPI::camera_construct);
|
||||||
REGISTER_EXT_OBJECT_CONSTRUCTOR("SceneCamera", "void f()", StudioAPI::sceneCamera_Construct);
|
REGISTER_EXT_OBJECT_CONSTRUCTOR("WorldCamera", "void f()", StudioAPI::sceneCamera_Construct);
|
||||||
|
|
||||||
REGISTER_EXT_OBJECT_METHOD("Transform", "vec3 relative(vec3)", StudioAPI::transform_relative);
|
REGISTER_EXT_OBJECT_METHOD("Transform", "vec3 relative(vec3)", StudioAPI::transform_relative);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ namespace Deer {
|
|||||||
// Menus
|
// Menus
|
||||||
REGISTER_GLOBAL_FUNC("bool menuItem(const string& in text)", StudioAPI::menuItem);
|
REGISTER_GLOBAL_FUNC("bool menuItem(const string& in text)", StudioAPI::menuItem);
|
||||||
REGISTER_GLOBAL_FUNC("void menuItemDisabled(const string& in text)", StudioAPI::menuItemDisabled);
|
REGISTER_GLOBAL_FUNC("void menuItemDisabled(const string& in text)", StudioAPI::menuItemDisabled);
|
||||||
REGISTER_GLOBAL_FUNC("void subMenu(const string& in text, Callback@+ func)", StudioAPI::subMenu);
|
REGISTER_GLOBAL_FUNC("void subMenu(const string& in text, SimpleFunction@+ func)", StudioAPI::subMenu);
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
REGISTER_GLOBAL_FUNC("void text(const string& in text)", StudioAPI::text);
|
REGISTER_GLOBAL_FUNC("void text(const string& in text)", StudioAPI::text);
|
||||||
@ -90,96 +90,94 @@ namespace Deer {
|
|||||||
|
|
||||||
// Tree & Components
|
// Tree & Components
|
||||||
REGISTER_GLOBAL_FUNC("void treeNodeLeaf(const string& in, bool)", StudioAPI::treeNodeLeaf);
|
REGISTER_GLOBAL_FUNC("void treeNodeLeaf(const string& in, bool)", StudioAPI::treeNodeLeaf);
|
||||||
REGISTER_GLOBAL_FUNC("bool treeNode(const string& in, bool, Callback@+)", StudioAPI::treeNode);
|
REGISTER_GLOBAL_FUNC("bool treeNode(const string& in, bool, SimpleFunction@+)", StudioAPI::treeNode);
|
||||||
REGISTER_GLOBAL_FUNC("bool componentNode(const string& in, Callback@+)", StudioAPI::componentNode);
|
REGISTER_GLOBAL_FUNC("bool componentNode(const string& in, SimpleFunction@+)", StudioAPI::componentNode);
|
||||||
REGISTER_GLOBAL_FUNC("bool componentNodeContextMenu(const string& in, Callback@+, Callback@+)", StudioAPI::componentNodeContextMenu);
|
REGISTER_GLOBAL_FUNC("bool componentNodeContextMenu(const string& in, SimpleFunction@+, SimpleFunction@+)", StudioAPI::componentNodeContextMenu);
|
||||||
|
|
||||||
// Popups & Modals
|
// Popups & Modals
|
||||||
REGISTER_GLOBAL_FUNC("void contextItemPopup(const string& in, Callback@+)", StudioAPI::contextItemPopup);
|
REGISTER_GLOBAL_FUNC("void contextItemPopup(const string& in, SimpleFunction@+)", StudioAPI::contextItemPopup);
|
||||||
REGISTER_GLOBAL_FUNC("void contextMenuPopup(const string& in, Callback@+)", StudioAPI::contextMenuPopup);
|
REGISTER_GLOBAL_FUNC("void contextMenuPopup(const string& in, SimpleFunction@+)", StudioAPI::contextMenuPopup);
|
||||||
REGISTER_GLOBAL_FUNC("void modalPopup(const string& in, Callback@+)", StudioAPI::modalPopup);
|
REGISTER_GLOBAL_FUNC("void modalPopup(const string& in, SimpleFunction@+)", StudioAPI::modalPopup);
|
||||||
REGISTER_GLOBAL_FUNC("void simplePopup(const string& in, Callback@+)", StudioAPI::simplePopup);
|
REGISTER_GLOBAL_FUNC("void simplePopup(const string& in, SimpleFunction@+)", StudioAPI::simplePopup);
|
||||||
REGISTER_GLOBAL_FUNC("void openPopup(const string& in, any@)", StudioAPI::openPopup);
|
REGISTER_GLOBAL_FUNC("void openPopup(const string& in, any@)", StudioAPI::openPopup);
|
||||||
REGISTER_GLOBAL_FUNC("void closePopup()", StudioAPI::closePopup);
|
REGISTER_GLOBAL_FUNC("void closePopup()", StudioAPI::closePopup);
|
||||||
|
|
||||||
// Drag & Drop
|
// Drag & Drop
|
||||||
REGISTER_GLOBAL_FUNC("void dragDropSource(const string& in, any@+, const string& in)", StudioAPI::dragDropSource);
|
REGISTER_GLOBAL_FUNC("void dragDropSource(const string& in, any@+, const string& in)", StudioAPI::dragDropSource);
|
||||||
REGISTER_GLOBAL_FUNC("void dragDropTarget(const string& in, AnyCallback@+)", StudioAPI::dragDropTarget);
|
REGISTER_GLOBAL_FUNC("void dragDropTarget(const string& in, ReciverFunction@+)", StudioAPI::dragDropTarget);
|
||||||
scriptEngine->SetDefaultNamespace("");
|
scriptEngine->SetDefaultNamespace("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AngelScriptEngine::registerUIStructs() {
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnum("key"));
|
||||||
|
|
||||||
void AngelScriptEngine::registerUIStructs() {
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "A", ImGuiKey_A));
|
||||||
AS_CHECK(scriptEngine->RegisterEnum("key"));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "B", ImGuiKey_B));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "C", ImGuiKey_C));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "D", ImGuiKey_D));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "E", ImGuiKey_E));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "F", ImGuiKey_F));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "G", ImGuiKey_G));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "H", ImGuiKey_H));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "I", ImGuiKey_I));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "J", ImGuiKey_J));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K", ImGuiKey_K));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "L", ImGuiKey_L));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "M", ImGuiKey_M));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "N", ImGuiKey_N));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "O", ImGuiKey_O));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "P", ImGuiKey_P));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Q", ImGuiKey_Q));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "R", ImGuiKey_R));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "S", ImGuiKey_S));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "T", ImGuiKey_T));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "U", ImGuiKey_U));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "V", ImGuiKey_V));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "W", ImGuiKey_W));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "X", ImGuiKey_X));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Y", ImGuiKey_Y));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Z", ImGuiKey_Z));
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "A", ImGuiKey_A));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K0", ImGuiKey_0));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "B", ImGuiKey_B));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K1", ImGuiKey_1));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "C", ImGuiKey_C));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K2", ImGuiKey_2));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "D", ImGuiKey_D));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K3", ImGuiKey_3));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "E", ImGuiKey_E));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K4", ImGuiKey_4));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "F", ImGuiKey_F));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K5", ImGuiKey_5));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "G", ImGuiKey_G));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K6", ImGuiKey_6));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "H", ImGuiKey_H));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K7", ImGuiKey_7));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "I", ImGuiKey_I));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K8", ImGuiKey_8));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "J", ImGuiKey_J));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K9", ImGuiKey_9));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K", ImGuiKey_K));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "L", ImGuiKey_L));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "M", ImGuiKey_M));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "N", ImGuiKey_N));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "O", ImGuiKey_O));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "P", ImGuiKey_P));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Q", ImGuiKey_Q));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "R", ImGuiKey_R));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "S", ImGuiKey_S));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "T", ImGuiKey_T));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "U", ImGuiKey_U));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "V", ImGuiKey_V));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "W", ImGuiKey_W));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "X", ImGuiKey_X));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Y", ImGuiKey_Y));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Z", ImGuiKey_Z));
|
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K0", ImGuiKey_0));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Tab", ImGuiKey_Tab));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K1", ImGuiKey_1));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Enter", ImGuiKey_Enter));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K2", ImGuiKey_2));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Escape", ImGuiKey_Escape));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K3", ImGuiKey_3));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Backspace", ImGuiKey_Backspace));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K4", ImGuiKey_4));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Space", ImGuiKey_Space));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K5", ImGuiKey_5));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Delete", ImGuiKey_Delete));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K6", ImGuiKey_6));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Insert", ImGuiKey_Insert));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K7", ImGuiKey_7));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Home", ImGuiKey_Home));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K8", ImGuiKey_8));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "End", ImGuiKey_End));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "K9", ImGuiKey_9));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "PageUp", ImGuiKey_PageUp));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "PageDown", ImGuiKey_PageDown));
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Tab", ImGuiKey_Tab));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Right", ImGuiKey_RightArrow));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Enter", ImGuiKey_Enter));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Up", ImGuiKey_UpArrow));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Escape", ImGuiKey_Escape));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Down", ImGuiKey_DownArrow));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Backspace", ImGuiKey_Backspace));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Left", ImGuiKey_LeftArrow));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Space", ImGuiKey_Space));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Delete", ImGuiKey_Delete));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Insert", ImGuiKey_Insert));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Home", ImGuiKey_Home));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "End", ImGuiKey_End));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "PageUp", ImGuiKey_PageUp));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "PageDown", ImGuiKey_PageDown));
|
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Right", ImGuiKey_RightArrow));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Up", ImGuiKey_UpArrow));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Down", ImGuiKey_DownArrow));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "Left", ImGuiKey_LeftArrow));
|
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "RightCtrl", ImGuiKey_RightCtrl));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "LeftShift", ImGuiKey_LeftShift));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "RightShift", ImGuiKey_RightShift));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "LeftAlt", ImGuiKey_LeftAlt));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "RightAlt", ImGuiKey_RightAlt));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "LeftSuper", ImGuiKey_LeftSuper));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "RightSuper", ImGuiKey_RightSuper));
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "LeftCtrl", ImGuiKey_LeftCtrl));
|
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "MouseLeft", ImGuiKey_MouseLeft));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "RightCtrl", ImGuiKey_RightCtrl));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "MouseRight", ImGuiKey_MouseRight));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "LeftShift", ImGuiKey_LeftShift));
|
||||||
AS_CHECK(scriptEngine->RegisterEnumValue("key", "MouseMiddle", ImGuiKey_MouseMiddle));
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "RightShift", ImGuiKey_RightShift));
|
||||||
}
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "LeftAlt", ImGuiKey_LeftAlt));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "RightAlt", ImGuiKey_RightAlt));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "LeftSuper", ImGuiKey_LeftSuper));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "RightSuper", ImGuiKey_RightSuper));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "LeftCtrl", ImGuiKey_LeftCtrl));
|
||||||
|
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "MouseLeft", ImGuiKey_MouseLeft));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "MouseRight", ImGuiKey_MouseRight));
|
||||||
|
AS_CHECK(scriptEngine->RegisterEnumValue("key", "MouseMiddle", ImGuiKey_MouseMiddle));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Deer
|
} // namespace Deer
|
||||||
@ -2,8 +2,8 @@
|
|||||||
#include "DeerStudio/AngelScriptEngine.h"
|
#include "DeerStudio/AngelScriptEngine.h"
|
||||||
|
|
||||||
#include "DeerRender/DataStore.h"
|
#include "DeerRender/DataStore.h"
|
||||||
#include "DeerRender/Scene.h"
|
|
||||||
#include "DeerRender/Tools/Path.h"
|
#include "DeerRender/Tools/Path.h"
|
||||||
|
#include "DeerRender/World.h"
|
||||||
|
|
||||||
#include "DeerRender/Application.h"
|
#include "DeerRender/Application.h"
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ namespace Deer {
|
|||||||
AngelScriptEngine::deinitialize();
|
AngelScriptEngine::deinitialize();
|
||||||
RenderUtils::deinitializeRenderUtils();
|
RenderUtils::deinitializeRenderUtils();
|
||||||
|
|
||||||
Scene::clear();
|
World::clear();
|
||||||
|
|
||||||
Application::shutdownWindow();
|
Application::shutdownWindow();
|
||||||
Log::shutdown();
|
Log::shutdown();
|
||||||
|
|||||||
@ -2,14 +2,14 @@
|
|||||||
#include "DeerStudio/AngelScriptEngine.h"
|
#include "DeerStudio/AngelScriptEngine.h"
|
||||||
|
|
||||||
#include "DeerRender/Components.h"
|
#include "DeerRender/Components.h"
|
||||||
#include "DeerRender/Enviroment.h"
|
#include "DeerRender/EntityEnviroment.h"
|
||||||
#include "DeerRender/Scene.h"
|
#include "DeerRender/World.h"
|
||||||
|
|
||||||
#include "DeerRender/Resource.h"
|
#include "DeerRender/Resource.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define GET_ENV(env) ((env < 0) ? Scene::environment : Deer::Resource<Environment>::unsafeFromId(environmentId).getData())
|
#define GET_ENV(env) ((env < 0) ? World::environment : Deer::Resource<EntityEnvironment>::unsafeFromId(environmentId).getData())
|
||||||
|
|
||||||
#define GET_ENTITY(env, id) GET_ENV(env).getEntity(id)
|
#define GET_ENTITY(env, id) GET_ENV(env).getEntity(id)
|
||||||
#define GET_MESH_COMPONENT(env, id) \
|
#define GET_MESH_COMPONENT(env, id) \
|
||||||
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
namespace StudioAPI {
|
namespace StudioAPI {
|
||||||
extern std::vector<Scope<Environment>> environments;
|
extern std::vector<Scope<EntityEnvironment>> environments;
|
||||||
|
|
||||||
EntityHandleStruct getRoot() { return EntityStruct(0); }
|
EntityHandleStruct getRoot() { return EntityStruct(0); }
|
||||||
|
|
||||||
@ -46,14 +46,14 @@ namespace Deer {
|
|||||||
|
|
||||||
EntityStruct::EntityStruct(uint16_t _entId, int32_t _envId) : EntityHandleStruct(_entId, _envId) {}
|
EntityStruct::EntityStruct(uint16_t _entId, int32_t _envId) : EntityHandleStruct(_entId, _envId) {}
|
||||||
|
|
||||||
Environment* EntityHandleStruct::getEntityEnvironment() {
|
EntityEnvironment* EntityHandleStruct::getEntityEntityEnvironment() {
|
||||||
if (environmentId < 0)
|
if (environmentId < 0)
|
||||||
return &Scene::environment;
|
return &World::environment;
|
||||||
return &Resource<Environment>::unsafeFromId(environmentId).getData();
|
return &Resource<EntityEnvironment>::unsafeFromId(environmentId).getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityHandleStruct::assertEntity(const char* funcName) {
|
bool EntityHandleStruct::assertEntity(const char* funcName) {
|
||||||
Environment* env = getEntityEnvironment();
|
EntityEnvironment* env = getEntityEntityEnvironment();
|
||||||
if (!env->entityExists(entityId)) {
|
if (!env->entityExists(entityId)) {
|
||||||
DEER_EDITOR_ENGINE_ERROR(
|
DEER_EDITOR_ENGINE_ERROR(
|
||||||
"Error, invalid entity calling {0}, entityId : {1}, environmentId : {2}",
|
"Error, invalid entity calling {0}, entityId : {1}, environmentId : {2}",
|
||||||
@ -93,7 +93,7 @@ namespace Deer {
|
|||||||
bool EntityStruct::exists() {
|
bool EntityStruct::exists() {
|
||||||
ASSERT_ENTITY("exists()", return false);
|
ASSERT_ENTITY("exists()", return false);
|
||||||
|
|
||||||
return Scene::environment.entityExists(entityId);
|
return World::environment.entityExists(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityStruct::setParent(EntityHandleStruct parent_struct) {
|
void EntityStruct::setParent(EntityHandleStruct parent_struct) {
|
||||||
@ -196,11 +196,11 @@ namespace Deer {
|
|||||||
if (!assertEntity(funcName))
|
if (!assertEntity(funcName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Environment* env;
|
EntityEnvironment* env;
|
||||||
if (environmentId < 0)
|
if (environmentId < 0)
|
||||||
env = &Scene::environment;
|
env = &World::environment;
|
||||||
else
|
else
|
||||||
env = &Resource<Environment>::unsafeFromId(environmentId).getData();
|
env = &Resource<EntityEnvironment>::unsafeFromId(environmentId).getData();
|
||||||
|
|
||||||
Entity& ent = env->getEntity(entityId);
|
Entity& ent = env->getEntity(entityId);
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ namespace Deer {
|
|||||||
EntityHandleStruct EntityStruct::createChild(std::string& name) {
|
EntityHandleStruct EntityStruct::createChild(std::string& name) {
|
||||||
ASSERT_ENTITY("createChild()", return *this);
|
ASSERT_ENTITY("createChild()", return *this);
|
||||||
|
|
||||||
Environment* entityEnv = getEntityEnvironment();
|
EntityEnvironment* entityEnv = getEntityEntityEnvironment();
|
||||||
|
|
||||||
Entity& newEnt = entityEnv->createEntity(name);
|
Entity& newEnt = entityEnv->createEntity(name);
|
||||||
Entity& me = GET_ENTITY(environmentId, entityId);
|
Entity& me = GET_ENTITY(environmentId, entityId);
|
||||||
@ -437,7 +437,7 @@ namespace Deer {
|
|||||||
bool ShaderComponentStruct::assertShaderComponent(const char* funcName) {
|
bool ShaderComponentStruct::assertShaderComponent(const char* funcName) {
|
||||||
if (!assertEntity(funcName))
|
if (!assertEntity(funcName))
|
||||||
return false;
|
return false;
|
||||||
Environment* env = getEntityEnvironment();
|
EntityEnvironment* env = getEntityEntityEnvironment();
|
||||||
|
|
||||||
Entity& ent = env->getEntity(entityId);
|
Entity& ent = env->getEntity(entityId);
|
||||||
|
|
||||||
@ -488,7 +488,7 @@ namespace Deer {
|
|||||||
bool CameraComponentStruct::assertCameraComponent(const char* funcName) {
|
bool CameraComponentStruct::assertCameraComponent(const char* funcName) {
|
||||||
if (!assertEntity(funcName))
|
if (!assertEntity(funcName))
|
||||||
return false;
|
return false;
|
||||||
Environment* env = getEntityEnvironment();
|
EntityEnvironment* env = getEntityEntityEnvironment();
|
||||||
|
|
||||||
Entity& ent = env->getEntity(entityId);
|
Entity& ent = env->getEntity(entityId);
|
||||||
|
|
||||||
|
|||||||
59
DeerStudio/src/DeerStudio/StudioAPI/EntityEnvironment.cpp
Normal file
59
DeerStudio/src/DeerStudio/StudioAPI/EntityEnvironment.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#include "DeerRender/EntityEnviroment.h"
|
||||||
|
#include "DeerRender/Resource.h"
|
||||||
|
#include "DeerRender/Tools/Memory.h"
|
||||||
|
#include "DeerRender/World.h"
|
||||||
|
|
||||||
|
#include "DeerStudio/StudioAPI/EntityEnvironment.h"
|
||||||
|
|
||||||
|
#include "DeerRender/FrameBuffer.h"
|
||||||
|
#include "DeerRender/World.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
namespace StudioAPI {
|
||||||
|
// The first element has to allways point to the main scene env
|
||||||
|
std::vector<EntityEnvironment*> environments{&World::environment};
|
||||||
|
|
||||||
|
void EntityEnvironmentStruct::render(FrameBufferHandleStruct frameBuffer_handle, WorldCamera& sc) {
|
||||||
|
Resource<FrameBuffer> frameBufferResource = Resource<FrameBuffer>::unsafeFromId(frameBuffer_handle.frameBufferId);
|
||||||
|
FrameBuffer& frameBuffer = frameBufferResource.getData();
|
||||||
|
|
||||||
|
EntityEnvironment* envPtr = nullptr;
|
||||||
|
if (environmentId < 0) {
|
||||||
|
envPtr = &World::environment;
|
||||||
|
} else {
|
||||||
|
Resource<EntityEnvironment> environmentResource = Resource<EntityEnvironment>::unsafeFromId(environmentId);
|
||||||
|
envPtr = &environmentResource.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityEnvironment& env = *envPtr;
|
||||||
|
|
||||||
|
frameBuffer.bind();
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
env.render(sc);
|
||||||
|
|
||||||
|
frameBuffer.unbind();
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityHandleStruct EntityEnvironmentStruct::getRootEntity() {
|
||||||
|
return EntityHandleStruct(0, environmentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityHandleStruct EntityEnvironmentStruct::getEntity(int id) {
|
||||||
|
return EntityHandleStruct(id, environmentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityEnvironmentHandleStruct getMainEntityEnvironment() {
|
||||||
|
return EntityEnvironmentHandleStruct(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
EntityEnvironmentHandleStruct createLoadEntityEnvironment(std::string& envId) {
|
||||||
|
EntityEnvironmentData envData;
|
||||||
|
Resource<EntityEnvironment> environmentResource = ResourceManager<EntityEnvironment>::loadResourceFromData(envData, envId);
|
||||||
|
|
||||||
|
return EntityEnvironmentHandleStruct(environmentResource.getResourceId());
|
||||||
|
}
|
||||||
|
} // namespace StudioAPI
|
||||||
|
} // namespace Deer
|
||||||
@ -1,60 +0,0 @@
|
|||||||
#include "DeerRender/Enviroment.h"
|
|
||||||
#include "DeerRender/Scene.h"
|
|
||||||
#include "DeerRender/Tools/Memory.h"
|
|
||||||
#include "DeerRender/Resource.h"
|
|
||||||
|
|
||||||
#include "DeerStudio/StudioAPI/Environment.h"
|
|
||||||
|
|
||||||
#include "DeerRender/FrameBuffer.h"
|
|
||||||
#include "DeerRender/Scene.h"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace Deer {
|
|
||||||
namespace StudioAPI {
|
|
||||||
// The first element has to allways point to the main scene env
|
|
||||||
std::vector<Environment*> environments{&Scene::environment};
|
|
||||||
|
|
||||||
void EnvironmentStruct::render(FrameBufferHandleStruct frameBuffer_handle, SceneCamera& sc) {
|
|
||||||
Resource<FrameBuffer> frameBufferResource = Resource<FrameBuffer>::unsafeFromId(frameBuffer_handle.frameBufferId);
|
|
||||||
FrameBuffer& frameBuffer = frameBufferResource.getData();
|
|
||||||
|
|
||||||
Environment* envPtr = nullptr;
|
|
||||||
if (environmentId < 0) {
|
|
||||||
envPtr = &Scene::environment;
|
|
||||||
} else {
|
|
||||||
Resource<Environment> environmentResource = Resource<Environment>::unsafeFromId(environmentId);
|
|
||||||
envPtr = &environmentResource.getData();
|
|
||||||
}
|
|
||||||
|
|
||||||
Environment& env = *envPtr;
|
|
||||||
|
|
||||||
frameBuffer.bind();
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
env.render(sc);
|
|
||||||
|
|
||||||
frameBuffer.unbind();
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityHandleStruct EnvironmentStruct::getRootEntity() {
|
|
||||||
return EntityHandleStruct(0, environmentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityHandleStruct EnvironmentStruct::getEntity(int id) {
|
|
||||||
return EntityHandleStruct(id, environmentId);
|
|
||||||
}
|
|
||||||
|
|
||||||
EnvironmentHandleStruct getMainEnvironment() {
|
|
||||||
return EnvironmentHandleStruct(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
EnvironmentHandleStruct createLoadEnvironment(std::string& envId) {
|
|
||||||
EnvironmentData envData;
|
|
||||||
Resource<Environment> environmentResource = ResourceManager<Environment>::loadResourceFromData(envData, envId);
|
|
||||||
|
|
||||||
return EnvironmentHandleStruct(environmentResource.getResourceId());
|
|
||||||
|
|
||||||
}
|
|
||||||
} // namespace StudioAPI
|
|
||||||
} // namespace Deer
|
|
||||||
@ -49,8 +49,8 @@ namespace Deer {
|
|||||||
void camera_construct(CameraComponent* mem) {
|
void camera_construct(CameraComponent* mem) {
|
||||||
new (mem) CameraComponent();
|
new (mem) CameraComponent();
|
||||||
}
|
}
|
||||||
void sceneCamera_Construct(SceneCamera* mem) {
|
void sceneCamera_Construct(WorldCamera* mem) {
|
||||||
new (mem) SceneCamera();
|
new (mem) WorldCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace StudioAPI
|
} // namespace StudioAPI
|
||||||
|
|||||||
@ -11,7 +11,7 @@ class ActiveEntity : Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
entity = Resource::getMainEnvironment().getRootEntity();
|
entity = Resource::getMainEntityEnvironment().getRootEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Expose]
|
[Expose]
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class AddComponentRender {
|
|||||||
void addComponentPopup() {
|
void addComponentPopup() {
|
||||||
UI::titleCenter("\uf055 Add Component");
|
UI::titleCenter("\uf055 Add Component");
|
||||||
UI::separator();
|
UI::separator();
|
||||||
UI::subMenu("Rendering", Callback(this.addComponentRendering));
|
UI::subMenu("Rendering", SimpleFunction(this.addComponentRendering));
|
||||||
if (UI::menuItem("Script Component")) {
|
if (UI::menuItem("Script Component")) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class MeshComponentRender {
|
|||||||
UI::drawIcon("empty.png", 32);
|
UI::drawIcon("empty.png", 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI::dragDropTarget("MESH", AnyCallback(this.setMesh));
|
UI::dragDropTarget("MESH", ReciverFunction(this.setMesh));
|
||||||
|
|
||||||
if (meshComponent.hasMesh) {
|
if (meshComponent.hasMesh) {
|
||||||
UI::sameline();
|
UI::sameline();
|
||||||
@ -25,7 +25,7 @@ class MeshComponentRender {
|
|||||||
UI::sameline();
|
UI::sameline();
|
||||||
|
|
||||||
UI::titleCenterY(meshComponent.meshResource.name, 32);
|
UI::titleCenterY(meshComponent.meshResource.name, 32);
|
||||||
UI::dragDropTarget("MESH", AnyCallback(this.setMesh));
|
UI::dragDropTarget("MESH", ReciverFunction(this.setMesh));
|
||||||
}
|
}
|
||||||
|
|
||||||
UI::space(20, 20);
|
UI::space(20, 20);
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class PropertiesPanel : Panel {
|
|||||||
// Id:0 [+ add component]
|
// Id:0 [+ add component]
|
||||||
UI::title("\uf1b2 " + entity.name);
|
UI::title("\uf1b2 " + entity.name);
|
||||||
if (!entity.isRoot)
|
if (!entity.isRoot)
|
||||||
UI::contextItemPopup("##MenuOptions", Callback(this.renameEntityMenu));
|
UI::contextItemPopup("##MenuOptions", SimpleFunction(this.renameEntityMenu));
|
||||||
UI::separator();
|
UI::separator();
|
||||||
UI::textColor(0.5, 0.5, 0.5f, "Id : " + entity.id);
|
UI::textColor(0.5, 0.5, 0.5f, "Id : " + entity.id);
|
||||||
|
|
||||||
@ -26,21 +26,21 @@ class PropertiesPanel : Panel {
|
|||||||
UI::space();
|
UI::space();
|
||||||
|
|
||||||
TransformPropertiesRender transformComponentRender(entity);
|
TransformPropertiesRender transformComponentRender(entity);
|
||||||
UI::componentNode("\uf0b2 Transform Component", Callback(transformComponentRender.renderTransformComponent));
|
UI::componentNode("\uf0b2 Transform Component", SimpleFunction(transformComponentRender.renderTransformComponent));
|
||||||
|
|
||||||
if (entity.hasMeshComponent()) {
|
if (entity.hasMeshComponent()) {
|
||||||
MeshComponentRender meshComponentRender(entity);
|
MeshComponentRender meshComponentRender(entity);
|
||||||
UI::componentNodeContextMenu("\uf248 Mesh Component", Callback(meshComponentRender.render), Callback(meshComponentRender.remove));
|
UI::componentNodeContextMenu("\uf248 Mesh Component", SimpleFunction(meshComponentRender.render), SimpleFunction(meshComponentRender.remove));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.hasShaderComponent()) {
|
if (entity.hasShaderComponent()) {
|
||||||
ShaderComponentRender shaderComponentRender(entity);
|
ShaderComponentRender shaderComponentRender(entity);
|
||||||
UI::componentNodeContextMenu("\uf248 Shader Component", Callback(shaderComponentRender.render), Callback(shaderComponentRender.remove));
|
UI::componentNodeContextMenu("\uf248 Shader Component", SimpleFunction(shaderComponentRender.render), SimpleFunction(shaderComponentRender.remove));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.hasCameraComponent()) {
|
if (entity.hasCameraComponent()) {
|
||||||
CameraComponentRender cameraComponentRender(entity);
|
CameraComponentRender cameraComponentRender(entity);
|
||||||
UI::componentNodeContextMenu("\uf030 Camera Component", Callback(cameraComponentRender.render), Callback(cameraComponentRender.remove));
|
UI::componentNodeContextMenu("\uf030 Camera Component", SimpleFunction(cameraComponentRender.render), SimpleFunction(cameraComponentRender.remove));
|
||||||
}
|
}
|
||||||
|
|
||||||
UI::space();
|
UI::space();
|
||||||
@ -52,8 +52,8 @@ class PropertiesPanel : Panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AddComponentRender addComponentRender(entity);
|
AddComponentRender addComponentRender(entity);
|
||||||
UI::simplePopup("ADD_COMPONENT", Callback(addComponentRender.addComponentPopup));
|
UI::simplePopup("ADD_COMPONENT", SimpleFunction(addComponentRender.addComponentPopup));
|
||||||
UI::modalPopup("Rename entity", Callback(this.renameEntityMenu));
|
UI::modalPopup("Rename entity", SimpleFunction(this.renameEntityMenu));
|
||||||
}
|
}
|
||||||
|
|
||||||
void renameEntityMenu() {
|
void renameEntityMenu() {
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class ShaderComponentRender {
|
|||||||
} else {
|
} else {
|
||||||
UI::drawIcon("empty.png", 32);
|
UI::drawIcon("empty.png", 32);
|
||||||
}
|
}
|
||||||
UI::dragDropTarget("SHADER", AnyCallback(this.setShader));
|
UI::dragDropTarget("SHADER", ReciverFunction(this.setShader));
|
||||||
|
|
||||||
if (shaderComponent.hasShader) {
|
if (shaderComponent.hasShader) {
|
||||||
UI::sameline();
|
UI::sameline();
|
||||||
@ -39,7 +39,7 @@ class ShaderComponentRender {
|
|||||||
UI::sameline();
|
UI::sameline();
|
||||||
|
|
||||||
UI::titleCenterY(shaderComponent.shader.name, 32);
|
UI::titleCenterY(shaderComponent.shader.name, 32);
|
||||||
UI::dragDropTarget("SHADER", AnyCallback(this.setShader));
|
UI::dragDropTarget("SHADER", ReciverFunction(this.setShader));
|
||||||
}
|
}
|
||||||
|
|
||||||
UI::space();
|
UI::space();
|
||||||
@ -49,7 +49,7 @@ class ShaderComponentRender {
|
|||||||
} else {
|
} else {
|
||||||
UI::drawIcon("empty.png", 32);
|
UI::drawIcon("empty.png", 32);
|
||||||
}
|
}
|
||||||
UI::dragDropTarget("TEXTURE", AnyCallback(this.setTexture));
|
UI::dragDropTarget("TEXTURE", ReciverFunction(this.setTexture));
|
||||||
|
|
||||||
if (shaderComponent.texture.isValid()) {
|
if (shaderComponent.texture.isValid()) {
|
||||||
UI::sameline();
|
UI::sameline();
|
||||||
@ -57,7 +57,7 @@ class ShaderComponentRender {
|
|||||||
UI::sameline();
|
UI::sameline();
|
||||||
|
|
||||||
UI::titleCenterY(shaderComponent.texture.name, 32);
|
UI::titleCenterY(shaderComponent.texture.name, 32);
|
||||||
UI::dragDropTarget("TEXTURE", AnyCallback(this.setTexture));
|
UI::dragDropTarget("TEXTURE", ReciverFunction(this.setTexture));
|
||||||
}
|
}
|
||||||
UI::space(20, 20);
|
UI::space(20, 20);
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
class RenderService : Service {
|
class RenderService : Service {
|
||||||
Environment env;
|
EntityEnvir nment env;
|
||||||
SceneCamera sceneCamera;
|
WorldCamera sceneCamera;
|
||||||
MeshComponent meshC;
|
MeshComponent meshC;
|
||||||
Entity child;
|
Entity child;
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
env = Resource::createLoadEnvironment("PreviewerEnv");
|
env = Resource::createLoadEntityEnvironment("PreviewerEnv");
|
||||||
|
|
||||||
child = env.getRootEntity().createChild("Render");
|
child = env.getRootEntity().createChild("Render");
|
||||||
meshC = child.createMeshComponent();
|
meshC = child.createMeshComponent();
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
class Test : Service {
|
|
||||||
void init() {
|
|
||||||
Engine::print("Initing");
|
|
||||||
Entity entity = ActiveEntity::getActiveEntity();
|
|
||||||
Engine::print(entity.name);
|
|
||||||
Engine::print("Ending");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"patch": 1,
|
|
||||||
"name": "Test",
|
|
||||||
"requires": ["ActiveEntity"]
|
|
||||||
}
|
|
||||||
@ -23,7 +23,7 @@ class EntityTreeRender {
|
|||||||
interaction();
|
interaction();
|
||||||
} else {
|
} else {
|
||||||
// ADD ANOTHER NODE
|
// ADD ANOTHER NODE
|
||||||
bool opened = UI::treeNode(displayName, isActiveEntity(), Callback(this.renderChilds));
|
bool opened = UI::treeNode(displayName, isActiveEntity(), SimpleFunction(this.renderChilds));
|
||||||
if (!opened) {
|
if (!opened) {
|
||||||
interaction();
|
interaction();
|
||||||
}
|
}
|
||||||
@ -40,8 +40,8 @@ class EntityTreeRender {
|
|||||||
|
|
||||||
void interaction() {
|
void interaction() {
|
||||||
UI::dragDropSource("ENTITY", any(entity), entity.name);
|
UI::dragDropSource("ENTITY", any(entity), entity.name);
|
||||||
UI::dragDropTarget("ENTITY", AnyCallback(this.entityDrop));
|
UI::dragDropTarget("ENTITY", ReciverFunction(this.entityDrop));
|
||||||
UI::contextItemPopup("POP_ENTITY_" + entity.id, Callback(this.renderContextMenu));
|
UI::contextItemPopup("POP_ENTITY_" + entity.id, SimpleFunction(this.renderContextMenu));
|
||||||
|
|
||||||
if (UI::isItemClicked(0)) {
|
if (UI::isItemClicked(0)) {
|
||||||
ActiveEntity::setActiveEntity(entity);
|
ActiveEntity::setActiveEntity(entity);
|
||||||
@ -86,7 +86,7 @@ class TreePanel : Panel {
|
|||||||
Entity root = Engine::getRoot();
|
Entity root = Engine::getRoot();
|
||||||
EntityTreeRender rootTree(root);
|
EntityTreeRender rootTree(root);
|
||||||
|
|
||||||
UI::contextMenuPopup("Window popup", Callback(rootTree.renderContextMenu));
|
UI::contextMenuPopup("Window popup", SimpleFunction(rootTree.renderContextMenu));
|
||||||
rootTree.renderEntity();
|
rootTree.renderEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
class ViewportPanel : Panel {
|
class ViewportPanel : Panel {
|
||||||
FrameBuffer frameBuffer;
|
FrameBuffer frameBuffer;
|
||||||
SceneCamera sceneCamera;
|
WorldCamera sceneCamera;
|
||||||
Environment mainEnv;
|
EntityEnvir nment mainEnv;
|
||||||
|
|
||||||
float pitch = 0;
|
float pitch = 0;
|
||||||
float yaw = 0;
|
float yaw = 0;
|
||||||
@ -70,7 +70,7 @@ class ViewportPanel : Panel {
|
|||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
frameBuffer = Resource::createLoadRGBA8FrameBuffer("MainFrameBuffer", 1000, 1000);
|
frameBuffer = Resource::createLoadRGBA8FrameBuffer("MainFrameBuffer", 1000, 1000);
|
||||||
mainEnv = Resource::getMainEnvironment();
|
mainEnv = Resource::getMainEntityEnvironment();
|
||||||
|
|
||||||
sceneCamera.transform.position = vec3(0, 1, -2);
|
sceneCamera.transform.position = vec3(0, 1, -2);
|
||||||
sceneCamera.camera.nearZ = 0.1;
|
sceneCamera.camera.nearZ = 0.1;
|
||||||
@ -87,7 +87,7 @@ class ViewportPanel : Panel {
|
|||||||
UI::openPopup("ViewportCameraProps", any());
|
UI::openPopup("ViewportCameraProps", any());
|
||||||
}
|
}
|
||||||
|
|
||||||
UI::simplePopup("ViewportCameraProps", Callback(this.viewportCameraProps));
|
UI::simplePopup("ViewportCameraProps", SimpleFunction(this.viewportCameraProps));
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewportCameraProps() {
|
void viewportCameraProps() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user