Changeset 13497 for branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/BasicCuboidShape.cs
- Timestamp:
- 01/12/16 10:42:58 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/BasicCuboidShape.cs
r13465 r13497 27 27 28 28 public class BasicCuboidShape { 29 //Basic information 30 private readonly Vector3 shapeSize; 31 public Vector3 ShapeSize { get { return shapeSize; } } 32 private readonly Vector3 shapePosition; 33 public Vector3 ShapePosition { get { return shapePosition; } } 34 private readonly int shapeID; 35 public int ShapeID { get { return shapeID; } } 36 public int Material { get; set; } 29 public Vector3 ShapeSize { get; private set; } 30 public Vector3 ShapePosition { get; private set; } 31 public int ShapeID { get; private set; } 32 public int Material { get; private set; } 37 33 38 34 39 //Vertices40 35 private VertexPositionColorNormal[] shapeTriangleVertices; 41 36 private VertexPositionColorNormal[] shapeLineVertices; 42 37 43 38 public BasicCuboidShape(Vector3 size, Vector3 position, int shapeNr, int material) { 44 shapeSize = size;45 shapePosition = position;46 shapeID = shapeNr;47 this.Material = material;39 ShapeSize = size; 40 ShapePosition = position; 41 ShapeID = shapeNr; 42 Material = material; 48 43 } 49 44 public BasicCuboidShape(Vector3 size, int shapeNr) : this(size, new Vector3(0, 0, 0), shapeNr, 0) { } … … 53 48 } 54 49 public void RenderShapeLines(GraphicsDevice device, Color color) { 55 shapeLineVertices = (new CuboidShapePreparations(shapeSize, shapePosition, color)).CreateVertexDefinitionsForEdgeLines(); 56 Buffer<VertexPositionColorNormal> shapeLineBuffer = Buffer.Vertex.New( 57 device, 58 shapeLineVertices); 59 VertexInputLayout inputLayoutLine = VertexInputLayout.FromBuffer(0, shapeLineBuffer); 50 shapeLineVertices = 51 new CuboidShapePreparations(ShapeSize, ShapePosition, color).CreateVertexDefinitionsForEdgeLines(); 52 var shapeLineBuffer = Buffer.Vertex.New(device, shapeLineVertices); 53 var inputLayoutLine = VertexInputLayout.FromBuffer(0, shapeLineBuffer); 60 54 61 55 device.SetVertexBuffer(shapeLineBuffer); … … 69 63 70 64 public void RenderShapeTriangles(GraphicsDevice device, Color color) { 71 shapeTriangleVertices = (new CuboidShapePreparations(shapeSize, shapePosition, color)).CreateVertexDefinitionsForTriangles(); 72 Buffer<VertexPositionColorNormal> shapeTriangleBuffer = Buffer.Vertex.New( 73 device, 74 shapeTriangleVertices); 75 VertexInputLayout inputLayoutTriangles = VertexInputLayout.FromBuffer(0, shapeTriangleBuffer); 65 shapeTriangleVertices = 66 new CuboidShapePreparations(ShapeSize, ShapePosition, color).CreateVertexDefinitionsForTriangles(); 67 var shapeTriangleBuffer = Buffer.Vertex.New(device, shapeTriangleVertices); 68 var inputLayoutTriangles = VertexInputLayout.FromBuffer(0, shapeTriangleBuffer); 76 69 77 70 device.SetVertexBuffer(shapeTriangleBuffer); … … 86 79 87 80 public Vector3 CalculatePositionRelativeToBottomLeftBackCorner(Vector3 itemSize, Vector3 itemPosition) { 88 Vector3 newPosition = itemPosition - ( shapeSize / 2 - itemSize / 2);81 Vector3 newPosition = itemPosition - (ShapeSize / 2 - itemSize / 2); 89 82 return newPosition; 90 83 }
Note: See TracChangeset
for help on using the changeset viewer.