Triangles, lines and points:
IndexedTriangleSet,
TriangleSet,
(also analogous IndexedQuadSet, QuadSet
from CAD geometry component).
IndexedTriangleFanSet,
TriangleFanSet,
IndexedTriangleStripSet,
TriangleStripSet
LineSet,
IndexedLineSet
PointSet
TODO: missing is only the implementation of new X3D fields
attrib and fogCoord.
TODO: for TriangleFanSet and TriangleStripSet,
a special constraint is present: if you will use colors
(colors are always per-vertex on these primitives,
according to X3D spec) and request generation of per-face normals
at the same time, for the same lit (with material) node,
then shading results will be slightly incorrect.
Like this:
#X3D V3.0 utf8
PROFILE Interchange
Shape {
appearance Appearance { material Material { } }
geometry TriangleFanSet {
coord Coordinate { point [ 0 0 0, 1 0 0, 1 1 0, 0.5 1.5 0.5 ] }
fanCount 4
color Color { color [ 1 0 0, 0 1 0, 0 0 1, 1 1 1 ] }
normalPerVertex FALSE
}
}
Unfortunately, this is quite unfixable without falling back to
worse rendering methods. Shading has to be smooth to interpolate
per-vertex colors, and at the same time the same vertex may require
different normals on a different faces. So to render this correctly one has
to decompose triangle fans and strips into separate triangles
(like to IndexedTriangleSet) which means that rendering is
non-optimal.
Ideas how to implement this without sacrificing rendering time
are welcome. Eventually, a fallback to internally convert fans and strips
to IndexedTriangleSet in such special case will be
implemented some day.
Note: As far as I see, X3D specification doesn't specify what to do
for triangle/quad sets when appearance specify a texture but no
texCoord is given.
Our engine currently takes the IndexedFaceSet approach for
automatic generation of texture coords in this case, let me know
if this is wrong for whatever reason.
ClipPlane
OpenGL limits the number of clipping planes that may be enabled
at the same time on a single shape. This limit is at least six
(see view3dscene "Help -> OpenGL Information", look
at "Max clip planes" line, to know the limit of your GPU).
Following X3D spec, we treat the "more global" clipping planes
as more important.
Note that clipping planes are purely visual effect.
The clipped geometry is still present for collision detection,
picking, bounding volumes etc.
TODO: clip planes don't work on background nodes
(X3DBackgroundNode) yet.