Ported the render plugin, render update callback and render widget

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
This commit is contained in:
Benjamin Jillich
2021-08-02 13:17:34 +02:00
parent a1051b15ee
commit e651f25577
7 changed files with 18 additions and 26 deletions
@@ -8,7 +8,7 @@
#pragma once
// include the Core system
#include <MCore/Source/AABB.h>
#include <MCore/Source/Vector.h>
#include <MCore/Source/BoundingSphere.h>
#include <MCore/Source/Ray.h>
@@ -9,7 +9,7 @@
#ifndef __MCOMMON_TRANSLATEMANIPULATOR_H
#define __MCOMMON_TRANSLATEMANIPULATOR_H
// include the Core system
#include <MCore/Source/AABB.h>
#include <MCore/Source/Vector.h>
#include <MCore/Source/Ray.h>
#include "MCommonConfig.h"
@@ -105,7 +105,6 @@ namespace EMotionFX
}
// If both x and y inputs have connections
//MCore::Quaternion x = MCore::AzQuatToEmfxQuat(m_defaultValue);
AZ::Quaternion x = m_defaultValue;
AZ::Quaternion y = x;
if (mConnections.size() == 2)
@@ -915,7 +915,7 @@ namespace EMStudio
}
// get the mesh based AABB
AZ::Aabb aabb;
AZ::Aabb aabb = AZ::Aabb::CreateNull();
actorInstance->CalcMeshBasedAabb(0, &aabb);
// get the node based AABB
@@ -170,9 +170,8 @@ namespace EMStudio
settings.mNodeBasedColor = renderOptions->GetNodeAABBColor();
settings.mStaticBasedColor = renderOptions->GetStaticAABBColor();
settings.mMeshBasedColor = renderOptions->GetMeshAABBColor();
settings.mCollisionMeshBasedColor = renderOptions->GetCollisionMeshAABBColor();
renderUtil->RenderAABBs(actorInstance, settings);
renderUtil->RenderAabbs(actorInstance, settings);
}
if (widget->GetRenderFlag(RenderViewWidget::RENDER_OBB))
@@ -260,8 +259,8 @@ namespace EMStudio
// render the selection
if (renderOptions->GetRenderSelectionBox() && EMotionFX::GetActorManager().GetNumActorInstances() != 1 && mPlugin->GetCurrentSelection()->CheckIfHasActorInstance(actorInstance))
{
MCore::AABB aabb = actorInstance->GetAABB();
aabb.Widen(aabb.CalcRadius() * 0.005f);
AZ::Aabb aabb = actorInstance->GetAabb();
aabb.Expand(aabb.GetExtents() * 0.005f);
renderUtil->RenderSelection(aabb, renderOptions->GetSelectionColor());
}
@@ -72,9 +72,8 @@ namespace EMStudio
}
// start view closeup flight
void RenderWidget::ViewCloseup(const MCore::AABB& aabb, float flightTime, uint32 viewCloseupWaiting)
void RenderWidget::ViewCloseup(const AZ::Aabb& aabb, float flightTime, uint32 viewCloseupWaiting)
{
//LogError("ViewCloseup: AABB: Pos=(%.3f, %.3f, %.3f), Width=%.3f, Height=%.3f, Depth=%.3f", aabb.CalcMiddle().x, aabb.CalcMiddle().y, aabb.CalcMiddle().z, aabb.CalcWidth(), aabb.CalcHeight(), aabb.CalcDepth());
mViewCloseupWaiting = viewCloseupWaiting;
mViewCloseupAABB = aabb;
mViewCloseupFlightTime = flightTime;
@@ -82,9 +81,8 @@ namespace EMStudio
void RenderWidget::ViewCloseup(bool selectedInstancesOnly, float flightTime, uint32 viewCloseupWaiting)
{
//LogError("ViewCloseup: AABB: Pos=(%.3f, %.3f, %.3f), Width=%.3f, Height=%.3f, Depth=%.3f", aabb.CalcMiddle().x, aabb.CalcMiddle().y, aabb.CalcMiddle().z, aabb.CalcWidth(), aabb.CalcHeight(), aabb.CalcDepth());
mViewCloseupWaiting = viewCloseupWaiting;
mViewCloseupAABB = mPlugin->GetSceneAABB(selectedInstancesOnly);
mViewCloseupAABB = mPlugin->GetSceneAabb(selectedInstancesOnly);
mViewCloseupFlightTime = flightTime;
}
@@ -603,14 +601,15 @@ namespace EMStudio
if (actor->CheckIfHasMeshes(actorInstance->GetLODLevel()) == false)
{
// calculate the node based AABB
MCore::AABB box;
actorInstance->CalcNodeBasedAABB(&box);
AZ::Aabb box;
actorInstance->CalcNodeBasedAabb(&box);
// render the aabb
if (box.CheckIfIsValid())
if (box.IsValid())
{
const MCore::AABB mcoreAabb(box.GetMin(), box.GetMax());
AZ::Vector3 ii, n;
if (ray.Intersects(box, &ii, &n))
if (ray.Intersects(mcoreAabb, &ii, &n))
{
selectedActorInstance = actorInstance;
oldIntersectionPoint = ii;
@@ -1169,8 +1168,7 @@ namespace EMStudio
mViewCloseupWaiting--;
if (mViewCloseupWaiting == 0)
{
mCamera->ViewCloseup(mViewCloseupAABB, mViewCloseupFlightTime);
//mViewCloseupWaiting = 0;
mCamera->ViewCloseup(MCore::AABB(mViewCloseupAABB.GetMin(), mViewCloseupAABB.GetMax()), mViewCloseupFlightTime);
}
}
@@ -6,11 +6,10 @@
*
*/
#ifndef __EMSTUDIO_RENDERWIDGET_H
#define __EMSTUDIO_RENDERWIDGET_H
#pragma once
//
#if !defined(Q_MOC_RUN)
#include <AzCore/Math/Aabb.h>
#include <MCore/Source/StandardHeaders.h>
#include "../EMStudioConfig.h"
#include <EMotionFX/Rendering/Common/Camera.h>
@@ -117,7 +116,7 @@ namespace EMStudio
MCORE_INLINE MCommon::Camera* GetCamera() const { return mCamera; }
MCORE_INLINE CameraMode GetCameraMode() const { return mCameraMode; }
MCORE_INLINE void SetSkipFollowCalcs(bool skipFollowCalcs) { mSkipFollowCalcs = skipFollowCalcs; }
void ViewCloseup(const MCore::AABB& aabb, float flightTime, uint32 viewCloseupWaiting = 5);
void ViewCloseup(const AZ::Aabb& aabb, float flightTime, uint32 viewCloseupWaiting = 5);
void ViewCloseup(bool selectedInstancesOnly, float flightTime, uint32 viewCloseupWaiting = 5);
void SwitchCamera(CameraMode mode);
@@ -161,7 +160,7 @@ namespace EMStudio
// used for closeup camera flights
uint32 mViewCloseupWaiting;
MCore::AABB mViewCloseupAABB;
AZ::Aabb mViewCloseupAABB;
float mViewCloseupFlightTime;
// manipulator helper data
@@ -175,6 +174,3 @@ namespace EMStudio
int32 mPixelsMovedSinceRightClick;
};
} // namespace EMStudio
#endif