OpenMetaverse.TexturePipeline.RequestTexture C# (CSharp) Method

RequestTexture() public method

Request a texture be downloaded, once downloaded OnImageRenderReady event will be fired containing texture key which can be used to retrieve texture with GetTextureToRender method
public RequestTexture ( UUID textureID, ImageType type ) : void
textureID UUID Texture to request
type ImageType Type of the requested texture
return void
        public void RequestTexture(UUID textureID, ImageType type)
        {
            lock (syncObject)
            {
                if (client.Assets.Cache.HasImage(textureID))
                {
                    // Add to rendering dictionary
                    if (!completedDownloads.ContainsKey(textureID))
                    {
                        completedDownloads.Add(textureID, client.Assets.Cache.GetCachedImage(textureID));

                        // Let any subscribers know about it
                        if (OnDownloadFinished != null)
                            OnDownloadFinished(textureID, true);
                    }
                    else
                    {
                        // This image has already been served up, ignore this request
                    }
                }
                else
                {
                    // Make sure the request isn't already queued up
                    foreach (TaskInfo task in requestQueue)
                    {
                        if (task.RequestID == textureID)
                            return;
                    }

                    // Make sure we aren't already downloading the texture
                    if (!currentRequests.ContainsKey(textureID))
                        requestQueue.Add(new TaskInfo(textureID, 0, type));
                }
            }
        }