const box2geom = boxGeometryWithMaterialGroups(2, 4, 6);
We'll go over all that code, for sure. But the 2,4,6 are just the dimensions (width, height, depth) of the box, respectively.
No worries. A mesh is just a combination of a geometry (e.g. sphere versus box) and a material (e.g. steel versus wood).
Both are necessary for rendering (drawing) the object, but it makes sense to modularize the software to represent them with different objects. So:
Or even:
The new way uses "flattened" typed arrays rather than more intuitive data structures.
The flattened, typed arrays can be processed directly by the WebGL code running on the graphics card, so it's faster.
Do you mean "normal" like "not abnormal" or do you mean "normal" like "perpendicular"?
Normal (perpendicular) vectors aren't used to locate something; only to orient it. I'll demonstrate with the barn.
But we will learn about surface normals soon. This is just a preview.
Sometimes we need to know how a face is oriented: its surface normal. That function computes surface normals for all the flat faces. Alas, it was for the old geometry and has been removed.
Yes.
Of course you are! We'll go through it very carefully.
For sure. A "group" is a bunch of faces (triangles) that have a
common materialIndex
.
For example, the three triangles of the front/back of the barn might have material indexes of 0/2, and correspond to the those indexes in an array of materials.