bool CCharShape::CheckPolyhedronCollision (TCharNode *node, TMatrix modelMatrix, TMatrix invModelMatrix, TPolyhedron ph) { TMatrix newModelMatrix, newInvModelMatrix; TCharNode *child; TPolyhedron newph; bool hit = false; MultiplyMatrices (newModelMatrix, modelMatrix, node->trans); MultiplyMatrices (newInvModelMatrix, node->invtrans, invModelMatrix); if (node->visible) { newph = CopyPolyhedron (ph); TransPolyhedron (newInvModelMatrix, newph); hit = IntersectPolyhedron (newph); FreePolyhedron (newph); } if (hit == true) return hit; child = node->child; while (child != NULL) { hit = CheckPolyhedronCollision (child, newModelMatrix, newInvModelMatrix, ph); if (hit == true) return hit; child = child->next; } return false; }
CCourse::~CCourse() { for(size_t i = 0; i < PolyArr.size(); i++) { for(size_t j = 0; j < PolyArr[i].num_polygons; j++) delete PolyArr[i].polygons[j].vertices; delete PolyArr[i].polygons; FreePolyhedron(PolyArr[i]); } FreeCourseList (); ResetCourse (); }