Skip to content

Instantly share code, notes, and snippets.

@roxlu
roxlu / OMesh.cpp
Created May 26, 2012 16:10
OpenMesh
#include "OMesh.h"
OMesh::OMesh() {
}
OMesh::~OMesh() {
}
bool OMesh::save(const string& filepath) {
@roxlu
roxlu / BillboardingParticles.cpp
Created June 16, 2012 23:28
Fixing wierd edges with transparent billboarded particles
void GlowiesManager::draw(const Mat4& pm, const Mat4& vm, const Vec3& right, const Vec3& up) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// IMPORTANT: disable depth mask writing to prevent wierd looking edges while using transparency!
// ------------------------------------------------------------------------------------------------
glDepthMask(GL_FALSE);
for(vector<GlowiesData>::iterator git = collections.begin(); git != collections.end(); ++git) {
GlowiesData& gd = (*git);
@roxlu
roxlu / Binnin2D.h
Created June 26, 2012 22:41
Simple templated 2D particle binning
#ifndef ROXLU_BINNING_2DH
#define ROXLU_BINNING_2DH
#include <math.h>
#include <vector>
using std::vector;
/*
@roxlu
roxlu / LightRays.cpp
Created July 16, 2012 19:04
Light Rays
#include "LightRays.h"
#include <roxlu/opengl/Error.h>
LightRays::LightRays()
:w(0)
,h(0)
,tex(0)
,fbo(0)
,depth_buffer(0)
,frag_shader(0)
@roxlu
roxlu / SnowDrawer.cpp
Created September 11, 2012 20:43
Point Sprites
#include "SnowDrawer.h"
SnowDrawer::SnowDrawer()
:allocated_vertices(500)
,vertices(allocated_vertices,SnowVertex())
,allocated_bytes(0)
,num_flakes(0)
{
}
@roxlu
roxlu / TrailParticle.cpp
Created December 1, 2012 00:55
MOTION BLUR
#include <TrailParticle.h>
static void print(TrailVertex& v) {
printf("x: %f, y: %f, z: %f\n", v.pos.x, v.pos.y, v.pos.z);
}
TrailParticle::TrailParticle()
:drag(0.99f)
,inv_mass(1.0f)
,mass(1.0f)
@roxlu
roxlu / Deferred.cpp
Created December 7, 2012 22:16
Deferred shader, very basic setup, just one light and only basic g-buffer.
#include "Deferred.h"
#define glGenVertexArrays glGenVertexArraysAPPLE
#define glBindVertexArray glBindVertexArrayAPPLE
static void print(DeferredVertex& v) {
printf("%f, %f, %f, %f, %f, %f\n", v.x, v.y, v.z, v.nx, v.ny, v.nz);
}
Deferred::Deferred()
@roxlu
roxlu / rxParticle.cpp
Created March 20, 2012 22:11
Poor mans Hyphae growth
#include "rxParticle.h"
rxParticle::rxParticle(ofVec3f pos, float mass)
:position(pos)
,mass(mass)
,velocity(0)
,forces(0)
,age(0)
,lifetime(10)
{
@roxlu
roxlu / compile_icecast_mac_64.sh
Created December 27, 2012 11:35
Compiling Icecast (http://www.icecast.org/) with all dependencies on OSX (10.6.8)
#!/bin/bash
# Compile script for icecast, using these libraries:
# --------------------------------------------------
# lame-3.99.5.tar.gz
# libogg-1.3.0.tar.gz
# libsamplerate-0.1.8.tar.gz
# libtheora-1.1.1.tar.bz2
# libtool-2.2.1.10.tar.gz
# libvorbis-1.3.3.tar.gz
@roxlu
roxlu / VorbisWriter.cpp
Created January 4, 2013 16:34
(Work in progress) Basic audio encoding using vorbis. This code assumes 16 bit mono as input.
#include "VorbisWriter.h"
VorbisWriter::VorbisWriter()
:fp(NULL)
,is_setup(false)
{
}
VorbisWriter::~VorbisWriter() {
close();