Game Development Reference
In-Depth Information
const float dx = sinf(longitude) * dxz;
const float dz = cosf(longitude) * dxz;
math::vector3 p = math::vector3(dx, dy, dz);
math::vector2 textureCoord = math::vector2(u, v);
vertex_default v(p, color::WHITE, textureCoord, p * radius);
vertices.push_back(v);
}
}
The next part of the sphere generation is to calculate the connectivity information, the in-
dices. The connectivity is done by joining two latitudinal rings by triangles.
Figure 46 - Indexing of a sphere's vertices.
We iterate over each of the latitudinal segments and for each of them we will iterate over
all the longitudinal segments, generating two triangles each time, the triangles will be giv-
en by the six indices:
Search WWH ::




Custom Search