Exemplo n.º 1
0
        public void RemoveSurfaceImage(string imageResource)
        {
            try
            {
                lock (m_SurfaceImages.SyncRoot)
                {
                    for (int i = 0; i < m_SurfaceImages.Count; i++)
                    {
                        SurfaceImage current = m_SurfaceImages[i] as SurfaceImage;
                        if (current != null && current.ImageFilePath == imageResource)
                        {
                            m_SurfaceImages.RemoveAt(i);
                            break;
                        }
                    }

                    m_SurfaceImages.Sort();
                }
                LastChange = System.DateTime.Now;
            }
            catch (System.Threading.ThreadAbortException)
            {
            }
            catch (Exception ex)
            {
                Log.DebugWrite(ex);
            }
        }
Exemplo n.º 2
0
        public int CompareTo(object obj)
        {
            if (!(obj is SurfaceImage))
            {
                return(1);
            }

            SurfaceImage robj = obj as SurfaceImage;

            string parentRenderableZOrderString = getZOrderStringFromIRenderable(m_ParentRenderable);
            string objectRenderableZOrderString = getZOrderStringFromIRenderable(robj.ParentRenderable);

            if (parentRenderableZOrderString == objectRenderableZOrderString)
            {
                double parentSourceRange = m_North - m_South;
                parentSourceRange = 1.0 / parentSourceRange;
                double objectSourceRange = robj.North - robj.South;
                objectSourceRange = 1.0 / objectSourceRange;

                return(parentSourceRange.CompareTo(objectSourceRange));
            }
            else
            {
                return(parentRenderableZOrderString.CompareTo(objectRenderableZOrderString));
            }
        }
Exemplo n.º 3
0
        public void RenderSurfaceImages(DrawArgs drawArgs)
        {
            if (this.m_Rts == null)
            {
                drawArgs.device.DeviceReset += new EventHandler(OnDeviceReset);
                OnDeviceReset(drawArgs.device, null);
            }
            if (!m_Initialized)
            {
                return;
            }

            if (m_TextureLoadQueue.Count > 0)
            {
                SurfaceImage si = m_TextureLoadQueue.Dequeue() as SurfaceImage;
                if (si != null)
                {
                    si.ImageTexture = ImageHelper.LoadTexture(si.ImageFilePath);

                    lock (this.m_SurfaceImages.SyncRoot)
                    {
                        m_SurfaceImages.Add(si);
                        m_SurfaceImages.Sort();
                    }
                }
                //drawArgs.TexturesLoadedThisFrame++;
            }

            if (drawArgs.device.RenderState.Lighting)
            {
                drawArgs.device.RenderState.Lighting = false;
            }
            NumberTilesUpdated = 0;



            foreach (SurfaceTile tile in m_RootSurfaceTiles)
            {
                if (tile != null)
                {
                    tile.Render(drawArgs);
                }
            }


            drawArgs.device.RenderState.Lighting = true;
        }
Exemplo n.º 4
0
        public void AddSurfaceImage(SurfaceImage surfaceImage)
        {
            if (surfaceImage.ImageTexture != null)
            {
                lock (m_SurfaceImages.SyncRoot)
                {
                    m_SurfaceImages.Add(surfaceImage);
                    m_SurfaceImages.Sort();
                }

                LastChange = System.DateTime.Now;
            }
            else
            {
                lock (m_TextureLoadQueue.SyncRoot)
                {
                    m_TextureLoadQueue.Enqueue(surfaceImage);
                }
            }
        }