Improved tree pannel
This commit is contained in:
parent
b3884b6bd5
commit
c5ca30dcfb
21
Deer/Include/DeerRender/FrameBuffer.h
Normal file
21
Deer/Include/DeerRender/FrameBuffer.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "DeerRender/Render/FrameBuffer.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
// TODO: Add safety
|
||||||
|
namespace FrameBufferManager {
|
||||||
|
uint16_t createRGBA8FrameBuffer(std::string& name, int, int);
|
||||||
|
void resizeFrameBuffer(uint16_t frameBufferId, int, int);
|
||||||
|
|
||||||
|
int getFrameBufferWidth(uint16_t frameBufferId);
|
||||||
|
int getFrameBufferHeight(uint16_t frameBufferId);
|
||||||
|
|
||||||
|
const std::string& getFrameBufferName(uint16_t);
|
||||||
|
uint16_t getFrameBufferId(std::string& name);
|
||||||
|
|
||||||
|
void unloadAllFrameBuffer();
|
||||||
|
}
|
||||||
|
}
|
@ -38,7 +38,7 @@ namespace Deer {
|
|||||||
|
|
||||||
virtual int getTextureBufferPixel(int id, unsigned int x, unsigned int y) = 0;
|
virtual int getTextureBufferPixel(int id, unsigned int x, unsigned int y) = 0;
|
||||||
|
|
||||||
static Ref<FrameBuffer> create(const FrameBufferSpecification& spec);
|
static FrameBuffer* create(const FrameBufferSpecification& spec);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
#ifdef DEER_RENDER
|
#ifdef DEER_RENDER
|
||||||
#include "DeerRender/Voxels/VoxelWorldRenderData.h"
|
#include "DeerRender/Voxels/VoxelWorldRenderData.h"
|
||||||
#include "DeerRender/Mesh.h"
|
#include "DeerRender/Mesh.h"
|
||||||
|
#include "DeerRender/Shader.h"
|
||||||
|
#include "DeerRender/FrameBuffer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
@ -26,6 +28,8 @@ namespace Deer {
|
|||||||
VoxelWorld::clear();
|
VoxelWorld::clear();
|
||||||
#ifdef DEER_RENDER
|
#ifdef DEER_RENDER
|
||||||
MeshManager::unloadAllModels();
|
MeshManager::unloadAllModels();
|
||||||
|
ShaderManager::unloadAllShaders();
|
||||||
|
FrameBufferManager::unloadAllFrameBuffer();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
76
Deer/src/DeerRender/FrameBuffer/FrameBufferManager.cpp
Normal file
76
Deer/src/DeerRender/FrameBuffer/FrameBufferManager.cpp
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#include "DeerRender/FrameBuffer.h"
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#define FRAME_BUFFER_MAX_COUNT 256
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
namespace FrameBufferManager {
|
||||||
|
struct FrameBufferContainer {
|
||||||
|
FrameBuffer* frameBuffer_data = nullptr;
|
||||||
|
std::string frameBuffer_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
uint16_t maxFrameBufferId = 1;
|
||||||
|
FrameBufferContainer frameBuffers[FRAME_BUFFER_MAX_COUNT]{};
|
||||||
|
std::unordered_map<std::string, uint16_t> frameBuffers_name_id_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t FrameBufferManager::createRGBA8FrameBuffer(std::string& name, int x, int y) {
|
||||||
|
FrameBufferSpecification specs(
|
||||||
|
x, y,
|
||||||
|
{TextureBufferType::RGBA8}, 4,
|
||||||
|
false);
|
||||||
|
|
||||||
|
FrameBuffer* frameBuffer = FrameBuffer::create(specs);
|
||||||
|
|
||||||
|
uint16_t frameBufferId = maxFrameBufferId;
|
||||||
|
maxFrameBufferId++;
|
||||||
|
|
||||||
|
frameBuffers[frameBufferId].frameBuffer_data = frameBuffer;
|
||||||
|
frameBuffers[frameBufferId].frameBuffer_name = name;
|
||||||
|
|
||||||
|
frameBuffers_name_id_map[name] = frameBufferId;
|
||||||
|
return frameBufferId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameBufferManager::resizeFrameBuffer(uint16_t frameBufferId, int x, int y) {
|
||||||
|
FrameBuffer* frameBuffer = frameBuffers[frameBufferId].frameBuffer_data;
|
||||||
|
|
||||||
|
frameBuffer->resize(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FrameBufferManager::getFrameBufferWidth(uint16_t frameBufferId) {
|
||||||
|
FrameBuffer* frameBuffer = frameBuffers[frameBufferId].frameBuffer_data;
|
||||||
|
|
||||||
|
return frameBuffer->getSpecification().width;
|
||||||
|
}
|
||||||
|
int FrameBufferManager::getFrameBufferHeight(uint16_t frameBufferId) {
|
||||||
|
FrameBuffer* frameBuffer = frameBuffers[frameBufferId].frameBuffer_data;
|
||||||
|
|
||||||
|
return frameBuffer->getSpecification().height;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& FrameBufferManager::getFrameBufferName(uint16_t id) {
|
||||||
|
DEER_CORE_ASSERT(id >= 0 && id < maxFrameBufferId, "Invalid frame buffer id {0}", id);
|
||||||
|
|
||||||
|
return frameBuffers[id].frameBuffer_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t FrameBufferManager::getFrameBufferId(std::string& name) {
|
||||||
|
return frameBuffers_name_id_map[name];
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameBufferManager::unloadAllFrameBuffer() {
|
||||||
|
for (int x = 1; x < maxFrameBufferId; x++) {
|
||||||
|
delete frameBuffers[x].frameBuffer_data;
|
||||||
|
frameBuffers[x].frameBuffer_data = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
frameBuffers_name_id_map.clear();
|
||||||
|
|
||||||
|
maxFrameBufferId = 1;
|
||||||
|
frameBuffers[0].frameBuffer_data = nullptr;
|
||||||
|
frameBuffers[0].frameBuffer_name = "NULL";
|
||||||
|
frameBuffers_name_id_map["NULL"] = 0;
|
||||||
|
}
|
||||||
|
}
|
@ -5,8 +5,8 @@
|
|||||||
#include "glad/glad.h"
|
#include "glad/glad.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
Ref<FrameBuffer> FrameBuffer::create(const FrameBufferSpecification& spec) {
|
FrameBuffer* FrameBuffer::create(const FrameBufferSpecification& spec) {
|
||||||
return Ref<FrameBuffer>(new OpenGLFrameBuffer(spec));
|
return new OpenGLFrameBuffer(spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenGLFrameBuffer::OpenGLFrameBuffer(const FrameBufferSpecification& frameBufferSpecification)
|
OpenGLFrameBuffer::OpenGLFrameBuffer(const FrameBufferSpecification& frameBufferSpecification)
|
||||||
|
@ -11,7 +11,7 @@ namespace Deer {
|
|||||||
GamePanel::GamePanel() {
|
GamePanel::GamePanel() {
|
||||||
FrameBufferSpecification fbSpecs = FrameBufferSpecification(
|
FrameBufferSpecification fbSpecs = FrameBufferSpecification(
|
||||||
100, 100, {TextureBufferType::RGBA8}, 1, false);
|
100, 100, {TextureBufferType::RGBA8}, 1, false);
|
||||||
m_frameBuffer = FrameBuffer::create(fbSpecs);
|
m_frameBuffer = Scope<FrameBuffer>(FrameBuffer::create(fbSpecs));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamePanel::onImGui() {
|
void GamePanel::onImGui() {
|
||||||
|
@ -15,7 +15,7 @@ namespace Deer {
|
|||||||
void onImGui() override;
|
void onImGui() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ref<FrameBuffer> m_frameBuffer;
|
Scope<FrameBuffer> m_frameBuffer;
|
||||||
|
|
||||||
glm::vec2 m_lastWindowSize;
|
glm::vec2 m_lastWindowSize;
|
||||||
};
|
};
|
||||||
|
@ -51,10 +51,10 @@ namespace Deer {
|
|||||||
processMovment();
|
processMovment();
|
||||||
|
|
||||||
if (!m_frameBuffer) {
|
if (!m_frameBuffer) {
|
||||||
m_frameBuffer = FrameBuffer::create(FrameBufferSpecification(
|
m_frameBuffer = Scope<FrameBuffer>(FrameBuffer::create(FrameBufferSpecification(
|
||||||
100, 100,
|
100, 100,
|
||||||
{TextureBufferType::RGBA8, TextureBufferType::RED_INTEGER}, 4,
|
{TextureBufferType::RGBA8, TextureBufferType::RED_INTEGER}, 4,
|
||||||
false));
|
false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||||
|
@ -7,3 +7,4 @@
|
|||||||
#include "DeerStudio/EditorEngine/API/Resource.h"
|
#include "DeerStudio/EditorEngine/API/Resource.h"
|
||||||
#include "DeerStudio/EditorEngine/API/UI.h"
|
#include "DeerStudio/EditorEngine/API/UI.h"
|
||||||
#include "DeerStudio/EditorEngine/API/Math.h"
|
#include "DeerStudio/EditorEngine/API/Math.h"
|
||||||
|
#include "DeerStudio/EditorEngine/API/FrameBuffer.h"
|
@ -1,4 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "DeerStudio/EditorEngine/API/GenericRefStructs.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "glm/glm.hpp"
|
#include "glm/glm.hpp"
|
||||||
@ -25,9 +27,8 @@ namespace Deer {
|
|||||||
//
|
//
|
||||||
// bool ==
|
// bool ==
|
||||||
//}
|
//}
|
||||||
struct EntityStruct {
|
struct EntityStruct : EntityRefStruct {
|
||||||
EntityStruct(uint16_t entId = 0) : entityId(entId) { }
|
EntityStruct(uint16_t entId = 0) { entityId = entId; }
|
||||||
uint16_t entityId;
|
|
||||||
|
|
||||||
std::string getName();
|
std::string getName();
|
||||||
void setName(std::string&);
|
void setName(std::string&);
|
||||||
@ -38,36 +39,33 @@ namespace Deer {
|
|||||||
bool isRoot();
|
bool isRoot();
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
EntityStruct createChild(std::string&);
|
EntityRefStruct createChild(std::string&);
|
||||||
|
|
||||||
void setParent(EntityStruct parent);
|
void setParent(EntityRefStruct parent);
|
||||||
EntityStruct getParent();
|
EntityRefStruct getParent();
|
||||||
|
|
||||||
bool isDescendantOf(EntityStruct parent);
|
bool isDescendantOf(EntityRefStruct parent);
|
||||||
bool opEquals(const EntityStruct& other);
|
bool opEquals(const EntityRefStruct& other);
|
||||||
|
|
||||||
//COMPONENTS
|
//COMPONENTS
|
||||||
EntityStruct getMeshComponent();
|
EntityRefStruct getMeshComponent();
|
||||||
bool hasMeshComponent();
|
bool hasMeshComponent();
|
||||||
void removeMeshComponent();
|
void removeMeshComponent();
|
||||||
|
|
||||||
EntityStruct getShaderComponent();
|
EntityRefStruct getShaderComponent();
|
||||||
bool hasShaderComponent();
|
bool hasShaderComponent();
|
||||||
void removeShaderComponent();
|
void removeShaderComponent();
|
||||||
|
|
||||||
// This is an internal function to avoid undefined behaviour from angelscript and avoid problems
|
|
||||||
bool assertEntity(const char* funcName);
|
|
||||||
|
|
||||||
// This function can be adapted to get a specific transform since the data is the same
|
// This function can be adapted to get a specific transform since the data is the same
|
||||||
EntityStruct getSelf();
|
EntityRefStruct getSelf();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EntityChildArrayStruct : EntityStruct{
|
struct EntityChildArrayStruct : EntityRefStruct {
|
||||||
int getChildCount();
|
int getChildCount();
|
||||||
EntityStruct getChild(int);
|
EntityRefStruct getChild(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TransformComponentStruct : EntityStruct {
|
struct TransformComponentStruct : EntityRefStruct {
|
||||||
glm::vec3 getPosition();
|
glm::vec3 getPosition();
|
||||||
glm::vec3 getScale();
|
glm::vec3 getScale();
|
||||||
glm::vec3 getRotation();
|
glm::vec3 getRotation();
|
||||||
@ -77,7 +75,7 @@ namespace Deer {
|
|||||||
void setRotation(glm::vec3);
|
void setRotation(glm::vec3);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MeshComponentStruct : EntityStruct {
|
struct MeshComponentStruct : EntityRefStruct {
|
||||||
bool isActive();
|
bool isActive();
|
||||||
void setActive(bool);
|
void setActive(bool);
|
||||||
|
|
||||||
@ -90,7 +88,7 @@ namespace Deer {
|
|||||||
bool assertMeshComponent(const char* funcName);
|
bool assertMeshComponent(const char* funcName);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ShaderComponentStruct : EntityStruct {
|
struct ShaderComponentStruct : EntityRefStruct {
|
||||||
bool hasShader();
|
bool hasShader();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
@ -100,7 +98,7 @@ namespace Deer {
|
|||||||
bool assertShaderComponent(const char* funcName);
|
bool assertShaderComponent(const char* funcName);
|
||||||
};
|
};
|
||||||
|
|
||||||
EntityStruct getRoot();
|
EntityRefStruct getRoot();
|
||||||
void constructEntityStruct(int id, void* memory);
|
void constructEntityStruct(int id, void* memory);
|
||||||
void copyEntityStruct(int id, void* memory);
|
void copyEntityStruct(int id, void* memory);
|
||||||
|
|
||||||
|
19
DeerStudio/src/DeerStudio/EditorEngine/API/Environment.h
Normal file
19
DeerStudio/src/DeerStudio/EditorEngine/API/Environment.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "GenericRefStructs.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
namespace EditorEngine {
|
||||||
|
struct EnvironmentStruct : EnvironmentRefStruct {
|
||||||
|
void render(EntityRefStruct cameraEntity, FrameBufferRefStruct);
|
||||||
|
|
||||||
|
EntityRefStruct getRootEntity();
|
||||||
|
EntityRefStruct getEntity(int);
|
||||||
|
};
|
||||||
|
|
||||||
|
EnvironmentRefStruct getMainEnvironment();
|
||||||
|
|
||||||
|
EnvironmentRefStruct createEnvironment(std::string&);
|
||||||
|
EnvironmentRefStruct getEnvironment(std::string&);
|
||||||
|
}
|
||||||
|
}
|
23
DeerStudio/src/DeerStudio/EditorEngine/API/FrameBuffer.h
Normal file
23
DeerStudio/src/DeerStudio/EditorEngine/API/FrameBuffer.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
namespace EditorEngine {
|
||||||
|
struct FrameBufferStruct : FrameBufferRefStruct{
|
||||||
|
FrameBufferStruct(uint16_t _id) { frameBufferId = _id; }
|
||||||
|
|
||||||
|
int getWidth();
|
||||||
|
int getHeight();
|
||||||
|
|
||||||
|
void resize(int, int);
|
||||||
|
std::string getName();
|
||||||
|
};
|
||||||
|
|
||||||
|
FrameBufferStruct createRGBA8FrameBuffer(std::string& name, int, int);
|
||||||
|
FrameBufferStruct getFrameBuffer(std::string& name);
|
||||||
|
|
||||||
|
void registerFrameBufferStructs();
|
||||||
|
void registerFrameBufferFunctions();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
namespace EditorEngine {
|
||||||
|
struct EntityRefStruct {
|
||||||
|
uint16_t entityId;
|
||||||
|
uint16_t environmentId;
|
||||||
|
|
||||||
|
// This is an internal function to avoid undefined behaviour from angelscript and avoid problems
|
||||||
|
bool assertEntity(const char* funcName);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct EnvironmentRefStruct {
|
||||||
|
uint16_t environmentId;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FrameBufferRefStruct {
|
||||||
|
uint16_t frameBufferId;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -15,9 +15,7 @@
|
|||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
namespace EditorEngine {
|
namespace EditorEngine {
|
||||||
EntityStruct activeEntity;
|
EntityRefStruct getRoot() {
|
||||||
|
|
||||||
EntityStruct getRoot() {
|
|
||||||
return EntityStruct(0);
|
return EntityStruct(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +27,7 @@ namespace Deer {
|
|||||||
return entityId;
|
return entityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityStruct::assertEntity(const char* funcName) {
|
bool EntityRefStruct::assertEntity(const char* funcName) {
|
||||||
if (!Scene::environment.entityExists(entityId)) {
|
if (!Scene::environment.entityExists(entityId)) {
|
||||||
DEER_UI_ENGINE_ERROR("Error, invalid entity calling {0}, entityId : {1}", funcName, entityId);
|
DEER_UI_ENGINE_ERROR("Error, invalid entity calling {0}, entityId : {1}", funcName, entityId);
|
||||||
if (currentDockPanelExecution)
|
if (currentDockPanelExecution)
|
||||||
@ -76,7 +74,7 @@ namespace Deer {
|
|||||||
.entityExists(entityId);
|
.entityExists(entityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityStruct::setParent(EntityStruct parent_struct) {
|
void EntityStruct::setParent(EntityRefStruct parent_struct) {
|
||||||
ASSERT_ENTITY("setParent()", return);
|
ASSERT_ENTITY("setParent()", return);
|
||||||
|
|
||||||
Entity& parent = GET_ENTITY(parent_struct.entityId);
|
Entity& parent = GET_ENTITY(parent_struct.entityId);
|
||||||
@ -85,7 +83,7 @@ namespace Deer {
|
|||||||
.setParent(parent);
|
.setParent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityStruct EntityStruct::getParent() {
|
EntityRefStruct EntityStruct::getParent() {
|
||||||
ASSERT_ENTITY("getParent()", return *this);
|
ASSERT_ENTITY("getParent()", return *this);
|
||||||
|
|
||||||
Entity& self = GET_ENTITY(entityId);
|
Entity& self = GET_ENTITY(entityId);
|
||||||
@ -95,7 +93,7 @@ namespace Deer {
|
|||||||
return EntityStruct(self.getParentId());
|
return EntityStruct(self.getParentId());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityStruct::isDescendantOf(EntityStruct parent_struct) {
|
bool EntityStruct::isDescendantOf(EntityRefStruct parent_struct) {
|
||||||
ASSERT_ENTITY("isDescendantOf()", return false);
|
ASSERT_ENTITY("isDescendantOf()", return false);
|
||||||
|
|
||||||
Entity& parent = GET_ENTITY(parent_struct.entityId);
|
Entity& parent = GET_ENTITY(parent_struct.entityId);
|
||||||
@ -104,13 +102,13 @@ namespace Deer {
|
|||||||
.isDescendantOf(parent);
|
.isDescendantOf(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EntityStruct::opEquals(const EntityStruct& other) {
|
bool EntityStruct::opEquals(const EntityRefStruct& other) {
|
||||||
ASSERT_ENTITY("opEquals()", return false);
|
ASSERT_ENTITY("opEquals()", return false);
|
||||||
|
|
||||||
return entityId == other.entityId;
|
return entityId == other.entityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityStruct EntityStruct::getSelf() {
|
EntityRefStruct EntityStruct::getSelf() {
|
||||||
ASSERT_ENTITY("getSelf()", return *this);
|
ASSERT_ENTITY("getSelf()", return *this);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
@ -179,7 +177,7 @@ namespace Deer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityStruct EntityChildArrayStruct::getChild(int i) {
|
EntityRefStruct EntityChildArrayStruct::getChild(int i) {
|
||||||
ASSERT_ENTITY("getChild()", return *this);
|
ASSERT_ENTITY("getChild()", return *this);
|
||||||
|
|
||||||
RelationshipComponent& rc = GET_ENTITY(entityId)
|
RelationshipComponent& rc = GET_ENTITY(entityId)
|
||||||
@ -196,7 +194,7 @@ namespace Deer {
|
|||||||
return EntityStruct(rc.getChildrenId(i));
|
return EntityStruct(rc.getChildrenId(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityStruct EntityStruct::createChild(std::string& name) {
|
EntityRefStruct EntityStruct::createChild(std::string& name) {
|
||||||
ASSERT_ENTITY("createChild()", return *this);
|
ASSERT_ENTITY("createChild()", return *this);
|
||||||
|
|
||||||
Entity& me = GET_ENTITY(entityId);
|
Entity& me = GET_ENTITY(entityId);
|
||||||
@ -209,7 +207,7 @@ namespace Deer {
|
|||||||
return EntityStruct(newEnt.getId());
|
return EntityStruct(newEnt.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityStruct EntityStruct::getMeshComponent() {
|
EntityRefStruct EntityStruct::getMeshComponent() {
|
||||||
ASSERT_ENTITY("getMeshComponent()", return *this);
|
ASSERT_ENTITY("getMeshComponent()", return *this);
|
||||||
|
|
||||||
Entity& self = GET_ENTITY(entityId);
|
Entity& self = GET_ENTITY(entityId);
|
||||||
@ -239,7 +237,7 @@ namespace Deer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityStruct EntityStruct::getShaderComponent() {
|
EntityRefStruct EntityStruct::getShaderComponent() {
|
||||||
ASSERT_ENTITY("getShaderComponent()", return *this);
|
ASSERT_ENTITY("getShaderComponent()", return *this);
|
||||||
|
|
||||||
Entity& self = GET_ENTITY(entityId);
|
Entity& self = GET_ENTITY(entityId);
|
||||||
|
@ -13,26 +13,20 @@ namespace Deer {
|
|||||||
void registerShaderComponentFunctions();
|
void registerShaderComponentFunctions();
|
||||||
|
|
||||||
void registerEntityStructs() {
|
void registerEntityStructs() {
|
||||||
AS_CHECK(scriptEngine->RegisterObjectType("Entity", sizeof(EntityStruct),
|
AS_CHECK(scriptEngine->RegisterObjectType("Entity", sizeof(EntityRefStruct),
|
||||||
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityRefStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterObjectBehaviour(
|
AS_CHECK(scriptEngine->RegisterObjectType("EntityChilds", sizeof(EntityRefStruct),
|
||||||
"Entity", asBEHAVE_CONSTRUCT, "void f(int)",
|
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityRefStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
||||||
asFunctionPtr(constructEntityStruct),
|
|
||||||
asCALL_CDECL_OBJLAST
|
|
||||||
));
|
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterObjectType("EntityChilds", sizeof(EntityStruct),
|
AS_CHECK(scriptEngine->RegisterObjectType("TransformComponent", sizeof(EntityRefStruct),
|
||||||
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityRefStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterObjectType("TransformComponent", sizeof(EntityStruct),
|
AS_CHECK(scriptEngine->RegisterObjectType("MeshComponent", sizeof(EntityRefStruct),
|
||||||
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityRefStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterObjectType("MeshComponent", sizeof(EntityStruct),
|
AS_CHECK(scriptEngine->RegisterObjectType("ShaderComponent", sizeof(EntityRefStruct),
|
||||||
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityRefStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterObjectType("ShaderComponent", sizeof(EntityStruct),
|
|
||||||
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<EntityStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerEntityFunctions() {
|
void registerEntityFunctions() {
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
#include "DeerStudio/EditorEngine/API/FrameBuffer.h"
|
||||||
|
#include "DeerRender/FrameBuffer.h"
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
namespace EditorEngine {
|
||||||
|
|
||||||
|
int FrameBufferStruct::getWidth() {
|
||||||
|
return FrameBufferManager::getFrameBufferWidth(frameBufferId);
|
||||||
|
}
|
||||||
|
|
||||||
|
int FrameBufferStruct::getHeight() {
|
||||||
|
return FrameBufferManager::getFrameBufferWidth(frameBufferId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrameBufferStruct::resize(int x, int y) {
|
||||||
|
FrameBufferManager::resizeFrameBuffer(frameBufferId, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string FrameBufferStruct::getName() {
|
||||||
|
return FrameBufferManager::getFrameBufferName(frameBufferId);
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameBufferStruct createRGBA8FrameBuffer(std::string& name, int x, int y) {
|
||||||
|
uint16_t id = FrameBufferManager::createRGBA8FrameBuffer(name, x, y);
|
||||||
|
return FrameBufferStruct(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameBufferStruct getFrameBuffer(std::string& name) {
|
||||||
|
return FrameBufferManager::getFrameBufferId(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
#include "DeerStudio/EditorEngine/API/FrameBuffer.h"
|
||||||
|
#include "DeerStudio/EditorEngine/ErrorHandle.h"
|
||||||
|
#include "DeerStudio/EditorEngine.h"
|
||||||
|
#include "angelscript.h"
|
||||||
|
|
||||||
|
namespace Deer {
|
||||||
|
namespace EditorEngine {
|
||||||
|
void registerFrameBufferStructs() {
|
||||||
|
AS_CHECK(scriptEngine->RegisterObjectType("FrameBuffer", sizeof(FrameBufferStruct),
|
||||||
|
asOBJ_VALUE | asOBJ_POD | asGetTypeTraits<FrameBufferStruct>() | asOBJ_APP_CLASS_ALLINTS));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void registerFrameBufferFunctions() {
|
||||||
|
AS_CHECK(scriptEngine->RegisterObjectMethod(
|
||||||
|
"FrameBuffer", "int get_width() const property",
|
||||||
|
asMETHOD(FrameBufferStruct, getWidth), asCALL_THISCALL
|
||||||
|
));
|
||||||
|
|
||||||
|
AS_CHECK(scriptEngine->RegisterObjectMethod(
|
||||||
|
"FrameBuffer", "int get_height() const property",
|
||||||
|
asMETHOD(FrameBufferStruct, getHeight), asCALL_THISCALL
|
||||||
|
));
|
||||||
|
|
||||||
|
AS_CHECK(scriptEngine->RegisterObjectMethod(
|
||||||
|
"FrameBuffer", "void resize(int, int)",
|
||||||
|
asMETHOD(FrameBufferStruct, resize), asCALL_THISCALL
|
||||||
|
));
|
||||||
|
|
||||||
|
AS_CHECK(scriptEngine->RegisterObjectMethod(
|
||||||
|
"FrameBuffer", "string get_name() const property",
|
||||||
|
asMETHOD(FrameBufferStruct, getName), asCALL_THISCALL
|
||||||
|
));
|
||||||
|
|
||||||
|
AS_CHECK(scriptEngine->RegisterGlobalFunction(
|
||||||
|
"FrameBuffer createRGBA8FrameBuffer(const string&in, int, int)",
|
||||||
|
asFUNCTION(createRGBA8FrameBuffer),
|
||||||
|
asCALL_CDECL
|
||||||
|
));
|
||||||
|
|
||||||
|
AS_CHECK(scriptEngine->RegisterGlobalFunction(
|
||||||
|
"FrameBuffer getFrameBuffer(const string&in)",
|
||||||
|
asFUNCTION(getFrameBuffer),
|
||||||
|
asCALL_CDECL
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ namespace Deer {
|
|||||||
registerEntityFunctions();
|
registerEntityFunctions();
|
||||||
registerMathFunctions();
|
registerMathFunctions();
|
||||||
registerUIFunctions();
|
registerUIFunctions();
|
||||||
|
registerFrameBufferFunctions();
|
||||||
|
|
||||||
AS_CHECK(scriptEngine->RegisterGlobalFunction(
|
AS_CHECK(scriptEngine->RegisterGlobalFunction(
|
||||||
"void setupAutomaticColumns(int)",
|
"void setupAutomaticColumns(int)",
|
||||||
|
@ -24,6 +24,7 @@ namespace Deer {
|
|||||||
registerResourceTypeEnum();
|
registerResourceTypeEnum();
|
||||||
registerEntityStructs();
|
registerEntityStructs();
|
||||||
registerMathStructs();
|
registerMathStructs();
|
||||||
|
registerFrameBufferStructs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1 +1 @@
|
|||||||
Entity activeEntity(0);
|
Entity activeEntity = getRoot();
|
@ -3,10 +3,7 @@ class TreePannel : DockPanel {
|
|||||||
Entity root = getRoot();
|
Entity root = getRoot();
|
||||||
contextMenuPopup("Window popup", any(root), ReciverFunc(this.entityContextMenu));
|
contextMenuPopup("Window popup", any(root), ReciverFunc(this.entityContextMenu));
|
||||||
|
|
||||||
bool opened = treeNode(root.name, false, any(root), ReciverFunc(this.renderNode));
|
renderNode(any(root));
|
||||||
if (!opened) {
|
|
||||||
contextItemPopup("POP_ENTITY_" + root.id, any(root), ReciverFunc(this.entityContextMenu));
|
|
||||||
}
|
|
||||||
|
|
||||||
modalPopup("Rename entity", renameEntity);
|
modalPopup("Rename entity", renameEntity);
|
||||||
}
|
}
|
||||||
@ -28,7 +25,8 @@ class TreePannel : DockPanel {
|
|||||||
Entity entity;
|
Entity entity;
|
||||||
data.retrieve(entity);
|
data.retrieve(entity);
|
||||||
|
|
||||||
entityInteraction(entity);
|
if (!entity.isRoot)
|
||||||
|
entityInteraction(entity);
|
||||||
|
|
||||||
// Maybe we deleted the entity in the context menu
|
// Maybe we deleted the entity in the context menu
|
||||||
if (!entity.exists)
|
if (!entity.exists)
|
||||||
|
@ -15,8 +15,8 @@ Collapsed=0
|
|||||||
DockId=0x00000004,1
|
DockId=0x00000004,1
|
||||||
|
|
||||||
[Window][Game Window]
|
[Window][Game Window]
|
||||||
Pos=258,24
|
Pos=365,24
|
||||||
Size=499,490
|
Size=504,503
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000006,0
|
DockId=0x00000006,0
|
||||||
|
|
||||||
@ -27,14 +27,14 @@ Collapsed=0
|
|||||||
DockId=0x00000001,0
|
DockId=0x00000001,0
|
||||||
|
|
||||||
[Window][Terrain Editor]
|
[Window][Terrain Editor]
|
||||||
Pos=759,24
|
Pos=871,24
|
||||||
Size=521,490
|
Size=409,503
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000004,0
|
DockId=0x00000004,0
|
||||||
|
|
||||||
[Window][Viewport]
|
[Window][Viewport]
|
||||||
Pos=258,24
|
Pos=365,24
|
||||||
Size=499,490
|
Size=504,503
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000006,1
|
DockId=0x00000006,1
|
||||||
|
|
||||||
@ -57,14 +57,14 @@ Collapsed=0
|
|||||||
DockId=0x00000008,1
|
DockId=0x00000008,1
|
||||||
|
|
||||||
[Window][MeshExplorer]
|
[Window][MeshExplorer]
|
||||||
Pos=0,516
|
Pos=0,529
|
||||||
Size=1280,204
|
Size=1280,191
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000008,0
|
DockId=0x00000008,0
|
||||||
|
|
||||||
[Window][TreePannel]
|
[Window][TreePannel]
|
||||||
Pos=0,24
|
Pos=0,24
|
||||||
Size=256,490
|
Size=363,503
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000005,0
|
DockId=0x00000005,0
|
||||||
|
|
||||||
@ -79,8 +79,8 @@ Size=351,75
|
|||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][PropertiesPannel]
|
[Window][PropertiesPannel]
|
||||||
Pos=759,24
|
Pos=871,24
|
||||||
Size=521,490
|
Size=409,503
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000004,1
|
DockId=0x00000004,1
|
||||||
|
|
||||||
@ -91,19 +91,19 @@ Collapsed=0
|
|||||||
DockId=0x00000004,1
|
DockId=0x00000004,1
|
||||||
|
|
||||||
[Window][ShaderExplorer]
|
[Window][ShaderExplorer]
|
||||||
Pos=0,516
|
Pos=0,529
|
||||||
Size=1280,204
|
Size=1280,191
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000008,1
|
DockId=0x00000008,1
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0xA1672E74 Window=0x4647B76E Pos=0,24 Size=1280,696 Split=Y
|
DockSpace ID=0xA1672E74 Window=0x4647B76E Pos=0,24 Size=1280,696 Split=Y
|
||||||
DockNode ID=0x00000007 Parent=0xA1672E74 SizeRef=1280,490 Split=Y
|
DockNode ID=0x00000007 Parent=0xA1672E74 SizeRef=1280,503 Split=Y
|
||||||
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=2560,363 Split=X Selected=0x13926F0B
|
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=2560,363 Split=X Selected=0x13926F0B
|
||||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=757,338 Split=X Selected=0x13926F0B
|
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=869,338 Split=X Selected=0x13926F0B
|
||||||
DockNode ID=0x00000005 Parent=0x00000003 SizeRef=256,446 Selected=0xE45B9F93
|
DockNode ID=0x00000005 Parent=0x00000003 SizeRef=363,446 Selected=0xE45B9F93
|
||||||
DockNode ID=0x00000006 Parent=0x00000003 SizeRef=499,446 CentralNode=1 Selected=0x13926F0B
|
DockNode ID=0x00000006 Parent=0x00000003 SizeRef=504,446 CentralNode=1 Selected=0x13926F0B
|
||||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=521,338 Selected=0xA35A27E3
|
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=409,338 Selected=0x2A2C795E
|
||||||
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=2560,331 Selected=0xCF339702
|
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=2560,331 Selected=0xCF339702
|
||||||
DockNode ID=0x00000008 Parent=0xA1672E74 SizeRef=1280,204 Selected=0xD962995A
|
DockNode ID=0x00000008 Parent=0xA1672E74 SizeRef=1280,191 Selected=0xD962995A
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user