protected override void ResizeUVVertices(int newNumberOfVertices) { var newVerticesUV = new VertexPosition3DUV[newNumberOfVertices]; Array.Copy(verticesUV, newVerticesUV, verticesUV.Length); verticesUV = newVerticesUV; }
public void CircularBufferCannotHandleMoreThan65536Vertices() { Assert.AreEqual(1024, buffer3D.MaxNumberOfVertices); var vertices = new VertexPosition3DUV[65536]; buffer3D.Add(image, vertices); buffer3D.Add(image, vertices); Assert.AreEqual(65536, buffer3D.MaxNumberOfVertices); }
public void VertexPositionTextured3D() { Assert.AreEqual(VertexPosition3DUV.SizeInBytes, 20); var vertex = new VertexPosition3DUV(Vector3D.UnitX, Vector2D.One); Assert.AreEqual(vertex.Format, VertexFormat.Position3DUV); Assert.AreEqual(vertex.Position, Vector3D.UnitX); Assert.AreEqual(vertex.UV, Vector2D.One); }
public void LerpPositionTextured3D() { var vertex = new VertexPosition3DUV(Vector3D.UnitX, Vector2D.One); var vertex2 = new VertexPosition3DUV(Vector2D.UnitY, Vector2D.Zero); var lerpedVertex = vertex.Lerp(vertex2, 0.5f); Assert.AreEqual(lerpedVertex.Position, new Vector3D(0.5f, 0.5f, 0f)); Assert.AreEqual(lerpedVertex.UV, Vector2D.One); }
public void Make3DBufferResize() { const int VerticesCount = 12288; const int IndicesCount = 16384; var vertices = new VertexPosition3DUV[VerticesCount]; var indices = new short[IndicesCount]; buffer3D.Add(null, vertices, indices); Assert.IsFalse(buffer3D.HasDrawn); buffer3D.Add(null, vertices, indices); Assert.IsTrue(buffer3D.HasDrawn); }
public Batch3D(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 VertexPosition3DColor[minimumNumberOfQuads * VerticesPerQuad]; //ncrunch: no coverage else if (hasColor) verticesColorUV = new VertexPosition3DColorUV[minimumNumberOfQuads * VerticesPerQuad]; else verticesUV = new VertexPosition3DUV[minimumNumberOfQuads * VerticesPerQuad]; //ncrunch: no coverage }
public Batch3D(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 VertexPosition3DColor[minimumNumberOfQuads * VerticesPerQuad]; //ncrunch: no coverage } else if (hasColor) { verticesColorUV = new VertexPosition3DColorUV[minimumNumberOfQuads * VerticesPerQuad]; } else { verticesUV = new VertexPosition3DUV[minimumNumberOfQuads * VerticesPerQuad]; //ncrunch: no coverage } }