chore: remove colors from Gizmo

This commit is contained in:
Nick Fisher
2024-12-17 14:07:29 +08:00
parent eb4e70a7cf
commit fc4842ed6d
2 changed files with 20 additions and 9 deletions

View File

@@ -0,0 +1,11 @@
#include "math.h"
namespace thermion {
using namespace filament;
constexpr math::float3 AXIS_COLORS[3] {
math::float3{1.0f, 0.0f, 0.0f}, // X
math::float3{0.0f, 1.0f, 0.0f}, // Y
math::float3{0.0f, 0.0f, 1.0f}, // Z
};
}

View File

@@ -7,13 +7,12 @@
#include <gltfio/math.h>
#include "Globals.hpp"
#include "Log.hpp"
#include "material/gizmo.h"
#include "scene/Gizmo.hpp"
#include "scene/SceneManager.hpp"
#include "material/gizmo.h"
#include "Log.hpp"
namespace thermion
{
@@ -82,7 +81,8 @@ namespace thermion
auto instance = _source->createInstance(&materialInstance, 1);
TRACE("Created Gizmo axis glTF instance with head entity %d", instance->getEntity());
materialInstance->setParameter("baseColorFactor", inactiveColors[axis]);
auto color = filament::math::float4(AXIS_COLORS[axis], 0.5f);
materialInstance->setParameter("baseColorFactor", color);
materialInstance->setParameter("scale", _scale);
auto hitTestEntity = instance->findEntityByName("HitTest");
@@ -179,8 +179,8 @@ namespace thermion
if (renderableInstance.isValid())
{
auto *materialInstance = rm.getMaterialInstanceAt(renderableInstance, 0);
math::float4 baseColor = activeColors[axis];
materialInstance->setParameter("baseColorFactor", baseColor);
auto color = filament::math::float4(AXIS_COLORS[axis], 1.0f);
materialInstance->setParameter("baseColorFactor", color);
}
}
}
@@ -202,8 +202,8 @@ namespace thermion
if (renderableInstance.isValid())
{
auto *materialInstance = rm.getMaterialInstanceAt(renderableInstance, 0);
math::float4 baseColor = inactiveColors[axis];
materialInstance->setParameter("baseColorFactor", baseColor);
auto color = filament::math::float4(AXIS_COLORS[axis], 0.5f);
materialInstance->setParameter("baseColorFactor", color);
}
}
}