Exemplo n.º 1
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="client">Reference to <code>SecondLife</code> client</param>
        public TexturePipeline(GridClient client)
        {
            Running = true;

            RequestQueue = new Queue<UUID>();
            CurrentRequests = new Dictionary<UUID, int>(MAX_TEXTURE_REQUESTS);

            RenderReady = new Dictionary<UUID, ImageDownload>();

            resetEvents = new AutoResetEvent[MAX_TEXTURE_REQUESTS];
            threadpoolSlots = new int[MAX_TEXTURE_REQUESTS];

            // pre-configure autoreset events/download slots
            for (int i = 0; i < MAX_TEXTURE_REQUESTS; i++)
            {
                resetEvents[i] = new AutoResetEvent(false);
                threadpoolSlots[i] = -1;
            }

            Client = client;

            DownloadCallback = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);
            DownloadProgCallback = new AssetManager.ImageReceiveProgressCallback(Assets_OnImageReceiveProgress);
            Client.Assets.OnImageReceived += DownloadCallback;
            Client.Assets.OnImageReceiveProgress += DownloadProgCallback;

            // Fire up the texture download thread
            downloadMaster = new Thread(new ThreadStart(DownloadThread));
            downloadMaster.Start();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="client">Reference to <code>SecondLife</code> client</param>
        public TexturePipeline(GridClient client)
        {
            Running = true;

            RequestQueue    = new Queue <UUID>();
            CurrentRequests = new Dictionary <UUID, int>(MAX_TEXTURE_REQUESTS);

            RenderReady = new Dictionary <UUID, ImageDownload>();

            resetEvents     = new AutoResetEvent[MAX_TEXTURE_REQUESTS];
            threadpoolSlots = new int[MAX_TEXTURE_REQUESTS];

            // pre-configure autoreset events/download slots
            for (int i = 0; i < MAX_TEXTURE_REQUESTS; i++)
            {
                resetEvents[i]     = new AutoResetEvent(false);
                threadpoolSlots[i] = -1;
            }

            Client = client;

            DownloadCallback                      = new AssetManager.ImageReceivedCallback(Assets_OnImageReceived);
            DownloadProgCallback                  = new AssetManager.ImageReceiveProgressCallback(Assets_OnImageReceiveProgress);
            Client.Assets.OnImageReceived        += DownloadCallback;
            Client.Assets.OnImageReceiveProgress += DownloadProgCallback;

            // Fire up the texture download thread
            downloadMaster = new Thread(new ThreadStart(DownloadThread));
            downloadMaster.Start();
        }