Sign in to follow this  
newtechnology

Inaccurate bounding box

Recommended Posts

newtechnology    1955

1466313_795805073779182_1936955470_n.jpg


Don't know why it happens, is it because i scale the model?

void Direct3D::buildAABBFarm()
{
D3DXCreateBox(pDevice, Farm.box.GetWidth(), Farm.box.GetHeight(), Farm.box.GetDepth(), &AABBFarm, 0);
 
 
}
 
void Direct3D::buildFarm()
{
LoadXFile("Main\\Models\\Farm.x", &Farm.mesh, Farm.mtrls, Farm.textures);
 
VertexPNT* v = 0;
 
Farm.mesh->LockVertexBuffer(0, (void**)&v);
 
D3DXComputeBoundingBox(&v->pos, Farm.mesh->GetNumVertices(), Farm.mesh->GetNumBytesPerVertex(), &Farm.box.minPt, &Farm.box.maxPt);
 
Farm.mesh->UnlockVertexBuffer();
 
D3DXMATRIX World;
D3DXMATRIX Scale;
 
D3DXMatrixTranslation(&World, -82.85f + 29.0f, 40.50f + 50.0f, 39.44f);
D3DXMatrixScaling(&Scale, 0.01f, 0.01f, 0.01f);
 
FarmWorld = Scale * World;
 
 
}
Edited by newtechnology

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this