Now diplaying links between brushes

This commit is contained in:
Antoine Pilote
2024-08-31 00:07:45 -04:00
parent 3959760627
commit 8aa41a1bf8
9 changed files with 82 additions and 15 deletions

View File

@@ -130,6 +130,11 @@ void NetScriptPanel::Draw(Nuake::Entity entity)
{
if (!field.Value.has_value())
{
if (!field.DefaultValue.has_value())
{
field.DefaultValue = 0.0f;
}
field.Value = field.DefaultValue;
}
@@ -143,6 +148,11 @@ void NetScriptPanel::Draw(Nuake::Entity entity)
{
if (!field.Value.has_value())
{
if (!field.DefaultValue.has_value())
{
field.DefaultValue = 0.0;
}
field.Value = field.DefaultValue;
}
@@ -156,6 +166,11 @@ void NetScriptPanel::Draw(Nuake::Entity entity)
{
if (!field.Value.has_value())
{
if (!field.DefaultValue.has_value())
{
field.DefaultValue = false;
}
field.Value = field.DefaultValue;
}
@@ -188,6 +203,11 @@ void NetScriptPanel::Draw(Nuake::Entity entity)
{
if (!field.Value.has_value())
{
if (!field.DefaultValue.has_value())
{
field.DefaultValue = Nuake::Vector2(0, 0);
}
field.Value = field.DefaultValue;
}
@@ -203,6 +223,11 @@ void NetScriptPanel::Draw(Nuake::Entity entity)
{
if (!field.Value.has_value())
{
if (!field.DefaultValue.has_value())
{
field.DefaultValue = Nuake::Vector3(0, 0, 0);
}
field.Value = field.DefaultValue;
}

View File

@@ -23,6 +23,7 @@
#include <src/Scene/Components/BoneComponent.h>
#include <src/Scene/Components/AudioEmitterComponent.h>
#include <DetourDebugDraw.h>
#include <src/Scene/Components/BSPBrushComponent.h>
GizmoDrawer::GizmoDrawer(EditorInterface* editor)
@@ -378,6 +379,35 @@ void GizmoDrawer::DrawGizmos(Ref<Scene> scene, bool occluded)
}
}
auto bspView = scene->m_Registry.view<TransformComponent, BSPBrushComponent>();
for (auto e : bspView)
{
auto [transform, brush] = scene->m_Registry.get<TransformComponent, BSPBrushComponent>(e);
if (brush.target.empty())
{
continue;
}
auto bspView2 = scene->m_Registry.view<TransformComponent, BSPBrushComponent>();
for (auto e2 : bspView2)
{
auto [transform2, brush2] = scene->m_Registry.get<TransformComponent, BSPBrushComponent>(e2);
if (brush2.TargetName.empty())
{
continue;
}
if (brush.target == brush2.TargetName)
{
Vector3 from = transform.GetGlobalTransform()[3];
Vector3 to = transform2.GetGlobalTransform()[3];
scene->m_SceneRenderer->DrawDebugLine(from, to, Color(1, 0, 0, 1), 0.f, 1.0f);
}
}
}
auto particleView = scene->m_Registry.view<TransformComponent, ParticleEmitterComponent>();
for (auto e : particleView)
{

View File

@@ -761,6 +761,8 @@ namespace Nuake
const auto& LayerFilter = _JoltPhysicsSystem->GetDefaultLayerFilter(Layers::CHARACTER);
const auto& joltGravity = _JoltPhysicsSystem->GetGravity();
auto& tempAllocatorPtr = *(joltTempAllocator);
c.second.Character->UpdateGroundVelocity();
if (characterController->AutoStepping)
{
// Create update settings from character controller
@@ -769,7 +771,7 @@ namespace Nuake
joltUpdateSettings.mWalkStairsStepUp = CreateJoltVec3(characterController->StepUp);
joltUpdateSettings.mWalkStairsStepForwardTest = characterController->StepDistance;
joltUpdateSettings.mWalkStairsMinStepForward = characterController->StepMinDistance;
c.second.Character->ExtendedUpdate(ts, joltGravity, joltUpdateSettings, broadPhaseLayerFilter, LayerFilter, { }, { }, tempAllocatorPtr);
}
else

View File

@@ -83,11 +83,6 @@ namespace Nuake
void SceneRenderer::Update(const Timestep time, bool isEditorUpdate)
{
if (isEditorUpdate)
{
return;
}
// Delete debug shapes that are dead
std::erase_if(mDebugLines, [](const DebugLine& line)
{
@@ -99,7 +94,6 @@ namespace Nuake
return shape.Life < 0.0f;
});
for (auto& line : mDebugLines)
{
line.Life -= time;
@@ -1082,8 +1076,6 @@ namespace Nuake
RenderCommand::DrawLines(0, 2);
}
shader->Unbind();
shader = Nuake::ShaderManager::GetShader("Resources/Shaders/line.shader");

View File

@@ -1,3 +1,4 @@
#pragma once
#include "src/Core/Core.h"
#include "src/Core/Maths.h"
@@ -54,8 +55,10 @@ namespace Nuake {
varJ["Name"] = e.Name;
varJ["Type"] = e.Type;
switch (e.Type)
if (e.Value.has_value() || e.DefaultValue.has_value())
{
switch (e.Type)
{
case NetScriptExposedVarType::Bool:
varJ["Value"] = std::any_cast<bool>(e.Value);
varJ["DefaultValue"] = std::any_cast<bool>(e.DefaultValue);
@@ -118,17 +121,19 @@ namespace Nuake {
{
value = std::any_cast<int>(e.Value);
}
varJ["Value"] = value;
varJ["DefaultValue"] = value;
break;
}
default:
varJ["Value"] = 0;
break;
}
}
}
exposedVarJson[i] = varJ;
i++;
}

View File

@@ -16,6 +16,7 @@ namespace Nuake {
bool LockX = false;
bool LockY = false;
bool LockZ = false;
bool HasBeenMoved = false;
Ref<Physics::RigidBody> Rigidbody;
Vector3 QueuedForce = Vector3();

View File

@@ -244,7 +244,7 @@ namespace Nuake {
TransformComponent& transformComponent = brushEntity.GetComponent<TransformComponent>();
BSPBrushComponent& bsp = brushEntity.AddComponent<BSPBrushComponent>();
bsp.IsSolid = fgdBrush.Solid;
bsp.IsSolid = !fgdBrush.IsTrigger;
bsp.IsTransparent = !fgdBrush.Visible;
bsp.IsFunc = true;
bsp.IsTrigger = fgdBrush.IsTrigger;

View File

@@ -275,6 +275,11 @@ namespace Nuake {
{
PhysicsManager::Get().SetCharacterControllerPosition(entity, { x, y, z });
}
if (entity.HasComponent<BSPBrushComponent>())
{
PhysicsManager::Get().SetBodyTransform(entity, { x, y, z }, component.GetGlobalRotation());
}
}
}

View File

@@ -213,6 +213,13 @@ namespace Nuake
component.ExposedVar.push_back(exposedVar);
}
}
std::erase_if(component.ExposedVar,
[&](Nuake::NetScriptExposedVar& var)
{
return std::find(detectedExposedVar.begin(), detectedExposedVar.end(), var.Name) == detectedExposedVar.end();
}
);
}
std::vector<ExposedVar> ScriptingEngineNet::GetExposedVarForTypes(Entity entity)
@@ -305,7 +312,7 @@ namespace Nuake
}
brushDescription = attribute.GetFieldValue<Coral::String>("Description");
isTrigger = attribute.GetFieldValue<bool>("IsTrigger");
isTrigger = attribute.GetFieldValue<Coral::Bool32>("IsTrigger");
isBrushScript = true;
}