Advertisement
keybode

source engine bsp TracePointInLeaf

Dec 23rd, 2014
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. dleaf_t* CMapParser::TracePointInLeaf ( const Vector3& vPoint )
  2. {
  3.     int node = 0;
  4.  
  5.     while ( node >= 0 )
  6.     {
  7.         dnode_t* pNode = &m_nodeList[node];
  8.         dplane_t* pPlane = &m_planeList[pNode->planenum];
  9.  
  10.         if ( pPlane->normal.Dot ( vPoint ) <= pPlane->dist )
  11.         {
  12.             node = pNode->children[1];
  13.         }
  14.         else
  15.         {
  16.             node = pNode->children[0];
  17.         }
  18.     }
  19.  
  20.     return &m_leafList[-node - 1];
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement