how to get bounding box

Hey guys, hoping someone can help here…



I’m trying to get the center of a mesh bounding box. I see these functions:



PVRTBoundingBoxCompute()

PVRTBoundingBoxComputeInterleaved()



But I can’t figure out how to call them. That is, I’m using Xcode, objective-c for ios app. Here’s how I call this function in my code:





CPVRTResourceFile::SetReadPath([readPath UTF8String]);



Just wondering if I don’t have access to the PVRTBoundingBoxCompute calls?



Thanks



Valerie


Hello



about boundingBox :

PVRTVec3 vBoundingBoxMin, vBoundingBoxMax;



// calculate bounding box for mesh 0

float* pfData = (float*)Mesh.pInterleaved;

vBoundingBoxMin.x = vBoundingBoxMax.x = pfData[0];

vBoundingBoxMin.y = vBoundingBoxMax.y = pfData[1];

vBoundingBoxMin.z = vBoundingBoxMax.z = pfData[2];



for(unsigned int i = 1; i < Mesh.nNumVertex; ++i)

{

pfData = (float*)(((char*)pfData) + Mesh.sVertex.nStride);



vBoundingBoxMin.x = PVRT_MIN(vBoundingBoxMin.x, pfData[0]);

vBoundingBoxMin.y = PVRT_MIN(vBoundingBoxMin.y, pfData[1]);

vBoundingBoxMin.z = PVRT_MIN(vBoundingBoxMin.z, pfData[2]);

vBoundingBoxMax.x = PVRT_MAX(vBoundingBoxMax.x, pfData[0]);

vBoundingBoxMax.y = PVRT_MAX(vBoundingBoxMax.y, pfData[1]);

vBoundingBoxMax.z = PVRT_MAX(vBoundingBoxMax.z, pfData[2]);

}



for (int i = 0; i < 8; ++i)

{

m_avBoundingBox.x = (i & 1) ? vBoundingBoxMin.x : vBoundingBoxMax.x;

m_avBoundingBox.y = (i & 2) ? vBoundingBoxMin.y : vBoundingBoxMax.y;

m_avBoundingBox.z = (i & 4) ? vBoundingBoxMin.z : vBoundingBoxMax.z;

m_avBoundingBox.w = 1.0f;

}




regards

david