Skip to content

VolumeLook ​

Inherits: RefCounted

The look of a movement volume: a mesh made from its box shape (the top, the bottom or all six faces), with the material you give it (a shader, or a texture). The volume itself draws nothing; this is the water, the lava, the cloud. Static functions, so a test can build a mesh without a node. The mesh is meant for a box shape: other shapes get no look.

Methods ​

ArrayMeshbuild_mesh( size: Vector3, faces: Faces, grid: int = 24, double_sided: bool = true, proportional: bool = false ) static
Materialmake_material( material: Material, texture: Texture2D, tint: Color ) static
ShaderMaterialmake_water_material() static
ShaderMaterialmake_river_material() static
boolhas_flow_parameters( material: Material ) static
boolapply_flow( material: Material, direction: Vector3, strength: float ) static
boolhas_parameter( material: Material, parameter: String, type: int ) static
voidapply_vertex_flow( material: Material, on: bool ) static
voidapply_size( material: Material, box_size: Vector3 ) static
intauto_grid( box_size: Vector3 ) static
ShaderMaterialmake_lava_material() static

Enumerations ​

enum Faces ​

  • NONE = 0
  • TOP = 1
  • BOTTOM = 2
  • ALL_SIDES = 3

Constants ​

  • String WATER_SHADER = "res://addons/chroniclenode/assets/shaders/volume_water.gdshader"
  • String LAVA_SHADER = "res://addons/chroniclenode/assets/shaders/volume_lava.gdshader"
  • String RIVER_SHADER = "res://addons/chroniclenode/assets/shaders/volume_river.gdshader"
  • int SIDE_CELLS = 4 - How many cells the sides of a box are cut in (they are flat: waves are for the top).
  • float AUTO_CELL = 0.5 - The cells of a look mesh when the volume works them out itself (Look grid 0): about this many metres each

Method descriptions ​

ArrayMesh build_mesh( size: Vector3, faces: Faces, grid: int = 24, double_sided: bool = true, proportional: bool = false ) ​

The mesh of a box of this size, centred on the origin: the top and the bottom are grids of grid x grid cells (a shader that moves the surface needs the vertices), the sides are coarse. With double_sided every face is made again looking the other way (a surface seen from under the water). Null for NONE.

Material make_material( material: Material, texture: Texture2D, tint: Color ) ​

The material a look has: the one given, else a plain one with the texture and the tint (see-through when the tint is), else a plain tinted one.

ShaderMaterial make_water_material() ​

The water of the Water preset: the shipped water shader with its usual numbers.

ShaderMaterial make_river_material() ​

The river of the River preset: water that flows (the shader has flow_direction and flow_speed, which a volume with "Look follows flow" sets from its own flow).

bool has_flow_parameters( material: Material ) ​

Does the material have a shader with a flow_direction (vec2) and a flow_speed (float) to set?

bool apply_flow( material: Material, direction: Vector3, strength: float ) ​

Gives the material the flow of a volume: the direction on the ground plane (x and z of the direction in the space of the volume) and the speed. False when the material has no such parameters.

bool has_parameter( material: Material, parameter: String, type: int ) ​

Does the shader of the material have a parameter of this name and type?

void apply_vertex_flow( material: Material, on: bool ) ​

Tells a shader that has a use_vertex_flow switch (the river shader) to take the flow and the banks from the mesh (a river that winds): the colour of a vertex is its flow, the texture x is across the river

void apply_size( material: Material, box_size: Vector3 ) ​

Gives the shader the size of the volume (half of its box), for the water that flattens towards the edge of its volume. Nothing happens when the shader has no volume_half_size.

int auto_grid( box_size: Vector3 ) ​

How many cells the long side of the look has for a box of this size when the grid is automatic: AUTO_CELL metres each, at least 8, at most 128

ShaderMaterial make_lava_material() ​

The lava of the Lava preset.