Skip to content

Instantly share code, notes, and snippets.

@backwardspy
backwardspy / reactor_control.lua
Last active April 12, 2020 17:26
Big Reactors ComputerCraft control script
-- CONFIGURATION
-- Desired output (RF/t)
local TARGET_OUTPUT = 30000
-- Reserve at least this much energy in the buffer
local BUFFER_MIN = 0.5
-- Attempt to stay below this much energy in the buffer
local BUFFER_MAX = 0.8
@backwardspy
backwardspy / raymarch.glsl
Last active March 2, 2020 20:20
template raymarcher
#define AA 2
const float PI=acos(-1.);
const float EPS=.001,MAX=100.;
const int ITER=128;
float sph(vec3 p, float r){
return length(p)-r;
}
@backwardspy
backwardspy / frag.glsl
Last active February 27, 2020 20:31
blood dragon
#version 410 core
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
uniform sampler1D texFFTIntegrated; // this is continually increasing
uniform sampler2D texChecker;
uniform sampler2D texNoise;
@backwardspy
backwardspy / particles.py
Created May 31, 2019 08:31
Pyxel particle system example
from random import randint as rand, random as randf
import math
import pyxel
class ObjectPool:
"""
ObjectPool is a data structure that grows to fit a set of objects.
"""
- mass
97794.515 kg + (35561.6 kg * 12)
= 524533.715 kg
- velocity
60 mile/h = 96.5606 km/h = 26.82238889 m/s
- displacement
30 feet = 9.144 m
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Init:
Create a context containing all needed devices (CPU(s) + GPU(s) + other(s)).
Create command queues for each device list in the context.
Create memory objects to share memory with coprocessor devices.
Load and link one or more computation kernels.
Usage:
Define an index-space (NDRange) of which the kernel is to be executed.
Set the arguments of the kernel's entry point function.
Enqueue a kernel for execution on one of the command queues for a particular device list.