Skip to content

Instantly share code, notes, and snippets.

View jeremyabel's full-sized avatar

Jeremy Abel jeremyabel

View GitHub Profile
package org.ygl.openrndr.demos
import org.openrndr.application
import org.openrndr.color.rgb
import org.openrndr.draw.LineCap
import org.openrndr.draw.renderTarget
import org.openrndr.extra.compositor.compose
import org.openrndr.extra.compositor.draw
import org.openrndr.extra.compositor.post
import org.openrndr.extra.fx.blur.FrameBlur
@SammyJames
SammyJames / UnifiedDelegate.h
Last active May 20, 2019 18:46
A wrapper to handle native and script delegates
#pragma once
#include "Delegate.h"
#include "Delegates/IDelegateInstance.h"
#include "LogMacros.h"
#include "UnrealTypeTraits.h"
namespace Private
{
template <bool, class T>
from math import *
# a performant solution would store a prefix sum of line lengths to
# a sidechannel and then use that to do a bsearch; on the GPU,
# you'd do a sum tree / histopyramid as a preprocessing step
def find_point(points, d):
d = d
for i in range(1, len(points)):
x0,y0 = points[i-1]
x1,y1 = points[i]
@mattatz
mattatz / Matrix.hlsl
Last active November 2, 2024 14:10
Matrix operations for HLSL
#ifndef __MATRIX_INCLUDED__
#define __MATRIX_INCLUDED__
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
float4x4 inverse(float4x4 m) {
float n11 = m[0][0], n12 = m[1][0], n13 = m[2][0], n14 = m[3][0];
float n21 = m[0][1], n22 = m[1][1], n23 = m[2][1], n24 = m[3][1];
float n31 = m[0][2], n32 = m[1][2], n33 = m[2][2], n34 = m[3][2];
float n41 = m[0][3], n42 = m[1][3], n43 = m[2][3], n44 = m[3][3];
/* this code is licensed CC-0 https://creativecommons.org/publicdomain/zero/1.0/ . use as you see fit.*/
function distance(a, b) {
/* Find the Euclidean distance between two 2-dimensional points.
*
* a: the first point.
* b: the second point.
*
* returns: the distance.
*/
var ncp = require('ncp').ncp;
var copyobj = require('../package.json').copy;
for (var prop in copyobj) {
ncp(copyobj[prop].src, copyobj[prop].dest, function (err) {
if (err) {
return console.error(err);
@jonobr1
jonobr1 / auto-capture.scpt
Last active September 6, 2024 19:20
A small AppleScript to take a screenshot every 30 seconds for 8 hours. Saves to an Image Sequence in a desktop folder. Great for recording your workday.
set dFolder to "~/Desktop/screencapture/"
do shell script ("mkdir -p " & dFolder)
set i to 0
repeat 960 times
do shell script ("screencapture " & dFolder & "frame-" & i & ".png")
delay 30 -- Wait for 30 seconds.
set i to i + 1
end repeat
anonymous
anonymous / gist:402ab895a5410e4cd250
Created February 10, 2015 10:37
twist box · http://drbl.in/nJje
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
if (p < 0.5)
return 0.5 * pow(2*p, g);
@renaudbedard
renaudbedard / ADSR.cs
Last active August 3, 2023 09:14
ADSR Envelope for Unity
using System;
using System.Collections.Generic;
using UnityEngine;
/* ****************
* Sample Usage *
****************
// prerequisite : put a gameobject with the ADSR script on it in your scene
// this enables the update loop that transparently updates Envelope objects