Mesh.FromFile(String,MeshFlags,Device,GraphicsStream,EffectInstance) Method (Microsoft.DirectX.Direct3D)
Loads a mesh from a .x file.
Definition
Visual Basic Public Shared Function FromFile( _
ByVal filename As String, _
ByVal options As MeshFlags, _
ByVal device As Device, _
ByRef adjacency As GraphicsStream, _
ByRef effects As EffectInstance _
) As MeshC# public static Mesh FromFile(
string filename,
MeshFlags options,
Device device,
out GraphicsStream adjacency,
out EffectInstance effects
);C++ public:
static Mesh^ FromFile(
String^ filename,
MeshFlags options,
Device^ device,
[Out] GraphicsStream^% adjacency,
[Out] EffectInstance% effects
);JScript public static function FromFile(
filename : String,
options : MeshFlags,
device : Device,
adjacency : GraphicsStream,
effects : EffectInstance
) : Mesh;
Parameters
filename System.String
String that specifies the file name.options Microsoft.DirectX.Direct3D.MeshFlags
One or more flags from the MeshFlags enumeration that specify creation options for the mesh (excepting the Simplify* and Optimize* flags).device Microsoft.DirectX.Direct3D.Device
A Device object that represents the device associated with the mesh.adjacency Microsoft.DirectX.GraphicsStream
A GraphicsStream containing three Int32 values per face that specify the three neighbors for each face in the mesh.effects Microsoft.DirectX.Direct3D.EffectInstance[]
An array of EffectInstance structures, where each structure contains a set of EffectDefault structures. Each EffectDefault represents an attribute group in the returned mesh. The data in these structures represent a particular instance of state information used to initialize an effect. For more information, see EffectInstance.
Return Value
Microsoft.DirectX.Direct3D.Mesh
Returns a Mesh object that represents the loaded mesh.
Remarks
All meshes in the file are collapsed into one output mesh. If the file contains a frame hierarchy, all of the transformations are applied to the mesh.
For mesh files that do not contain effect instance information, default effect instances are generated from the material information in the .x file. A default effect instance has default values that correspond to the members of the Material structure.
The default texture name also is filled in, but is handled differently. The name is Texture0@Name, which corresponds to an effect variable by the name of "Texture0" with an annotation called "Name." This variable contains the string file name for the texture.
Exceptions
The method call is invalid. For example, a method's parameter might contain an invalid value.
Microsoft Direct3D could not allocate sufficient memory to complete the call.