Added some serialization and added shader functionallity

This commit is contained in:
Antoine Pilote
2023-03-05 20:09:57 -05:00
parent b1edeb387f
commit 69a2013a0f
6 changed files with 14 additions and 3 deletions

View File

@@ -42,7 +42,8 @@ public:
ImGuiHelper::DrawVec3("Rotation", &eulerDegrees);
Vector3 eulerAnglesDelta = Vector3(glm::radians(eulerDegrees.x), glm::radians(eulerDegrees.y), glm::radians(eulerDegrees.z));
if (eulerAngles != eulerAnglesDelta)
float delta = glm::length(eulerAngles - eulerAnglesDelta);
if (delta > 0.f)
{
Quat rotation = QuatFromEuler(eulerAnglesDelta.x, eulerAnglesDelta.y, eulerAnglesDelta.z);
//component.SetLocalRotation(rotation);

View File

@@ -63,7 +63,6 @@ namespace Nuake
m_World = new Physics::DynamicWorld();
m_World->SetGravity(glm::vec3(0, -3, 0));
m_IsRunning = false;
}
}

View File

@@ -261,6 +261,14 @@ namespace Nuake
glUniform1iv(addr, size, value);
}
void Shader::SetUniform1fv(const std::string& name, int size, float* value)
{
int addr = FindUniformLocation(name);
//ASSERT(addr != -1);
if (addr != -1)
glUniform1fv(addr, size, value);
}
void Shader::SetUniformMat3f(const std::string& name, Matrix3 mat)
{
int addr = FindUniformLocation(name);

View File

@@ -44,6 +44,7 @@ namespace Nuake
void SetUniform1i(const std::string& name, int v0);
void SetUniform1iv(const std::string& name, int size, int* value);
void SetUniform1fv(const std::string& name, int size, float* value);
void SetUniformMat3f(const std::string& name, Matrix3 mat);
void SetUniformMat4f(const std::string& name, Matrix4 mat);

View File

@@ -51,6 +51,8 @@ namespace Nuake
SERIALIZE_OBJECT_REF_LBL("ModelComponent", GetComponent<ModelComponent>());
if (HasComponent<BSPBrushComponent>())
SERIALIZE_OBJECT_REF_LBL("BSPBrushComponent", GetComponent<BSPBrushComponent>());
if (HasComponent<QuakeMapComponent>())
SERIALIZE_OBJECT_REF_LBL("QuakeMapComponent", GetComponent<QuakeMapComponent>());
END_SERIALIZE();
}

View File

@@ -346,7 +346,7 @@ namespace Nuake {
CopyComponent<ModelComponent>(sceneCopy->m_Registry, this->m_Registry);
CopyComponent<CameraComponent>(sceneCopy->m_Registry, this->m_Registry);
CopyComponent<WrenScriptComponent>(sceneCopy->m_Registry, this->m_Registry);
CopyComponent<QuakeMapComponent>(sceneCopy->m_Registry, this->m_Registry);
return sceneCopy;
}