# HG changeset patch
# User alfonse
# Date 1330574738 28800
# Node ID b6e5dc03ea4cdfe37327aef16e687f55a45ba2cb
# Parent 79e66e109dfb8020c3923eb37f12f1b4f1a41dca
Tut09: Diagrams for topology.
diff git a/Documents/Illumination/CubeNormalTopology.svg b/Documents/Illumination/CubeNormalTopology.svg
new file mode 100644
 /dev/null
+++ b/Documents/Illumination/CubeNormalTopology.svg
@@ 0,0 +1,456 @@
+
+
+
+
diff git a/Documents/Illumination/CubePositionTopology.svg b/Documents/Illumination/CubePositionTopology.svg
new file mode 100644
 /dev/null
+++ b/Documents/Illumination/CubePositionTopology.svg
@@ 0,0 +1,315 @@
+
+
+
+
diff git a/Documents/Illumination/CubeTotalTopology.svg b/Documents/Illumination/CubeTotalTopology.svg
new file mode 100644
 /dev/null
+++ b/Documents/Illumination/CubeTotalTopology.svg
@@ 0,0 +1,929 @@
+
+
+
+
diff git a/Documents/Illumination/Tutorial 09.xml b/Documents/Illumination/Tutorial 09.xml
 a/Documents/Illumination/Tutorial 09.xml
+++ b/Documents/Illumination/Tutorial 09.xml
@@ 888,20 +888,34 @@
separate topology. How is this possible?
Consider a simple cube. It has 8 vertex positions. The topology between the positions
of the cube is as follows:

+
The topology diagram has the 8 different positions, with each position connected to
three neighbors. The connections represent the edges of the cube faces, and the area
bounded by connections represent the faces themselves. So each face has four edges and
four positions.Now consider the topology of the normals of a cube. A cube has 6 faces, each of which
has a distinct normal. The topology is a bit unorthodox:

 Here, the points represent distinct normals, not positions in space. The connections
+
+ The square points represent distinct normals, not positions in space. The connections
between normals all loop back on themselves. That's because each vertex of each face
uses the same normal. While the front face and the top face share two vertex positions
in common, they share no vertex normals at all. Therefore, there is no topological
 relation between the front normal and the top normal. Each normal is connected to
 itself, but to nothing else.
+ relation between the front normal and the top normal. Each normal value is connected to
+ itself four times, but it is connected to nothing else.We have 8 positions and 6 normals. They each have a unique topology over the mesh. How
do we turn this into something we can render?If we knew nothing about OpenGL, this would be simple. We simply use the topologies to
@@ 916,18 +930,19 @@
}
The first index in each element of the list pulls from the position array, and the
second index pulls from the normal array. This list explicitly specifies the
 relationship between faces and topology: the first face contains 4 positions, but uses
 the same normal for all vertices. The second face shares two positions with the first,
 but no normals.
+ relationship between faces and topology: the first face (composed of two triangles)
+ contains 4 positions, but uses the same normal for all vertices. The second face shares
+ two positions with the first, but no normals.This is complicated in OpenGL because of one simple reason: we only get
one index list. When we render with an index array, every
attribute array uses the same index. Therefore, what we need to do is convert the above
index list into a list of unique combinations of vertex attributes. So each pair of
indices must refer to a unique index.Consider the first face. It consists of 4 unique vertices; the index pairs {1, 0} and
 {2, 0} are repeated. Since these pairs are repeats, we can collapse them; they will
 refer to the same index. However, the fact that each vertex uses the same normal must be
 ignored entirely. Therefore, the final index list we use for the first face is:
+ {2, 0} are repeated, since we must draw triangles. Since these pairs are repeats, we can
+ collapse them; they will refer to the same index. However, the fact that each vertex
+ uses the same normal must be ignored entirely. Therefore, the final index list we use
+ for the first face is:
{ 0, 1, 2, 1, 3, 2 }The attribute arrays for this one face contain 4 positions and 4 normals. But while
the positions are all different, the normals must all be the same value. Even though
@@ 941,15 +956,21 @@
normals for the second face are all duplicates of each other. And there are two
positions that are duplicated. Topologically speaking, our cube vertex topology looks
like the following:

 Each face is entirely distinct topologically from the rest. The two triangles in each
 face share an edge, but that is all.
+
+ Each face is entirely distinct topologically from the rest.In the end, this gives us 24 positions and 24 normals in our arrays. There will only
 be 6 distinct normals and 8 distinct positions in the array, but there will be 24 of
 each. So this represents a significant increase in our data size.
 Do not be too concerned about the increase in data however. A cube, or other faceted
 object, represents the worstcase scenario for this kind of conversion. Most actual
 meshes of smooth objects have much more interconnected topologies.
+ be 6 distinct normal values and 8 distinct position values in the array, but there will
+ be 24 of each. So this represents a significant increase in our data size.
+ Do not be too concerned about the increase in data however. A cube, or any other
+ faceted object, represents the worstcase scenario for this kind of conversion. Most
+ actual meshes of smooth objects have much more interconnected topologies.Mesh topology is something to be aware of, as is the ability to convert attribute
topologies into forms that OpenGL can directly process. Each attribute has its own
topology which affects how the index list is built. Different attributes can share the