It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.

Search articles, jobs, buyers guide, and more.

by Jeff Lander
Gamasutra
February 03, 2000

This article originally appeared in the
February 1999 issue of:

Printer Friendly Version


 

Change Login/Pwd
Post A Job
Post A Project
Post Resume
Post An Event
Post A Contractor
Post A Product
Write An Article
Get In Art Gallery
Submit News

 


 


[Submit Letter]

[View All...]
  



[Submit Event]
[View All...]

 


[Enter Forums...]

Note: Discussion forums for Gamasutra are hosted by the IGDA, which is free to join.
 

 

 


Features

Listing 2. Faster AABB Calculation Using Starting OBB.

///////////////////////////////////////////////////////////////////////////////
// Procedure: RecalcBBox
// Purpose: Recalculates the BBox associated with a bone based on the
// original bounding box. This is faster then the true BBox in
// most cases. However, this BBox is not as tight a fit.
///////////////////////////////////////////////////////////////////////////////

GLvoid COGLView::RecalcBBox(t_Bone *curBone, tVector *min,tVector *max)

{

/// Local Variables ///////////////////////////////////////////////////////////
tVector tempRes;
int loop;
///////////////////////////////////////////////////////////////////////////////

for (loop = 0; loop < 8; loop++) // LOOP THROUGH ALL 8 BBOX COORDS

{
MultVectorByMatrix(&curBone->matrix, &curBone->visuals->bbox[loop],&tempRes);
memcpy(&curBone->visuals->transBBox[loop],&tempRes,sizeof(tVector));
if (loop == 0)

{
memcpy(min,&tempRes,sizeof(tVector));
memcpy(max,&tempRes,sizeof(tVector));
}
else
{
 if (tempRes.x > max->x) max->x = tempRes.x;
if (tempRes.y > max->y) max->y = tempRes.y;
if (tempRes.z > max->z) max->z = tempRes.z;
if (tempRes.x < min->x) min->x = tempRes.x;
if (tempRes.y < min->y) min->y = tempRes.y;
if (tempRes.z < min->z) min->z = tempRes.z;
}

}

}

________________________________________________________


join | contact us | advertise | write | my profile
news | features | companies | jobs | resumes | education | product guide | projects | store



Copyright © 2003 CMP Media LLC

privacy policy
| terms of service