public void AddMultipleBuffers() { var mesh = new MeshA(); mesh.AddBuffer("buffer1", new byte[8]); mesh.AddBuffer("buffer2", new byte[8]); mesh.AddBuffer("buffer3", new byte[8]); }
public void AddDuplicateBuffer() { var mesh = new MeshA(); mesh.AddBuffer("buffer1", new byte[8]); var e = Assert.ThrowsException <System.ArgumentException>(() => mesh.AddBuffer("buffer1", new byte[8])); Assert.IsTrue(e.Message.Contains("A buffer with the given name already exists.")); }
public void ValidAttributeMultipleBuffers() { // Buffer 2 and 3 wouldn't be valid. var mesh = new MeshA(); mesh.AddBuffer("buffer2", new byte[vertexCount * 3]); mesh.AddBuffer("buffer1", new byte[vertexCount * 4]); mesh.AddBuffer("buffer3", new byte[vertexCount * 1]); mesh.ConfigureAttribute(new VertexFloatAttribute("attr1", ValueCount.Four, VertexAttribPointerType.Byte, false), "buffer1", 0, 4); }
public void ValidAttributeSingleBuffer() { var mesh = new MeshA(); mesh.AddBuffer("buffer1", new byte[vertexCount * 4]); mesh.ConfigureAttribute(new VertexFloatAttribute("attr1", ValueCount.Four, VertexAttribPointerType.Byte, false), "buffer1", 0, 4); }
public void ValidAttributeSizeLessThanStride() { // The last element won't actually read one byte past the end of the buffer. var mesh = new MeshA(); mesh.AddBuffer("buffer1", new byte[(vertexCount * 5) - 1]); mesh.ConfigureAttribute(new VertexFloatAttribute("attr1", ValueCount.Four, VertexAttribPointerType.Byte, false), "buffer1", 0, 5); }
public void ValidAttributeStrideTooLarge() { var mesh = new MeshA(); mesh.AddBuffer("buffer1", new byte[vertexCount * 3]); var e = Assert.ThrowsException <ArgumentOutOfRangeException>(() => mesh.ConfigureAttribute(new VertexFloatAttribute("attr1", ValueCount.Four, VertexAttribPointerType.Byte, false), "buffer1", 0, 4)); Assert.IsTrue(e.Message.Contains("One or more attribute data accesses will not be within the specified buffer's data storage")); }
public void InvalidAttributeNegativeOffset() { var mesh = new MeshA(); mesh.AddBuffer("buffer1", buffer1); var e = Assert.ThrowsException <ArgumentOutOfRangeException>(() => mesh.ConfigureAttribute(new VertexFloatAttribute("attr1", ValueCount.Four, VertexAttribPointerType.Byte, false), "buffer1", -5, sizeof(byte) * 4)); Assert.IsTrue(e.Message.Contains("One or more attribute data accesses will not be within the specified buffer's data storage")); }
public void InvalidAttributePointerType() { // The attribute data size is larger than stride. // It's unclear what OpenGL would do in this case. var mesh = new MeshA(); mesh.AddBuffer("buffer1", new byte[vertexCount * 4]); var e = Assert.ThrowsException <ArgumentOutOfRangeException>(() => mesh.ConfigureAttribute(new VertexFloatAttribute("attr1", ValueCount.Four, VertexAttribPointerType.Double, false), "buffer1", 0, 4)); Assert.IsTrue(e.Message.Contains("One or more attribute data accesses will not be within the specified buffer's data storage")); }
public void AddBufferNoExistingBuffers() { var mesh = new MeshA(); mesh.AddBuffer("buffer1", new byte[8]); }
public void AddBufferNoExistingBuffers() { var mesh = new MeshA(); mesh.AddBuffer("buffer1", meshBuffer); }