Package com.ms.com.directX |
![]() Previous |
![]() Microsoft Packages |
![]() Index |
![]() Next |
Applications use the methods of the d3drmMeshBuilder class to interact with mesh objects.
public class d3drmMeshBuilder implements Id3drmMeshBuilder { public void InternalSetObject(IUnknown lpdd); public IUnknown InternalGetObject(); public d3drmMeshBuilder Clone(); public void AddDestroyCallback(Id3drmCallback fn, IUnknown Arg); public void DeleteDestroyCallback(Id3drmCallback fn, IUnknown args); public void SetAppData(int data); public int GetAppData(); public void SetName(String name); public String GetName(); public String GetClassName(); public d3drmMeshBuilder Getd3drmMeshBuilder(); public void LoadFromFileByPos(String filename, int position, int flags, ILoadTextureCallback c, IUnknown pUser); public void Save(String fname, int xFormat, int Save); public void Scale(float sx, float sy, float Sz); public void Translate(float tx, float ty, float tz); public void SetColorSource(int val); public void GetBox(d3drmBox retv); public void GenerateNormals(); public int GetColorSource(); public void AddMesh(d3drmMesh m); public void AddMeshBuilder(d3drmMeshBuilder mb); public void AddFrame(d3drmFrame f); public void AddFace(d3drmFace f); public void AddFacesToMesh(int vc, float[] ver, int nc, float[] norm, int[] data); public d3drmFaceArray CreateFaceArray(int vcount, float[] vertices, int nCount, float[] normals, int[] data); public void ReserveSpace(int v_cnt, int n_cnt, int f_cnt); public void SetColorRGB(float red, float green, float blue); public void SetColor(int col); public void SetTexture(d3drmTexture val); public void SetMaterial(d3drmMaterial val); public void SetTextureTopology(int wrap_u, int wrap_v); public void SetQuality(int q); public void SetPerspective(int persp); public void SetVertex(int idx, float x, float y, float z); public void SetNormal(int idx, float x, float y, float z); public void SetTextureCoordinates(int idx, float u, float v); public void SetVertexColor(int idx, int c); public void SetVertexColorRGB(int idx, float r, float g, float b); public d3drmFaceArray GetFaces(); public int GetVerticesSize(); public void GetVertices(int[] vc, d3dvector v, int[] nc, d3dvector n, int[] fs, int[] fc); public void GetTextureCoordinates(int idx, float[] u, float[] v); public void AddVertex(float x, float y, float z); public void AddNormal(float x, float y, float z); public d3drmFace CreateFace(); public int GetQuality(); public int GetPerspective(); public int GetFaceCount(); public int GetVertexCount(); public int GetVertexColor(int index); public d3drmMesh CreateMesh(); }
The methods can be organized into the following groups:
Color | GetColorSource |
SetColor | |
SetColorRGB | |
SetColorSource | |
Creation and information | GetBox |
Faces | AddFace |
AddFacesToMesh | |
CreateFace | |
CreateFaceArray | |
GetFaceCount | |
GetFaces | |
Loading | LoadFromFileByPos |
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 | |
GetVerticesSize | |
SetVertex | |
SetVertexColor | |
SetVertexColorRGB |
In addition, the d3drmMeshBuilder class inherits the following methods from the d3drmObject class:
AddDestroyCallback |
Clone |
DeleteDestroyCallback |
GetAppData |
GetClassName |
GetName |
SetAppData |
SetName |
The d3drmMeshBuilder object is obtained by calling the CreateMeshBuilder method.
public void AddFace(d3drmFace f);Adds a face to a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description f The d3drmFace object to add. Remarks:
Any one face can exist in only one mesh at a time.
public void AddFacesToMesh(int vc, float[] ver, int nc, float[] norm, int[] data);Adds a face to the d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description vc Number of vertices. ver Array variable that contains the vertices to use to create the face. nc Number of normals. norm Array variable that contains the normals to use to create the face. data Array variable that contains the data associated with the face.
public void AddFrame(d3drmFrame f);Adds the contents of a frame to a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description f The d3drmFrame object to add. Remarks:
The source frame is not modified or referenced by this operation.
public void AddMesh(d3drmMesh m);Adds a mesh to a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description m The d3drmMesh object to add.
public void AddMeshBuilder(d3drmMeshBuilder mb);Adds the contents of a d3drmMeshBuilder object to another d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description mb The d3drmMeshBuilder object to add. Remarks:
The source d3drmMeshBuilder object is not modified or referenced by this operation.
public void AddNormal(float x, float y, float z);Adds a normal to a d3drmMeshBuilder object.
Return Value:
Returns the index of the normal.
Parameter Description x, y, and z The x, y, and z components of the direction of the new normal.
public void AddVertex(float x, float y, float z);Adds a vertex to a d3drmMeshBuilder object.
Return Value:
Returns the index of the vertex.
Parameter Description x, y, and z The x, y, and z components of the position of the new vertex.
public d3drmFace CreateFace();Creates a new face with no vertices and adds it to a d3drmMeshBuilder object.
Return Value:
Returns the d3drmFace object if successful; null otherwise.
public d3drmFaceArray CreateFaceArray(int vcount, float[] vertices, int nCount, float[] normals, int[] data);Creates a face array for the d3drmMeshBuilder object.
Return Value:
Returns the d3drmFaceArray object if successful; null otherwise.
Parameter Description vcount Number of vertices. vertices Array variable that contains the vertices to use to create the face array. nCount Number of normals. normals Array variable that contains the normals to use to create the face array. data Array variable that contains the data associated with the face array.
public d3drmMesh CreateMesh();Creates a new mesh from a d3drmMeshBuilder object.
Return Value:
Returns the d3drmMesh object if successful; null otherwise.
public void GenerateNormals();Processes the d3drmMeshBuilder object and generates vertex normals that are the average of each vertex's adjoining face normals.
Return Value:
No return value.
Remarks:
Averaging the normals of back-to-back faces produces a zero normal.
public void GetBox(d3drmBox retv);Retrieves the bounding box containing a d3drmMeshBuilder object. The bounding box gives the minimum and maximum model coordinates in each dimension.
Return Value:
No return value.
Parameter Description retv A d3drmBox object that receives the bounding box coordinates.
public int GetColorSource();Retrieves the color source of a d3drmMeshBuilder object. The color source can be either a face or a vertex.
Return Value:
Returns a value of color source type.
See Also: SetColorSource
public int GetFaceCount();Retrieves the number of faces in a d3drmMeshBuilder object.
Return Value:
Returns the number of faces.
public d3drmFaceArray GetFaces();Retrieves the faces of a d3drmMeshBuilder object.
Return Value:
Returns the d3drmFaceArray object if successful; null otherwise.
public int GetPerspective();Determines whether perspective correction is on for a d3drmMeshBuilder object.
Return Value:
Returns TRUE if perspective correction is on, or FALSE otherwise.
public int GetQuality();Retrieves the rendering quality of a d3drmMeshBuilder object.
Return Value:
Returns a value of render quality type that specifies the rendering quality of the mesh.
See Also: SetQuality
public void GetTextureCoordinates(int idx, float[] u, float[] v);Retrieves the texture coordinates of a specified vertex in a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description idx Index of the vertex. u and v Array variables that receive the texture coordinates of the vertex. See Also: SetTextureCoordinates
public int GetVertexColor(int index);Retrieves the color of a specified vertex in a d3drmMeshBuilder object.
Return Value:
Returns the color.
Parameter Description index Index of the vertex. See Also: SetVertexColor
public int GetVertexCount();Retrieves the number of vertices in a d3drmMeshBuilder object.
Return Value:
Returns the number of vertices.
public void GetVertices(int[] vc, d3dvector v, int[] nc, d3dvector n, int[] fs, int[] fc);Retrieves the vertices, normals, and face data for a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description vc Array variable that receives the number of vertices. v A d3dvector object that receives the vertices for the d3drmMeshBuilder object. nc Array variable that receives the number of normals. n A d3dvector object that receives the normals for the d3drmMeshBuilder object. fs Array variable that receives the length of the array associated with the fc parameter. fc Array variable that receives the face data for the d3drmMeshBuilder object. This data is in the same format as specified in the AddFaces method except that it is null-terminated.
public void LoadFromFileByPos(String filename, int position, int flags, ILoadTextureCallback c, IUnknown pUser);Loads a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description filename Name of the file containing the object to be loaded. position Position of the object to be loaded. The value gives the object's order in the file. flags Value of load options type. c Callback interface that contains a load texture callback function called to load any textures used by an object that require special formatting. This parameter can be null. pUser application-defined data passed to the load texture callback function. Remarks:
By default, this method loads the first mesh from the file specified in the filename parameter.
public void ReserveSpace(int v_cnt, int n_cnt, int f_cnt);Reserves space within a d3drmMeshBuilder object for the specified number of vertices, normals, and faces. This allows the system to use memory more efficiently.
Return Value:
No return value.
Parameter Description v_cnt, n_cnt, and f_cnt Number of vertices, normals, and faces to allocate space for.
public void Save(String fname, int xFormat, int Save);Saves a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description fname Name of the created file. This file must have a .X file name extension. xFormat D3DRMXOF_TEXT. Save One value of save options type.
public void Scale(float sx, float sy, float Sz);Scales a d3drmMeshBuilder 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 SetColor(int col);Sets all the faces of a d3drmMeshBuilder object to a given color.
Return Value:
No return value.
Parameter Description col Color of the faces.
public void SetColorRGB(float red, float green, float blue);Sets all the faces of a d3drmMeshBuilder object to a given color.
Return Value:
No return value.
Parameter Description red, green, and blue Red, green, and blue components of the color.
public void SetColorSource(int val);Sets the color source of a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description val Value of color source type that specifies the new color source to use. See Also: GetColorSource
public void SetMaterial(d3drmMaterial val);Sets the material of all the faces of a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description val The d3drmMaterial object to set.
public void SetNormal(int idx, float x, float y, float z);Sets the normal vector of a specified vertex in a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description idx 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.
public void SetPerspective(int persp);Enables or disables perspective-correct texture-mapping for a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description persp Specify TRUE if the mesh should be texture-mapped with perspective correction, or FALSE otherwise.
public void SetQuality(int q);Sets the rendering quality of a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description q Value of render quality type that specifies the new rendering quality to use. See Also: GetQuality
public void SetTexture(d3drmTexture val);Sets the texture of all the faces of a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description val The d3drmTexture object to set.
public void SetTextureCoordinates(int idx, float u, float v);Sets the texture coordinates of a specified vertex in a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description idx Index of the vertex to be set. u and v Texture coordinates to assign to the specified mesh vertex. See Also: GetTextureCoordinates
public void SetTextureTopology(int wrap_u, int wrap_v);Sets the texture topology of a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description wrap_u and wrap_v 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.
public void SetVertex(int idx, float x, float y, float z);Sets the position of a specified vertex in a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description idx 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.
public void SetVertexColor(int idx, int c);Sets the color of a specified vertex in a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description idx Index of the vertex to be set. c Color to assign to the specified vertex. See Also: GetVertexColor
public void SetVertexColorRGB(int idx, float r, float g, float b);Sets the color of a specified vertex in a d3drmMeshBuilder object.
Return Value:
No return value.
Parameter Description idx Index of the vertex to be set. r, g, and b Red, green, and blue components of the color to assign to the specified vertex.
public void Translate(float tx, float ty, float tz);Adds the specified offsets to the vertex positions of a d3drmMeshBuilder 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 d3drmMeshBuilder Getd3drmMeshBuilder();Retrieves a mesh builder object associated with this object.
Return Value:
Returns the d3drmMeshBuilder object if successful; null otherwise.
public int GetVerticesSize();Returns the number of vertices.
Return Value:
Returns the number of vertices.
See Also: GetVertices