Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/12/16 10:42:58 (8 years ago)
Author:
gkronber
Message:

#1966: fixed various problems: bugs in cloning, bugs in persistence, method names, various minor improvements of source code for readability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/PackingPlanVisualizations/3D/BasicCuboidShape.cs

    r13465 r13497  
    2727
    2828  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; }
    3733
    3834
    39     //Vertices
    4035    private VertexPositionColorNormal[] shapeTriangleVertices;
    4136    private VertexPositionColorNormal[] shapeLineVertices;
    4237
    4338    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;
    4843    }
    4944    public BasicCuboidShape(Vector3 size, int shapeNr) : this(size, new Vector3(0, 0, 0), shapeNr, 0) { }
     
    5348    }
    5449    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);
    6054
    6155      device.SetVertexBuffer(shapeLineBuffer);
     
    6963
    7064    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);
    7669
    7770      device.SetVertexBuffer(shapeTriangleBuffer);
     
    8679
    8780    public Vector3 CalculatePositionRelativeToBottomLeftBackCorner(Vector3 itemSize, Vector3 itemPosition) {
    88       Vector3 newPosition = itemPosition - (shapeSize / 2 - itemSize / 2);
     81      Vector3 newPosition = itemPosition - (ShapeSize / 2 - itemSize / 2);
    8982      return newPosition;
    9083    }
Note: See TracChangeset for help on using the changeset viewer.