mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 00:17:14 +00:00
Added rotation arrow for when billboards are selected
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "Core/Render/CGraphics.h"
|
||||
#include "Core/Render/CDrawUtil.h"
|
||||
#include "Core/Resource/CGameArea.h"
|
||||
#include "Core/Resource/CResCache.h"
|
||||
#include <Common/AnimUtil.h>
|
||||
#include <Math/CTransform4f.h>
|
||||
|
||||
@@ -215,6 +216,12 @@ void CSceneNode::DrawBoundingBox() const
|
||||
CDrawUtil::DrawWireCube(AABox(), CColor::skWhite);
|
||||
}
|
||||
|
||||
void CSceneNode::DrawRotationArrow() const
|
||||
{
|
||||
static TResPtr<CModel> spArrowModel = gResCache.GetResource("../resources/RotationArrow.cmdl");
|
||||
spArrowModel->Draw(eNoRenderOptions, 0);
|
||||
}
|
||||
|
||||
void CSceneNode::AddSurfacesToRenderer(CRenderer *pRenderer, CModel *pModel, u32 MatSet, const SViewInfo& rkViewInfo)
|
||||
{
|
||||
u32 SurfaceCount = pModel->GetSurfaceCount();
|
||||
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
void BuildLightList(CGameArea *pArea);
|
||||
void LoadLights(const SViewInfo& ViewInfo);
|
||||
void DrawBoundingBox() const;
|
||||
void DrawRotationArrow() const;
|
||||
void AddSurfacesToRenderer(CRenderer *pRenderer, CModel *pModel, u32 MatSet, const SViewInfo& ViewInfo);
|
||||
|
||||
// Transform
|
||||
|
||||
@@ -197,15 +197,28 @@ void CScriptNode::Draw(FRenderOptions Options, int ComponentIndex, const SViewIn
|
||||
void CScriptNode::DrawSelection()
|
||||
{
|
||||
glBlendFunc(GL_ONE, GL_ZERO);
|
||||
LoadModelMatrix();
|
||||
|
||||
// Draw wireframe for models; billboards only get tinted
|
||||
// Draw wireframe for models
|
||||
if (UsesModel())
|
||||
{
|
||||
LoadModelMatrix();
|
||||
CModel *pModel = (mpActiveModel ? mpActiveModel : CDrawUtil::GetCubeModel());
|
||||
pModel->DrawWireframe(eNoRenderOptions, WireframeColor());
|
||||
}
|
||||
|
||||
// Draw rotation arrow for billboards
|
||||
else
|
||||
{
|
||||
// Create model matrix that doesn't take scaling into account, and draw
|
||||
CTransform4f Transform;
|
||||
Transform.Rotate(AbsoluteRotation());
|
||||
Transform.Translate(AbsolutePosition());
|
||||
CGraphics::sMVPBlock.ModelMatrix = Transform.ToMatrix4f();
|
||||
CGraphics::UpdateMVPBlock();
|
||||
|
||||
DrawRotationArrow();
|
||||
}
|
||||
|
||||
if (mpInstance)
|
||||
{
|
||||
CGraphics::sMVPBlock.ModelMatrix = CMatrix4f::skIdentity;
|
||||
@@ -503,7 +516,7 @@ void CScriptNode::CalculateTransform(CTransform4f& rOut) const
|
||||
rOut.Scale(Scale * pTemp->PreviewScale());
|
||||
}
|
||||
|
||||
if (UsesModel() && pTemp->RotationType() == CScriptTemplate::eRotationEnabled)
|
||||
if (pTemp->RotationType() == CScriptTemplate::eRotationEnabled)
|
||||
rOut.Rotate(AbsoluteRotation());
|
||||
|
||||
rOut.Translate(AbsolutePosition());
|
||||
|
||||
Reference in New Issue
Block a user