Merge branch 'master' into device_name_info

This commit is contained in:
Amer Koleci
2022-09-11 11:21:42 +02:00
committed by GitHub
15 changed files with 450 additions and 342 deletions
+9 -4
View File
@@ -77,6 +77,15 @@ void ComponentsWindow::Create(EditorComponent* _editor)
return;
Scene& scene = editor->GetCurrentScene();
Entity entity = editor->translator.selected.back().entity;
if (args.userdata == 17)
{
// explanation: for softbody, we want to create it for the MeshComponent, if it's also selected together with the object:
ObjectComponent* object = scene.objects.GetComponent(entity);
if (object != nullptr)
{
entity = object->meshID;
}
}
if (entity == INVALID_ENTITY)
{
assert(0);
@@ -195,7 +204,6 @@ void ComponentsWindow::Create(EditorComponent* _editor)
break;
case 3:
scene.lights.Create(entity);
scene.aabb_lights.Create(entity);
break;
case 4:
scene.materials.Create(entity);
@@ -225,7 +233,6 @@ void ComponentsWindow::Create(EditorComponent* _editor)
break;
case 8:
scene.probes.Create(entity);
scene.aabb_probes.Create(entity);
break;
case 9:
if (!scene.materials.Contains(entity))
@@ -241,7 +248,6 @@ void ComponentsWindow::Create(EditorComponent* _editor)
if (!scene.materials.Contains(entity))
scene.materials.Create(entity);
scene.decals.Create(entity);
scene.aabb_decals.Create(entity);
break;
case 12:
scene.weathers.Create(entity);
@@ -272,7 +278,6 @@ void ComponentsWindow::Create(EditorComponent* _editor)
break;
case 21:
scene.objects.Create(entity);
scene.aabb_objects.Create(entity);
break;
default:
break;
+7 -7
View File
@@ -1578,7 +1578,7 @@ void EditorComponent::Render() const
const ObjectComponent* object = scene.objects.GetComponent(hovered.entity);
if (object != nullptr)
{
const AABB& aabb = *scene.aabb_objects.GetComponent(hovered.entity);
const AABB& aabb = scene.aabb_objects[scene.objects.GetIndex(hovered.entity)];
XMFLOAT4X4 hoverBox;
XMStoreFloat4x4(&hoverBox, aabb.getAsBoxMatrix());
@@ -1588,7 +1588,7 @@ void EditorComponent::Render() const
const LightComponent* light = scene.lights.GetComponent(hovered.entity);
if (light != nullptr)
{
const AABB& aabb = *scene.aabb_lights.GetComponent(hovered.entity);
const AABB& aabb = scene.aabb_lights[scene.lights.GetIndex(hovered.entity)];
XMFLOAT4X4 hoverBox;
XMStoreFloat4x4(&hoverBox, aabb.getAsBoxMatrix());
@@ -1604,7 +1604,7 @@ void EditorComponent::Render() const
const EnvironmentProbeComponent* probe = scene.probes.GetComponent(hovered.entity);
if (probe != nullptr)
{
const AABB& aabb = *scene.aabb_probes.GetComponent(hovered.entity);
const AABB& aabb = scene.aabb_probes[scene.probes.GetIndex(hovered.entity)];
XMFLOAT4X4 hoverBox;
XMStoreFloat4x4(&hoverBox, aabb.getAsBoxMatrix());
@@ -1647,21 +1647,21 @@ void EditorComponent::Render() const
const ObjectComponent* object = scene.objects.GetComponent(picked.entity);
if (object != nullptr)
{
const AABB& aabb = *scene.aabb_objects.GetComponent(picked.entity);
const AABB& aabb = scene.aabb_objects[scene.objects.GetIndex(picked.entity)];
selectedAABB = AABB::Merge(selectedAABB, aabb);
}
const LightComponent* light = scene.lights.GetComponent(picked.entity);
if (light != nullptr)
{
const AABB& aabb = *scene.aabb_lights.GetComponent(picked.entity);
const AABB& aabb = scene.aabb_lights[scene.lights.GetIndex(picked.entity)];
selectedAABB = AABB::Merge(selectedAABB, aabb);
}
const DecalComponent* decal = scene.decals.GetComponent(picked.entity);
if (decal != nullptr)
{
const AABB& aabb = *scene.aabb_decals.GetComponent(picked.entity);
const AABB& aabb = scene.aabb_decals[scene.decals.GetIndex(picked.entity)];
selectedAABB = AABB::Merge(selectedAABB, aabb);
// also display decal OBB:
@@ -1673,7 +1673,7 @@ void EditorComponent::Render() const
const EnvironmentProbeComponent* probe = scene.probes.GetComponent(picked.entity);
if (probe != nullptr)
{
const AABB& aabb = *scene.aabb_probes.GetComponent(picked.entity);
const AABB& aabb = scene.aabb_probes[scene.probes.GetIndex(picked.entity)];
selectedAABB = AABB::Merge(selectedAABB, aabb);
}
-1
View File
@@ -19,7 +19,6 @@ void EnvProbeWindow::Create(EditorComponent* _editor)
editor->RecordEntity(archive, entity);
editor->GetCurrentScene().probes.Remove(entity);
editor->GetCurrentScene().aabb_probes.Remove(entity);
editor->RecordEntity(archive, entity);
-1
View File
@@ -23,7 +23,6 @@ void LightWindow::Create(EditorComponent* _editor)
editor->RecordEntity(archive, entity);
editor->GetCurrentScene().lights.Remove(entity);
editor->GetCurrentScene().aabb_lights.Remove(entity);
editor->RecordEntity(archive, entity);
-1
View File
@@ -271,7 +271,6 @@ void ObjectWindow::Create(EditorComponent* _editor)
editor->RecordEntity(archive, entity);
editor->GetCurrentScene().objects.Remove(entity);
editor->GetCurrentScene().aabb_objects.Remove(entity);
editor->RecordEntity(archive, entity);
+2 -5
View File
@@ -694,11 +694,8 @@ void TerrainWindow::Create(EditorComponent* _editor)
wi::primitive::AABB aabb;
for (auto& chunk : terrain->chunks)
{
const wi::primitive::AABB* object_aabb = terrain->scene->aabb_objects.GetComponent(chunk.second.entity);
if (object_aabb != nullptr)
{
aabb = wi::primitive::AABB::Merge(aabb, *object_aabb);
}
const wi::primitive::AABB& object_aabb = terrain->scene->aabb_objects[terrain->scene->objects.GetIndex(chunk.second.entity)];
aabb = wi::primitive::AABB::Merge(aabb, object_aabb);
}
wi::vector<uint8_t> data;