Microsoft DirectX 8.0 (Visual Basic)

D3DXMesh.ConvertPointRepsToAdjacency

Converts point representative data stored in Microsoft® DirectX® (.x) files to face adjacency information that is more flexible for optimization and simplification operations.

object.ConvertPointRepsToAdjacency( _ 
    PointRep As Any, _ 
    FaceAdjacency As Any)

Parts

object
Object expression that resolves to a D3DXMesh object.
PointRep
First element of an array of Long values, representing the point representatives for the mesh. The point representatives are stored as an array of indices with one element per vertex. The size of this array is the number of vertices in the mesh. You can specify ByVal 0 for this parameter, if the vertices do not need to be relabeled.
FaceAdjacency
First element of an array of Long values, representing the destination buffer for the face adjacency array of the mesh. The face adjacency is stored as an array of arrays. The innermost array is three indices of adjacent triangles, and the outer array is one set of face adjacency per triangle in the mesh. This size of this array is the maximum number of faces multiplied by 3. See Remarks.

Error Codes

If the method fails, an error is raised and Err.Number can be set to one of the following values.

D3DERR_INVALIDCALL
E_OUTOFMEMORY

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

Point representatives are a method of describing mesh adjacency by fusing two vertices with the same x-, y-, and z- coordinates but with different normal coordinates, u- and v-coordinates, color data, an so on. In a perfectly smooth mesh (a mesh without creases, boundaries, or holes), point representatives are redundant. In that case, it is possible to compute adjacent triangles by using a hash table to locate edges that share vertex indices. In the case of creases and texture boundaries, the point representatives are required to give a unique vertex index to use in a hash table for a group of co-located vertices that make up a vertex in the mesh.

The following code fragment shows how to use a D3DXBuffer object to pass adjacency information.

Dim d3dxbAdjacency As D3DXBuffer
Dim PointRep As Any

' This code fragment assumes that d3dxbAdjacency and PointRep have been properly
' initialized.
Call D3DX8.ConvertPointRepsToAdjacency(ByVal PointRep.GetBufferPointer, ByVal d3dxbAdjacency.GetBufferPointer)

See Also

D3DXMesh.ConvertAdjacencyToPointReps