-
Notifications
You must be signed in to change notification settings - Fork 22
Brush Tool
Lucas Damian Johnson edited this page Nov 12, 2022
·
3 revisions
The BrushTool is an object that allows you to easily add voxels into the world.
You use voxels from the voxel palette to paint the world.
const brush = new BrushTool();
brush.setXYZ(0,0,0)
.setId("dve:liquiddreadether")
.paint();| Function | Parameters | Returns | Note |
|---|---|---|---|
start |
self |
Enables chunk caching. | |
stop |
self |
Disables chunk caching. | |
setDimension |
id : string
|
self |
Sets the current dimension to paint to. |
setXYZ |
x: number, y: number, z: number
|
self |
Sets position to paint to. |
paint |
self |
Paints the voxel with the current data. | |
erease |
self |
Ereases the voxel at the current position. | |
setId |
id: string, state : number = 0 |
self |
Sets the ID of the current voxel to paint. |
setSecondaryId |
id: string, state : number = 0 |
self |
Sets the secondary ID of the current voxel to paint. |
setState |
state: number
|
self |
Sets voxels state. |
setShapeState |
state: number
|
self |
Sets voxels shape state. |
setRaw |
data : number[]
|
self |
Loads in the raw voxel data into the tool. |
getRaw |
number[] |
Returns a number array that contains the raw voxel data for the brush's current voxel data. |
Currently only available in the WorldData thread the advanced BrushTool can be created like this:
import { DVEW } from "dve/World/DivineVoxelEngineWorld.js";
const brush = DVEW.getBrush();| Function | Parameters | Returns | Note |
|---|---|---|---|
paintAndUpdate |
onDone ?: Function
|
void |
Paint voxel and update the world and then rebuild chunks. |
ereaseAndUpdate |
onDone ?: Function
|
void |
Erease voxel and update the world and then rebuild chunks. |
paintAndAwaitUpdate |
Promise |
Returns a promise to wait for paintAndUpdate to finish. |
|
ereaseAndAwaitUpdate |
Promise |
Returns a promise to wait for ereaseAndUpdate to finish. |
|
explode |
radius : number = 6, onDone ?: Function
|
void |
Explodes an area at the current position with the provided radius. |