## IDirect3DRMFace

Applications use the methods of the IDirect3DRMFace interface to interact with a single polygon in a mesh. This section is a reference to the methods of this interface. For a conceptual overview, see IDirect3DRMFace and IDirect3DRMFaceArray Interfaces.

The methods of the IDirect3DRMFace interface can be organized into the following groups:

Color | GetColor
| SetColor
| SetColorRGB
Materials | GetMaterial
| SetMaterial
Textures | GetTexture
| GetTextureCoordinateIndex
| GetTextureCoordinates
| GetTextureTopology
| SetTexture
| SetTextureCoordinates
| SetTextureTopology
Vertices and normals | AddVertex
| AddVertexAndNormalIndexed
| GetNormal
| GetVertex
| GetVertexCount
| GetVertexIndex
| GetVertices

The IDirect3DRMFace interface, like all Component Object Model (COM) interfaces, inherits the IUnknown interface methods. The IUnknown interface supports the following three methods:

AddRef
QueryInterface
Release

In addition, the IDirect3DRMFace interface inherits the following methods from the IDirect3DRMObject interface:

AddDestroyCallback
Clone
DeleteDestroyCallback
GetAppData
GetClassName
GetName
SetAppData
SetName

The Direct3DRMFace object is obtained by using the IDirect3DRM::CreateFace method.

###

IDirect3DRMFace::AddVertex

IDirect3DRMFace

Adds a vertex to a Direct3DRMFace object.

HRESULT AddVertex(
D3DVALUE x,
D3DVALUE y,
D3DVALUE z
);

##### Parameters

x, y, and z
  The x, y, and z components of the new vertex position.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

###

IDirect3DRMFace::AddVertexAndNormalIndexed

IDirect3DRMFace

Adds a vertex and a normal to a Direct3DRMFace object, using an index for the vertex and an index for the normal in the containing mesh builder. The face, vertex, and normal must already be part of a Direct3DRMMeshBuilder object.

HRESULT AddVertexAndNormalIndexed(
DWORD vertex,
DWORD normal
);

##### Parameters

vertex and normal
  Indexes of the vertex and normal to add.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

###

IDirect3DRMFace::GetColor

IDirect3DRMFace

Retrieves the color of a Direct3DRMFace object.

D3DCOLOR GetColor( );

##### Return Values

Returns the color.

##### See Also

IDirect3DRMFace::SetColor

###

IDirect3DRMFace::GetMaterial

IDirect3DRMFace

Retrieves the material of a Direct3DRMFace object.

HRESULT GetMaterial(
LPDIRECT3DRMMATERIAL* lplpMaterial
);

##### Parameters

lplpMaterial
  Address of the pointer to the Direct3DRMMaterial object applied to the face.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMFace::SetMaterial

###

IDirect3DRMFace::GetNormal

IDirect3DRMFace

Retrieves the normal vector of a Direct3DRMFace object.

HRESULT GetNormal(
D3DVECTOR *lpNormal
);

##### Parameters

lpNormal
  Address of a D3DVECTOR structure that will be filled with the normal vector of the face.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

###

IDirect3DRMFace::GetTexture

IDirect3DRMFace

Retrieves the Direct3DRMTexture object applied to a Direct3DRMFace object.

HRESULT GetTexture(
LPDIRECT3DRMTEXTURE* lplpTexture
);

##### Parameters

lplpTexture
  Address of a variable that will be filled with a pointer to the texture applied to the face.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMFace::SetTexture

###

IDirect3DRMFace::GetTextureCoordinateIndex

IDirect3DRMFace

Retrieves the index of the vertex for texture coordinates in the face's mesh. You pass in the face-relative vertex index in the which parameter, and this method returns the corresponding mesh-relative vertex index.

int GetTextureCoordinateIndex(
DWORD which
);

##### Parameters

which
  Index within the face of the vertex whose coorresponding mesh vertex index is being retrieved.

##### Return Values

Returns the face's mesh-relative vertex index.

###

IDirect3DRMFace::GetTextureCoordinates

IDirect3DRMFace

Retrieves the texture coordinates of a vertex in a Direct3DRMFace object.

HRESULT GetTextureCoordinates(
DWORD index,
D3DVALUE *lpU,
D3DVALUE *lpV
);

##### Parameters

index
  Index of the vertex.
lpU and lpV
  Addresses of variables that are filled with the texture coordinates of the vertex.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

###

IDirect3DRMFace::GetTextureTopology

IDirect3DRMFace

Retrieves the texture topology of a Direct3DRMFace object.

HRESULT GetTextureTopology(
BOOL *lpU,
BOOL *lpV
);

##### Parameters

lpU and lpV
  Addresses of variables that are set or cleared, depending on how the cylindrical wrapping flags are set for the face.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMFace::SetTextureTopology

###

IDirect3DRMFace::GetVertex

IDirect3DRMFace

Retrieves the position and normal of a vertex in a Direct3DRMFace object.

HRESULT GetVertex(
DWORD index,
D3DVECTOR *lpPosition,
D3DVECTOR *lpNormal
);

##### Parameters

index
  Index of the vertex.
lpPosition and lpNormal
  Addresses of D3DVECTOR structures that will be filled with the position and normal of the vertex, respectively.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

###

IDirect3DRMFace::GetVertexCount

IDirect3DRMFace

Retrieves the number of vertices in a Direct3DRMFace object.

int GetVertexCount( );

##### Return Values

Returns the number of vertices.

###

IDirect3DRMFace::GetVertexIndex

IDirect3DRMFace

Retrieves the index of the vertex in the face's mesh. You pass in the face-relative vertex index in the which parameter, and this method returns the corresponding mesh-relative vertex index.

int GetVertexIndex (
DWORD which
);

##### Parameters

which
  Index within the face of the vertex whose coorresponding mesh vertex index is being retrieved.

##### Return Values

Returns the mesh-relative vertex index.

###

IDirect3DRMFace::GetVertices

IDirect3DRMFace

Retrieves the position and normal vector of each vertex in a Direct3DRMFace object.

HRESULT GetVertices(
DWORD *lpdwVertexCount,
D3DVECTOR *lpPosition,
D3DVECTOR *lpNormal
);

##### Parameters

lpdwVertexCount
  Address of a variable that is filled with the number of vertices. This parameter cannot be NULL.
lpPosition and lpNormal
  Arrays of D3DVECTOR structures that will be filled with the positions and normal vectors of the vertices, respectively. If both of these parameters are NULL, the method will fill the lpdwVertexCount parameter with the number of vertices that will be retrieved.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

###

IDirect3DRMFace::SetColor

IDirect3DRMFace

Sets a Direct3DRMFace object to a given color.

HRESULT SetColor(
D3DCOLOR color
);

##### Parameters

color
  Color to set.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMFace::GetColor

###

IDirect3DRMFace::SetColorRGB

IDirect3DRMFace

Sets a Direct3DRMFace object to a given color.

HRESULT SetColorRGB(
D3DVALUE red,
D3DVALUE green,
D3DVALUE blue
);

##### Parameters

red, green, and blue
  The red, green, and blue components of the color.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

###

IDirect3DRMFace::SetMaterial

IDirect3DRMFace

Sets the material of a Direct3DRMFace object.

HRESULT SetMaterial(
LPDIRECT3DRMMATERIAL lpD3DRMMaterial
);

##### Parameters

lpD3DRMMaterial
  Address of the material.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMFace::GetMaterial

###

IDirect3DRMFace::SetTexture

IDirect3DRMFace

Sets the texture of a Direct3DRMFace object.

HRESULT SetTexture(
LPDIRECT3DRMTEXTURE lpD3DRMTexture
);

##### Parameters

lpD3DRMTexture
  Address of the texture.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMFace::GetTexture

###

IDirect3DRMFace::SetTextureCoordinates

IDirect3DRMFace

Sets the texture coordinates of a specified vertex in a Direct3DRMFace object.

HRESULT SetTextureCoordinates(
DWORD vertex,
D3DVALUE u,
D3DVALUE v
);

##### Parameters

vertex
  Index of the vertex to be set. For example, if the face were a triangle, the possible vertex indices would be 0, 1, and 2.
u and v
  Texture coordinates to assign to the specified vertex.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

###

IDirect3DRMFace::SetTextureTopology

IDirect3DRMFace

Sets the texture topology of a Direct3DRMFace object.

HRESULT SetTextureTopology(
BOOL cylU,
BOOL cylV
);

##### Parameters

cylU and cylV
  Specify whether the texture has a cylindrical topology in the u and v dimensions.

##### Return Values

Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.

##### See Also

IDirect3DRMFace::GetTextureTopology

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.