Scene.FromStream

FromStream(Stream, FileFormat, CancellationToken)

Opens the scene from given stream using specified file format.

public static Scene FromStream(Stream stream, FileFormat format, 
    CancellationToken cancellationToken = default)
ParameterTypeDescription
streamStreamInput stream, user is responsible for closing the stream.
formatFileFormatFile format.
cancellationTokenCancellationTokenCancellation token to the load task

Examples

The following code shows how to create a scene from a stream

using(var stream = new FileStream("input.fbx", FileMode.Open))
{
    Scene scene = Scene.FromStream(stream);
}

See Also


FromStream(Stream, LoadOptions, CancellationToken)

Opens the scene from given stream using specified IO config.

public static Scene FromStream(Stream stream, LoadOptions options, 
    CancellationToken cancellationToken = default)
ParameterTypeDescription
streamStreamInput stream, user is responsible for closing the stream.
optionsLoadOptionsMore detailed configuration to open the stream.
cancellationTokenCancellationTokenCancellation token to the load task

Examples

The following code shows how to create a scene from a stream with load options

var opts = new FbxLoadOptions();
opts.LookupPaths.Add("textures");
using(var stream = new FileStream("input.fbx", FileMode.Open))
{
    Scene scene = Scene.FromStream(stream, opts);
}

See Also


FromStream(Stream, CancellationToken)

Opens the scene from given stream

public static Scene FromStream(Stream stream, CancellationToken cancellationToken = default)
ParameterTypeDescription
streamStreamInput stream, user is responsible for closing the stream.
cancellationTokenCancellationTokenCancellation token to the load task

Examples

The following code shows how to create a scene from a stream with a cancellation token source

var cts = new CancellationTokenSource();
using(var stream = new FileStream("input.fbx", FileMode.Open))
{
    Scene scene = Scene.FromStream(stream, cts.Token);
}

See Also