Index Topic Contents | |||
Previous Topic: IDirect3DRMMesh Next Topic: IDirect3DRMMeshBuilder2 |
IDirect3DRMMeshBuilder
Applications use the methods of the IDirect3DRMMeshBuilder interface to interact with mesh objects. This section is a reference to the methods of this interface. For a conceptual overview, see IDirect3DRMMesh, IDirect3DRMMeshBuilder, and IDirect3DRMMeshBuilder2 Interfaces.
The methods of the IDirect3DRMMeshBuilder interface can be organized into the following groups:
Color GetColorSource SetColor SetColorRGB SetColorSource Creation and GetBox information Faces AddFace AddFaces CreateFace GetFaceCount GetFaces Loading Load Meshes AddMesh CreateMesh Miscellaneous AddFrame AddMeshBuilder ReserveSpace Save Scale SetMaterial Translate Normals AddNormal GenerateNormals SetNormal Perspective GetPerspective SetPerspective Rendering quality GetQuality SetQuality Textures GetTextureCoordinates SetTexture SetTextureCoordinates SetTextureTopology Vertices AddVertex GetVertexColor GetVertexCount GetVertices SetVertex SetVertexColor SetVertexColorRGB The IDirect3DRMMeshBuilder 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 IDirect3DRMMeshBuilder interface inherits the following methods from the IDirect3DRMObject interface:
AddDestroyCallback Clone DeleteDestroyCallback GetAppData GetClassName GetName SetAppData SetName The Direct3DRMMeshBuilder object is obtained by using the IDirect3DRM::CreateMeshBuilder method.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::AddFace
Adds a face to a Direct3DRMMeshBuilder object.
HRESULT AddFace(
LPDIRECT3DRMFACE lpD3DRMFace
);Parameters
- lpD3DRMFace
- Address of the face being added.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
Any one face can exist in only one mesh at a time.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::AddFaces
Adds faces to a Direct3DRMMeshBuilder object.
HRESULT AddFaces(
DWORD dwVertexCount,
D3DVECTOR * lpD3DVertices,
DWORD normalCount,
D3DVECTOR *lpNormals,
DWORD *lpFaceData,
LPDIRECT3DRMFACEARRAY* lplpD3DRMFaceArray
);Parameters
- dwVertexCount
- Number of vertices.
- lpD3DVertices
- Base address of an array of D3DVECTOR structures that stores the vertex positions.
- normalCount
- Number of normals.
- lpNormals
- Base address of an array of D3DVECTOR structures that stores the normal positions.
- lpFaceData
- For each face, this parameter should contain a vertex count followed by the indices into the vertices array. If normalCount is not zero, this parameter should contain a vertex count followed by pairs of indices, with the first index of each pair indexing into the array of vertices, and the second indexing into the array of normals. The list of indices must terminate with a zero.
- lplpD3DRMFaceArray
- Address of a pointer to an IDirect3DRMFaceArray interface that will be filled with a pointer to the newly created faces.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::AddFrameAdds the contents of a frame to a Direct3DRMMeshBuilder object.
HRESULT AddFrame(
LPDIRECT3DRMFRAME lpD3DRMFrame
);Parameters
- lpD3DRMFrame
- Address of the frame whose contents are being added.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
The source frame is not modified or referenced by this operation.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::AddMeshAdds a mesh to a Direct3DRMMeshBuilder object.
HRESULT AddMesh(
LPDIRECT3DRMMESH lpD3DRMMesh
);Parameters
- lpD3DRMMesh
- Address of the mesh being added.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::AddMeshBuilderAdds the contents of a Direct3DRMMeshBuilder object to another Direct3DRMMeshBuilder object.
HRESULT AddMeshBuilder(
LPDIRECT3DRMMESHBUILDER lpD3DRMMeshBuild
);Parameters
- lpD3DRMMeshBuild
- Address of the Direct3DRMMeshBuilder object whose contents are being added.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
The source Direct3DRMMeshBuilder object is not modified or referenced by this operation.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::AddNormal
Adds a normal to a Direct3DRMMeshBuilder object.
int AddNormal(
D3DVALUE x,
D3DVALUE y,
D3DVALUE z
);Parameters
- x, y, and z
- The x-, y-, and z-components of the direction of the new normal.
Return Values
Returns the index of the normal.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::AddVertex
Adds a vertex to a Direct3DRMMeshBuilder object.
int AddVertex(
D3DVALUE x,
D3DVALUE y,
D3DVALUE z
);Parameters
- x, y, and z
- The x-, y-, and z-components of the position of the new vertex.
Return Values
Returns the index of the vertex.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::CreateFace
Creates a new face with no vertices and adds it to a Direct3DRMMeshBuilder object.
HRESULT CreateFace(
LPDIRECT3DRMFACE* lplpD3DRMFace
);Parameters
- lplpD3DRMFace
- Address of a pointer to an IDirect3DRMFace interface that will be filled with a pointer to the face that was created.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::CreateMesh
Creates a new mesh from a Direct3DRMMeshBuilder object.
HRESULT CreateMesh(
LPDIRECT3DRMMESH* lplpD3DRMMesh
);Parameters
- lplpD3DRMMesh
- Address that will be filled with a pointer to an IDirect3DRMMesh interface.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GenerateNormals
Processes the Direct3DRMMeshBuilder object and generates vertex normals that are the average of each vertex's adjoining face normals.
HRESULT GenerateNormals( );
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
Averaging the normals of back-to-back faces produces a zero normal.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetBox
Retrieves the bounding box containing a Direct3DRMMeshBuilder object. The bounding box gives the minimum and maximum model coordinates in each dimension.
HRESULT GetBox(
D3DRMBOX *lpD3DRMBox
);Parameters
- lpD3DRMBox
- Address of a D3DRMBOX structure that will be filled with the bounding box coordinates.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetColorSourceRetrieves the color source of a Direct3DRMMeshBuilder object. The color source can be either a face or a vertex.
D3DRMCOLORSOURCE GetColorSource( );
Return Values
Returns a member of the D3DRMCOLORSOURCE enumerated type.
See Also
IDirect3DRMMeshBuilder::SetColorSource
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetFaceCount
Retrieves the number of faces in a Direct3DRMMeshBuilder object.
int GetFaceCount( );
Return Values
Returns the number of faces.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetFaces
Retrieves the faces of a Direct3DRMMeshBuilder object.
HRESULT GetFaces(
LPDIRECT3DRMFACEARRAY* lplpD3DRMFaceArray
);Parameters
- lplpD3DRMFaceArray
- Address of a pointer to an IDirect3DRMFaceArray interface that is filled with an address of the faces.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetPerspectiveDetermines whether perspective correction is on for a Direct3DRMMeshBuilder object.
BOOL GetPerspective( );
Return Values
Returns TRUE if perspective correction is on, or FALSE otherwise.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetQuality
Retrieves the rendering quality of a Direct3DRMMeshBuilder object.
D3DRMRENDERQUALITY GetQuality( );
Return Values
Returns a member of the D3DRMRENDERQUALITY enumerated type that specifies the rendering quality of the mesh.
See Also
IDirect3DRMMeshBuilder::SetQuality
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetTextureCoordinates
Retrieves the texture coordinates of a specified vertex in a Direct3DRMMeshBuilder object.
HRESULT GetTextureCoordinates(
DWORD index,
D3DVALUE *lpU,
D3DVALUE *lpV
);Parameters
- index
- Index of the vertex.
- lpU and lpV
- Addresses of variables that will be filled with the texture coordinates of the vertex when the method returns.
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
IDirect3DRMMeshBuilder::SetTextureCoordinates
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetVertexColor
Retrieves the color of a specified vertex in a Direct3DRMMeshBuilder object.
D3DCOLOR GetVertexColor(
DWORD index
);Parameters
- index
- Index of the vertex.
Return Values
Returns the color.
See Also
IDirect3DRMMeshBuilder::SetVertexColor
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetVertexCount
Retrieves the number of vertices in a Direct3DRMMeshBuilder object.
int GetVertexCount( );
Return Values
Returns the number of vertices.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::GetVerticesRetrieves the vertices, normals, and face data for a Direct3DRMMeshBuilder object.
HRESULT GetVertices(
DWORD *vcount,
D3DVECTOR *vertices,
DWORD *ncount,
D3DVECTOR *normals,
DWORD *face_data_size,
DWORD *face_data
);Parameters
- vcount
- Address of a variable that will contain the number of vertices.
- vertices
- Address of an array of D3DVECTOR structures that will contain the vertices for the Direct3DRMMeshBuilder object. If this parameter is NULL, the method returns the number of vertices in the vcount parameter.
- ncount
- Address of a variable that will contain the number of normals.
- normals
- Address of an array of D3DVECTOR structures that will contain the normals for the Direct3DRMMeshBuilder object. If this parameter is NULL, the method returns the number of normals in the ncount parameter.
- face_data_size
- Address of a variable that specifies the size of the buffer pointed to by the face_data parameter. The size is given in units of DWORD values. This parameter cannot be NULL.
- face_data
- Address of the face data for the Direct3DRMMeshBuilder object. This data is in the same format as specified in the IDirect3DRMMeshBuilder::AddFaces method except that it is null-terminated. If this parameter is NULL, the method returns the required size of the face-data buffer in the face_data_size parameter.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::LoadLoads a Direct3DRMMeshBuilder object.
HRESULT Load(
LPVOID lpvObjSource,
LPVOID lpvObjID,
D3DRMLOADOPTIONS d3drmLOFlags,
D3DRMLOADTEXTURECALLBACK d3drmLoadTextureProc,
LPVOID lpvArg
);Parameters
- lpvObjSource
- Source for the object to be loaded. This source can be a file, resource, memory block, or stream, depending on the source flags specified in the d3drmLOFlags parameter.
- lpvObjID
- Object name or position to be loaded. The use of this parameter depends on the identifier flags specified in the d3drmLOFlags parameter. If the D3DRMLOAD_BYPOSITION flag is specified, this parameter is a pointer to a DWORD value that gives the object's order in the file. This parameter can be NULL.
- d3drmLOFlags
- Value of the D3DRMLOADOPTIONS type describing the load options.
- d3drmLoadTextureProc
- A D3DRMLOADTEXTURECALLBACK callback function used to load any textures used by an object that require special formatting. This parameter can be NULL.
- lpvArg
- Address of application-defined data passed to the D3DRMLOADTEXTURECALLBACK callback function.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
By default, this method loads the first mesh from the source specified in the lpvObjSource parameter.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::ReserveSpace
Reserves space within a Direct3DRMMeshBuilder object for the specified number of vertices, normals, and faces. This allows the system to use memory more efficiently.
HRESULT ReserveSpace(
DWORD vertexCount,
DWORD normalCount,
DWORD faceCount
);Parameters
- vertexCount, normalCount, and faceCount
- Number of vertices, normals, and faces to allocate space for.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::Save
Saves a Direct3DRMMeshBuilder object.
HRESULT Save(
const char * lpFilename,
D3DRMXOFFORMAT d3drmXOFFormat,
D3DRMSAVEOPTIONS d3drmSOContents
);Parameters
- lpFilename
- Address specifying the name of the created file. This file must have a .x file name extension.
- d3drmXOFFormat
- The D3DRMXOF_TEXT value from the D3DRMXOFFORMAT enumerated type.
- d3drmSOContents
- Value of the D3DRMSAVEOPTIONS type describing the save options.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::Scale
Scales a Direct3DRMMeshBuilder object by the given scaling factors, parallel to the x-, y-, and z-axes in model coordinates.
HRESULT Scale(
D3DVALUE sx,
D3DVALUE sy,
D3DVALUE sz
);Parameters
- sx sy, and sz
- Scaling factors that are applied along the x-, y-, and z-axes.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetColor
Sets all the faces of a Direct3DRMMeshBuilder object to a given color.
HRESULT SetColor(
D3DCOLOR color
);Parameters
- color
- Color of the faces.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetColorRGB
Sets all the faces of a Direct3DRMMeshBuilder object to a given color.
HRESULT SetColorRGB(
D3DVALUE red,
D3DVALUE green,
D3DVALUE blue
);Parameters
- red, green, and blue
- 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.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetColorSource
Sets the color source of a Direct3DRMMeshBuilder object.
HRESULT SetColorSource(
D3DRMCOLORSOURCE source
);Parameters
- source
- Member of the D3DRMCOLORSOURCE enumerated type that specifies the new color source to use.
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
IDirect3DRMMeshBuilder::GetColorSource
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetMaterial
Sets the material of all the faces of a Direct3DRMMeshBuilder object.
HRESULT SetMaterial(
LPDIRECT3DRMMATERIAL lpIDirect3DRMmaterial
);Parameters
- lpIDirect3DRMmaterial
- Address of IDirect3DRMMaterial interface for the Direct3DRMMeshBuilder object.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetNormal
Sets the normal vector of a specified vertex in a Direct3DRMMeshBuilder object.
HRESULT SetNormal(
DWORD index,
D3DVALUE x,
D3DVALUE y,
D3DVALUE z
);Parameters
- index
- Index of the normal to be set.
- x, y, and z
- The x-, y-, and z-components of the vector to assign to the specified normal.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetPerspective
Enables or disables perspective-correct texture-mapping for a Direct3DRMMeshBuilder object.
HRESULT SetPerspective(
BOOL perspective
);Parameters
- perspective
- Specify TRUE if the mesh should be texture-mapped with perspective correction, or FALSE otherwise.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetQuality
Sets the rendering quality of a Direct3DRMMeshBuilder object.
HRESULT SetQuality(
D3DRMRENDERQUALITY quality
);Parameters
- quality
- Member of the D3DRMRENDERQUALITY enumerated type that specifies the new rendering quality to use.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
Remarks
An object's quality has three components: shade mode (flat or Gouraud, Phong is not yet implemented and will default to Gouraud shading), lighting type (on or off), and fill mode (point, wire-frame or solid).
You can set the quality of a device with IDirect3DRMDevice::SetQuality. By default it is D3DRMRENDER_FLAT (flat shading, lights on, and solid fill).
You can set the quality of a Direct3DRMMeshBuilder object with the SetQuality method. By default, a Direct3DRMMeshBuilder object's quality is D3DRMRENDER_GOURAUD (Gouraud shading, lights on, and solid fill).
Direct3D Retained Mode renders an object at the lowest quality setting based on the device and object's current setting for each individual component. For example, if the object's current quality setting is D3DRMRENDER_GOURAUD, and the device is D3DRMRENDER_FLAT then the object will be rendered with flat shading, solid fill and lights on.
If the object's current quality setting is D3DRMSHADE_GOURAUD|D3DRMLIGHT_OFF|D3DRMFILL_WIREFRAME and the device's quality setting is D3DRMSHADE_FLAT|D3DRMLIGHT_ON|D3DRMFILL_POINT, then the object will be rendered with flat shading, lights off and point fill mode.
These rules apply to Direct3DRMMeshBuilder objects, Direct3DRMMeshBuilder2 objects, and Direct3DRMProgressiveMesh objects. However, Direct3DRMMesh objects do not follow these rules. Mesh objects ignore the device's quality settings and use the group quality setting (which defaults to D3DRMRENDER_GOURAUD).
See Also
IDirect3DRMMeshBuilder::GetQuality
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetTexture
Sets the texture of all the faces of a Direct3DRMMeshBuilder object.
HRESULT SetTexture(
LPDIRECT3DRMTEXTURE lpD3DRMTexture
);Parameters
- lpD3DRMTexture
- Address of the required Direct3DRMTexture object.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetTextureCoordinates
Sets the texture coordinates of a specified vertex in a Direct3DRMMeshBuilder object.
HRESULT SetTextureCoordinates(
DWORD index,
D3DVALUE u,
D3DVALUE v
);Parameters
- index
- Index of the vertex to be set.
- u and v
- Texture coordinates to assign to the specified mesh vertex.
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
IDirect3DRMMeshBuilder::GetTextureCoordinates
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetTextureTopology
Sets the texture topology of a Direct3DRMMeshBuilder object.
HRESULT SetTextureTopology(
BOOL cylU,
BOOL cylV
);Parameters
- cylU and cylV
- Specify TRUE for either or both of these parameters if you want the texture to have a cylindrical topology in the u- and v-dimensions, respectively; otherwise, specify FALSE.
Return Values
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible errors, see Direct3D Retained Mode Return Values.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetVertex
Sets the position of a specified vertex in a Direct3DRMMeshBuilder object.
HRESULT SetVertex(
DWORD index,
D3DVALUE x,
D3DVALUE y,
D3DVALUE z
);Parameters
- index
- Index of the vertex to be set.
- x, y, and z
- The x-, y-, and z-components of the position 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.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetVertexColor
Sets the color of a specified vertex in a Direct3DRMMeshBuilder object.
HRESULT SetVertexColor(
DWORD index,
D3DCOLOR color
);Parameters
- index
- Index of the vertex to be set.
- color
- Color 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.
See Also
IDirect3DRMMeshBuilder::GetVertexColor
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::SetVertexColorRGB
Sets the color of a specified vertex in a Direct3DRMMeshBuilder object.
HRESULT SetVertexColorRGB(
DWORD index,
D3DVALUE red,
D3DVALUE green,
D3DVALUE blue
);Parameters
- index
- Index of the vertex to be set.
- red, green, and blue
- Red, green, and blue components of the color 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.
IDirect3DRMMeshBuilder
IDirect3DRMMeshBuilder::Translate
Adds the specified offsets to the vertex positions of a Direct3DRMMeshBuilder object.
HRESULT Translate(
D3DVALUE tx,
D3DVALUE ty,
D3DVALUE tz
);Parameters
- tx, ty, and tz
- Offsets that are added to the x-, y-, and z-coordinates respectively of each 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.
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.