예제 #1
0
        protected override void ResizeUVVertices(int newNumberOfVertices)
        {
            var newVerticesUV = new VertexPosition2DUV[newNumberOfVertices];

            Array.Copy(verticesUV, newVerticesUV, verticesUV.Length);
            verticesUV = newVerticesUV;
        }
예제 #2
0
        public void UsingTexturing()
        {
            var vertices = new VertexPosition2DUV[4];

            buffer2D.Add(image, vertices);
            Assert.IsTrue(buffer2D.UsesTexturing);
        }
예제 #3
0
        public void IndicesAreComputedWhenNotPassedAsArgument()
        {
            var vertices = new VertexPosition2DUV[4];

            buffer2D.Add(image, vertices);
            Assert.AreEqual(quadIndices, buffer2D.CachedIndices);
        }
예제 #4
0
		public void ExpectExceptionIfTryingToAddTooManyVertices()
		{
			const int NumberOfTooMuchVertices = CircularBuffer.TotalMaximumVerticesLimit + 1;
			var dummyVertices = new VertexPosition2DUV[1];
			Assert.Throws<CircularBuffer.TooManyVerticesForCircularBuffer>(
				() => buffer2D.Add(null, dummyVertices, new short[1], NumberOfTooMuchVertices, 1));
		}
예제 #5
0
		public void LerpPositionTextured2D()
		{
			var vertex = new VertexPosition2DUV(Vector2D.UnitX, Vector2D.One);
			var vertex2 = new VertexPosition2DUV(Vector2D.UnitY, Vector2D.Zero);
			var lerpedVertex = vertex.Lerp(vertex2, 0.5f);
			Assert.AreEqual(lerpedVertex.Position, Vector2D.Half);
			Assert.AreEqual(lerpedVertex.UV, Vector2D.One);
		}
예제 #6
0
        public void ExpectExceptionIfTryingToAddTooManyVertices()
        {
            const int NumberOfTooMuchVertices = CircularBuffer.TotalMaximumVerticesLimit + 1;
            var       dummyVertices           = new VertexPosition2DUV[1];

            Assert.Throws <CircularBuffer.TooManyVerticesForCircularBuffer>(
                () => buffer2D.Add(null, dummyVertices, new short[1], NumberOfTooMuchVertices, 1));
        }
예제 #7
0
        public void LerpPositionTextured2D()
        {
            var vertex       = new VertexPosition2DUV(Vector2D.UnitX, Vector2D.One);
            var vertex2      = new VertexPosition2DUV(Vector2D.UnitY, Vector2D.Zero);
            var lerpedVertex = vertex.Lerp(vertex2, 0.5f);

            Assert.AreEqual(lerpedVertex.Position, Vector2D.Half);
            Assert.AreEqual(lerpedVertex.UV, Vector2D.One);
        }
예제 #8
0
		public void OffsetIncrement()
		{
			const int VerticesCount = 32;
			const int IndicesCount = 48;
			var vertices = new VertexPosition2DUV[VerticesCount];
			var indices = new short[IndicesCount];
			buffer2D.Add(null, vertices, indices);
			Assert.AreEqual(VerticesCount * vertexSize, buffer2D.VertexOffset);
			Assert.AreEqual(IndicesCount * sizeof(short), buffer2D.IndexOffset);
		}
예제 #9
0
 public void DataBiggerThanBufferSize()
 {
     var verticesCount = buffer2D.MaxNumberOfVertices * 3;
     var indicesCount = buffer2D.MaxNumberOfVertices * 4;
     var vertices = new VertexPosition2DUV[verticesCount];
     var indices = new short[indicesCount];
     buffer2D.Add(null, vertices, indices);
     Assert.AreEqual(verticesCount * vertexSize, buffer2D.VertexOffset);
     Assert.AreEqual(indicesCount * sizeof(short), buffer2D.IndexOffset);
 }
예제 #10
0
        public void IndicesAreRemappedWhenAddedVerticesAreNotAtTheBeginningOfTheBuffer()
        {
            var remappedIndices = new short[] { 4, 5, 6, 4, 6, 7 };
            var vertices        = new VertexPosition2DUV[4];

            buffer2D.Add(image, vertices, quadIndices);
            Assert.AreEqual(quadIndices, buffer2D.CachedIndices);
            buffer2D.Add(image, vertices, quadIndices);
            Assert.AreEqual(remappedIndices, buffer2D.CachedIndices);
        }
예제 #11
0
        public void DataBiggerThanBufferSize()
        {
            var verticesCount = buffer2D.MaxNumberOfVertices * 3;
            var indicesCount  = buffer2D.MaxNumberOfVertices * 4;
            var vertices      = new VertexPosition2DUV[verticesCount];
            var indices       = new short[indicesCount];

            buffer2D.Add(null, vertices, indices);
            Assert.AreEqual(verticesCount * vertexSize, buffer2D.VertexOffset);
            Assert.AreEqual(indicesCount * sizeof(short), buffer2D.IndexOffset);
        }
예제 #12
0
        public void OffsetIncrement()
        {
            const int VerticesCount = 32;
            const int IndicesCount  = 48;
            var       vertices      = new VertexPosition2DUV[VerticesCount];
            var       indices       = new short[IndicesCount];

            buffer2D.Add(null, vertices, indices);
            Assert.AreEqual(VerticesCount * vertexSize, buffer2D.VertexOffset);
            Assert.AreEqual(IndicesCount * sizeof(short), buffer2D.IndexOffset);
        }
예제 #13
0
 public void DataBiggerThanHalfOfTheBufferSize()
 {
     const int VerticesCount = 12288;
     const int IndicesCount = 16384;
     var vertices = new VertexPosition2DUV[VerticesCount];
     var indices = new short[IndicesCount];
     buffer2D.Add(null, vertices, indices);
     Assert.AreEqual(VerticesCount * vertexSize, buffer2D.VertexOffset);
     Assert.AreEqual(IndicesCount * sizeof(short), buffer2D.IndexOffset);
     Assert.IsFalse(buffer2D.HasDrawn);
 }
예제 #14
0
        public void DataBiggerThanHalfOfTheBufferSize()
        {
            const int VerticesCount = 12288;
            const int IndicesCount  = 16384;
            var       vertices      = new VertexPosition2DUV[VerticesCount];
            var       indices       = new short[IndicesCount];

            buffer2D.Add(null, vertices, indices);
            Assert.AreEqual(VerticesCount * vertexSize, buffer2D.VertexOffset);
            Assert.AreEqual(IndicesCount * sizeof(short), buffer2D.IndexOffset);
            Assert.IsFalse(buffer2D.HasDrawn);
        }
예제 #15
0
        public void MakeBufferResize()
        {
            const int VerticesCount = 12288;
            const int IndicesCount  = 16384;
            var       vertices      = new VertexPosition2DUV[VerticesCount];
            var       indices       = new short[IndicesCount];

            buffer2D.Add(null, vertices, indices);
            Assert.IsFalse(buffer2D.HasDrawn);
            buffer2D.Add(null, vertices, indices);
            Assert.IsTrue(buffer2D.HasDrawn);
        }
예제 #16
0
        private void AddVerticesRotated(Sprite sprite, Vector2D rotationCenter)
        {
            float sin = MathExtensions.Sin(rotation);
            float cos = MathExtensions.Cos(rotation);

            if (!hasUV)
            {
                var color = sprite.Color;
                verticesColor[verticesIndex++] = new VertexPosition2DColor(
                    ScreenSpace.Current.ToPixelSpaceRounded(
                        drawArea.TopLeft.RotateAround(rotationCenter, sin, cos)), color);
                verticesColor[verticesIndex++] = new VertexPosition2DColor(
                    ScreenSpace.Current.ToPixelSpaceRounded(
                        drawArea.BottomLeft.RotateAround(rotationCenter, sin, cos)), color);
                verticesColor[verticesIndex++] = new VertexPosition2DColor(
                    ScreenSpace.Current.ToPixelSpaceRounded(
                        drawArea.BottomRight.RotateAround(rotationCenter, sin, cos)), color);
                verticesColor[verticesIndex++] = new VertexPosition2DColor(
                    ScreenSpace.Current.ToPixelSpaceRounded(
                        drawArea.TopRight.RotateAround(rotationCenter, sin, cos)), color);
            }
            else if (hasColor)
            {
                var color = sprite.Color;
                verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
                    ScreenSpace.Current.ToPixelSpaceRounded(
                        drawArea.TopLeft.RotateAround(rotationCenter, sin, cos)), color, uv.TopLeft);
                verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
                    ScreenSpace.Current.ToPixelSpaceRounded(
                        drawArea.BottomLeft.RotateAround(rotationCenter, sin, cos)), color, uv.BottomLeft);
                verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
                    ScreenSpace.Current.ToPixelSpaceRounded(
                        drawArea.BottomRight.RotateAround(rotationCenter, sin, cos)), color, uv.BottomRight);
                verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
                    ScreenSpace.Current.ToPixelSpaceRounded(
                        drawArea.TopRight.RotateAround(rotationCenter, sin, cos)), color, uv.TopRight);
            }
            else
            {
                verticesUV[verticesIndex++] = new VertexPosition2DUV(
                    screen.ToPixelSpaceRounded(drawArea.TopLeft.RotateAround(rotationCenter, sin, cos)),
                    uv.TopLeft);
                verticesUV[verticesIndex++] = new VertexPosition2DUV(
                    screen.ToPixelSpaceRounded(drawArea.BottomLeft.RotateAround(rotationCenter, sin, cos)),
                    uv.BottomLeft);
                verticesUV[verticesIndex++] = new VertexPosition2DUV(
                    screen.ToPixelSpaceRounded(drawArea.BottomRight.RotateAround(rotationCenter, sin, cos)),
                    uv.BottomRight);
                verticesUV[verticesIndex++] = new VertexPosition2DUV(
                    screen.ToPixelSpaceRounded(drawArea.TopRight.RotateAround(rotationCenter, sin, cos)),
                    uv.TopRight);
            }
        }
예제 #17
0
		public void OffsetSeveralIncrements()
		{
			const int VerticesCount = 32;
			const int IndicesCount = 48;
			var vertices = new VertexPosition2DUV[VerticesCount];
			var indices = new short[IndicesCount];
			for (int i = 1; i <= IncrementCount; i++)
			{
				buffer2D.Add(null, vertices, indices);
				Assert.AreEqual(i * VerticesCount * vertexSize, buffer2D.VertexOffset);
				Assert.AreEqual(i * IndicesCount * sizeof(short), buffer2D.IndexOffset);
			}
		}
예제 #18
0
        public void OffsetSeveralIncrements()
        {
            const int VerticesCount = 32;
            const int IndicesCount  = 48;
            var       vertices      = new VertexPosition2DUV[VerticesCount];
            var       indices       = new short[IndicesCount];

            for (int i = 1; i <= IncrementCount; i++)
            {
                buffer2D.Add(null, vertices, indices);
                Assert.AreEqual(i * VerticesCount * vertexSize, buffer2D.VertexOffset);
                Assert.AreEqual(i * IndicesCount * sizeof(short), buffer2D.IndexOffset);
            }
        }
예제 #19
0
        public void DrawAndReset()
        {
            const int VerticesCount = 32;
            const int IndicesCount  = 48;
            var       vertices      = new VertexPosition2DUV[VerticesCount];
            var       indices       = new short[IndicesCount];

            buffer2D.Add(null, vertices, indices);
            Assert.IsFalse(buffer2D.HasDrawn);
            buffer2D.DrawAllTextureChunks();
            Assert.IsTrue(buffer2D.HasDrawn);
            Assert.AreEqual(512, buffer2D.VertexOffset);
            Assert.AreEqual(96, buffer2D.IndexOffset);
        }
예제 #20
0
		public Batch2D(Material material, BlendMode blendMode, 
			int minimumNumberOfQuads = MinNumberOfQuads)
		{
			Material = material;
			BlendMode = blendMode;
			minimumNumberOfQuads = MathExtensions.Max(minimumNumberOfQuads, MinNumberOfQuads);
			hasUV = ((material.Shader.Flags & ShaderFlags.Textured) != 0);
			hasColor = ((material.Shader.Flags & ShaderFlags.Colored) != 0);
			indices = new short[minimumNumberOfQuads * IndicesPerQuad];
			if (!hasUV)
				verticesColor = new VertexPosition2DColor[minimumNumberOfQuads * VerticesPerQuad];
			else if (hasColor)
				verticesColorUV = new VertexPosition2DColorUV[minimumNumberOfQuads * VerticesPerQuad];
			else
				verticesUV = new VertexPosition2DUV[minimumNumberOfQuads * VerticesPerQuad];
		}
예제 #21
0
        public void LoadDataWithDifferentSize()
        {
            const int Data1VerticesCount = 100;
            const int Data1IndicesCount  = 150;
            const int Data2VerticesCount = 400;
            const int Data2IndicesCount  = 500;
            var       vertices1          = new VertexPosition2DUV[Data1VerticesCount];
            var       indices1           = new short[Data1IndicesCount];
            var       vertices2          = new VertexPosition2DUV[Data2VerticesCount];
            var       indices2           = new short[Data2IndicesCount];

            buffer2D.Add(null, vertices1, indices1);
            Assert.AreEqual(Data1VerticesCount * vertexSize, buffer2D.VertexOffset);
            Assert.AreEqual(Data1IndicesCount * sizeof(short), buffer2D.IndexOffset);
            buffer2D.Add(null, vertices2, indices2);
            Assert.AreEqual((Data1VerticesCount + Data2VerticesCount) * vertexSize, buffer2D.VertexOffset);
            Assert.AreEqual((Data1IndicesCount + Data2IndicesCount) * sizeof(short), buffer2D.IndexOffset);
        }
예제 #22
0
 public Batch2D(Material material, BlendMode blendMode,
                int minimumNumberOfQuads = MinNumberOfQuads)
 {
     Material             = material;
     BlendMode            = blendMode;
     minimumNumberOfQuads = MathExtensions.Max(minimumNumberOfQuads, MinNumberOfQuads);
     hasUV    = ((material.Shader.Flags & ShaderFlags.Textured) != 0);
     hasColor = ((material.Shader.Flags & ShaderFlags.Colored) != 0);
     indices  = new short[minimumNumberOfQuads * IndicesPerQuad];
     if (!hasUV)
     {
         verticesColor = new VertexPosition2DColor[minimumNumberOfQuads * VerticesPerQuad];
     }
     else if (hasColor)
     {
         verticesColorUV = new VertexPosition2DColorUV[minimumNumberOfQuads * VerticesPerQuad];
     }
     else
     {
         verticesUV = new VertexPosition2DUV[minimumNumberOfQuads * VerticesPerQuad];
     }
 }
예제 #23
0
        }         //ncrunch: no coverage end

        private void AddVerticesNotRotated(Sprite sprite)
        {
            if (!hasUV)
            {
                var color = sprite.Color;
                verticesColor[verticesIndex++] = new VertexPosition2DColor(
                    ScreenSpace.Current.ToPixelSpaceRounded(drawArea.TopLeft), color);
                verticesColor[verticesIndex++] = new VertexPosition2DColor(
                    ScreenSpace.Current.ToPixelSpaceRounded(drawArea.BottomLeft), color);
                verticesColor[verticesIndex++] = new VertexPosition2DColor(
                    ScreenSpace.Current.ToPixelSpaceRounded(drawArea.BottomRight), color);
                verticesColor[verticesIndex++] = new VertexPosition2DColor(
                    ScreenSpace.Current.ToPixelSpaceRounded(drawArea.TopRight), color);
            }
            else if (hasColor)
            {
                var color = sprite.Color;
                verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
                    ScreenSpace.Current.ToPixelSpaceRounded(drawArea.TopLeft), color, uv.TopLeft);
                verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
                    ScreenSpace.Current.ToPixelSpaceRounded(drawArea.BottomLeft), color, uv.BottomLeft);
                verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
                    ScreenSpace.Current.ToPixelSpaceRounded(drawArea.BottomRight), color, uv.BottomRight);
                verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
                    ScreenSpace.Current.ToPixelSpaceRounded(drawArea.TopRight), color, uv.TopRight);
            }
            else
            {
                verticesUV[verticesIndex++] =
                    new VertexPosition2DUV(screen.ToPixelSpaceRounded(drawArea.TopLeft), uv.TopLeft);
                verticesUV[verticesIndex++] =
                    new VertexPosition2DUV(screen.ToPixelSpaceRounded(drawArea.BottomLeft), uv.BottomLeft);
                verticesUV[verticesIndex++] =
                    new VertexPosition2DUV(screen.ToPixelSpaceRounded(drawArea.BottomRight), uv.BottomRight);
                verticesUV[verticesIndex++] =
                    new VertexPosition2DUV(screen.ToPixelSpaceRounded(drawArea.TopRight), uv.TopRight);
            }
        }
예제 #24
0
 public void MakeBufferResize()
 {
     const int VerticesCount = 12288;
     const int IndicesCount = 16384;
     var vertices = new VertexPosition2DUV[VerticesCount];
     var indices = new short[IndicesCount];
     buffer2D.Add(null, vertices, indices);
     Assert.IsFalse(buffer2D.HasDrawn);
     buffer2D.Add(null, vertices, indices);
     Assert.IsTrue(buffer2D.HasDrawn);
 }
예제 #25
0
		private void AddVerticesRotated(Sprite sprite, Vector2D rotationCenter)
		{
			float sin = MathExtensions.Sin(rotation);
			float cos = MathExtensions.Cos(rotation);
			if (!hasUV)
			{
				var color = sprite.Color;
				verticesColor[verticesIndex++] = new VertexPosition2DColor(
					ScreenSpace.Current.ToPixelSpaceRounded(
					drawArea.TopLeft.RotateAround(rotationCenter, sin, cos)), color);
				verticesColor[verticesIndex++] = new VertexPosition2DColor(
					ScreenSpace.Current.ToPixelSpaceRounded(
					drawArea.BottomLeft.RotateAround(rotationCenter, sin, cos)), color);
				verticesColor[verticesIndex++] = new VertexPosition2DColor(
						ScreenSpace.Current.ToPixelSpaceRounded(
						drawArea.BottomRight.RotateAround(rotationCenter, sin, cos)), color);
				verticesColor[verticesIndex++] = new VertexPosition2DColor(
					ScreenSpace.Current.ToPixelSpaceRounded(
					drawArea.TopRight.RotateAround(rotationCenter, sin, cos)), color);
			}
			else if (hasColor)
			{
				var color = sprite.Color;
				verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
					ScreenSpace.Current.ToPixelSpaceRounded(
					drawArea.TopLeft.RotateAround(rotationCenter, sin, cos)), color, uv.TopLeft);
				verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
					ScreenSpace.Current.ToPixelSpaceRounded(
					drawArea.BottomLeft.RotateAround(rotationCenter, sin, cos)), color, uv.BottomLeft);
				verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
					ScreenSpace.Current.ToPixelSpaceRounded(
					drawArea.BottomRight.RotateAround(rotationCenter, sin, cos)), color, uv.BottomRight);
				verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
					ScreenSpace.Current.ToPixelSpaceRounded(
					drawArea.TopRight.RotateAround(rotationCenter, sin, cos)), color, uv.TopRight);
			}
			else
			{
				verticesUV[verticesIndex++] = new VertexPosition2DUV(
					screen.ToPixelSpaceRounded(drawArea.TopLeft.RotateAround(rotationCenter, sin, cos)),
					uv.TopLeft);
				verticesUV[verticesIndex++] = new VertexPosition2DUV(
					screen.ToPixelSpaceRounded(drawArea.BottomLeft.RotateAround(rotationCenter, sin, cos)),
					uv.BottomLeft);
				verticesUV[verticesIndex++] = new VertexPosition2DUV(
					screen.ToPixelSpaceRounded(drawArea.BottomRight.RotateAround(rotationCenter, sin, cos)),
					uv.BottomRight);
				verticesUV[verticesIndex++] = new VertexPosition2DUV(
					screen.ToPixelSpaceRounded(drawArea.TopRight.RotateAround(rotationCenter, sin, cos)),
					uv.TopRight);
			}
		}
예제 #26
0
		protected override void ResizeUVVertices(int newNumberOfVertices)
		{
			var newVerticesUV = new VertexPosition2DUV[newNumberOfVertices];
			Array.Copy(verticesUV, newVerticesUV, verticesUV.Length);
			verticesUV = newVerticesUV;
		}
예제 #27
0
		//ncrunch: no coverage start
		private void AddVerticesAtlasRotated(Sprite sprite)
		{
			if (!hasUV)
			{
				var color = sprite.Color;
				verticesColor[verticesIndex++] = new VertexPosition2DColor(
					ScreenSpace.Current.ToPixelSpaceRounded(drawArea.TopLeft), color);
				verticesColor[verticesIndex++] = new VertexPosition2DColor(
					ScreenSpace.Current.ToPixelSpaceRounded(drawArea.BottomLeft), color);
				verticesColor[verticesIndex++] = new VertexPosition2DColor(
						ScreenSpace.Current.ToPixelSpaceRounded(drawArea.BottomRight), color);
				verticesColor[verticesIndex++] = new VertexPosition2DColor(
					ScreenSpace.Current.ToPixelSpaceRounded(drawArea.TopRight), color);
			}
			else if (hasColor)
			{
				var color = sprite.Color;
				verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
					ScreenSpace.Current.ToPixelSpaceRounded(drawArea.TopLeft), color, uv.TopLeft);
				verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
					ScreenSpace.Current.ToPixelSpaceRounded(drawArea.BottomLeft), color, uv.BottomLeft);
				verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
					ScreenSpace.Current.ToPixelSpaceRounded(drawArea.BottomRight), color, uv.BottomRight);
				verticesColorUV[verticesIndex++] = new VertexPosition2DColorUV(
					ScreenSpace.Current.ToPixelSpaceRounded(drawArea.TopRight), color, uv.TopRight);
			}
			else
			{
				verticesUV[verticesIndex++] =
					new VertexPosition2DUV(screen.ToPixelSpaceRounded(drawArea.TopLeft), uv.TopLeft);
				verticesUV[verticesIndex++] =
					new VertexPosition2DUV(screen.ToPixelSpaceRounded(drawArea.BottomLeft), uv.BottomLeft);
				verticesUV[verticesIndex++] =
					new VertexPosition2DUV(screen.ToPixelSpaceRounded(drawArea.BottomRight), uv.BottomRight);
				verticesUV[verticesIndex++] =
					new VertexPosition2DUV(screen.ToPixelSpaceRounded(drawArea.TopRight), uv.TopRight);
			}
		}
예제 #28
0
 public void IndicesAreNotChangedWhenPassedAsArgument()
 {
     var vertices = new VertexPosition2DUV[4];
     buffer2D.Add(image, vertices, quadIndices);
     Assert.AreEqual(quadIndices, buffer2D.CachedIndices);
 }
예제 #29
0
 public void DrawAndReset()
 {
     const int VerticesCount = 32;
     const int IndicesCount = 48;
     var vertices = new VertexPosition2DUV[VerticesCount];
     var indices = new short[IndicesCount];
     buffer2D.Add(null, vertices, indices);
     Assert.IsFalse(buffer2D.HasDrawn);
     buffer2D.DrawAllTextureChunks();
     Assert.IsTrue(buffer2D.HasDrawn);
     Assert.AreEqual(512, buffer2D.VertexOffset);
     Assert.AreEqual(96, buffer2D.IndexOffset);
 }
예제 #30
0
 public void IndicesAreRemappedWhenAddedVerticesAreNotAtTheBeginningOfTheBuffer()
 {
     var remappedIndices = new short[] { 4, 5, 6, 4, 6, 7 };
     var vertices = new VertexPosition2DUV[4];
     buffer2D.Add(image, vertices, quadIndices);
     Assert.AreEqual(quadIndices, buffer2D.CachedIndices);
     buffer2D.Add(image, vertices, quadIndices);
     Assert.AreEqual(remappedIndices, buffer2D.CachedIndices);
 }
예제 #31
0
 public void LoadDataWithDifferentSize()
 {
     const int Data1VerticesCount = 100;
     const int Data1IndicesCount = 150;
     const int Data2VerticesCount = 400;
     const int Data2IndicesCount = 500;
     var vertices1 = new VertexPosition2DUV[Data1VerticesCount];
     var indices1 = new short[Data1IndicesCount];
     var vertices2 = new VertexPosition2DUV[Data2VerticesCount];
     var indices2 = new short[Data2IndicesCount];
     buffer2D.Add(null, vertices1, indices1);
     Assert.AreEqual(Data1VerticesCount * vertexSize, buffer2D.VertexOffset);
     Assert.AreEqual(Data1IndicesCount * sizeof(short), buffer2D.IndexOffset);
     buffer2D.Add(null, vertices2, indices2);
     Assert.AreEqual((Data1VerticesCount + Data2VerticesCount) * vertexSize, buffer2D.VertexOffset);
     Assert.AreEqual((Data1IndicesCount + Data2IndicesCount) * sizeof(short), buffer2D.IndexOffset);
 }
예제 #32
0
 public void UsingTexturing()
 {
     var vertices = new VertexPosition2DUV[4];
     buffer2D.Add(image, vertices);
     Assert.IsTrue(buffer2D.UsesTexturing);
 }