WaterMesh
Extends: MeshInstance2D
Description
Water Mesh is the visual object that draws the water for Dungeondraft. There is one per level.
Properties
Level | Level |
WaterPreMesh | PreMesh |
Line2D[] | Lines |
Color | DeepColor |
Color | ShallowColor |
float | BlendDistance |
Texture | BorderTexture |
Texture | RippleTexture |
ArrayMesh | arrayMesh |
ShaderMaterial | material |
bool | premeshInverted |
bool | queueUpdateMesh |
bool | disableBorder |
Methods
Dictionary | Save ( bool copy = false ) |
void | Load ( Dictionary data ) |
void | Resize ( int x, int y, int w, int h ) |
void | CreateMesh ( ) |
void | OnDrawingBegin ( bool inverted ) |
void | OnDrawingEnd ( ) |
void | Cancel ( ) |
void | SetCircle ( Vector2 position, int size ) |
void | DrawRect ( Rect2 rect, bool invertAction ) |
void | DrawCircle ( Rect2 rect, int sides, bool invertAction ) |
void | DrawPolygon ( Vector2[] points, bool invertAction ) |
void | AddPolygon ( Vector2[] points, Rect2 bounds, bool invertAction ) |
void | QueueUpdate ( ) |
void | UpdateMesh ( bool restore = false ) |
void | UpdateLines ( ) |
Line2D | AddLine ( Vector2[] points, Texture texture ) |
void | DisableBorder ( bool value ) |
Property Descriptions
- Level Level:
Gets the level where the water mesh belongs.
- WaterPreMesh PreMesh:
Special mesh that is used to brush the water with stylized edges. It is the yellow shape the user sees while painting before the water is added.
- Line2D[] Lines:
Gets the Line2D representing the border of the water. DO NOT MODIFY.
- Color DeepColor:
Gets or sets the deep water color. Call UpdateMesh() for it to visually update.
- Color ShallowColor:
Gets or sets the shallow water color. Call UpdateMesh() for it to visually update.
- float BlendDistance:
Gets or sets the water blend distance between shallow and deep. Call UpdateMesh() for it to visually update.
- Texture BorderTexture:
Gets or sets the border texture. Call UpdateMesh() for it to visually update.
- Texture RippleTexture:
Gets or sets the ripple texture. Call UpdateMesh() for it to visually update.
- ArrayMesh arrayMesh:
Gets the mesh primitive that renders the water.
- ShaderMaterial material:
Gets the material that shades the water.
- bool premeshInverted:
Used to inform that the user is trying to erase, so the PreMesh will be subtracted, rather than added to the current water.
- bool queueUpdateMesh:
Set by QueueUpdate() so that Dungeondraft knows to update the water when it is next possible.
- bool disableBorder:
Gets if the border is disabled. Do not set directly. Call SetDisableBorder() instead.
Method Descriptions
- Dictionary Save ( bool copy = false ):
Save the water into the save file format and return it as a Dictionary. The param copy is only used by copy-pasting feature of Dungeondraft.
- void Load ( Dictionary data ):
Load a saved water data. Used by a saved map file to load existing water.
- void Resize ( int x, int y, int w, int h ):
Called automatically when the canvas is resized. DO NOT CALL DIRECTLY. FOR REFERENCE ONLY.
- void CreateMesh ( ):
Called automatically on new map or load map to prepare a water mesh. No need to call manually.
- void OnDrawingBegin ( bool inverted ):
Prepares the premesh for drawing.
- void OnDrawingEnd ( ):
Finishes the premesh for drawing and queues an update.
- void Cancel ( ):
Cancels any edits currently in the PreMesh.
- void DrawRect ( Rect2 rect, bool invertAction ):
Draws a rectangle directly onto the Mesh, not the PreMesh.
- void DrawCircle ( Rect2 rect, int sides, bool invertAction ):
Draws a circle directly onto the Mesh, not the PreMesh.
- void DrawPolygon ( Vector2[] points, bool invertAction ):
Draws a polygon directly onto the Mesh, not the PreMesh.
- void AddPolygon ( Vector2[] points, Rect2 bounds, bool invertAction ):
The internal method DrawRect(), DrawCircle(), and DrawPolygon() all call to draw onto the water. Not advisable to call directly.
- void QueueUpdate ( ):
Queue an update to the water mesh.
- void UpdateMesh ( bool restore = false ):
Update the water mesh. Heavy CPU workload.
- void UpdateLines ( ):
Update the water border.
- Line2D AddLine ( Vector2[] points, Texture texture ):
Used internally to draw a border around the water. Any manual changes will be deleted by UpdateLines() in an update.
- void DisableBorder ( bool value ):
Toggles the border visibility.