Skip to content

Instantly share code, notes, and snippets.

View cwhitney's full-sized avatar

Charlie Whitney cwhitney

View GitHub Profile
@cwhitney
cwhitney / gist:8064fc36196c1e259cb8
Created November 18, 2015 17:17
CatmullRom from points
// From: https://github.com/sansumbrella/Pockets/blob/master/src/archive/pockets/CurveUtils.cpp
template <typename T>
vector<T> Predator::curveThrough(const vector<T> &points)
{
assert(points.size() > 2);
vector<T> curvePoints;
T p1 = points.at(0);
T p2 = points.at(1);
T p3 = points.at(2);
@cwhitney
cwhitney / gist:ef9a767998471a3fe1b9
Last active September 5, 2018 00:39
Cinder 0.9.0 default shader params
https://github.com/cinder/Cinder/blob/81e55e7eb76c7c856633eaed4679aca5ab6531f4/src/cinder/gl/GlslProg.cpp#L583
https://github.com/cinder/Cinder/blob/master/src/cinder/gl/EnvironmentCore.cpp#L158
Uniforms
-------------
ciModelMatrix
ciModelMatrixInverse
ciModelMatrixInverseTranspose
ciViewMatrix
ciViewMatrixInverse
@cwhitney
cwhitney / gist:687a17444cd89690200d
Created October 28, 2014 18:44
Rename visible layers in Illustrator
var doc = app.activeDocument;
var prefix = Window.prompt ("Rename prefix", "", "By Sharkbox");
function transverseTree(layer){
if( layer.visible ){
layer.name = prefix + "-" + layer.name;
}
for( var i=0; i<layer.layers.length; i++){
transverseTree( layer.layers[i] );
//
// CiTextField.h
// CinderText
//
// Created by Charlie Whitney on 10/13/14.
//
//
#pragma once
// I was getting bad results, so I looked up uniform sphere distribution and got this: http://mathworld.wolfram.com/SpherePointPicking.html
float phi = ofRandom( 0, TWO_PI );
float costheta = ofRandom( -1.0f, 1.0f );
float rho = sqrt( 1.0f - costheta * costheta );
float x = rho * cos( phi );
float y = rho * sin( phi );
float z = costheta;
ofVec3f randVec(x, y, z);
In Terminal:
> cd (the directory where the file is)
> sudo chmod 777 ./(filename)
It will ask you for the root password (the one your computer always asks you for when you try to install new software). Type it in and press enter, but know that it will appears like you aren't even typing. Dont' be fooled!
gl::setMatricesWindow( mFbo.getSize(), false );
gl::pushMatrices();
mFbo.bindFramebuffer();{
gl::clear( Color(0,0,0) );
gl::draw( mFace );
}mFbo.unbindFramebuffer();
gl::popMatrices();
gl::setMatricesWindow( getWindowSize(), true );
@cwhitney
cwhitney / gist:4120445
Created November 20, 2012 19:30
cinder fbo scissor
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "cinder/gl/Fbo.h"
using namespace ci;
using namespace ci::app;
using namespace std;
class MirroredFboApp : public AppBasic {
public: