-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
171 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: macbury.forge.editor.DesktopLauncher | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
editor/src/macbury/forge/editor/selection/EreaseSelection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package macbury.forge.editor.selection; | ||
|
||
/** | ||
* Created by macbury on 06.11.14. | ||
*/ | ||
public class EreaseSelection extends BoxSelection { | ||
@Override | ||
public SelectType getSelectType() { | ||
return SelectType.Replace; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
editor/src/macbury/forge/editor/undo_redo/actions/EraserBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package macbury.forge.editor.undo_redo.actions; | ||
|
||
import macbury.forge.editor.selection.AbstractSelection; | ||
import macbury.forge.voxel.VoxelMap; | ||
import macbury.forge.voxel.VoxelMaterial; | ||
|
||
/** | ||
* Created by macbury on 06.11.14. | ||
*/ | ||
public class EraserBlock extends TerrainCursorChangeable { | ||
private VoxelMaterial oldMaterials[][][]; | ||
|
||
public EraserBlock(AbstractSelection selection, VoxelMap map) { | ||
super(selection, map); | ||
} | ||
|
||
@Override | ||
public void revert() { | ||
for (int x = (int)applyBox.min.x; x < applyBox.max.x; x++) { | ||
for (int y = (int)applyBox.min.y; y < applyBox.max.y; y++) { | ||
for (int z = (int)applyBox.min.z; z < applyBox.max.z; z++) { | ||
VoxelMaterial mat = oldMaterials[x - (int)applyBox.min.x][y - (int)applyBox.min.y][z - (int)applyBox.min.z]; | ||
if (mat == null) { | ||
map.setEmptyForPosition(x,y,z); | ||
} else { | ||
map.setMaterialForPosition(mat, x,y,z); | ||
} | ||
|
||
} | ||
} | ||
} | ||
|
||
oldMaterials = null; | ||
} | ||
|
||
@Override | ||
public void apply() { | ||
this.oldMaterials = new VoxelMaterial[(int)applyBox.getWidth()][(int)applyBox.getHeight()][(int)applyBox.getDepth()]; | ||
for (int x = (int)applyBox.min.x; x < applyBox.max.x; x++) { | ||
for (int y = (int)applyBox.min.y; y < applyBox.max.y; y++) { | ||
for (int z = (int)applyBox.min.z; z < applyBox.max.z; z++) { | ||
if (!map.isEmpty(x,y,z)) { | ||
oldMaterials[x - (int)applyBox.min.x][y - (int)applyBox.min.y][z - (int)applyBox.min.z] = map.getMaterialForPosition(x,y,z); | ||
} | ||
map.setEmptyForPosition(x,y,z); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.