コード例 #1
0
 public void ClearBuffers()
 {
     if (BufferInitialized)
     {
         IndexBuffer.Clear(BufferTarget.ElementArrayBuffer);
         VertexBuffer.Clear(BufferTarget.ArrayBuffer);
     }
 }
コード例 #2
0
ファイル: GpuCluster.cs プロジェクト: huangdonghai/titan3d
        public void Cleanup()
        {
            MeshVertices.Clear();
            IndexBuffer.Clear();
            ClusterDatas.Clear();

            ResourceState.ResourceSize = 0;
        }
コード例 #3
0
 public void SetIndices(IEnumerable <int> indices)
 {
     if (!BufferInitialized)
     {
         CreateBuffers();
     }
     IndexBuffer.Clear(BufferTarget.ElementArrayBuffer);
     IndexBuffer.Init(BufferTarget.ElementArrayBuffer, indices.ToArray());
 }
コード例 #4
0
        public void AppendIndices(IEnumerable <int> indices)
        {
            if (!BufferInitialized)
            {
                CreateBuffers();
            }
            var currentIndices = IndexBuffer.Content;

            IndexBuffer.Clear(BufferTarget.ElementArrayBuffer);
            IndexBuffer.Init(BufferTarget.ElementArrayBuffer, currentIndices.Concat(indices).ToArray());
        }
コード例 #5
0
 public void ClearBuffers()
 {
     if (BufferInitialized)
     {
         IndexBuffer.Clear(BufferTarget.ElementArrayBuffer);
         VertexBuffer.Clear(BufferTarget.ArrayBuffer);
     }
     else
     {
         TempIndices.Clear();
         TempVertices.Clear();
     }
 }
コード例 #6
0
        public void SetIndices(IEnumerable <int> indices)
        {
            //if (!BufferInitialized)
            //    CreateBuffers();

            if (BufferInitialized)
            {
                IndexBuffer.Clear(BufferTarget.ElementArrayBuffer);
                IndexBuffer.Init(BufferTarget.ElementArrayBuffer, indices.ToArray());
            }
            else
            {
                TempIndices = indices.ToList();
            }
        }
コード例 #7
0
        public void AppendIndices(IEnumerable <int> indices)
        {
            //if (!BufferInitialized)
            //    CreateBuffers();

            if (BufferInitialized)
            {
                var currentIndices = IndexBuffer.Content;
                IndexBuffer.Clear(BufferTarget.ElementArrayBuffer);
                IndexBuffer.Init(BufferTarget.ElementArrayBuffer, currentIndices.Concat(indices).ToArray());
            }
            else
            {
                TempIndices.AddRange(indices);
            }
        }
コード例 #8
0
ファイル: Mesh.cs プロジェクト: cyril12/Tr3Smoothing
        /// <summary>
        /// Copies the triangle indices into an index buffer.
        /// </summary>
        /// <typeparam name="TIndex">The type of index to use.</typeparam>
        /// <param name="buffer">The index buffer to write indices into.</param>
        /// <param name="transform">Outputs the type of index needed in the buffer.</param>
        private void CopyIndices <TIndex>(IndexBuffer <TIndex> buffer, Func <uint, TIndex> transform) where TIndex : struct
        {
            buffer.Clear();

            int offset;

            TIndex[] indexArray = buffer.WriteDirectly(m_triangles.Length * 3, out offset);

            for (int i = 0; i < m_triangles.Length; i++)
            {
                Triangle triangle = m_triangles[i];

                indexArray[offset]     = transform(triangle.index0);
                indexArray[offset + 1] = transform(triangle.index1);
                indexArray[offset + 2] = transform(triangle.index2);

                offset += 3;
            }
        }
コード例 #9
0
 private void TraverseAffectedFaces(int currentFace)
 {
     TraverseStack.Clear();
     TraverseStack.Push(currentFace);
     AffectedFaceFlags[currentFace] = true;
     while (TraverseStack.Count > 0)
     {
         ConvexFaceInternal convexFaceInternal = FacePool[TraverseStack.Pop()];
         for (int i = 0; i < NumOfDimensions; i++)
         {
             int num = convexFaceInternal.AdjacentFaces[i];
             if (!AffectedFaceFlags[num] && mathHelper.GetVertexDistance(CurrentVertex, FacePool[num]) >= PlaneDistanceTolerance)
             {
                 AffectedFaceBuffer.Add(num);
                 AffectedFaceFlags[num] = true;
                 TraverseStack.Push(num);
             }
         }
     }
 }
コード例 #10
0
        private void FindBeyondVertices(ConvexFaceInternal face, IndexBuffer beyond, IndexBuffer beyond1)
        {
            int         num;
            IndexBuffer beyondBuffer = this.BeyondBuffer;

            this.MaxDistance    = double.NegativeInfinity;
            this.FurthestVertex = 0;
            for (int i = 0; i < beyond1.Count; i++)
            {
                this.VertexMarks[beyond1[i]] = true;
            }
            this.VertexMarks[this.CurrentVertex] = false;
            for (int j = 0; j < beyond.Count; j++)
            {
                num = beyond[j];
                if (num != this.CurrentVertex)
                {
                    this.VertexMarks[num] = false;
                    this.IsBeyond(face, beyondBuffer, num);
                }
            }
            for (int k = 0; k < beyond1.Count; k++)
            {
                num = beyond1[k];
                if (this.VertexMarks[num])
                {
                    this.IsBeyond(face, beyondBuffer, num);
                }
            }
            face.FurthestVertex = this.FurthestVertex;
            IndexBuffer verticesBeyond = face.VerticesBeyond;

            face.VerticesBeyond = beyondBuffer;
            if (verticesBeyond.Count > 0)
            {
                verticesBeyond.Clear();
            }
            this.BeyondBuffer = verticesBeyond;
        }
コード例 #11
0
        private void FindBeyondVertices(ConvexFaceInternal face, IndexBuffer beyond, IndexBuffer beyond1)
        {
            IndexBuffer beyondBuffer = BeyondBuffer;

            MaxDistance    = double.NegativeInfinity;
            FurthestVertex = 0;
            for (int i = 0; i < beyond1.Count; i++)
            {
                VertexVisited[beyond1[i]] = true;
            }
            VertexVisited[CurrentVertex] = false;
            for (int j = 0; j < beyond.Count; j++)
            {
                int num = beyond[j];
                if (num != CurrentVertex)
                {
                    VertexVisited[num] = false;
                    IsBeyond(face, beyondBuffer, num);
                }
            }
            for (int k = 0; k < beyond1.Count; k++)
            {
                int num = beyond1[k];
                if (VertexVisited[num])
                {
                    IsBeyond(face, beyondBuffer, num);
                }
            }
            face.FurthestVertex = FurthestVertex;
            IndexBuffer verticesBeyond = face.VerticesBeyond;

            face.VerticesBeyond = beyondBuffer;
            if (verticesBeyond.Count > 0)
            {
                verticesBeyond.Clear();
            }
            BeyondBuffer = verticesBeyond;
        }
コード例 #12
0
        private void FindBeyondVertices(ConvexFaceInternal face, IndexBuffer beyond)
        {
            IndexBuffer beyondBuffer = this.BeyondBuffer;

            this.MaxDistance    = double.NegativeInfinity;
            this.FurthestVertex = 0;
            for (int i = 0; i < beyond.Count; i++)
            {
                int v = beyond[i];
                if (v != this.CurrentVertex)
                {
                    this.IsBeyond(face, beyondBuffer, v);
                }
            }
            face.FurthestVertex = this.FurthestVertex;
            IndexBuffer verticesBeyond = face.VerticesBeyond;

            face.VerticesBeyond = beyondBuffer;
            if (verticesBeyond.Count > 0)
            {
                verticesBeyond.Clear();
            }
            this.BeyondBuffer = verticesBeyond;
        }
コード例 #13
0
        private void FindBeyondVertices(ConvexFaceInternal face, IndexBuffer beyond)
        {
            IndexBuffer beyondBuffer = BeyondBuffer;

            MaxDistance    = double.NegativeInfinity;
            FurthestVertex = 0;
            for (int i = 0; i < beyond.Count; i++)
            {
                int num = beyond[i];
                if (num != CurrentVertex)
                {
                    IsBeyond(face, beyondBuffer, num);
                }
            }
            face.FurthestVertex = FurthestVertex;
            IndexBuffer verticesBeyond = face.VerticesBeyond;

            face.VerticesBeyond = beyondBuffer;
            if (verticesBeyond.Count > 0)
            {
                verticesBeyond.Clear();
            }
            BeyondBuffer = verticesBeyond;
        }
コード例 #14
0
 /// <summary>
 /// Deposit the index buffer.
 /// </summary>
 /// <param name="buffer">The buffer.</param>
 public void DepositVertexBuffer(IndexBuffer buffer)
 {
     buffer.Clear();
     EmptyBufferStack.Push(buffer);
 }
コード例 #15
0
 /// <summary>
 /// Deposit the index buffer.
 /// </summary>
 /// <param name="buffer"></param>
 public void DepositVertexBuffer(IndexBuffer buffer)
 {
     buffer.Clear();
     EmptyBufferStack.Push(buffer);
 }
コード例 #16
0
 private void TagAffectedFaces(ConvexFaceInternal currentFace)
 {
     AffectedFaceBuffer.Clear();
     AffectedFaceBuffer.Add(currentFace.Index);
     TraverseAffectedFaces(currentFace.Index);
 }