Пример #1
0
        /// <summary>
        /// Copies the source to the target array. Note that this is an unsafe operation, if you supply wrong offset/count values
        /// it can lead to memory corruption!
        /// </summary>
        public static unsafe void Copy(Vertex[] source, int sourceOffset, Vertex[] target, int targetOffset, int count)
        {
            // The following fixed statement pins the location of the source and 
            // target objects in memory so that they will not be moved by garbage 
            // collection. 
            fixed (Vertex* pSource = source, pTarget = target)
            {
                // Set the starting points in source and target for the copying. 
                Vertex* ps = pSource + sourceOffset;
                Vertex* pt = pTarget + targetOffset;

                // Copy the specified number of bytes from source to target. 
                for (int i = 0; i < count; i++)
                {
                    *pt = *ps;
                    pt++;
                    ps++;
                }
            }
        }
Пример #2
0
 private Vertex DefaultVertex() {
     Vertex vertex = new Vertex();
     vertex.Position = new Vector2 (0.0f, 0.0f);
     vertex.TexCoords = new Vector2(0.0f, 0.0f);
     return vertex;
 }
Пример #3
0
 private Vertex AnyVertex() {
     Vertex vertex = new Vertex();
     vertex.Position = new Vector2 (1.0f, 2.0f);
     vertex.TexCoords = new Vector2(3.0f, 4.0f);
     return vertex;
 }
Пример #4
0
 public void CompareVertex (Vertex v1, Vertex v2)
 {
     CompareVector(v1.Position, v2.Position);;
     CompareVector(v1.TexCoords, v2.TexCoords);
 }