Request a texture asset from the simulator
using the
TexturePipelinesystem to manage the requests and re-assemble
the image from the packets received from the simulator
Declaration Syntax
Parameters
- imageType ( ImageType)
- The ImageTypeof the texture asset. Use Normalfor most textures, or Bakedfor baked layer texture assets
- priority ( Single)
- A float indicating the requested priority for the transfer. Higher priority values tell the simulator to prioritize the request before lower valued requests. An image already being transferred using the TexturePipelinecan have its priority changed by resending the request with the new priority value
- discardLevel ( Int32)
- Number of quality layers to discard. This controls the end marker of the data sent. Sending with value -1 combined with priority of 0 cancels an in-progress transfer.
- packetStart ( UInt32)
- The packet number to begin the request at. A value of 0 begins the request from the start of the asset texture
- callback ( TextureDownloadCallback)
- The TextureDownloadCallbackcallback to fire when the image is retrieved. The callback will contain the result of the request and the texture asset data
- progress ( Boolean)
- If true, the callback will be fired for each chunk of the downloaded image. The callback asset parameter will contain all previously received chunks of the texture asset starting from the beginning of the request
Remarks
A bug exists in the Linden Simulator
where a -1 will occasionally be sent with a non-zero priority
indicating an off-by-one error.
Examples
Request an image and fire a callback
when the request is complete
Request an image and use an inline anonymous method to handle
the downloaded texture data
Request a texture, decode the texture to a bitmap image and
apply it to a imagebox
Copy | |
---|---|
Client.Assets.RequestImage(UUID.Parse( "c307629f-e3a1-4487-5e88-0d96ac9d4965"), ImageType.Normal, TextureDownloader_OnDownloadFinished); private void TextureDownloader_OnDownloadFinished(TextureRequestState state, AssetTexture asset) { if(state == TextureRequestState.Finished) { Console.WriteLine( "Texture {0} ({1} bytes) has been successfully downloaded", asset.AssetID, asset.AssetData.Length); } } |
Copy | |
---|---|
Client.Assets.RequestImage(UUID.Parse( "c307629f-e3a1-4487-5e88-0d96ac9d4965"), ImageType.Normal, delegate(TextureRequestState state, AssetTexture asset) { if(state == TextureRequestState.Finished) { Console.WriteLine( "Texture {0} ({1} bytes) has been successfully downloaded", asset.AssetID, asset.AssetData.Length); } } ); |
Copy | |
---|---|
Client.Assets.RequestImage(UUID.Parse( "c307629f-e3a1-4487-5e88-0d96ac9d4965"), ImageType.Normal, TextureDownloader_OnDownloadFinished); private void TextureDownloader_OnDownloadFinished(TextureRequestState state, AssetTexture asset) { if(state == TextureRequestState.Finished) { ManagedImage imgData; Image bitmap; if (state == TextureRequestState.Finished) { OpenJPEG.DecodeToImage(assetTexture.AssetData, out imgData, out bitmap); picInsignia.Image = bitmap; } } } |
Assembly: OpenMetaverse(Module: OpenMetaverse.dll) Version: 0.9.3.3318 (0.9.3.3318)