Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Alexander notlion

View GitHub Profile
@notlion
notlion / gltf_primitive_pbr_fs.glsl
Last active Oct 14, 2018
GLTF2 Utils for Cinder (With support for up to 4 blendshapes)
View gltf_primitive_pbr_fs.glsl
precision highp float;
// The PBR shader below is adapted from the Khronos glTF WebGL example:
// https://github.com/KhronosGroup/glTF-WebGL-PBR/blob/master/shaders/pbr-frag.glsl
struct PBRInfo {
float NdotL; // cos angle between normal and light direction
float NdotV; // cos angle between normal and view direction
float NdotH; // cos angle between normal and half vector
float LdotH; // cos angle between light direction and half vector
@notlion
notlion / gen_resized_images.py
Last active Feb 28, 2018
Generates resized images at various resolutions
View gen_resized_images.py
#!/usr/bin/env python
from __future__ import print_function
import os
import subprocess
from glob import glob
from wand.image import Image
@notlion
notlion / .clang-format
Last active Mar 15, 2020
Cinder ClangFormat
View .clang-format
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: false
AlignConsecutiveAssignments: false
AlignEscapedNewlinesLeft: false
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
@notlion
notlion / BlockTimer.cpp
Last active Dec 23, 2015
ci::audio BlockTimer
View BlockTimer.cpp
#include "BlockTimer.hpp"
using namespace cinder;
class FnNode : public audio::Node {
std::function<void()> mFunc;
protected:
void process(audio::Buffer *buffer) override {
mFunc();
@notlion
notlion / snippets.glsl
Last active Dec 14, 2017
GLSL Snippets
View snippets.glsl
// Largely, these are taken from
// http://pouet.net/topic.php?which=7931&page=1&x=28&y=8 and
// http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm and
// organized here for convenience.
// Euler Rotation
void rX(inout vec3 p, float t) {
float c = cos(t), s = sin(t); vec3 q = p;
p.y = c * q.y - s * q.z;
View index.html
<!DOCTYPE html>
<html>
<body>
<style>
html, body {
padding: 0; margin: 0;
}
#tris > path {
stroke: #fff;
View app_index.js
var derby = require('derby')
, app = derby.createApp(module)
app.get('/', function(page, model, params, next) {
model.subscribe("result", function(err, all) {
page.render()
})
})
app.ready(function(model) {
@notlion
notlion / model_tests.js
Created Sep 17, 2012
Derby model/store listener tests
View model_tests.js
// Middleware Function
expressApp.use(function(req, res, next) {
req.getModel().subscribe("*", function(err, model) {
model.on("set", "*", function(path, value) {
console.log("Middleware - %s: %s", path, value)
})
next()
})
})
@notlion
notlion / gen_offsets.js
Created Nov 14, 2011
Offset Generator for GLSL Sandbox
View gen_offsets.js
var size = 9;
var size_half = Math.floor(size / 2);
var offs = [];
for(var y = size; --y >= 0;){
for(var x = size; --x >= 0;){
var ox = x - size_half;
var oy = y - size_half;
var dist = Math.sqrt(ox * ox + oy * oy);
@notlion
notlion / test_text.js
Created Oct 23, 2011
Test case for Plask font cache issue
View test_text.js
var chars = "abcdefghijklmnopqrstuvwxyz";
require("plask").simpleWindow({
init: function(){
this.paint.setFontFamily("Myriad Pro");
this.paint.setColor(255, 255, 255);
this.canvas.drawColor(0, 0, 0);
this.framerate(60);
},
You can’t perform that action at this time.