void HeightMapShapeSW::_setup(PoolVector<real_t> p_heights, int p_width, int p_depth, real_t p_cell_size) { heights = p_heights; width = p_width; depth = p_depth; cell_size = p_cell_size; PoolVector<real_t>::Read r = heights.read(); Rect3 aabb; for (int i = 0; i < depth; i++) { for (int j = 0; j < width; j++) { real_t h = r[i * width + j]; Vector3 pos(j * cell_size, h, i * cell_size); if (i == 0 || j == 0) aabb.pos = pos; else aabb.expand_to(pos); } } configure(aabb); }
Rect3 Rect3::expand(const Vector3 &p_vector) const { Rect3 aabb = *this; aabb.expand_to(p_vector); return aabb; }