Skip to content

Instantly share code, notes, and snippets.


HungryProton HungryProton

View GitHub Profile

Keybase proof

I hereby claim:

  • I am hungryproton on github.
  • I am hungryproton ( on keybase.
  • I have a public key ASDsS255eo0PcZ4LvlRg6jyN_9kbixIrw2_oE7_lLxqtdwo

To claim this, I am signing this object:

HungryProton /
Last active February 24, 2023 06:47
Godot shader cache hack
extends Spatial
var _materials := []
var _process_materials := []
var _count := 0
func _ready() -> void:
func extrude(bevel: Array, path: Path):
# Bevel is your cross section, it's an array of Vector3
# Path is the curve we're following
var resolution = 1.0
var curve: Curve3D = path.curve
var length: float = curve.get_baked_length()
var steps: int = floor(length / resolution)
var offset: float = length / steps
HungryProton /
Last active May 5, 2020 11:58
A simple node pool that works with an arbitrary amount of different node types.
extends Node
class_name NodePool
var _pools := {}
func _exit_tree() -> void:
HungryProton /
Last active September 14, 2020 09:04
ECS protoype
This is the base Component class. Every component should inherit from this.
It only stores data. Its only responsibility is to notify the parent Entity when its
created. (Or we could setup something in the Entity to monitor new components
but I just find it easier this way)
extends Node
class_name Component
HungryProton /
Last active July 21, 2020 21:55
UI scaling to make the interface appear larger on high dpi monitors
static func get_scaled_theme(theme: Theme) -> Theme:
var scale = get_editor_scale()
var res: Theme = theme.duplicate(true)
res.default_font.size *= scale
for font_name in res.get_font_list("EditorFonts"):
var font = res.get_font(font_name, "EditorFonts")
font.size *= scale
HungryProton / color_space_conversion.shader
Created September 16, 2020 10:55
convert from rgb to srgb and the other way around in godot shaders
View color_space_conversion.shader
float lts(float L) {
if (abs(L) < 0.0031308) {
return 12.92 * L;
return 1.055 * pow(L, (1.0 / 2.4)) - 0.055;
vec3 rgb_to_srgb(vec3 color) {
return vec3(lts(color.r), lts(color.g), lts(color.b));
HungryProton / smoke_shader.shader
Last active August 4, 2022 17:19
Godot smoke shader test
View smoke_shader.shader
shader_type spatial;
uniform sampler2D mask;
uniform float min_scale = 0.0;
uniform float max_scale = 1.0;
varying float scale;
float range_lerp(float value, float istart, float istop, float ostart, float oend) {
HungryProton /
Last active April 20, 2022 05:29
Spatial gizmo example - A box you can resize
class_name ConceptBoxInput
extends Spatial
signal input_changed
signal property_changed
export var size := Vector3.ONE setget set_size
HungryProton /
Created July 21, 2021 12:04
Editor Inspector plugin example
extends Resource
class_name GridShape
export var size := Vector2.ONE
export var grid := []
func _init() -> void: