Skip to content

Instantly share code, notes, and snippets.

View andreasmuller's full-sized avatar

Andreas Müller andreasmuller

View GitHub Profile
// meshCopies is an std::deque where index 0 is the latest copy and index size()-1 is the oldest
// TEMP
for( int meshIndex = 0; meshIndex < meshCopies.size(); meshIndex++ )
{
ofMesh* mesh = meshCopies.at(meshIndex);
ofSeedRandom(meshIndex << 24);
#pragma once
#include "BoundingBox.h"
class OrientedBoundingBox : public BoundingBox
{
public:
#pragma once
#include "ofMain.h"
class BoundingBox
{
public:
// --------------------------------------------
//
// FirstPersonCamera.h
// GaiaTerrain
//
// Created by Andreas Müller on 24/01/2014.
//
//
#pragma once
float rand(vec2 co) { return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); }
float map( float value, float inputMin, float inputMax, float outputMin, float outputMax ) { return ((value - inputMin) / (inputMax - inputMin) * (outputMax - outputMin) + outputMin); }
float mapClamped( float value, float inputMin, float inputMax, float outputMin, float outputMax ) { return clamp( ((value - inputMin) / (inputMax - inputMin) * (outputMax - outputMin) + outputMin), outputMin, outputMax ); }
float stepInOut( float _edge1, float _edge2, float _val ) { return step(_edge1, _val) - step(_edge2,_val); }
float smoothStepInOut( float _low0, float _high0, float _high1, float _low1, float _t ) { return smoothstep( _low0, _high0, _t ) * (1.0 - smoothstep( _high1, _low1, _t )); }
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); }