Skip to content

Instantly share code, notes, and snippets.

View snowflower's full-sized avatar
🎯
Focusing

Snowflower snowflower

🎯
Focusing
View GitHub Profile
@snowflower
snowflower / _expm1.gd
Created January 9, 2025 08:54
Compute exp(x) - 1 without loss of precision for small values of x. example snippet from godot game code
##
## Compute exp(x) - 1 without loss of precision for small values of x.
## https://www.johndcook.com/blog/cpp_expm1/
##
## usage for exponential smoothing in games/animation e.g.:
## for any value of dt (delta time):
##
## position += (target - position) * (1 - exp(- speed * dt))
##
## changed to use -expm1(x) instead of 1-exp(x)
@snowflower
snowflower / bakeable_NoiseTexture2d.gd
Last active December 13, 2024 14:14
Custom class of NoiseTexture2D that gives an option to bake the generated noise texture. See comments for revisions and original source this is based on.
@tool
extends NoiseTexture2D
class_name BakeableNoiseTexture2D
#
# Custom class for bakeable NoiseTexture2D resource
#
# based on code by @fabimakesgames.bsky.social
# https://gist.github.com/nan0m/c280761802c6dfc86533d1de89d27dae
# bsky post: https://bsky.app/profile/fabimakesgames.bsky.social/post/3ld4teamupk2i