Skip to content

Instantly share code, notes, and snippets.

@notlion
notlion / gltf_primitive_pbr_fs.glsl
Last active February 15, 2022 07:20
GLTF2 Utils for Cinder (With support for up to 4 blendshapes)
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 February 28, 2018 07:07
Generates resized images at various resolutions
#!/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 March 15, 2020 06:51
Cinder ClangFormat
---
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: false
AlignConsecutiveAssignments: false
AlignEscapedNewlinesLeft: false
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
@notlion
notlion / BlockTimer.cpp
Last active December 23, 2015 04:27
ci::audio BlockTimer
#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 December 14, 2017 11:09
GLSL Snippets
// 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;
<!DOCTYPE html>
<html>
<body>
<style>
html, body {
padding: 0; margin: 0;
}
#tris > path {
stroke: #fff;
@notlion
notlion / app_index.js
Created September 18, 2012 00:07
Derby Test
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 September 17, 2012 20:20
Derby model/store listener tests
// 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 November 14, 2011 01:53
Offset Generator for GLSL Sandbox
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 October 23, 2011 04:37
Test case for Plask font cache issue
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);
},