Exemplo n.º 1
0
 private void DestroyTimerQueue()
 {
     lock (_timerSyncRoot)
         _timerCompletionQueue.Clear();
     Debug.Assert(TimerQueue != null);
     TimerQueue.Dispose();
     TimerQueue = null;
 }
Exemplo n.º 2
0
        public void Dispose()
        {
            GC.SuppressFinalize(this);

            LinkedListEntry <KMemoryBlock> e = Blocks.HeadEntry;

            while (e != null)
            {
                Partition.Free(e.Value);
                e = e.Next;
            }
            Blocks.Clear();
        }
Exemplo n.º 3
0
        public void Clear()
        {
            List <int> textureIds          = new List <int>();
            LinkedListEntry <MGLTexture> e = _values.HeadEntry;

            while (e != null)
            {
                textureIds.Add(e.Value.TextureID);
                e = e.Next;
            }
            _values.Clear();
            Gl.glDeleteTextures(textureIds.Count, textureIds.ToArray());
        }
Exemplo n.º 4
0
        public override void Stop()
        {
            if ((_timer != null) &&
                (_kernel.TimerQueue != null))
            {
                _kernel.TimerQueue.StopTimer(_timer);
            }
            _timer = null;

            if (_buffer != null)
            {
                _buffer.Clear();
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 清空缓存
 /// </summary>
 public void ClearCache()
 {
     _noRef.Clear();
 }
Exemplo n.º 6
0
        /**
         * Recursive version of ClipOutTriangles. This method partitions the triangles
         * in @triangles using @node's split plane, and then recursively calls itself
         * with the resulting greater-than and less-than lists. If the recursion reaches a
         * point where triangles in @triangles are on the back side of @node's split plane,
         * but this instance of BSPTree contains no geometry on that side (node.LessThan == null),
         * then the triangles placed in @lessThan are deleted from @triangles. This removes
         * the portions of triangles in @triangles that lie inside the geometry of this BSPTree
         * instance.
         *
         * If @clippLessThan is false, then we perform the reverse of the above oepration.
         * Triangles placed in @greaterThan than are removed when node.GreaterThan == null.
         * In that case the portions of triangles in @triangles that lie outside the geometry
         * of this BSPTree instance are removed.
         */
        private void ClipOutTriangles(Node node, FastLinkedList<Triangle> triangles, bool clipLessThan = true, IList<Triangle> discarded = null)
        {
            if (triangles == null || triangles.First == null)return;
            if(node == null)return;

            FastLinkedList<Triangle> lessThan = new FastLinkedList<Triangle>();
            FastLinkedList<Triangle> greaterThan = new FastLinkedList<Triangle>();

            // iterate through each triangle in @triangles and classify/partition each according
            // @node's split plane. triangles on the front side go into @greaterThan, triangles
            // on the back side go into @lessThan. co-planar triangles whose normal matches that of
            // @node's split plane go into @greaterThan; the rest go into @lessThan.
            triangles.Iterate((Triangle tri) => {
                Partitioner.Orientation orient = Partitioner.SliceTriangle(tri, node.SplitPlane, lessThan, greaterThan, lessThan, greaterThan);
            });

            // release memory used by @triangles
            triangles.Clear();

            // recurse on the back side of @node's split plane if this BSPTree contains
            // geometry on that side. if it does not, and we want to clip out triangles
            // inside this BSPTree's geometry (@clipLessThan == true), then we clear out @lessThan.
            if(node.LessThan != null)
                ClipOutTriangles (node.LessThan, lessThan, clipLessThan, discarded);
            else if(clipLessThan)
            {
                if(discarded != null)lessThan.CopyInto(discarded);
                lessThan.Clear();
            }

            // recurse on the front side of @node's split plane if this BSPTree contains
            // geometry on that side. if it does not, and we want to clip out triangles
            // outside this BSPTree's geometry (@clipLessThan == false), then we clear out @greaterThan.
            if(node.GreaterThan != null)
                ClipOutTriangles (node.GreaterThan, greaterThan, clipLessThan, discarded);
            else if(!clipLessThan)
            {
                if(discarded != null)greaterThan.CopyInto(discarded);
                greaterThan.Clear();
            }

            // rebuild @triangles with the properly clipped triangles
            triangles.AppendIntoList(lessThan);
            triangles.AppendIntoList(greaterThan);
        }
Exemplo n.º 7
0
        /**
         * Rescursive version of AddTriangles. This method partitions the triangles
         * in @triangles using @node's split plane, and then recursively calls itself
         * with the resulting greater-than and less-than lists.
         */
        private void AddTriangles(Node node, FastLinkedList<Triangle> triangles)
        {
            if (triangles == null)return;
            if(node == null)return;

            // get a reference to the list of triangles that are co-planar with
            // @node's split plane
            FastLinkedList<Triangle> nodeTriangles =  node.GetTriangleList();

            FastLinkedList<Triangle> lessThan = new FastLinkedList<Triangle> ();
            FastLinkedList<Triangle> greaterThan = new FastLinkedList<Triangle> ();

            // iterate through each triangle in @triangles and classify/partition each according
            // @node's split plane. co-planar triangles go into @nodeTriangles, triangles on the front
            // side go into @greaterThan, traingles on the back side go into @lessThan.
            triangles.Iterate((Triangle tri) => {
                Partitioner.Orientation orient = Partitioner.SliceTriangle(tri, node.SplitPlane, lessThan, greaterThan, nodeTriangles, nodeTriangles);
            });

            // release clear memory occupied by @triangles
            triangles.Clear();

            // recurse on the back side of @node's split plane
            if(lessThan.First != null)
            {
                if(node.LessThan == null)
                    node.LessThan = Node.Create(lessThan.First.Value.OrientationPlane);
                AddTriangles(node.LessThan, lessThan);
            }

            // recurse on the front side of @node's split plane
            if(greaterThan.First != null)
            {
                if( node.GreaterThan == null)
                    node.GreaterThan = Node.Create(greaterThan.First.Value.OrientationPlane);
                AddTriangles(node.GreaterThan,  greaterThan);
            }
        }