Graphics Reference
In-Depth Information
include vertex normal and vertex color in addition to vertex position. The class of
vertex should be defined by user in XNA.
The structure of the DEM data used is regular grid. It is suitable to load in array.
Filling the vertex array occurs in system initialization and updating of the roaming
camera's view point. After vertex position data read from the small terrain block file
by FileStream instance, it needs to be transformed from the WGS-84 geocentric
geographic coordinates (B, L, H) to geocentric rectangular space coordinates (X, Y,
Z). The conversion formula can be found in reference [4].
3.2
Defining the Indices
Using a TriangleStrip primitive type can save more memory and bandwidth
than using a TriangleList . A method that generates indices defining triangles as
a TriangleStrip for a terrain based on a grid is described in reference [5]. Figure
1 shows the order of defining the triangle indices. In reference to the basis of his
thinking, the order of defining the triangle indices designed in prototype system was
shown as in Figure 2. After added index pointing to vertex(3*w-1), add next index
pointing to the same vertex again. In fact there are four invisible triangles between the
normal triangle based on vertex(2*W-2), vertex(W-1)and vertex(2*W-1) and the
normal triangle based on vertex(3*W-1), vertex(2*W-1) and vertex(3*W-2). Thus the
culling order is not changed.
Fig. 1 . “Rendering your terrain correctly as a TriangleStrip” in reference [5]
Fig. 2. The order of defining the triangle indices designed in prototype system
Search WWH ::




Custom Search