Package com.ms.com.directX |
![]() Previous |
![]() Microsoft Packages |
![]() Index |
![]() Next |
Applications use the methods of the d3drmMesh class to interact with groups of meshes.
public class d3drmMesh implements Id3drmMesh { public void InternalSetObject(IUnknown lpdd); public IUnknown InternalGetObject(); public void AddDestroyCallback(Id3drmCallback fn, IUnknown Arg); public void DeleteDestroyCallback(Id3drmCallback fn, IUnknown args); public d3drmMesh Clone(); public void SetAppData(int data); public int GetAppData(); public void SetName(String name); public String GetName(); public String GetClassName(); public void Scale(float sx, float sy, float Sz); public void Translate(float tx, float ty, float tz); public void GetBox(d3drmBox vector); public void AddGroup(int vcnt, int fcnt, int vPerFace, int[] fdata, int[] retId); public void SetVertices(int id, int idx, int cnt, d3drmVertex values); public void SetGroupColor(int id, int val); public void SetGroupColorRGB(int id, float r, float g, float b); public void SetGroupMapping(int id, int value); public void SetGroupQuality(int id, int value); public void SetGroupMaterial(int id, d3drmMaterial val); public void SetGroupTexture(int id, d3drmTexture val); public int GetGroupCount(); public void GetGroupSize(int id, int[] val); public void GetGroup(int id, int[] vcnt, int[] fcnt, int[] vPerFace, int[] fDataSize, int[] fdata); public void GetVertices(int id, int idx, int cnt, d3drmVertex ret); public void GetVerticesSize(int id, int idx, int[] cnt); public int GetGroupColor(int id); public int GetGroupMapping(int id); public int GetGroupQuality(int id); public d3drmMaterial GetGroupMaterial(int id); public d3drmTexture GetGroupTexture(int id); }
The methods can be organized into the following groups:
Color | GetGroupColor |
SetGroupColor | |
SetGroupColorRGB | |
Creation and information | AddGroup |
GetBox | |
GetGroup | |
GetGroupCount | |
Materials | GetGroupMaterial |
SetGroupMaterial | |
Miscellaneous | Scale |
Translate | |
Rendering quality | GetGroupQuality |
SetGroupQuality | |
Texture mapping | GetGroupMapping |
SetGroupMapping | |
Textures | GetGroupTexture |
SetGroupTexture | |
Vertex positions | GetVertices |
SetVertices |
In addition, the d3drmMesh class inherits the following methods from the d3drmObject class:
AddDestroyCallback |
Clone |
DeleteDestroyCallback |
GetAppData |
GetClassName |
GetName |
SetAppData |
SetName |
The d3drmMesh object is obtained by calling the CreateMesh method.
public void AddGroup(int vcnt, int fcnt, int vPerFace, int[] fdata, int[] retId);Groups a collection of faces and retrieves an identifier for the group.
Return Value:
No return value.
Parameter Description vcnt and fcnt Number of vertices and faces in the group. vPerFace Number of vertices per face in the group, if all faces have the same vertex count. If the group contains faces with varying vertex counts, this parameter should be zero. fdata Array variable containing face data. If the vPerFace parameter specifies a value, this data is simply a list of indices into the group's vertex array. If vPerFace is zero, the vertex indices should be preceded by an integer giving the number of vertices in that face. For example, if vPerFace is zero and the group is made up of triangular and quadrilateral faces, the data might be in the following form: 3 index index index 4 index index index index 3 index index index ... retId Array variable that receives a value identifying the group. Remarks:
A newly added group has the following default properties:
- White
- No texture
- No specular reflection
- Position, normal, and color of each vertex in the vertex array equal to zero
To set the positions of the vertices, use the SetVertices method.
public void GetBox(d3drmBox vector);Retrieves the bounding box containing a d3drmMesh object. The bounding box gives the minimum and maximum model coordinates in each dimension.
Return Value:
No return value.
Parameter Description vector A d3drmBox object that receives the bounding box coordinates.
public void GetGroup(int id, int[] vcnt, int[] fcnt, int[] vPerFace, int[] fDataSize, int[] fdata);Retrieves the data associated with a specified group.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. vcnt and fcnt Array variables that receive the number of vertices and the number of faces for the group. vPerFace Array variable that receives the number of vertices per face for the group. fDataSize Array variable that receives the number of values in array associated with the fdata parameter. fData Array variable that receives the face data for the group. The format of this data is the same as was specified in the call to the AddGroup method.
public int GetGroupColor(int id);Retrieves the color for a group.
Return Value:
Returns a value specifying the color if successful, or zero otherwise.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. See Also: SetGroupColor, SetGroupColorRGB
public int GetGroupCount();Retrieves the number of groups for a given d3drmMesh object.
Return Value:
Returns the number of groups if successful, or zero otherwise.
public int GetGroupMapping(int id);Returns a description of how textures are mapped to a group in a d3drmMesh object.
Return Value:
Returns one value of mapping type describing how textures are mapped to a group, if successful. Returns zero otherwise.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. See Also: SetGroupMapping
public d3drmMaterial GetGroupMaterial(int id);Retrieves the material object associated with a group in a d3drmMesh object.
Return Value:
Returns the d3drmMaterial object if successful; null otherwise.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. See Also: SetGroupMaterial
public int GetGroupQuality(int id);Retrieves the rendering quality for a specified group in a d3drmMesh object.
Return Value:
Returns one or more values of render quality type if successful, or zero otherwise. These values include the shading, lighting, and fill modes for the object.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. See Also: SetGroupQuality
public d3drmTexture GetGroupTexture(int id);Retrieves an address of the texture associated with a group in a d3drmMesh object.
Return Value:
Returns the d3drmTexture object if successful; null otherwise.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. See Also: SetGroupTexture
public void GetVertices(int id, int idx, int cnt, d3drmVertex ret);Retrieves the vertex positions for a specified group in a d3drmMesh object.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. idx Index of the d3drmVertex object to return. This index is relative to the start of the array of vertices associated with the mesh. cnt Number of d3drmVertex objects (vertices) to retrieve following the index given in the idx parameter. ret The d3drmVertex object that receives the vertex positions. See Also: SetVertices
public void Scale(float sx, float sy, float Sz);Scales a d3drmMesh object by the given scaling factors, parallel to the x-, y-, and z-axes in model coordinates.
Return Value:
No return value.
Parameter Description sx, sy, and Sz Scaling factors that are applied along the x-, y-, and z-axes.
public void SetGroupColor(int id, int val);Sets the color of a group in a d3drmMesh object.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. val Color of the group. See Also: GetGroupColor, SetGroupColorRGB
public void SetGroupColorRGB(int id, float r, float g, float b);Sets the color of a group in a d3drmMesh object, using individual RGB values.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. r, g, and b Red, green, and blue components of the group color. See Also: GetGroupColor, SetGroupColor
public void SetGroupMapping(int id, int value);Sets the mapping for a group in a d3drmMesh object. The mapping controls how textures are mapped to a surface.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. value Value of mapping type describing the mapping for the group. See Also: GetGroupMapping
public void SetGroupMaterial(int id, d3drmMaterial val);Sets the material associated with a group in a d3drmMesh object.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. val The d3drmMaterial object to set. See Also: GetGroupMaterial
public void SetGroupQuality(int id, int value);Sets the rendering quality for a specified group in a d3drmMesh object.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. value Values of render quality type. These values include the shading, lighting, and fill modes for the object. See Also: GetGroupQuality
public void SetGroupTexture(int id, d3drmTexture val);Sets the texture associated with a group in a d3drmMesh object.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. val The d3drmTexture object to set. See Also: GetGroupTexture
public void SetVertices(int id, int idx, int cnt, d3drmVertex values);Sets the vertex positions for a specified group in a d3drmMesh object.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. idx Index of the first d3drmVertex object to set. This index is relative to the start of the array of vertex positions associated with the group. cnt Number of vertices to set. values The d3drmVertex object specifying the vertex positions to be set. Remarks:
Vertices are local to the group. If an application needs to share vertices between two different groups (for example, if neighboring faces in a mesh are different colors), the vertices must be duplicated in both groups.
See Also: GetVertices
public void Translate(float tx, float ty, float tz);Adds the specified offsets to the vertex positions of a d3drmMesh object.
Return Value:
No return value.
Parameter Description tx, ty, and tz Offsets that are added to the x-, y-, and z-coordinates respectively of each vertex position.
public void GetGroupSize(int id, int[] val);Retrieves the size of data associated with the group.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. val Array variable that receives the size of the data. See Also: GetGroup
public void GetVerticesSize(int id, int idx, int[] cnt);Retrieves the number of vertex positions from the given index to the end of the array associated with the group.
Return Value:
No return value.
Parameter Description id Identifier of the group. This identifier must have been produced by using the AddGroup method. idx Index of the first vertex position to count. cnt Array variable that receives the count of vertex positions. See Also: GetVertices