spaceship/resources/DarkMatterResourceGlyph.gd

26 lines
1.2 KiB
GDScript3
Raw Normal View History

extends Control
@export var colour: Color = Color(0.55, 0.15, 0.85)
func _draw() -> void:
var centre: Vector2 = size * 0.5
var radius: float = minf(size.x, size.y) * 0.34
var points := PackedVector2Array()
for i in range(8):
var angle: float = TAU * float(i) / 8.0 - PI * 0.5
points.append(centre + Vector2(cos(angle), sin(angle)) * radius)
# Deep violet glow around a near-black core - not colour.darkened() like
# every other glyph's core, deliberately: dark matter has to read as an
# absence even against deep space, where a merely-darker version of the
# glow colour would still show up as a faint fill instead of a void
# with a rim.
NeonDraw.draw_glowing_polygon(self, points, colour, 1.0, Color(0.04, 0.01, 0.06), maxf(0.5, radius * 0.035))
# A tighter inner ring hints at an event horizon rather than a solid
# body - the same outline-only idiom every glyph already uses, just
# nested once more.
var inner := PackedVector2Array()
for i in range(8):
var angle: float = TAU * float(i) / 8.0 - PI * 0.5
inner.append(centre + Vector2(cos(angle), sin(angle)) * radius * 0.5)
NeonDraw.draw_glowing_polygon(self, inner, colour.lightened(0.25), 0.75, Color(0.04, 0.01, 0.06), maxf(0.35, radius * 0.02))