Share via


Mesh.FromStream(Stream,Int32,MeshFlags,Device,GraphicsStream,ExtendedMaterial) Method (Microsoft.DirectX.Direct3D)

Loads a mesh from a StreamLeave Site.

Definition

Visual Basic Public Shared Function FromStream( _
    ByVal stream As StreamLeave Site, _
    ByVal readBytes As Integer, _
    ByVal options As MeshFlags, _
    ByVal device As Device, _
    ByRef adjacency As GraphicsStream, _
    ByRef materials As ExtendedMaterial _
) As Mesh
C# public static Mesh FromStream(
    StreamLeave Site stream,
    int readBytes,
    MeshFlags options,
    Device device,
    out GraphicsStream adjacency,
    out ExtendedMaterial materials
);
C++ public:
static MeshFromStream(
    StreamLeave Sitestream,
    int readBytes,
    MeshFlags options,
    Devicedevice,
    [Out] GraphicsStream^% adjacency,
    [Out] ExtendedMaterialmaterials
);
JScript public static function FromStream(
    stream : StreamLeave Site,
    readBytes : int,
    options : MeshFlags,
    device : Device,
    adjacency : GraphicsStream,
    materials : ExtendedMaterial
) : Mesh;

Parameters

stream System.IO.Stream
A StreamLeave Site object that contains the mesh data.
readBytes System.Int32
Size of the file in memory in bytes.
options Microsoft.DirectX.Direct3D.MeshFlags
One or more flags from the Mesh enumeration that specify creation options for the mesh (excepting the Simplify* and Optimize* flags).
device Microsoft.DirectX.Direct3D.Device
The Device to associate with the mesh.
adjacency Microsoft.DirectX.GraphicsStream
A GraphicsStream object containing three Int32Leave Site values per face that specify the three neighbors for each face in the mesh.
materials Microsoft.DirectX.Direct3D.ExtendedMaterial[]
Array of ExtendedMaterial structures that contain material information saved in the mesh.

Return Value

Microsoft.DirectX.Direct3D.Mesh
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 DirectX (.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

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

OutOfMemoryExceptionLeave Site

Microsoft Direct3D could not allocate sufficient memory to complete the call.