Added library support for non-integer radius spheres and cylinders.

This commit is contained in:
TomyLobo
2011-08-07 05:10:59 +02:00
parent a527b59770
commit 9d98ca3db8
9 changed files with 49 additions and 46 deletions

View File

@ -41,7 +41,7 @@ public class BrushTool implements TraceTool {
private Mask mask = null;
private Brush brush = new SphereBrush();
private Pattern material = new SingleBlockPattern(new BaseBlock(BlockID.COBBLESTONE));
private int size = 1;
private double size = 1;
private String permission;
/**
@ -125,17 +125,17 @@ public class BrushTool implements TraceTool {
*
* @return
*/
public int getSize() {
public double getSize() {
return size;
}
/**
* Set the set brush size.
*
* @param size
* @param radius
*/
public void setSize(int size) {
this.size = size;
public void setSize(double radius) {
this.size = radius;
}
/**

View File

@ -39,6 +39,6 @@ public interface Brush {
* @param size
* @throws MaxChangedBlocksException
*/
public void build(EditSession editSession, Vector pos, Pattern mat, int size)
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
throws MaxChangedBlocksException;
}

View File

@ -34,7 +34,7 @@ public class ClipboardBrush implements Brush {
this.noAir = noAir;
}
public void build(EditSession editSession, Vector pos, Pattern mat, int size)
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
throws MaxChangedBlocksException {
clipboard.place(editSession,
pos.subtract(clipboard.getSize().divide(2)), noAir);

View File

@ -31,7 +31,7 @@ public class CylinderBrush implements Brush {
this.height = height;
}
public void build(EditSession editSession, Vector pos, Pattern mat, int size)
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
throws MaxChangedBlocksException {
editSession.makeCylinder(pos, mat, size, height);
}

View File

@ -31,7 +31,7 @@ public class HollowCylinderBrush implements Brush {
this.height = height;
}
public void build(EditSession editSession, Vector pos, Pattern mat, int size)
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
throws MaxChangedBlocksException {
editSession.makeHollowCylinder(pos, mat, size, height);
}

View File

@ -28,7 +28,7 @@ public class HollowSphereBrush implements Brush {
public HollowSphereBrush() {
}
public void build(EditSession editSession, Vector pos, Pattern mat, int size)
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
throws MaxChangedBlocksException {
editSession.makeSphere(pos, mat, size, false);
}

View File

@ -36,9 +36,9 @@ public class SmoothBrush implements Brush {
this.iterations = iterations;
}
public void build(EditSession editSession, Vector pos, Pattern mat, int size)
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
throws MaxChangedBlocksException {
int rad = size;
double rad = size;
Vector min = pos.subtract(rad, rad, rad);
Vector max = pos.add(rad, rad + 10, rad);
Region region = new CuboidRegion(min, max);

View File

@ -28,7 +28,7 @@ public class SphereBrush implements Brush {
public SphereBrush() {
}
public void build(EditSession editSession, Vector pos, Pattern mat, int size)
public void build(EditSession editSession, Vector pos, Pattern mat, double size)
throws MaxChangedBlocksException {
editSession.makeSphere(pos, mat, size, true);
}