Skip to content

Instantly share code, notes, and snippets.

View zao's full-sized avatar

Lars Viklund zao

View GitHub Profile
@zao
zao / CMakeLists.txt
Created April 8, 2013 11:37
BON super-advanced mega-build-script
project(BON)
add_library(BON
BON/bon.c
BON/bon.h
BON/bon_private.h
BON/crc32.c
BON/crc32.h
BON/read.c
BON/type.c
@zao
zao / dual-line.fx
Created April 12, 2013 20:25
Thicker dual-line waveform effect
texture tex : WAVEFORMDATA;
sampler sTex = sampler_state
{
Texture = (tex);
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = Clamp;
#pragma once
#include <cassert>
#include <sstream>
#include <vector>
#include <physfs.h>
#include "util/SmartPointer.h"
namespace vfs
@zao
zao / OrientationMapping.h++
Last active December 19, 2015 21:29
Quaternion path builder
#pragma once
#include "util/Numeric.h"
namespace math
{
inline float4 SO3ToR4(Quat const& q)
{
float const mul = 1.0f / sqrt(2.0f * (1.0f - q.w));
return float4(q.x, q.y, q.z, (1.0f - q.w)).Mul(mul);
}
@zao
zao / HermiteSpline.hpp
Created July 17, 2013 12:41
Hermite spline application
#pragma once
#include "math/OrientationMapping.h"
#include "util/Numeric.h"
#include "util/PaddedVector.h"
namespace math
{
template <size_t A, size_t B>
float H(float t);
@zao
zao / hm-vs.glsl
Created July 18, 2013 22:14
Heightmaps, ho!
#version 130
uniform mat4 mat_worldview;
uniform mat4 mat_projection;
in vec2 vs_xz;
in vec3 vs_displace;
in vec3 vs_color;
out vec3 fs_color;
@zao
zao / Kitteh.pm
Created August 7, 2013 15:40
Kitteh-module
package Kitteh;
use strict;
use warnings;
use DBI;
use File::Basename;
use File::HomeDir;
use MIME::Base64;
use UUID::Tiny ':std';
@zao
zao / main.cc
Created August 11, 2013 19:40
Piano Hero input injection
#define NOMINMAX
#include <windows.h>
#include <dinput.h>
#include <boost/format.hpp>
using boost::wformat;
void sendKey(WORD key, bool down) {
INPUT input = { INPUT_KEYBOARD };
KEYBDINPUT & ki = input.ki;
@zao
zao / TSProcess.cc
Created August 21, 2013 23:27
Terrain splitter processing
#include <functional>
#include <memory>
#include <sstream>
#include "TSInput.h"
#include "png.h"
#include <list>
#include <vector>
#include <boost/gil/gil_all.hpp>
#include <boost/gil/extension/io/png_io.hpp>
@zao
zao / adler32.py
Created February 3, 2014 12:53
Python implementation of streaming Adler32 checksum
#!/usr/bin/env python
import io,sys,zlib
for filename in sys.argv[1:]:
try:
file = io.open(filename,'rb')
buf = bytearray(1024*128)
part_sum = 1;
while True:
n = file.readinto(buf)