Skip to content

Instantly share code, notes, and snippets.

@belzecue
belzecue / catmull-rom.gd
Created June 22, 2024 11:55 — forked from JoelBesada/catmull-rom.gd
Catmull-Rom Spline in GDScript
func catmull_rom_spline(
_points: Array, resolution: int = 10, extrapolate_end_points = true
) -> PackedVector2Array:
var points = _points.duplicate()
if extrapolate_end_points:
points.insert(0, points[0] - (points[1] - points[0]))
points.append(points[-1] + (points[-1] - points[-2]))
var smooth_points := PackedVector2Array()
if points.size() < 4:
@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 / 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
@belzecue
belzecue / LinkedList.gd
Last active November 11, 2023 19:25 — forked from bojidar-bg/LinkedList.gd
Doubly Linked List for Godot
# Linked List
# from https://gist.github.com/bojidar-bg/a570c614a4dd1cd84949
# Example use
"""
var my_linked_list = LinkedList.new()
func _ready():
var ll = my_linked_list
export var viewportResizeStanddown = 0.5
var viewportResizeCounter = 0.0
signal settingsChanged()
signal particlesSettingsChanged()
signal removeGpuParticles()
func forbidParticles(time):
particlesForbiddenCounter = time
particlesForbidden = true