Fixed some faces dissapearing on some models

Serializing environement ambient color
This commit is contained in:
Antoine Pilote
2023-09-16 01:31:42 -04:00
parent 70e766a899
commit c808d2f061
6 changed files with 15 additions and 8 deletions

3
.gitmodules vendored
View File

@@ -19,3 +19,6 @@
[submodule "Nuake/dependencies/soloud"]
path = Nuake/dependencies/soloud
url = https://github.com/antopilo/soloud.git
[submodule "Nuake/dependencies/optick"]
path = Nuake/dependencies/optick
url = https://github.com/bombomby/optick.git

View File

@@ -279,7 +279,7 @@ namespace Nuake
gBufferShader->SetUniformMat4f("u_View", mView);
// Models
glCullFace(GL_FRONT);
glDisable(GL_CULL_FACE);
auto view = scene.m_Registry.view<TransformComponent, ModelComponent, VisibilityComponent>();
for (auto e : view)
{
@@ -296,6 +296,7 @@ namespace Nuake
Renderer::Flush(gBufferShader, false);
// Quake BSPs
auto quakeView = scene.m_Registry.view<TransformComponent, BSPBrushComponent, VisibilityComponent>();
for (auto e : quakeView)
@@ -310,6 +311,7 @@ namespace Nuake
Renderer::SubmitMesh(b, transform.GetGlobalTransform(), (uint32_t)e);
}
}
Renderer::Flush(gBufferShader, false);
// Sprites

View File

@@ -52,6 +52,7 @@ namespace Nuake {
{
BEGIN_SERIALIZE();
SERIALIZE_VAL(CurrentSkyType);
SERIALIZE_VEC4(AmbientColor);
SERIALIZE_VAL(VolumetricFog);
SERIALIZE_VAL(VolumetricStepCount);
SERIALIZE_VEC4(AmbientColor);
@@ -63,6 +64,8 @@ namespace Nuake {
{
if (j.contains("CurrentSkyType"))
CurrentSkyType = j["CurrentSkyType"];
if (j.contains("AmbientColor"))
DESERIALIZE_VEC4(j["AmbientColor"], AmbientColor);
if (j.contains("VolumetricFog"))
VolumetricFog = j["VolumetricFog"];
if (j.contains("VolumetricStepCount"))

View File

@@ -101,8 +101,7 @@ namespace Nuake
}
Logger::Log("Entity not found with id: " + std::to_string(id), "scene", CRITICAL);
assert("Entity not found");
return Entity{ (entt::entity)0, this };
}
bool Scene::OnInit()
@@ -388,7 +387,6 @@ namespace Nuake
sceneCopy->Path = Path;
json serializedScene = Serialize();
sceneCopy->Deserialize(serializedScene);
return sceneCopy;
}
@@ -485,7 +483,7 @@ namespace Nuake
Entity skeletonRootEntity = CreateEntity(skeletonRoot.Name);
skeletonRootEntity.AddComponent<BoneComponent>().Name = skeletonRoot.Name;
skeletonRoot.EntityHandle = skeletonRootEntity.GetHandle();
skeletonRoot.EntityHandle = skeletonRootEntity.GetID();
entity.AddChild(skeletonRootEntity);
@@ -511,7 +509,7 @@ namespace Nuake
boneEntity.AddComponent<BoneComponent>();
entity.AddChild(boneEntity);
c.EntityHandle = boneEntity.GetHandle();
c.EntityHandle = boneEntity.GetID();
Vector3 bonePosition;
Quat boneRotation;

View File

@@ -50,9 +50,9 @@ namespace Nuake
auto& animationTrack = animation->GetTrack(boneName);
Entity& boneEntity = m_Scene->GetEntity(boneName);
Entity& boneEnt = Entity{ (entt::entity)bone.EntityHandle, m_Scene };
Entity& boneEnt = m_Scene->GetEntityByID(bone.EntityHandle);
///assert(boneEnt.GetHandle() == boneEntity.GetHandle());
if (boneEnt.GetHandle() != 0)
if (boneEnt.IsValid())
{
auto& transformComponent = boneEnt.GetComponent<TransformComponent>();
bone.FinalTransform = transformComponent.GetGlobalTransform() * bone.Offset;