Skip to content

Instantly share code, notes, and snippets.

View HungryProton's full-sized avatar

HungryProton HungryProton

View GitHub Profile
@FreyaHolmer
FreyaHolmer / GpuPrinter.cginc
Last active November 1, 2024 23:31
A unity shader .cginc to draw numbers in the fragment shader - see the first comment below for example usage!
///////////////////////////////////////////////////////////////////////////////
// ABOUT: A unity Shader .cginc to draw numbers in the fragment shader
// AUTHOR: Freya Holmér
// LICENSE: Use for whatever, commercial or otherwise!
// Don't hold me liable for issues though
// But pls credit me if it works super well <3
// LIMITATIONS: There's some precision loss beyond 3 decimal places
// CONTRIBUTORS: yes please! if you know a more precise way to get
// decimal digits then pls lemme know!
// GetDecimalSymbolAt() could use some more love/precision
@h3r2tic
h3r2tic / raymarch.hlsl
Last active November 14, 2024 18:25
Depth buffer raymarching for contact shadows, SSGI, SSR, etc.
// Copyright (c) 2023 Tomasz Stachowiak
//
// This contribution is dual licensed under EITHER OF
//
// Apache License, Version 2.0, (http://www.apache.org/licenses/LICENSE-2.0)
// MIT license (http://opensource.org/licenses/MIT)
//
// at your option.
#include "/inc/frame_constants.hlsl"
@YuriSizov
YuriSizov / DrawUtils.gd
Last active June 7, 2021 09:13
GraphEdit Minimap GDScript implementation
extends Object
class_name DrawUtils
# Extracted from graph_node.cpp
static func draw_cos_line(node : Node, from_position : Vector2, to_position : Vector2, from_color : Color, to_color : Color, bezier_len_pos : int, bezier_len_neg : int, line_width : float = 1.0, shadow : bool = false) -> void:
var diff = to_position.x - from_position.x
var cp_offset
var cp_len = bezier_len_pos
var cp_neg_len = bezier_len_neg
@YuriSizov
YuriSizov / NodeUtils.gd
Last active December 19, 2021 19:50
A sample code for Godot Editor plugin to play an arbitrary scene from GDScript
extends Object
class_name NodeUtils
static func get_child_by_class(node : Node, child_class : String, counter : int = 1) -> Node:
var match_counter = 0
var node_children = node.get_children()
for child in node_children:
if (child.get_class() == child_class):
match_counter += 1