Feature additions and improvements for pick mode and the POI -> World editor

This commit is contained in:
parax0
2016-01-16 12:57:20 -07:00
parent 5c3a37ca4a
commit 440c3ad484
19 changed files with 331 additions and 100 deletions

View File

@@ -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);
}

View File

@@ -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();