Package com.ms.com.directX Previous
Previous
Microsoft Packages
Microsoft Packages
Index
Index
Next
Next

Class d3drmMesh

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.

AddGroup

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.

ParameterDescription
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:

To set the positions of the vertices, use the SetVertices method.


GetBox

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.

ParameterDescription
vector A d3drmBox object that receives the bounding box coordinates.


GetGroup

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.

ParameterDescription
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.


GetGroupColor

public int GetGroupColor(int id);

Retrieves the color for a group.

Return Value:

Returns a value specifying the color if successful, or zero otherwise.

ParameterDescription
id Identifier of the group. This identifier must have been produced by using the AddGroup method.

See Also: SetGroupColor, SetGroupColorRGB


GetGroupCount

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.


GetGroupMapping

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.

ParameterDescription
id Identifier of the group. This identifier must have been produced by using the AddGroup method.

See Also: SetGroupMapping


GetGroupMaterial

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.

ParameterDescription
id Identifier of the group. This identifier must have been produced by using the AddGroup method.

See Also: SetGroupMaterial


GetGroupQuality

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.

ParameterDescription
id Identifier of the group. This identifier must have been produced by using the AddGroup method.

See Also: SetGroupQuality


GetGroupTexture

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.

ParameterDescription
id Identifier of the group. This identifier must have been produced by using the AddGroup method.

See Also: SetGroupTexture


GetVertices

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.

ParameterDescription
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


Scale

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.

ParameterDescription
sx, sy, and Sz Scaling factors that are applied along the x-, y-, and z-axes.


SetGroupColor

public void SetGroupColor(int id, int val);

Sets the color of a group in a d3drmMesh object.

Return Value:

No return value.

ParameterDescription
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


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.

ParameterDescription
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


SetGroupMapping

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.

ParameterDescription
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


SetGroupMaterial

public void SetGroupMaterial(int id, d3drmMaterial val);

Sets the material associated with a group in a d3drmMesh object.

Return Value:

No return value.

ParameterDescription
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


SetGroupQuality

public void SetGroupQuality(int id, int value);

Sets the rendering quality for a specified group in a d3drmMesh object.

Return Value:

No return value.

ParameterDescription
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


SetGroupTexture

public void SetGroupTexture(int id, d3drmTexture val);

Sets the texture associated with a group in a d3drmMesh object.

Return Value:

No return value.

ParameterDescription
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


SetVertices

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.

ParameterDescription
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


Translate

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.

ParameterDescription
tx, ty, and tz Offsets that are added to the x-, y-, and z-coordinates respectively of each vertex position.


GetGroupSize

public void GetGroupSize(int id, int[] val);

Retrieves the size of data associated with the group.

Return Value:

No return value.

ParameterDescription
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


GetVerticesSize

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.

ParameterDescription
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



© 1996 Microsoft Corporation. All rights reserved.