From: Christian Rothländer (Mailinglisten++at++rothlaender.net)
Date: 01/18/2006 03:47:35
Hi there
I am currently writing code for a project, which needs many Intersection tests. While benchmarking the Algorithm it
became obvious that the Intersection tests run on the processor and not in graphic hardware. Is there a possibility to
move the code to the graphic system to get a faster testing? .. Currently I have about 90x complexity in comparison to
the testing time, which is simply impossible, because in a normal task the system would work for about 2 days :-( .
I would need about 600.000 Tests per second.
The intersection_testing function is attached, perhaps somebody out there has a solution for the Problem, otherwise I
need to reduce the testing rate and testing resolution to get a better runtime (1 night would be ok).
Christian
intersection_data nameit::isecTest(pfSeg line){
intersection_data daten;
pfSegSet segset;
pfHit **hits[32];
int isect;
segset.activeMask = 1;
segset.isectMask = 0x01;
segset.discFunc = NULL;
segset.mode = PFTRAV_IS_PRIM;
segset.segs[0].pos.set(line.pos[0], line.pos[1], line.pos[2]);
segset.segs[0].dir.set(line.dir[0], line.dir[1], line.dir[2]);
segset.segs[0].length = line.length;
isect = Shared->scene->isect(&segset, hits);
#ifdef DEBUG
std::cout << "Name wird ermittelt fr Objekt Nummer :" << index << std::endl;
#endif
//Hier wird die Namensbersetzung ausgefhrt:
//Immer im Elternknoten wird nach dem Namen nachgeschlagen
pfGeode *node;
(*hits[0]) -> query(PFQHIT_NODE, &node);
if (node->getNumParents() == 0 || node->getName() != NULL) //Wir haben keine Elternknoten -> meistens Himmel
{
//std::cout << "a" << std::endl;
if (node->getName() != NULL){
//std::cout << node->getName() << std::endl;
daten.name = (node->getName());
}
else{ daten.name = "Unbenannt";
}
}
else { //Wir suchen in 3 Ebenen nach einem Namen, wenn dieser nicht gefunden wird -> PECH
if (node->getParent(0)->getName() != NULL){
//std::cout << "b" << std::endl;
//std::cout << node->getParent(0)->getName() << std::endl;
daten.name =(node->getParent(0)->getName());
}
else if (node->getParent(0)->getNumParents() != 0 && node->getParent(0)->getParent(0)->getName() != NULL){
//std::cout << "c" << std::endl;
//std::cout << node->getParent(0)->getParent(0)->getName() << std::endl;
daten.name =(node->getParent(0)->getParent(0)->getName());
}
else if (node->getParent(0)->getParent(0)->getNumParents() != 0 &&
node->getParent(0)->getParent(0)->getParent(0)->getName() != NULL){
//std::cout << "d" << std::endl;
//std::cout << node->getParent(0)->getParent(0)->getParent(0)->getName() << std::endl;
daten.name =(node->getParent(0)->getParent(0)->getParent(0)->getName());
}
else { daten.name =("Unbenannt");
//std::cout << "Kein Name gefunden" << std::endl;
}
}
#ifdef DEBUG
std::cout << " fertig" << std::endl;
#endif
//pnt == Punkt der Intersection.. wie komm ich dran mit was die sich schneidet
pfVec3 pnt;
pfMatrix matt;
(*hits[0])->query(PFQHIT_POINT, pnt.vec);
(*hits[0])->query(PFQHIT_XFORM, matt.mat);
pnt.xformPt(pnt, matt);
///Punkte der getroffenen Objekte speichern
daten.x = pnt[0];
daten.y = pnt[1];
daten.z = pnt[2];
daten.fix = 0;
return daten;
}
This archive was generated by hypermail 2b29 : Wed Jan 18 2006 - 03:47:48 PST