Skip to content

Instantly share code, notes, and snippets.

@belzecue
belzecue / create_export_pack.sh
Created April 20, 2024 11:41 — forked from pavanpodila/create_export_pack.sh
Export each Git branch as a separate folder
previous_pwd=$PWD
cd $(dirname $0)
PROJECT="$HOME/Desktop/project"
EXPORT_DIR="$HOME/Desktop/export"
rm -rf $EXPORT_DIR
mkdir -p $EXPORT_DIR
/**
* \brief Returns positional offset for a given point as a result of summing 4 gerstner waves
* \param positionWS point in world space
* \param wavelengths wavelength of each of the 4 waves
* \param amplitudes amplitudes of each of the 4 waves
* \param directions direction of each of the 4 waves (each row = one direction). MUST BE NORMALIZED!
* \param speed global speed multiplier. Individual wave speed depends on Wavelength
* \param steepness Gerstner wave 'Steepness' parameter. Modulates the horizontal offset of points
* \param normal returns the normal of given point.
* \return positional offset of the given point
@belzecue
belzecue / ReadOnlyAttribute.cs
Created March 28, 2020 04:05
[Unity] Inspector Read-Only Fields - Shows field data but doesn't allow to modify it
/**
* ReadOnlyAttribute.cs
* Created by: Joao Borks [joao.borks@gmail.com]
* Created on: 05/06/18 (dd/mm//yy)
* Reference from It3ration: https://answers.unity.com/questions/489942/how-to-make-a-readonly-property-in-inspector.html
*/
using UnityEngine;
using System;
@belzecue
belzecue / CameraTrackingRefraction.cs
Created May 21, 2018 19:15 — forked from runevision/CameraTrackingRefraction.cs
Unity CommandBuffer replacement for GrabPass - works with multiple separate cameras.
using UnityEngine;
using UnityEngine.Rendering;
// This script is added to cameras automatically at runtime by the ObjectNeedingRefraction scripts.
public class CameraTrackingRefraction : MonoBehaviour {
[System.NonSerialized]
public int lastRenderedFrame = -1;
Camera cam;
@belzecue
belzecue / GLSL-Noise.md
Last active January 21, 2024 03:20 — forked from patriciogonzalezvivo/GLSL-Noise.md
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);
@belzecue
belzecue / gamepad_debugger.gd
Last active January 16, 2024 02:26 — forked from anthonyec/gamepad_debugger.gd
Godot gamepad input visualisation for debugging (GDScript 2)
# Godot 3.x version of a Godot 4 script written by anthonyec at:
# https://gist.github.com/anthonyec/5342fce79b2b7b22ada748df0ad7f7c0
# This Godot 3.x version available at:
# https://gist.github.com/belzecue/025d8829f69dead512e58f44e990ce30/edit
# Attach script to a Control node.
tool
extends Control
export var device: int = 0
@belzecue
belzecue / text_decal_sdf.shader
Created January 6, 2024 16:39
Godot 3 SDF shader for clear decal edges at low resolutions, as used by Valve
// Generate high-resolution white on black text decal in GIMP and apply Filters > Generic > Distance Map
// then scale down to e.g. 64 pixel height.
// Import decal image into Godot and set:
// Compression mode to lossless
// Filter ON
// Mipmaps ON
// Fix alpha border ON
// Invert color ON (if required)
@belzecue
belzecue / AnimationToPNG.gd
Last active January 1, 2024 17:20
Capture an animation to a PNG sequence, e.g. to turn into an Animated Sprite.
"""
Attach this script to the parent node of an AnimationPlayer.
"""
extends Node2D
export(NodePath) var anim_player_path: NodePath
export(String) var track_name: String
onready var anim_player: AnimationPlayer = get_node(anim_player_path) as AnimationPlayer
onready var tree: SceneTree = get_tree()
class_name RingBuffer extends Reference
"""
Uses simple arrays as ring buffers, passed to these static methods.
Allocates the first two slots for metadata (pointer, queue length).
USAGE:
var rb: Array = RingBuffer.create(5)
@belzecue
belzecue / GdscriptCallSequence.txt
Created November 30, 2023 09:57 — forked from Gnumaru/GdscriptCallSequence.txt
The sequence in which methods and signals gets called in gdscript
# as of godot 4.1
_static_init
_init
_notification 20 Node.NOTIFICATION_SCENE_INSTANTIATED # only on instantiated scene roots
_notification 18 Node.NOTIFICATION_PARENTED
_enter_tree
tree_entered signal
_notification 27 Node.NOTIFICATION_POST_ENTER_TREE
_ready
ready signal