/// <see cref="org.rnp.voxel.utils.IDimensions3D"></see> public IDimensions3D Set(IDimensions3D other) { this._width = other.Width; this._height = other.Height; this._depth = other.Depth; return this; }
/// <see cref="org.rnp.voxel.mesh.IVoxelMesh"/> public virtual void Fill(VoxelLocation start, IDimensions3D size, Color color) { for (int x = 0; x < size.Width; ++x) { for(int y = 0; y < size.Height; ++y) { for(int z = 0; z < size.Depth; ++z) { this[x + start.X, y + start.Y, z + start.Z] = color; } } } }
/// <see cref="org.rnp.voxel.mesh.IVoxelMesh"/> public virtual void Copy(VoxelLocation start, IDimensions3D size, VoxelLocation where, IVoxelMesh toCopy) { for (int x = 0; x < size.Width; ++x) { for (int y = 0; y < size.Height; ++y) { for (int z = 0; z < size.Depth; ++z) { this[where.X + x, where.Y + y, where.Z + z] = toCopy[start.X + x, start.Y + y, start.Z + z]; } } } }
/// <summary> /// Create a copy of an existing IDimensions3D element. /// </summary> /// <param name="toCopy"></param> public Dimensions3D(IDimensions3D toCopy) { this._width = toCopy.Width; this._height = toCopy.Height; this._depth = toCopy.Depth; }
/// <summary> /// Add another dimension 3D /// </summary> /// <param name="other"></param> public IDimensions3D Add(IDimensions3D other) { this._width += other.Width; this._height += other.Height; this._depth += other.Depth; return this; }
/// <summary> /// Copy an existing voxel mesh. /// </summary> /// <param name="toCopy"></param> public SubMesh(ISubMesh toCopy) : base() { this._dimensions = new Dimensions3D(toCopy.Width, toCopy.Height, toCopy.Depth); this._parentMesh = toCopy.ParentMesh; this._start = new VoxelLocation(toCopy.Offset); }
/// <summary> /// Create a custom voxel mesh. /// </summary> /// /// <param name="width"></param> /// <param name="height"></param> /// <param name="depth"></param> public SubMesh(IVoxelMesh parent, IDimensions3D dimensions) : base() { this._dimensions = dimensions.Copy(); this._parentMesh = parent; this._start = VoxelLocation.Zero; }
/// <summary> /// Keep a submesh of an existing mesh. /// </summary> /// <param name="parent"></param> /// <param name="start"></param> /// <param name="dimensions"></param> public SubMesh(IVoxelMesh parent, VoxelLocation start, IDimensions3D dimensions) : base() { this._dimensions = dimensions.Copy(); this._parentMesh = parent; this._start = new VoxelLocation(start); }
/// 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; }