#include "IntelRayCaster.h" #include "VssRay.h" #include "Preprocessor.h" #include "SceneGraph.h" #ifdef GTP_INTERNAL #include "ArchModeler2MLRT.hxx" #define DEBUG_RAYCAST 0 namespace GtpVisibilityPreprocessor { IntelRayCaster::IntelRayCaster(const Preprocessor &preprocessor, const string externKdTree): RayCaster(preprocessor) { InitRayCast(externKdTree); } IntelRayCaster::~IntelRayCaster() { } bool IntelRayCaster::InitRayCast(const string externKdTree) { cout<<"Ray Cast file: " << externKdTree << endl; return mlrtaLoadAS(externKdTree.c_str()); } int IntelRayCaster::CastRay( const SimpleRay &simpleRay, VssRayContainer &vssRays, const AxisAlignedBox3 &box, const bool castDoubleRay, const bool pruneInvalidRays, const bool keepOrigin ) { //cout << "intel ray" << endl; VssRay *vssRay = NULL; int hits = 0; int hittriangle; Intersection hitA(simpleRay.mOrigin), hitB(simpleRay.mOrigin); float dist; double normal[3]; hittriangle = mlrtaIntersectAS( &simpleRay.mOrigin.x, &simpleRay.mDirection.x, normal, dist); if (hittriangle != -1 ) { Intersectable *intersect = mPreprocessor.GetParentObject(hittriangle); if (intersect) { hitA.mObject = intersect; hitA.mNormal = Vector3(normal[0], normal[1], normal[2]); // Get the normal of that face // Mesh *mesh = ((MeshInstance *)objectA)->GetMesh(); // normalA = mesh->GetFacePlane(mFaceParents[forward_hit_triangles[i]].mFaceIndex).mNormal; //-rays[index+i].mDirection; // $$ temporary hitA.mPoint = simpleRay.Extrap(dist); } } if (castDoubleRay) { cerr<<"HERE"<GetMesh(); // normalA = mesh->GetFacePlane(mFaceParents[forward_hit_triangles[i]].mFaceIndex).mNormal; //-rays[index+i].mDirection; // $$ temporary hitB.mPoint = simpleRay.Extrap(dist); } } return ProcessRay( simpleRay, hitA, hitB, vssRays, box, castDoubleRay, pruneInvalidRays, keepOrigin ); } void IntelRayCaster::CastRays16( SimpleRayContainer &rays, VssRayContainer &vssRays, const AxisAlignedBox3 &sbox, const bool castDoubleRay, const bool pruneInvalidRays, const bool keepOrigin) { int i; const int num = 16; #if DEBUG_RAYCAST Debug<<"C16 "<GetBox().Min(); Vector3 max = mPreprocessor.mSceneGraph->GetBox().Max(); for (i=0; i < num; i++) { #if DEBUG_RAYCAST if (counter == 43964) { Debug<