khanat-assets---3d-godot-cl.../meshes/decors/rocks/cliff.gd

74 lines
2.8 KiB
GDScript3
Raw Permalink Normal View History

tool
extends Spatial
## Moss.
# Moss height.
export var moss_height = 10.0 setget set_moss_height, get_moss_height
func set_moss_height( value ):
moss_height = value
for children in self.get_children():
for mesh in children.get_children():
if mesh is MeshInstance:
mesh.get_surface_material( 0 ).next_pass.set_shader_param( "height_thresold", moss_height )
func get_moss_height():
return moss_height
# Moss fade.
export var moss_fade = 5.0 setget set_moss_fade, get_moss_fade
func set_moss_fade( value ):
moss_fade = value
for children in self.get_children():
for mesh in children.get_children():
if mesh is MeshInstance:
mesh.get_surface_material( 0 ).next_pass.set_shader_param( "height_fade", moss_fade )
func get_moss_fade():
return moss_fade
# Moss depth min.
export var moss_depth_min = 0.73 setget set_moss_depth_min, get_moss_depth_min
func set_moss_depth_min( value ):
moss_depth_min = value
for children in self.get_children():
for mesh in children.get_children():
if mesh is MeshInstance:
var ao_gradiant = mesh.get_surface_material( 0 ).next_pass.get_shader_param( "cliff_ao_gradiant" )
ao_gradiant.gradient.offsets[0] = moss_depth_min
ao_gradiant.gradient.colors[0] = Color( 1.0, 1.0, 1.0, 1.0 )
ao_gradiant.gradient.offsets[1] = moss_depth_max
ao_gradiant.gradient.colors[1] = Color( 0.0, 0.0, 0.0, 1.0 )
mesh.get_surface_material( 0 ).next_pass.set_shader_param( "cliff_ao_gradiant", ao_gradiant )
func get_moss_depth_min():
return moss_depth_min
# Moss depth max.
export var moss_depth_max = 0.93 setget set_moss_depth_max, get_moss_depth_max
func set_moss_depth_max( value ):
moss_depth_max = value
for children in self.get_children():
for mesh in children.get_children():
if mesh is MeshInstance:
var ao_gradiant = mesh.get_surface_material( 0 ).next_pass.get_shader_param( "cliff_ao_gradiant" )
ao_gradiant.gradient.offsets[0] = moss_depth_min
ao_gradiant.gradient.colors[0] = Color( 1.0, 1.0, 1.0, 1.0 )
ao_gradiant.gradient.offsets[1] = moss_depth_max
ao_gradiant.gradient.colors[1] = Color( 0.0, 0.0, 0.0, 1.0 )
mesh.get_surface_material( 0 ).next_pass.set_shader_param( "cliff_ao_gradiant", ao_gradiant )
func get_moss_depth_max():
return moss_depth_max
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass