Skip to content

Instantly share code, notes, and snippets.

View foretoo's full-sized avatar

Sergey Borovikov foretoo

View GitHub Profile
@tripzilch
tripzilch / quadtree.js
Last active December 5, 2023 21:59 — forked from L-A/quadtree.js
Basic quadtree implementation in JS
const CAPACITY = 8;
class QuadTree {
constructor(x, y, w, h) {
// the rect (x,y,w,h) defines the product of two half-open intervals: [x, x+w) × [y, y+h)
this.x = x; this.xe = x + w;
this.y = y; this.ye = y + h;
this.w = w;
this.h = h;
this.pts = [];
@mairod
mairod / Webgl shader Hue Shift function
Last active April 26, 2024 07:12
Optimised Hue shift function in GLSL
vec3 hueShift( vec3 color, float hueAdjust ){
const vec3 kRGBToYPrime = vec3 (0.299, 0.587, 0.114);
const vec3 kRGBToI = vec3 (0.596, -0.275, -0.321);
const vec3 kRGBToQ = vec3 (0.212, -0.523, 0.311);
const vec3 kYIQToR = vec3 (1.0, 0.956, 0.621);
const vec3 kYIQToG = vec3 (1.0, -0.272, -0.647);
const vec3 kYIQToB = vec3 (1.0, -1.107, 1.704);
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active June 25, 2024 09:41
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
@nolanlawson
nolanlawson / index.html
Last active December 5, 2023 07:14 — forked from bemson/index.html
Web Worker via blob URL
<!doctype html>
<html lang="en">
<body>
<span id="output"></span>
</body>
<script>
(function () {
var workerBlob = new Blob(
[workerRunner.toString().replace(/^function .+\{?|\}$/g, '')],
{ type:'text/javascript' }
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active June 26, 2024 17:39
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);
@c0ldlimit
c0ldlimit / git_newrepo
Created November 16, 2012 17:14
Git: Push a new or existing repo to Github
# Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/c0ldlimit/vimcolors.git
git push -u origin master
# Push an existing repository from the command line
@gre
gre / easing.js
Last active June 27, 2024 15:37
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {