1

From what I've read in specs each scene element form XML3D has bounding box associated with it. I would like to ask how is the size of bounding boxes calculated? Especially for the <group> and <xml3d> elements - does it take into consideration the sizes of children's bounding boxes? I assume that bounding box size for <mesh> is calculated from mesh vertices positions.

I need this knowledge to tweak camera translation speed.

Xyz
  • 1,522
  • 17
  • 23
  • Ok I've checked it seems that xml3d bounding box is just set to be whole space. Which doesn;t make sense imho. – Xyz May 28 '15 at 17:40

1 Answers1

1

As you guessed on <mesh> elements it's calculated from the vertex positions. For <group> elements it's basically calculated as follows:

var bbox = new XML3DBox();
for (var child in children) {
    bbox.extend(child.getWorldBoundingBox());
}

So it recurses until it hits <mesh> elements and the resulting bounding box for each group in the hierarchy is the smallest volume that encloses the bounding boxes of all the child elements, whether they be <groups> or <meshes>. A <group> with no renderable objects (<mesh> or <model>) anywhere in its subtree will return an empty box.

On the <xml3d> element it will return a box that encloses the entire scene.

One thing to remember is that objects marked as invisible (with the visible="false" attribute) won't be included in the bounding box calculations.

csvurt
  • 236
  • 1
  • 2