| 1540 | } |
| 1541 | |
| 1542 | void 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 |
| 1563 | void Model::calcBoundingSphere() { |
no test coverage detected