Example #1
0
        public void SetMesh(Vertex3D[] mesh)
        {
            if (mesh == null)
            {
                _frameworkMessenger.Report("Supplied Mesh is null");
                return;
            }

            var numVertices = mesh.Length;

            var remainder = numVertices % 3;

            if (remainder != 0)
            {
                _frameworkMessenger.Report("Supplied mesh number of vertices is not a multiple of 3. Extra vertices being cut... it's all about triangles baby");
                numVertices -= remainder;
            }

            if (numVertices <= 0)
            {
                return;
            }

            MeshNumberVertices = (uint)numVertices;

            MeshVertexBuffer?.Dispose();

            MeshVertexBuffer = _systemComponents.Factory.CreateBuffer(new BufferDescription(MeshNumberVertices * Vertex3D.SizeInBytes, BufferUsage.VertexBuffer));

            _systemComponents.Device.UpdateBuffer(MeshVertexBuffer, 0, ref mesh[0], MeshNumberVertices * Vertex3D.SizeInBytes);
        }
Example #2
0
 public void DestroyResources()
 {
     LightPropertiesResource?.Dispose();
     LightsResource?.Dispose();
     MeshVertexBuffer?.Dispose();
     _lightingPropertiesDeviceBuffer?.Dispose();
     _lightsDeviceBuffer?.Dispose();
 }