Skip to content

Instantly share code, notes, and snippets.

View Jellonator's full-sized avatar
🏳️‍⚧️

Jocelyn Beedie Jellonator

🏳️‍⚧️
View GitHub Profile
local function dowobble(cel, data, dataoffset)
local img = cel.image:clone()
-- local selection = cel.sprite.selection
for it in img:pixels() do
local nx = it.x
local ny = it.y
local seed = data.dir == "y" and it.x or it.y
-- Frequency is number of pixels it takes to perform full phase
local pos = (seed + dataoffset) / data.frequency
local offset = math.floor(math.sin(pos * math.pi * 2) * data.amplitude)
func gen_random_in_cone(theta: float) -> Vector3:
var z = rand_range(cos(theta), 1.0)
var phi = rand_range(0.0, PI * 2.0)
var tmp = sqrt(1 - z*z)
return Vector3(tmp * cos(phi), tmp * sin(phi), z)
@Jellonator
Jellonator / godot_mode7_shader.shader
Created January 2, 2020 22:42
Mode 7 shader for Godot
shader_type canvas_item;
uniform mat4 TRANSFORM;
uniform vec2 DEPTH;
uniform bool REPEAT_X;
uniform bool REPEAT_Y;
uniform bool FLIP;
void fragment() {
// Create the matrix. A workaround is used to modify the matrix's W column
#!/usr/bin/python3
import argparse
import struct
import math
import operator
parser = argparse.ArgumentParser()
parser.add_argument('input', metavar="INPUT", type=argparse.FileType('rb'),
nargs=1, help='the TMESH file to open')