MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / calcBoundingBox

Method calcBoundingBox

Source/Graphics/model.cpp:1542–1560  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1540}
1541
1542void Model::calcBoundingBox() {
1543 min_coords = 0;
1544 max_coords = 0;
1545 center_coords = 0;
1546
1547 for (int i = 0, len = vertices.size() / 3, vert_index = 0; i < len; i++, vert_index += 3) {
1548 for (int j = 0; j < 3; ++j) {
1549 float coord = vertices[vert_index + j];
1550 if (i == 0 || coord > max_coords[j]) {
1551 max_coords[j] = coord;
1552 }
1553 if (i == 0 || coord < min_coords[j]) {
1554 min_coords[j] = coord;
1555 }
1556 }
1557 }
1558
1559 center_coords = (min_coords + max_coords) / 2;
1560}
1561
1562// Calculate bounding sphere
1563void Model::calcBoundingSphere() {

Callers 4

CalculatePatchesMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected