Removed OBB rendering helpers and color options (was already hidden from the UI)

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
This commit is contained in:
Benjamin Jillich
2021-08-03 17:13:19 +02:00
parent aab8ab9706
commit b335285e19
9 changed files with 0 additions and 125 deletions
@@ -403,77 +403,6 @@ namespace MCommon
}
}
// render object orientated bounding boxes for all enabled nodes inside the actor instance
void RenderUtil::RenderOBBs(EMotionFX::ActorInstance* actorInstance, const AZStd::unordered_set<AZ::u32>* visibleJointIndices, const AZStd::unordered_set<AZ::u32>* selectedJointIndices, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor, bool directlyRender)
{
AZ::Vector3 p[8];
// get the actor it is an instance from
const EMotionFX::Actor* actor = actorInstance->GetActor();
const EMotionFX::Skeleton* skeleton = actor->GetSkeleton();
const EMotionFX::Pose* pose = actorInstance->GetTransformData()->GetCurrentPose();
// iterate through all enabled nodes
MCore::RGBAColor tempColor;
const uint32 numEnabled = actorInstance->GetNumEnabledNodes();
for (uint32 i = 0; i < numEnabled; ++i)
{
const EMotionFX::Node* joint = skeleton->GetNode(actorInstance->GetEnabledNode(i));
const AZ::u32 jointIndex = joint->GetNodeIndex();
if (!visibleJointIndices || visibleJointIndices->empty() ||
(visibleJointIndices->find(jointIndex) != visibleJointIndices->end()))
{
const MCore::OBB& obb = actor->GetNodeOBB(jointIndex);
EMotionFX::Transform worldTransform = pose->GetWorldSpaceTransform(jointIndex);
// skip the OBB if it isn't valid
if (obb.CheckIfIsValid() == false)
{
continue;
}
// check if the current bone is selected and set the color according to it
if (selectedJointIndices && selectedJointIndices->find(jointIndex) != selectedJointIndices->end())
{
tempColor = selectedColor;
}
else
{
tempColor = color;
}
obb.CalcCornerPoints(p);
for (uint32 a = 0; a < 8; a++)
{
p[a] = worldTransform.TransformPoint(p[a]);
}
// render
RenderLine(p[0], p[1], tempColor);
RenderLine(p[1], p[2], tempColor);
RenderLine(p[2], p[3], tempColor);
RenderLine(p[0], p[3], tempColor);
RenderLine(p[1], p[5], tempColor);
RenderLine(p[3], p[7], tempColor);
RenderLine(p[2], p[6], tempColor);
RenderLine(p[0], p[4], tempColor);
RenderLine(p[4], p[5], tempColor);
RenderLine(p[4], p[7], tempColor);
RenderLine(p[6], p[7], tempColor);
RenderLine(p[6], p[5], tempColor);
}
}
if (directlyRender)
{
RenderLines();
}
}
// render wireframe mesh
void RenderUtil::RenderWireframe(EMotionFX::Mesh* mesh, const AZ::Transform& worldTM, const MCore::RGBAColor& color, bool directlyRender, float offsetScale)
{
@@ -167,18 +167,6 @@ namespace MCommon
*/
void RenderAabbs(EMotionFX::ActorInstance* actorInstance, const AABBRenderSettings& renderSettings = AABBRenderSettings(), bool directlyRender = false);
/**
* Render OBB for all enabled nodes inside the actor instance.
* @param actorInstance A pointer to the actor instance which will be rendered.
* @param[in] visibleJointIndices List of visible joint indices. nullptr in case all joints should be rendered.
* @param[in] selectedJointIndices List of selected joint indices. nullptr in case selection should not be considered.
* @param[in] color The color of the OBBs.
* @param[in] selectedColor The color of the selected OBBs.
* @param[in] directlyRender Will call the RenderLines() function internally in case it is set to true. If false
* you have to make sure to call RenderLines() manually at the end of your custom render frame function.
*/
void RenderOBBs(EMotionFX::ActorInstance* actorInstance, const AZStd::unordered_set<AZ::u32>* visibleJointIndices = nullptr, const AZStd::unordered_set<AZ::u32>* selectedJointIndices = nullptr, const MCore::RGBAColor& color = MCore::RGBAColor(1.0f, 1.0f, 0.0f, 1.0f), const MCore::RGBAColor& selectedColor = MCore::RGBAColor(1.0f, 0.647f, 0.0f), bool directlyRender = false);
/**
* Render a simple line based skeleton for all enabled nodes of the actor instance.
* @param[in] actorInstance A pointer to the actor instance which will be rendered.
@@ -98,7 +98,6 @@ namespace EMotionFX
result->mChildIndices = mChildIndices;
//result->mImportanceFactor = mImportanceFactor;
result->mNodeFlags = mNodeFlags;
result->mOBB = mOBB;
result->mSemanticNameID = mSemanticNameID;
// copy the node attributes
@@ -55,7 +55,6 @@ namespace EMStudio
const char* RenderOptions::s_nodeAABBColorOptionName = "nodeAABBColor";
const char* RenderOptions::s_staticAABBColorOptionName = "staticAABBColor";
const char* RenderOptions::s_meshAABBColorOptionName = "meshAABBColor";
const char* RenderOptions::s_OBBsColorOptionName = "OBBsColor";
const char* RenderOptions::s_lineSkeletonColorOptionName = "lineSkeletonColor_v2";
const char* RenderOptions::s_skeletonColorOptionName = "skeletonColor";
const char* RenderOptions::s_selectionColorOptionName = "selectionColor";
@@ -107,7 +106,6 @@ namespace EMStudio
, m_nodeAABBColor(1.0f, 0.0f, 0.0f, 1.0f)
, m_staticAABBColor(0.0f, 0.7f, 0.7f, 1.0f)
, m_meshAABBColor(0.0f, 0.0f, 0.7f, 1.0f)
, m_OBBsColor(1.0f, 1.0f, 0.0f, 1.0f)
, m_lineSkeletonColor(0.33333f, 1.0f, 0.0f, 1.0f)
, m_skeletonColor(0.19f, 0.58f, 0.19f, 1.0f)
, m_selectionColor(1.0f, 1.0f, 1.0f, 1.0f)
@@ -167,7 +165,6 @@ namespace EMStudio
SetNodeAABBColor(other.GetNodeAABBColor());
SetStaticAABBColor(other.GetStaticAABBColor());
SetMeshAABBColor(other.GetMeshAABBColor());
SetOBBsColor(other.GetOBBsColor());
SetLineSkeletonColor(other.GetLineSkeletonColor());
SetSkeletonColor(other.GetSkeletonColor());
SetSelectionColor(other.GetSelectionColor());
@@ -204,7 +201,6 @@ namespace EMStudio
settings->setValue(s_staticAABBColorOptionName, ColorToString(m_staticAABBColor));
settings->setValue(s_meshAABBColorOptionName, ColorToString(m_meshAABBColor));
settings->setValue(s_collisionMeshColorOptionName, ColorToString(m_collisionMeshColor));
settings->setValue(s_OBBsColorOptionName, ColorToString(m_OBBsColor));
settings->setValue(s_lineSkeletonColorOptionName, ColorToString(m_lineSkeletonColor));
settings->setValue(s_skeletonColorOptionName, ColorToString(m_skeletonColor));
settings->setValue(s_selectionColorOptionName, ColorToString(m_selectionColor));
@@ -272,7 +268,6 @@ namespace EMStudio
options.m_staticAABBColor = StringToColor(settings->value(s_staticAABBColorOptionName, ColorToString(options.m_staticAABBColor)).toString());
options.m_meshAABBColor = StringToColor(settings->value(s_meshAABBColorOptionName, ColorToString(options.m_meshAABBColor)).toString());
options.m_collisionMeshColor = StringToColor(settings->value(s_collisionMeshColorOptionName, ColorToString(options.m_collisionMeshColor)).toString());
options.m_OBBsColor = StringToColor(settings->value(s_OBBsColorOptionName, ColorToString(options.m_OBBsColor)).toString());
options.m_lineSkeletonColor = StringToColor(settings->value(s_lineSkeletonColorOptionName, ColorToString(options.m_lineSkeletonColor)).toString());
options.m_skeletonColor = StringToColor(settings->value(s_skeletonColorOptionName, ColorToString(options.m_skeletonColor)).toString());
options.m_selectionColor = StringToColor(settings->value(s_selectionColorOptionName, ColorToString(options.m_selectionColor)).toString());
@@ -388,7 +383,6 @@ namespace EMStudio
->Field(s_nodeAABBColorOptionName, &RenderOptions::m_nodeAABBColor)
->Field(s_staticAABBColorOptionName, &RenderOptions::m_staticAABBColor)
->Field(s_meshAABBColorOptionName, &RenderOptions::m_meshAABBColor)
->Field(s_OBBsColorOptionName, &RenderOptions::m_OBBsColor)
->Field(s_lineSkeletonColorOptionName, &RenderOptions::m_lineSkeletonColor)
->Field(s_skeletonColorOptionName, &RenderOptions::m_skeletonColor)
->Field(s_selectionColorOptionName, &RenderOptions::m_selectionColor)
@@ -546,9 +540,6 @@ namespace EMStudio
->DataElement(AZ::Edit::UIHandlers::Default, &RenderOptions::m_meshAABBColor, "Mesh based AABB color",
"Color for the runtime-updated AABB calculated based on the deformed meshes.")
->Attribute(AZ::Edit::Attributes::ChangeNotify, &RenderOptions::OnMeshAABBColorChangedCallback)
->DataElement(AZ::Edit::UIHandlers::Default, &RenderOptions::m_OBBsColor, "Joint OBB color",
"Color used for the pre-calculated joint oriented bounding boxes.")
->Attribute(AZ::Edit::Attributes::ChangeNotify, &RenderOptions::OnOBBsColorChangedCallback)
->DataElement(AZ::Edit::UIHandlers::Default, &RenderOptions::m_lineSkeletonColor, "Line based skeleton color",
"Line-based skeleton color.")
->Attribute(AZ::Edit::Attributes::ChangeNotify, &RenderOptions::OnLineSkeletonColorChangedCallback)
@@ -894,15 +885,6 @@ namespace EMStudio
}
}
void RenderOptions::SetOBBsColor(const AZ::Color& OBBsColor)
{
if (!OBBsColor.IsClose(m_OBBsColor))
{
m_OBBsColor = OBBsColor;
OnOBBsColorChangedCallback();
}
}
void RenderOptions::SetLineSkeletonColor(const AZ::Color& lineSkeletonColor)
{
if (!lineSkeletonColor.IsClose(m_lineSkeletonColor))
@@ -1240,11 +1222,6 @@ namespace EMStudio
PluginOptionsNotificationsBus::Event(s_meshAABBColorOptionName, &PluginOptionsNotificationsBus::Events::OnOptionChanged, s_meshAABBColorOptionName);
}
void RenderOptions::OnOBBsColorChangedCallback() const
{
PluginOptionsNotificationsBus::Event(s_OBBsColorOptionName, &PluginOptionsNotificationsBus::Events::OnOptionChanged, s_OBBsColorOptionName);
}
void RenderOptions::OnLineSkeletonColorChangedCallback() const
{
PluginOptionsNotificationsBus::Event(s_lineSkeletonColorOptionName, &PluginOptionsNotificationsBus::Events::OnOptionChanged, s_lineSkeletonColorOptionName);
@@ -59,7 +59,6 @@ namespace EMStudio
static const char* s_nodeAABBColorOptionName;
static const char* s_staticAABBColorOptionName;
static const char* s_meshAABBColorOptionName;
static const char* s_OBBsColorOptionName;
static const char* s_lineSkeletonColorOptionName;
static const char* s_skeletonColorOptionName;
static const char* s_selectionColorOptionName;
@@ -190,9 +189,6 @@ namespace EMStudio
AZ::Color GetMeshAABBColor() const { return m_meshAABBColor; }
void SetMeshAABBColor(const AZ::Color& meshAABBColor);
AZ::Color GetOBBsColor() const { return m_OBBsColor; }
void SetOBBsColor(const AZ::Color& OBBsColor);
AZ::Color GetLineSkeletonColor() const { return m_lineSkeletonColor; }
void SetLineSkeletonColor(const AZ::Color& lineSkeletonColor);
@@ -299,7 +295,6 @@ namespace EMStudio
void OnNodeAABBColorChangedCallback() const;
void OnStaticAABBColorChangedCallback() const;
void OnMeshAABBColorChangedCallback() const;
void OnOBBsColorChangedCallback() const;
void OnLineSkeletonColorChangedCallback() const;
void OnSkeletonColorChangedCallback() const;
void OnSelectionColorChangedCallback() const;
@@ -356,7 +351,6 @@ namespace EMStudio
AZ::Color m_nodeAABBColor;
AZ::Color m_staticAABBColor;
AZ::Color m_meshAABBColor;
AZ::Color m_OBBsColor;
AZ::Color m_lineSkeletonColor;
AZ::Color m_skeletonColor;
AZ::Color m_selectionColor;
@@ -1160,10 +1160,6 @@ namespace EMStudio
renderUtil->RenderAabbs(actorInstance, settings);
}
if (widget->GetRenderFlag(RenderViewWidget::RENDER_OBB))
{
renderUtil->RenderOBBs(actorInstance, &visibleJointIndices, &selectedJointIndices, renderOptions->GetOBBsColor(), renderOptions->GetSelectedObjectColor());
}
if (widget->GetRenderFlag(RenderViewWidget::RENDER_LINESKELETON))
{
const MCommon::Camera* camera = widget->GetRenderWidget()->GetCamera();
@@ -174,10 +174,6 @@ namespace EMStudio
renderUtil->RenderAabbs(actorInstance, settings);
}
if (widget->GetRenderFlag(RenderViewWidget::RENDER_OBB))
{
renderUtil->RenderOBBs(actorInstance, &visibleJointIndices, &selectedJointIndices, renderOptions->GetOBBsColor(), renderOptions->GetSelectedObjectColor());
}
if (widget->GetRenderFlag(RenderViewWidget::RENDER_LINESKELETON))
{
renderUtil->RenderSimpleSkeleton(actorInstance, &visibleJointIndices, &selectedJointIndices, renderOptions->GetLineSkeletonColor(), renderOptions->GetSelectedObjectColor());
@@ -108,7 +108,6 @@ namespace EMStudio
CreateViewOptionEntry(contextMenu, "Face Normals", RENDER_FACENORMALS);
CreateViewOptionEntry(contextMenu, "Tangents", RENDER_TANGENTS);
CreateViewOptionEntry(contextMenu, "Actor Bounding Boxes", RENDER_AABB);
CreateViewOptionEntry(contextMenu, "Joint OBBs", RENDER_OBB, false);
CreateViewOptionEntry(contextMenu, "Collision Meshes", RENDER_COLLISIONMESHES, false);
contextMenu->addSeparator();
CreateViewOptionEntry(contextMenu, "Line Skeleton", RENDER_LINESKELETON);
@@ -233,7 +232,6 @@ namespace EMStudio
SetRenderFlag(RENDER_TANGENTS, false);
SetRenderFlag(RENDER_AABB, false);
SetRenderFlag(RENDER_OBB, false);
SetRenderFlag(RENDER_COLLISIONMESHES, false);
SetRenderFlag(RENDER_RAGDOLL_COLLIDERS, true);
SetRenderFlag(RENDER_RAGDOLL_JOINTLIMITS, true);
@@ -410,7 +408,6 @@ namespace EMStudio
}
// Override some settings as we removed those from the menu.
SetRenderFlag(RENDER_OBB, false);
SetRenderFlag(RENDER_COLLISIONMESHES, false);
SetRenderFlag(RENDER_TEXTURING, false);
@@ -52,7 +52,6 @@ namespace EMStudio
RENDER_VERTEXNORMALS = 6,
RENDER_TANGENTS = 7,
RENDER_AABB = 8,
RENDER_OBB = 9,
RENDER_COLLISIONMESHES = 10,
RENDER_SKELETON = 11,
RENDER_LINESKELETON = 12,