mirror of
https://github.com/HarmonyHoney/ROTA.git
synced 2026-07-17 16:46:17 +00:00
Simplify & optimize Clouds! Instance count now exact (-:
This commit is contained in:
parent
63e7622cf3
commit
897a1125b2
3 changed files with 14 additions and 28 deletions
|
|
@ -15,7 +15,7 @@ export var offset_angle := 0.0
|
|||
|
||||
var gons = []
|
||||
var last_pos := Vector2.ZERO
|
||||
var hair_end = Vector2(-150, 150)
|
||||
var hair_end := Vector2.ZERO
|
||||
|
||||
func _ready():
|
||||
u()
|
||||
|
|
|
|||
|
|
@ -206,13 +206,10 @@ func set_is_rain(arg := is_rain):
|
|||
func create_clouds():
|
||||
cloud_dir = (-1.0 if randf() > 0.5 else 1.0) * rand_range(0.6, 1.0)
|
||||
precip_list = []
|
||||
var ci = 0
|
||||
var bi = 0
|
||||
var wi = 0
|
||||
var ri = 0
|
||||
var pi = 0
|
||||
var pc = precip.get_children()
|
||||
var ps = pc.size()
|
||||
var layers = [[], [], [], []]
|
||||
|
||||
for x in (length / 50.0) + cloud_bonus_rings:
|
||||
for y in max(3, x):
|
||||
|
|
@ -232,15 +229,9 @@ func create_clouds():
|
|||
var t = Transform2D(randf() * TAU, Vector2.ZERO)
|
||||
t = t.scaled(scl)
|
||||
t.origin = pos
|
||||
([clouds, clouds1, clouds2, clouds_rain][layer]).multimesh.set_instance_transform_2d([ci, bi, wi, ri][layer], t)
|
||||
layers[layer].append(t)
|
||||
|
||||
match layer:
|
||||
0: ci += 1
|
||||
1: bi += 1
|
||||
2: wi += 1
|
||||
3: ri += 1
|
||||
|
||||
if is_precip:
|
||||
if is_precip:
|
||||
var p = null
|
||||
if pi < ps:
|
||||
p = pc[pi]
|
||||
|
|
@ -266,7 +257,12 @@ func create_clouds():
|
|||
|
||||
# clouds
|
||||
for i in 4:
|
||||
[clouds, clouds1, clouds2, clouds_rain][i].multimesh.visible_instance_count = [ci, bi, wi, ri][i]
|
||||
var mesh = [clouds, clouds1, clouds2, clouds_rain][i].multimesh
|
||||
var c = layers[i].size()
|
||||
mesh.instance_count = c
|
||||
|
||||
for x in c:
|
||||
mesh.set_instance_transform_2d(x, layers[i][x])
|
||||
|
||||
# particles
|
||||
if pi < ps:
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue