• Create Account

We're offering banner ads on our site from just \$5!

### #Actualbelfegor

Posted 03 April 2013 - 03:35 PM

From what i can see the size(s) variables should be half extent of a bbox , so

void UMesh::AdaptBoundingBox(){
...
//BoundingBox.sizex = BoundingBox.maxx - BoundingBox.minx;
//BoundingBox.sizey = BoundingBox.maxy - BoundingBox.miny;
//BoundingBox.sizez = BoundingBox.maxz - BoundingBox.minz;
BoundingBox.sizex = (BoundingBox.maxx - BoundingBox.minx) * 0.5;
BoundingBox.sizey = (BoundingBox.maxy - BoundingBox.miny) * 0.5f;
BoundingBox.sizez = (BoundingBox.maxz - BoundingBox.minz) * 0.5f;
}

float bbCenter[3];
bbCenter[0] = (mesh->BoundingBox.maxx + mesh->BoundingBox.minx) * 0.5; // x
bbCenter[1] = (mesh->BoundingBox.maxy + mesh->BoundingBox.miny) * 0.5f;// y
bbCenter[2] = (mesh->BoundingBox.maxz + mesh->BoundingBox.minz) * 0.5f; // z

if (ViewFrustum.CheckRectangle(mesh->position.x + (bbCenter[0]), // the x center
mesh->position.y + (bbCenter[1]), // the y center
mesh->position.z + (bbCenter[2]), // the z center
mesh->BoundingBox.sizex, // the x size
mesh->BoundingBox.sizey, // the y size
mesh->BoundingBox.sizez) == false) // the z size
...


### #1belfegor

Posted 03 April 2013 - 03:34 PM

From what i can see the size(s) variables should be half extent of a bbox , so

...
//BoundingBox.sizex = BoundingBox.maxx - BoundingBox.minx;
//BoundingBox.sizey = BoundingBox.maxy - BoundingBox.miny;
//BoundingBox.sizez = BoundingBox.maxz - BoundingBox.minz;
BoundingBox.sizex = (BoundingBox.maxx - BoundingBox.minx) * 0.5;
BoundingBox.sizey = (BoundingBox.maxy - BoundingBox.miny) * 0.5f;
BoundingBox.sizez = (BoundingBox.maxz - BoundingBox.minz) * 0.5f;
}

float bbCenter[3];
bbCenter[0] = (mesh->BoundingBox.maxx + mesh->BoundingBox.minx) * 0.5; // x
bbCenter[1] = (mesh->BoundingBox.maxy + mesh->BoundingBox.miny) * 0.5f;// y
bbCenter[2] = (mesh->BoundingBox.maxz + mesh->BoundingBox.minz) * 0.5f; // z

if (ViewFrustum.CheckRectangle(mesh->position.x + (bbCenter[0]), // the x center
mesh->position.y + (bbCenter[1]), // the y center
mesh->position.z + (bbCenter[2]), // the z center
mesh->BoundingBox.sizex, // the x size
mesh->BoundingBox.sizey, // the y size
mesh->BoundingBox.sizez) == false) // the z size
...


PARTNERS