mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-20 21:07:17 +01:00
Draw the bevel and radius to the world editor's rects for the test continent.
This commit is contained in:
parent
4e8e860562
commit
bedb1ae4a2
@ -198,10 +198,10 @@ func get_editor_class() -> String:
|
||||
func get_editor_additional_text() -> String:
|
||||
return ""
|
||||
|
||||
func eitor_draw_additional(rect_view_node : MarginContainer) -> void:
|
||||
_eitor_draw_additional(rect_view_node)
|
||||
func eitor_draw_additional(control : Control) -> void:
|
||||
_eitor_draw_additional(control)
|
||||
|
||||
func _eitor_draw_additional(rect_view_node : MarginContainer) -> void:
|
||||
func _eitor_draw_additional(control : Control) -> void:
|
||||
pass
|
||||
|
||||
func setup_property_inspector(inspector) -> void:
|
||||
|
@ -8,6 +8,45 @@ export(float) var continent_base : float = 0
|
||||
var voxel_scale : float = 1
|
||||
var current_seed : int = 0
|
||||
|
||||
func _eitor_draw_additional(control : Control) -> void:
|
||||
gui_draw_continent_radius(control, Color(0.6, 0.6, 0.6, 1))
|
||||
gui_draw_continent_bevel(control, Color(1, 1, 1, 1))
|
||||
|
||||
func gui_draw_continent_radius(control : Control, color : Color) -> void:
|
||||
var s : Vector2 = control.get_size()
|
||||
|
||||
var points : PoolVector2Array
|
||||
var ofsx : float = (1 - (continent_radius * 2)) * s.x / 2.0
|
||||
var ofsy : float = (1 - (continent_radius * 2)) * s.y / 2.0
|
||||
|
||||
for i in range(16):
|
||||
var ifl : float = float(i)
|
||||
var n : float = ifl / 16.0 * 2 * PI
|
||||
var n1 : float = (ifl + 1.0) / 16.0 * 2 * PI
|
||||
|
||||
points.push_back(Vector2((sin(n) + 1.0) * 0.5 * continent_radius * 2 * s.x + ofsx, (cos(n) + 1.0) * 0.5 * continent_radius * 2 * s.y + ofsy))
|
||||
points.push_back(Vector2((sin(n1) + 1.0) * 0.5 * continent_radius * 2 * s.x + ofsx, (cos(n1) + 1.0) * 0.5 * continent_radius * 2 * s.y + ofsy))
|
||||
|
||||
control.draw_polyline(points, color, 1)
|
||||
|
||||
func gui_draw_continent_bevel(control : Control, color : Color) -> void:
|
||||
var s : Vector2 = control.get_size()
|
||||
|
||||
var points : PoolVector2Array
|
||||
var bevel_radius : float = (min(continent_radius, continent_bevel) / continent_radius) / 2.0
|
||||
var ofsx : float = (1 - (bevel_radius * 2)) * s.x / 2.0
|
||||
var ofsy : float = (1 - (bevel_radius * 2)) * s.y / 2.0
|
||||
|
||||
for i in range(16):
|
||||
var ifl : float = float(i)
|
||||
var n : float = ifl / 16.0 * 2 * PI
|
||||
var n1 : float = (ifl + 1.0) / 16.0 * 2 * PI
|
||||
|
||||
points.push_back(Vector2((sin(n) + 1.0) * 0.5 * bevel_radius * 2 * s.x + ofsx, (cos(n) + 1.0) * 0.5 * bevel_radius * 2 * s.y + ofsy))
|
||||
points.push_back(Vector2((sin(n1) + 1.0) * 0.5 * bevel_radius * 2 * s.x + ofsx, (cos(n1) + 1.0) * 0.5 * bevel_radius * 2 * s.y + ofsy))
|
||||
|
||||
control.draw_polyline(points, color, 1)
|
||||
|
||||
func get_continent_radius() -> float:
|
||||
return continent_radius
|
||||
|
||||
|
@ -44,7 +44,7 @@ subzone_props = [ SubResource( 5 ), SubResource( 6 ) ]
|
||||
[sub_resource type="Resource" id=3]
|
||||
resource_name = "TestForest"
|
||||
script = ExtResource( 7 )
|
||||
rect = Rect2( 8.75557, 6.875, 21.9944, 11.2839 )
|
||||
rect = Rect2( 8.85557, 6.975, 21.9944, 11.2839 )
|
||||
min_size = Vector2i( 1, 1 )
|
||||
max_size = Vector2i( 1e+06, 1e+06 )
|
||||
locked = false
|
||||
|
Loading…
Reference in New Issue
Block a user