Skip to content
Snippets Groups Projects
Commit a6aed180 authored by Florent Berthaut's avatar Florent Berthaut
Browse files

Removed old tunnel behavior

parent 8936dadc
No related branches found
No related tags found
No related merge requests found
...@@ -17,8 +17,6 @@ const RADIUS : float = 0.1 ...@@ -17,8 +17,6 @@ const RADIUS : float = 0.1
func _ready(): func _ready():
super._ready() super._ready()
_update_tunnel_preset_array() _update_tunnel_preset_array()
#_generate_slice()
#_update_slices()
_update_multislice() _update_multislice()
func _update_tunnel_preset_array(): func _update_tunnel_preset_array():
...@@ -30,55 +28,6 @@ func _update_tunnel_preset_array(): ...@@ -30,55 +28,6 @@ func _update_tunnel_preset_array():
if child.active: if child.active:
tunnel_preset_array.append(child.get_tunnel_preset_data()) tunnel_preset_array.append(child.get_tunnel_preset_data())
func _generate_slice():
var sli = get_node("Slices")
for s in range(0,NUMBER_OF_SLICES) :
var new_slice = MeshInstance3D.new()
new_slice.position = Vector3((s-NUMBER_OF_SLICES/2)*
(1.0/NUMBER_OF_SLICES), 0, 0)
new_slice.mesh = CylinderMesh.new()
new_slice.mesh.rings = 1
new_slice.mesh.radial_segments = 5
new_slice.mesh.top_radius=RADIUS
new_slice.mesh.bottom_radius=RADIUS
new_slice.mesh.height=1.0/NUMBER_OF_SLICES
new_slice.rotation_degrees = Vector3(0,0,90)
new_slice.set_surface_override_material(0, StandardMaterial3D.new())
new_slice.get_surface_override_material(0).params_cull_mode = StandardMaterial3D.CULL_BACK
sli.add_child(new_slice)
_slices.push_back(new_slice)
func _update_slices() :
var i=0.0
for s in _slices :
var ratio = i / _slices.size()
s.get_surface_override_material(0).albedo_color.s=0.1
s.get_surface_override_material(0).albedo_color.h=0.5
s.get_surface_override_material(0).albedo_color.v=0.5
s.scale.x = 0.5
s.scale.z = 0.5
s.rotation_degrees.x = 0
for param in tunnel_preset_array[_preset_index]:
var value : float = param.curve.sample(ratio)
if value > 1.0 :
value/=127
match param.name:
"tunnel_color_scale" :
s.get_surface_override_material(0).albedo_color.h = fmod(value*5.0,1.0)
s.get_surface_override_material(0).albedo_color.s = 1.0 - abs(value*2.0-1.0)
s.get_surface_override_material(0).albedo_color.v = value
"tunnel_height" :
s.scale.x = value*0.9+0.1
s.scale.z = value*0.9+0.1
"tunnel_rotation" :
s.rotation_degrees.x = value*180
"tunnel_density" :
s.scale.y = value
#FIXME add other params
i+=1.0
func _update_multislice() : func _update_multislice() :
for s in range(_nb_slices) : for s in range(_nb_slices) :
var col : Color var col : Color
...@@ -108,7 +57,6 @@ func _update_multislice() : ...@@ -108,7 +57,6 @@ func _update_multislice() :
sca.x = value*0.8+0.1 sca.x = value*0.8+0.1
pass pass
#trans.basis = trans.basis.from_euler(Vector3(0.0, 0.0, PI/2.0))
trans.basis = Basis.from_euler(rot).scaled(sca) trans.basis = Basis.from_euler(rot).scaled(sca)
$MultiSlice.multimesh.set_instance_transform(s, trans) $MultiSlice.multimesh.set_instance_transform(s, trans)
$MultiSlice.multimesh.set_instance_custom_data(s, Color(col.r,col.g,col.b,1.0)) $MultiSlice.multimesh.set_instance_custom_data(s, Color(col.r,col.g,col.b,1.0))
...@@ -138,7 +86,6 @@ func get_extent(): ...@@ -138,7 +86,6 @@ func get_extent():
func _cycle_preset(): func _cycle_preset():
_preset_index = (_preset_index+1)%tunnel_preset_array.size() _preset_index = (_preset_index+1)%tunnel_preset_array.size()
#pdate_slices()
_update_multislice() _update_multislice()
...@@ -156,5 +103,4 @@ func _update_tunnel(): ...@@ -156,5 +103,4 @@ func _update_tunnel():
func _set_preset_index(val): func _set_preset_index(val):
if val < (get_child_count()-1) and val >= 0: if val < (get_child_count()-1) and val >= 0:
_preset_index = val _preset_index = val
#_update_tunnel()
_update_multislice() _update_multislice()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment