Packages
 In this topic

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.directX   Previous This
Package
Next

 


Class Direct3dRMMesh

public class Direct3dRMMesh implements IDirect3dRMMesh
{
  // Methods
  public void addGroup(int vcnt, int fcnt, int vPerFace,
        int[] fdata, int[] retId);
  public void getBox(D3dRMBox vector);
  public void getGroup(int id, int[] vcnt, int[] fcnt,
        int[] vPerFace, int[] fDataSize, int[] fdata);
  public int getGroupColor(int id);
  public int getGroupCount();
  public int getGroupMapping(int id);
  public Direct3dRMMaterial getGroupMaterial(int id);
  public int getGroupQuality(int id);
  public void getGroupSize(int id, int[] val);
  public Direct3dRMTexture getGroupTexture(int id);
  public void getVertices(int id, int idx, int vCount,
        Direct3dRMVertex[] v);
  public void getVerticesSize(int id, int idx, int[] cnt);
  public void scale(float sx, float sy, float sz);
  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 setGroupMaterial(int id, Direct3dRMMaterial val);
  public void setGroupQuality(int id, int value);
  public void setGroupTexture(int id, Direct3dRMTexture val);
  public void setVertices(int id, int idx, int vCount,
        Direct3dRMVertex[] v);
  public void setVerticesAsFloats(int id, int idx, int vCount,
        float[] v);
  public void translate(float tx, float ty, float tz);
}

Applications use the methods of the Direct3dRMMesh class to interact with groups of meshes.

The Direct3dRMMesh class inherits the following methods from the Direct3dRMObject class:

addDestroyCallback
duplicate
deleteDestroyCallback
getAppData
getClassName
getName
setAppData
setName

The Direct3dRMMesh object is obtained by calling the createMesh method.

Methods

addGroup

public void addGroup(int vcnt, int fcnt, int vPerFace, int[] fdata,
        int[] retId);

Allocates space for a collection of vertices and faces and retrieves an identifier for the group.

Return Value:

No return value.

ParameterDescription
vcnt The number of vertices in the group.
fcnt The number of 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 The 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 The 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.

getBox

public void getBox(D3dRMBox vector);

Retrieves the bounding box containing a Direct3dRMMesh 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 The group identifier. This identifier must have been produced by using the addGroup method.
vcnt The array variables that receive the number of vertices for the group.
fcnt The array variables that receive the number of faces for the group.
vPerFace The array variable that receives the number of vertices per face for the group.
fDataSize The array variable that receives the number of values in the array associated with the fdata parameter.
fData The 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; otherwise, returns zero.

ParameterDescription
id The group identifier. 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 Direct3dRMMesh object.

Return Value:

Returns the number of groups if successful; otherwise, returns zero.

getGroupMapping

public int getGroupMapping(int id);

Returns a description of how textures are mapped to a group in a Direct3dRMMesh object.

Return Value:

Returns one value of mapping type describing how textures are mapped to a group, if successful; otherwise, returns zero.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.

See Also: setGroupMapping

getGroupMaterial

public Direct3dRMMaterial getGroupMaterial(int id);

Retrieves the material object associated with a group in a Direct3dRMMesh object.

Return Value:

Returns the Direct3dRMMaterial object if successful; otherwise, returns null.

ParameterDescription
id The group identifier. 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 Direct3dRMMesh object.

Return Value:

Returns one or more values of the render quality type if successful; otherwise, returns zero. These values include the shading, lighting, and fill modes for the object.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.

See Also: setGroupQuality

getGroupSize

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

Retrieves the size of data associated with the group.

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
val The array variable that receives the size of the data.

See Also: getGroup

getGroupTexture

public Direct3dRMTexture getGroupTexture(int id);

Retrieves an address of the texture associated with a group in a Direct3dRMMesh object.

Return Value:

Returns the Direct3dRMTexture object if successful; otherwise, returns null.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.

See Also: setGroupTexture

getVertices

public void getVertices(int id, int idx, int vCount, Direct3dRMVertex[] v);

Retrieves the vertex positions for a specified group in a Direct3dRMMesh object.

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
idx The index of the D3dRMVertex object to return. The idx parameter is used in an internal data structure, not the v array. The structure follows the following format
D3DVECTOR position;    v[0]x  v[1]y  v[2]z
D3DVECTOR normal;      v[3]xn v[4]yn v[5]zn
D3DVALUE tu, tv;       v[6]   v[7]
D3DCOLOR color;        v[8]
                       v[9]x for the next D3dRMVector
vCount The number of D3dRMVertex objects (vertices) to retrieve.
v The array of D3dRMVertex objects that receives the vertex positions.

See Also: setVertices

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 The group identifier. This identifier must have been produced by using the addGroup method.
idx The index of the first vertex position to count.
cnt The array variable that receives the count of vertex positions.

See Also: getVertices

scale

public void scale(float sx, float sy, float sz);

Scales a Direct3dRMMesh object by the given scaling factors parallel to the x-, y-, and z-axes in model coordinates.

Return Value:

No return value.

ParameterDescription
sx The scaling factor that is applied along the x-axis.
sy The scaling factor that is applied along the y-axis.
sz The scaling factor that is applied along the z-axis.

setGroupColor

public void setGroupColor(int id, int val);

Sets the color of a group in a Direct3dRMMesh object.

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
val The 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 Direct3dRMMesh object by using individual RGB values.

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
r The red component of the group color.
g The green component of the group color.
b The blue component of the group color.

See Also: getGroupColor, setGroupColor

setGroupMapping

public void setGroupMapping(int id, int value);

Sets the mapping for a group in a Direct3dRMMesh object. The mapping controls how textures are mapped to a surface.

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
value The mapping type value describing the mapping for the group.

See Also: getGroupMapping

setGroupMaterial

public void setGroupMaterial(int id, Direct3dRMMaterial val);

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

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
val The Direct3dRMMaterial object to set.

See Also: getGroupMaterial

setGroupQuality

public void setGroupQuality(int id, int value);

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

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
value The render quality type value. These values include the shading, lighting, and fill modes for the object.

See Also: getGroupQuality

setGroupTexture

public void setGroupTexture(int id, Direct3dRMTexture val);

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

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
val The Direct3dRMTexture object to set.

See Also: getGroupTexture

setVertices

public void setVertices(int id, int idx, int vCount, Direct3dRMVertex[] v);

Sets the vertex positions for a specified group in a Direct3dRMMesh object.

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
idx The index of the first D3dRMVertex object to set. The idx parameter is used in an internal data structure, not the v array. The structure follows the following format
D3DVECTOR position;    v[0]x  v[1]y  v[2]z
D3DVECTOR normal;      v[3]xn v[4]yn v[5]zn
D3DVALUE tu, tv;       v[6]   v[7]
D3DCOLOR color;        v[8]
                       v[9]x for the next D3dRMVector
vCount The number of vertices in the array.
v An array of D3dRMVertex objects 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

setVerticesAsFloats

public void setVerticesAsFloats(int id, int idx, int vCount, float[] v);

Sets the vertex positions for a specified group in a Direct3dRMMesh object, using an array of floats.

Return Value:

No return value.

ParameterDescription
id The group identifier. This identifier must have been produced by using the addGroup method.
idx The index of the first D3dRMVertex object to set. The idx parameter is used in an internal data structure, not the v array.
vCount The number of floats to set.
v An array of floats 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.

translate

public void translate(float tx, float ty, float tz);

Adds the specified offsets to the vertex positions of a Direct3dRMMesh object.

Return Value:

No return value.

ParameterDescription
tx The offset that is added to the x coordinate of each vertex position.
ty The offset that is added to the y coordinate of each vertex position.
tz The offset that is added to the z coordinate of each vertex position.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.