mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-18 09:25:31 +00:00
Feature additions and improvements for pick mode and the POI -> World editor
This commit is contained in:
@@ -68,10 +68,6 @@ void CPoiToWorld::RemovePoiMeshMap(u32 PoiID, u32 ModelID)
|
||||
if (*ListIt == ModelID)
|
||||
{
|
||||
pMap->ModelIDs.erase(ListIt);
|
||||
|
||||
if (pMap->ModelIDs.empty())
|
||||
RemovePoi(PoiID);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define SRAYINTERSECTION
|
||||
|
||||
#include <Common/types.h>
|
||||
#include <Math/CVector3f.h>
|
||||
|
||||
class CSceneNode;
|
||||
|
||||
@@ -9,12 +10,15 @@ struct SRayIntersection
|
||||
{
|
||||
bool Hit;
|
||||
float Distance;
|
||||
CVector3f HitPoint;
|
||||
CSceneNode *pNode;
|
||||
u32 ComponentIndex;
|
||||
|
||||
SRayIntersection() {}
|
||||
SRayIntersection(bool _Hit, float _Distance, CSceneNode *_pNode, u32 _ComponentIndex)
|
||||
: Hit(_Hit), Distance(_Distance), pNode(_pNode), ComponentIndex(_ComponentIndex) {}
|
||||
SRayIntersection()
|
||||
: Hit(false), Distance(0.f), HitPoint(CVector3f::skZero), pNode(nullptr), ComponentIndex(-1) {}
|
||||
|
||||
SRayIntersection(bool _Hit, float _Distance, CVector3f _HitPoint, CSceneNode *_pNode, u32 _ComponentIndex)
|
||||
: Hit(_Hit), Distance(_Distance), HitPoint(_HitPoint), pNode(_pNode), ComponentIndex(_ComponentIndex) {}
|
||||
};
|
||||
|
||||
#endif // SRAYINTERSECTION
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
inline void RayAABoxIntersectTest(CRayCollisionTester&, const SViewInfo&) {}
|
||||
|
||||
inline SRayIntersection RayNodeIntersectTest(const CRay &, u32, const SViewInfo&) {
|
||||
return SRayIntersection(false, 0.f, nullptr, 0);
|
||||
return SRayIntersection();
|
||||
}
|
||||
|
||||
inline void DrawSelection() {}
|
||||
|
||||
@@ -250,13 +250,15 @@ void CDamageableTriggerExtra::RayAABoxIntersectTest(CRayCollisionTester& Tester,
|
||||
std::pair<bool,float> Result = AABox().IntersectsRay(Ray);
|
||||
|
||||
if (Result.first)
|
||||
{
|
||||
Tester.AddNode(this, -1, Result.second);
|
||||
mCachedRayDistance = Result.second;
|
||||
}
|
||||
}
|
||||
|
||||
SRayIntersection CDamageableTriggerExtra::RayNodeIntersectTest(const CRay& Ray, u32 /*ComponentIndex*/, const SViewInfo& /*ViewInfo*/)
|
||||
{
|
||||
// The bounding box and all other tests already passed in RayAABoxIntersectTest, so we
|
||||
// already know that we have a positive. We just need the distance again.
|
||||
std::pair<bool,float> Result = AABox().IntersectsRay(Ray);
|
||||
return SRayIntersection(true, Result.second, mpParent, -1);
|
||||
// already know that we have a positive.
|
||||
return SRayIntersection(true, mCachedRayDistance, Ray.PointOnRay(mCachedRayDistance), mpParent, -1);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,8 @@ class CDamageableTriggerExtra : public CScriptExtra
|
||||
CMaterial *mpMat;
|
||||
CVector2f mCoordScale;
|
||||
|
||||
float mCachedRayDistance;
|
||||
|
||||
public:
|
||||
explicit CDamageableTriggerExtra(CScriptObject *pInstance, CScene *pScene, CSceneNode *pParent = 0);
|
||||
~CDamageableTriggerExtra();
|
||||
|
||||
Reference in New Issue
Block a user