Huge rework of editor and other changes.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include "src/Core/Physics/Rigibody.h"
|
||||
|
||||
namespace Nuake {
|
||||
class BSPBrushComponent
|
||||
class BSPBrushComponent
|
||||
{
|
||||
public:
|
||||
std::vector<Ref<Mesh>> Meshes;
|
||||
@@ -22,10 +22,28 @@ namespace Nuake {
|
||||
bool IsTransparent = false;
|
||||
bool IsFunc = false;
|
||||
|
||||
BSPBrushComponent() {
|
||||
BSPBrushComponent()
|
||||
{
|
||||
Meshes = std::vector<Ref<Mesh>>();
|
||||
Materials = std::vector<Ref<Material>>();
|
||||
Rigidbody = std::vector<Ref<Physics::RigidBody>>();
|
||||
}
|
||||
|
||||
json Serialize()
|
||||
{
|
||||
BEGIN_SERIALIZE();
|
||||
|
||||
for (unsigned int i = 0; i < Meshes.size(); i++)
|
||||
{
|
||||
j["Meshes"][i] = Meshes[i]->Serialize();
|
||||
}
|
||||
|
||||
END_SERIALIZE();
|
||||
}
|
||||
|
||||
bool Deserialize()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
22
Nuake/src/Scene/Components/BoxCollider.cpp
Normal file
22
Nuake/src/Scene/Components/BoxCollider.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "BoxCollider.h"
|
||||
#include "src/Resource/Serializable.h"
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
json BoxColliderComponent::Serialize()
|
||||
{
|
||||
BEGIN_SERIALIZE();
|
||||
|
||||
j["IsTrigger"] = IsTrigger;
|
||||
SERIALIZE_VEC3(Size);
|
||||
END_SERIALIZE();
|
||||
}
|
||||
|
||||
bool BoxColliderComponent::Deserialize(const std::string& str)
|
||||
{
|
||||
BEGIN_DESERIALIZE();
|
||||
this->IsTrigger = j["IsTrigger"];
|
||||
this->Size = Vector3(j["Size"]["x"], j["Size"]["y"], j["Size"]["z"]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
#pragma once
|
||||
#include "src/Core/Physics/PhysicsShapes.h"
|
||||
#include "src/Core/Core.h"
|
||||
|
||||
namespace Nuake {
|
||||
class BoxColliderComponent
|
||||
{
|
||||
public:
|
||||
Ref<Physics::PhysicShape> Box;
|
||||
glm::vec3 Size = glm::vec3(0.5f, 0.5f, 0.5f);
|
||||
bool IsTrigger;
|
||||
bool IsTrigger = false;
|
||||
|
||||
json Serialize();
|
||||
bool Deserialize(const std::string& str);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace Nuake {
|
||||
//start = glm::rotate(start, glm::radians(Direction.z), glm::vec3(0, 0, 1));
|
||||
|
||||
//return glm::vec3(start * glm::vec4(defaultDirection, 1.0f));
|
||||
return Direction;
|
||||
return glm::normalize(Direction);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -108,7 +108,8 @@ namespace Nuake {
|
||||
return nullptr;
|
||||
|
||||
aiMaterial* material = scene->mMaterials[mesh->mMaterialIndex];
|
||||
Ref<Material> newMaterial = MaterialManager::Get()->GetMaterial(directory + std::to_string(mesh->mMaterialIndex) + material->GetName().C_Str());
|
||||
std::string materialPath = directory + std::to_string(mesh->mMaterialIndex) + material->GetName().C_Str();
|
||||
Ref<Material> newMaterial = MaterialManager::Get()->GetMaterial(materialPath);
|
||||
|
||||
aiString str;
|
||||
|
||||
@@ -126,7 +127,13 @@ namespace Nuake {
|
||||
}
|
||||
else
|
||||
{
|
||||
newMaterial->SetAlbedo(TextureManager::Get()->GetTexture(FileSystem::Root + directory + str.C_Str()));
|
||||
std::string texturePath = FileSystem::Root + directory + str.C_Str();
|
||||
if (!FileSystem::FileExists(texturePath))
|
||||
{
|
||||
Logger::Log("Texture file couldn't be found: " + texturePath, Nuake::LOG_TYPE::CRITICAL);
|
||||
texturePath = "resources/Textures/default/Default.png";
|
||||
}
|
||||
newMaterial->SetAlbedo(TextureManager::Get()->GetTexture(texturePath));
|
||||
}
|
||||
|
||||
material->GetTexture(aiTextureType_NORMALS, 0, &str);
|
||||
|
||||
@@ -26,6 +26,12 @@ namespace Nuake {
|
||||
BEGIN_SERIALIZE();
|
||||
SERIALIZE_VAL(HasCollisions);
|
||||
SERIALIZE_VAL(Path);
|
||||
|
||||
for (unsigned int i = 0; i < m_Meshes.size(); i++)
|
||||
{
|
||||
j["Meshes"][i] = m_Meshes[i]->Serialize();
|
||||
}
|
||||
|
||||
END_SERIALIZE();
|
||||
}
|
||||
|
||||
@@ -34,7 +40,6 @@ namespace Nuake {
|
||||
BEGIN_DESERIALIZE();
|
||||
this->Path = j["Path"];
|
||||
this->HasCollisions = j["HasCollisions"];
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user