mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-10 14:07:56 +00:00
Draw wire sphere on selected lights to visualize light radius
This commit is contained in:
@@ -27,20 +27,28 @@ ENodeType CLightNode::NodeType()
|
||||
|
||||
void CLightNode::AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo)
|
||||
{
|
||||
if (!ViewInfo.ViewFrustum.BoxInFrustum(AABox())) return;
|
||||
if (ViewInfo.GameMode) return;
|
||||
|
||||
pRenderer->AddOpaqueMesh(this, -1, AABox(), eDrawMesh);
|
||||
if (ViewInfo.ViewFrustum.BoxInFrustum(AABox()))
|
||||
pRenderer->AddOpaqueMesh(this, -1, AABox(), eDrawMesh);
|
||||
|
||||
if (IsSelected() && mpLight->GetType() == eCustom)
|
||||
{
|
||||
CAABox RadiusBox = (CAABox::skOne * 2.f * mpLight->GetRadius()) + mPosition;
|
||||
|
||||
if (ViewInfo.ViewFrustum.BoxInFrustum(RadiusBox))
|
||||
pRenderer->AddOpaqueMesh(this, -1, AABox(), eDrawSelection);
|
||||
}
|
||||
}
|
||||
|
||||
void CLightNode::Draw(ERenderOptions /*Options*/, int /*ComponentIndex*/, const SViewInfo& ViewInfo)
|
||||
{
|
||||
CDrawUtil::DrawLightBillboard(mpLight->GetType(), mpLight->GetColor(), mPosition, BillboardScale(), TintColor(ViewInfo));
|
||||
}
|
||||
|
||||
// Below commented-out code is for light radius visualization as a bounding box
|
||||
/*float r = mLight->GetRadius();
|
||||
CAABox AABB(Position + r, Position - r);
|
||||
pRenderer->DrawBoundingBox(mLight->GetColor(), AABB);*/
|
||||
void CLightNode::DrawSelection()
|
||||
{
|
||||
CDrawUtil::DrawWireSphere(mPosition, mpLight->GetRadius(), mpLight->GetColor());
|
||||
}
|
||||
|
||||
void CLightNode::RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& /*ViewInfo*/)
|
||||
|
||||
@@ -12,6 +12,7 @@ public:
|
||||
ENodeType NodeType();
|
||||
void AddToRenderer(CRenderer *pRenderer, const SViewInfo& ViewInfo);
|
||||
void Draw(ERenderOptions Options, int ComponentIndex, const SViewInfo& ViewInfo);
|
||||
void DrawSelection();
|
||||
void RayAABoxIntersectTest(CRayCollisionTester& Tester, const SViewInfo& ViewInfo);
|
||||
SRayIntersection RayNodeIntersectTest(const CRay &Ray, u32 AssetID, const SViewInfo& ViewInfo);
|
||||
CLight* Light();
|
||||
|
||||
@@ -205,6 +205,7 @@ void CDamageableTriggerExtra::Draw(ERenderOptions Options, int /*ComponentIndex*
|
||||
CGraphics::sPixelBlock.TintColor = mpParent->TintColor(ViewInfo).ToVector4f();
|
||||
mpMat->SetCurrent(Options);
|
||||
|
||||
// Note: The plane the game renders this onto is 5x4.5, which is why we divide the tex coords by this value
|
||||
CVector2f TexUL(0.f, mCoordScale.y / 4.5f);
|
||||
CVector2f TexUR(mCoordScale.x / 5.f, mCoordScale.y / 4.5f);
|
||||
CVector2f TexBR(mCoordScale.x / 5.f, 0.f);
|
||||
|
||||
Reference in New Issue
Block a user