This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code adapted from: https://www.shadertoy.com/view/WlsSRr Cubemap sampling | |
shader_type spatial; | |
uniform sampler2D tex; | |
varying vec3 v; | |
void vertex() { | |
v = normalize(VERTEX); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func process_lines_pass1(lines): | |
var addr = 0 | |
var line_num = 0 | |
for line in lines: | |
line_num += 1 | |
var label = "" | |
var directive = "" | |
var op_code = -1 | |
var op_token = "" | |
var no_comment_line = remove_comment(line, ";") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Control | |
# Code to flip between 0 and 1 speed comparisons | |
func _ready(): | |
const MILLION = 1_000_000 | |
var start = Time.get_ticks_msec() | |
var x = 1 | |
for n in MILLION: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func _notification(what): | |
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: | |
if not Input.is_key_pressed(KEY_F8): | |
get_tree().quit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.shadertoy.com/view/lslSR7 | |
shader_type canvas_item; | |
vec3 hsv(float h,float s,float v) { | |
return mix(vec3(1.),clamp((abs(fract(h+vec3(3.,2.,1.)/3.)*6.-3.)-1.),0.,1.),s)*v; | |
} | |
float circle(vec2 p, float r) { | |
return smoothstep(0.1, 0.0, abs(length(p)-r)); // try changing the 0.1 to 0.3 | |
} | |
void fragment() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Control | |
func _on_button_pressed(): | |
var html: String = $Src.text | |
# Find start of table | |
var idx1 = html.find("boardtable") | |
if idx1 > 0: | |
var idx2 = html.find("</table", idx1) | |
if idx2 > 0: | |
var table = html.substr(idx1, idx2 - idx1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This shader creates a 2D image that may be used as a Equirectangular panorama background | |
// It creates fairly evenly spread stars (blobs) on a black background | |
// Todo: randomly modulate the positions via theta and radius | |
shader_type canvas_item; | |
uniform float samples = 1000.0; | |
void fragment() { | |
// Project from plane onto a sphere | |
float phi = PI * UV.y; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
const float PI = 3.14159265358979323846; | |
const float w = 0.1; // Width of line | |
void fragment() { | |
float dis = 0.1; // Displacement (spacing) of lines | |
// Get an angle value around a circle of 0.0 .. 1.0 | |
vec2 pt = (UV - vec2(0.5)) * 2.0; // +/-1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I/O values are in the range 0.0 .. 1.0 | |
func rgb_to_hsv(c: Color): | |
var M: float = rgb.max() | |
var m: float = rgb.min() | |
var v = M | |
var s = 0.0 if M < 0.001 else 1.0 - m / M | |
var h = (c.r - c.g / 2.0 - c.b / 2.0) / sqrt(c.r*c.r + c.g*c.g + c.b*c.b - c.r*c.g - c.r*c.b - c.g*c.b) | |
return { h=h, s=s, v=v } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class_name Audio | |
var player: AudioStreamPlayer | |
var info | |
func _init(audio_player_instance): | |
player = audio_player_instance | |
func load_data(path: String): |
NewerOlder