/// <summary>
    ///   Return child dimensions.
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <param name="z"></param>
    /// <returns></returns>
    protected IDimensions3D GetDimensionsFor(int x, int y, int z)
    {
      Dimensions3D childDimensions = new Dimensions3D();

      if (x == 0)
      {
        childDimensions.Width = this._node.Width / 2;
      }
      else
      {
        childDimensions.Width = this._node.Width - (this._node.Width / 2);
      }

      if (y == 0)
      {
        childDimensions.Height = this._node.Height / 2;
      }
      else
      {
        childDimensions.Height = this._node.Height - (this._node.Height / 2);
      }

      if (z == 0)
      {
        childDimensions.Depth = this._node.Depth / 2;
      }
      else
      {
        childDimensions.Depth = this._node.Depth - (this._node.Depth / 2);
      }

      return childDimensions;
    }
Ejemplo n.º 2
0
    public void Awake()
    {
      this._objectTransform = this.gameObject.transform;

      this._location = new VoxelLocation();
      this._dimensions = new Dimensions3D(1, 1, 1);
    }
    /// <see cref="org.rnp.voxel.mesh.IVoxelMesh"/>
    public virtual void Copy(VoxelLocation from, VoxelLocation to, VoxelLocation where, IVoxelMesh toCopy)
    {
      Dimensions3D size = new Dimensions3D(
        to.X - from.X, to.Y - from.Y, to.Z - from.Z
      );

      this.Copy(from, size, where, toCopy);
    }
 /// <summary>
 ///   Create an empty voxel mesh.
 /// </summary>
 public ArrayVoxelMesh() : base()
 {
   this._dimensions = new Dimensions3D();
   this._datas = new Color32[0, 0, 0];
   this.emptyVoxels = 0;
 }
 /// <summary>
 ///   Copy an existing voxel mesh.
 /// </summary>
 /// <param name="toCopy"></param>
 public ArrayVoxelMesh(IVoxelMesh toCopy) : base()
 {
   this._dimensions = new Dimensions3D(toCopy.Width, toCopy.Height, toCopy.Depth);
   this._datas = new Color32[
     this.Width,
     this.Height,
     this.Depth
   ];
   this.emptyVoxels = this.Width * this.Height * this.Depth;
   this.Copy(toCopy.Start, toCopy.End, VoxelLocation.Zero, toCopy);
 }
 /// Create a custom voxel mesh.
 /// 
 /// <param name="dimensions"></param>
 public ArrayVoxelMesh(IDimensions3D dimensions) : base()
 {
   this._dimensions = new Dimensions3D(dimensions);
   this._datas = new Color32[
     this.Width, 
     this.Height, 
     this.Depth
   ];
   this.Clear();
   this.emptyVoxels = this.Width * this.Height * this.Depth;
 }
 /// <summary>
 ///   Create a custom voxel mesh.
 /// </summary>
 /// 
 /// <param name="width"></param>
 /// <param name="height"></param>
 /// <param name="depth"></param>
 public ArrayVoxelMesh(int width, int height, int depth) : base()
 {
   this._dimensions = new Dimensions3D(width, height, depth);
   this._datas = new Color32[width, height, depth];
   this.Clear();
   this.emptyVoxels = width * height * depth;
 }