StreamingManager Class
Namespace: Stride.StreamingAssembly: Stride.Rendering.dll
Performs content streaming.
public class StreamingManager : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable, IStreamingManager, ITexturesStreamingProvider
| Name | Description | |
|---|---|---|
| Constructors | ||
| StreamingManager(IServiceRegistry) | Initializes a new instance of the StreamingManager class. |
|
| Fields | ||
| ManagerUpdatesInterval | The interval between StreamingManager updates. |
|
| MaxResourcesPerUpdate | The maximum number of resources updated per streaming manager tick. Used to balance performance/streaming speed. |
|
| ResourceLiveTimeout | The StreamableResource live timeout. Resources that aren't used for a while are downscaled in quality. |
|
| TargetedMemoryBudget | The targeted memory budget of the streaming system in MB. If the memory allocated by streaming system is under this budget it will not try to unload not visible resources. |
|
| Properties | ||
| AllocatedMemory | Gets the memory currently allocated by streamable resources in MB. |
|
| AllocatedMemoryBytes | Gets the extact memory amount allocated by streamable resources in bytes. |
|
| ContentStreaming | Gets the content streaming service. |
|
| Resources | List with all registered streamable resources. |
|
| Methods | ||
| Destroy() | Disposes of object resources. |
|
| Get(Texture) | Gets the StreamingTexture corresponding to the given texture object. |
|
| Get<T>(Object) | Gets the StreamableResource corresponding to the given resource object. |
|
| RegisterMemoryUsage(Int64) | Notify the streaming manager of the change memory used by the resources. |
|
| SetResourceStreamingOptions(Texture, Nullable<StreamingOptions>) | Set the streaming options for the resources |
|
| SetResourceStreamingOptions(ParameterCollection, Nullable<StreamingOptions>) | Set the streaming options for the resources |
|
| SetResourceStreamingOptions(RenderMesh, Nullable<StreamingOptions>) | Set the streaming options for the resources |
|
| SetStreamingSettings(StreamingSettings) | ||
| StreamResources(Texture, Nullable<StreamingOptions>) | Called when texture is submitted to rendering. Registers referenced resources to stream them. |
|
| StreamResources(ParameterCollection, Nullable<StreamingOptions>) | Called when material parameters are submitted to rendering. Registers referenced resources to stream them. |
|
| StreamResources(RenderMesh, Nullable<StreamingOptions>) | Called when render mesh is submitted to rendering. Registers referenced resources to stream them. |
|
| Update(GameTime) | ||
| Explicit Interface Implementations | ||
| IStreamingManager.FullyLoadResource(Object) | Puts request to load given resource up to the maximum residency level. |
|
| ITexturesStreamingProvider.FullyLoadTexture(Texture, ref ImageDescription, ref ContentStorageHeader) | Loads the texture in a streaming service. |
|
| ITexturesStreamingProvider.RegisterTexture(Texture, ref ImageDescription, ref ContentStorageHeader) | Registers the texture in a streaming service. |
|
| ITexturesStreamingProvider.UnregisterTexture(Texture) | Unregisters the texture. |
|
Constructors
StreamingManager(IServiceRegistry)
Initializes a new instance of the StreamingManager class.
public StreamingManager(IServiceRegistry services)
Parameters
| Type | Name | Description |
|---|---|---|
| IServiceRegistry | services | The servicies registry. |
Remarks
The GameSystem expects the following services to be registered: IGame and IContentManager.
Fields
ManagerUpdatesInterval
The interval between StreamingManager updates.
public TimeSpan ManagerUpdatesInterval
Field Value
| Type | Description |
|---|---|
| System.TimeSpan |
MaxResourcesPerUpdate
The maximum number of resources updated per streaming manager tick. Used to balance performance/streaming speed.
public int MaxResourcesPerUpdate
Field Value
| Type | Description |
|---|---|
| System.Int32 |
ResourceLiveTimeout
The StreamableResource live timeout. Resources that aren't used for a while are downscaled in quality.
public TimeSpan ResourceLiveTimeout
Field Value
| Type | Description |
|---|---|
| System.TimeSpan |
TargetedMemoryBudget
The targeted memory budget of the streaming system in MB. If the memory allocated by streaming system is under this budget it will not try to unload not visible resources.
public int TargetedMemoryBudget
Field Value
| Type | Description |
|---|---|
| System.Int32 |
Properties
AllocatedMemory
Gets the memory currently allocated by streamable resources in MB.
public float AllocatedMemory { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
AllocatedMemoryBytes
Gets the extact memory amount allocated by streamable resources in bytes.
public long AllocatedMemoryBytes { get; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
ContentStreaming
Gets the content streaming service.
public ContentStreamingService ContentStreaming { get; }
Property Value
| Type | Description |
|---|---|
| ContentStreamingService |
Resources
List with all registered streamable resources.
public ICollection<StreamableResource> Resources { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.ICollection<StreamableResource> |
Methods
Destroy()
Disposes of object resources.
protected override void Destroy()
Overrides
Get(Texture)
Gets the StreamingTexture corresponding to the given texture object.
public StreamingTexture Get(Texture obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | obj | The texture object. |
Returns
| Type | Description |
|---|---|
| StreamingTexture | Streamable texture, or null if it can't be found. |
Get<T>(Object)
Gets the StreamableResource corresponding to the given resource object.
public T Get<T>(object obj)
where T : StreamableResource
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The object. |
Returns
| Type | Description |
|---|---|
| T | Streamable resource, or null if it can't be found. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the streamable resource. |
RegisterMemoryUsage(Int64)
Notify the streaming manager of the change memory used by the resources.
public void RegisterMemoryUsage(long memoryUsedChange)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | memoryUsedChange | The change of memory used in bytes. This value can be positive of negative. |
SetResourceStreamingOptions(Texture, Nullable<StreamingOptions>)
Set the streaming options for the resources
public void SetResourceStreamingOptions(Texture texture, StreamingOptions? options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | texture | The texture. |
| System.Nullable<StreamingOptions> | options | The streaming options when streaming those resources |
SetResourceStreamingOptions(ParameterCollection, Nullable<StreamingOptions>)
Set the streaming options for the resources
public void SetResourceStreamingOptions(ParameterCollection parameters, StreamingOptions? options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterCollection | parameters | The material parameters. |
| System.Nullable<StreamingOptions> | options | The streaming options when streaming those resources |
SetResourceStreamingOptions(RenderMesh, Nullable<StreamingOptions>)
Set the streaming options for the resources
public void SetResourceStreamingOptions(RenderMesh renderMesh, StreamingOptions? options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderMesh | renderMesh | The render mesh. |
| System.Nullable<StreamingOptions> | options | The streaming options when streaming those resources |
SetStreamingSettings(StreamingSettings)
public void SetStreamingSettings(StreamingSettings streamingSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| StreamingSettings | streamingSettings |
StreamResources(Texture, Nullable<StreamingOptions>)
Called when texture is submitted to rendering. Registers referenced resources to stream them.
public void StreamResources(Texture texture, StreamingOptions? options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | texture | The texture. |
| System.Nullable<StreamingOptions> | options | The streaming options when streaming those resources |
StreamResources(ParameterCollection, Nullable<StreamingOptions>)
Called when material parameters are submitted to rendering. Registers referenced resources to stream them.
public void StreamResources(ParameterCollection parameters, StreamingOptions? options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ParameterCollection | parameters | The material parameters. |
| System.Nullable<StreamingOptions> | options | The streaming options when streaming those resources |
StreamResources(RenderMesh, Nullable<StreamingOptions>)
Called when render mesh is submitted to rendering. Registers referenced resources to stream them.
public void StreamResources(RenderMesh renderMesh, StreamingOptions? options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderMesh | renderMesh | The render mesh. |
| System.Nullable<StreamingOptions> | options | The streaming options when streaming those resources |
Update(GameTime)
public override void Update(GameTime gameTime)
Parameters
| Type | Name | Description |
|---|---|---|
| GameTime | gameTime |
Overrides
| Improve this Doc View SourceExplicit Interface Implementations
IStreamingManager.FullyLoadResource(Object)
Puts request to load given resource up to the maximum residency level.
void IStreamingManager.FullyLoadResource(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | obj | The streamable resource object. |
ITexturesStreamingProvider.FullyLoadTexture(Texture, ref ImageDescription, ref ContentStorageHeader)
Loads the texture in a streaming service.
void ITexturesStreamingProvider.FullyLoadTexture(Texture obj, ref ImageDescription imageDescription, ref ContentStorageHeader storageHeader)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | obj | The texture object. |
| ImageDescription | imageDescription | The image description. |
| ContentStorageHeader | storageHeader | The storage header. |
ITexturesStreamingProvider.RegisterTexture(Texture, ref ImageDescription, ref ContentStorageHeader)
Registers the texture in a streaming service.
void ITexturesStreamingProvider.RegisterTexture(Texture obj, ref ImageDescription imageDescription, ref ContentStorageHeader storageHeader)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | obj | The texture object. |
| ImageDescription | imageDescription | The image description. |
| ContentStorageHeader | storageHeader | The storage header. |
ITexturesStreamingProvider.UnregisterTexture(Texture)
Unregisters the texture.
void ITexturesStreamingProvider.UnregisterTexture(Texture obj)
Parameters
| Type | Name | Description |
|---|---|---|
| Texture | obj | The texture object. |