Skip to content

Instantly share code, notes, and snippets.

@kayru
kayru / Jamfile.jam
Created April 21, 2012 12:58
Data build jamfile
# JamPlus script
SubDir TOP ;
DEPCACHE.standard = ../bin/data/depcache ;
# Global paths
PATH_DATA = "../bin/data" ;
PATH_CONTENT = "../content" ;
@kayru
kayru / generate_points_inside_sphere.py
Created April 30, 2012 18:22
Generate random points inside a sphere
import sys
import random
def GeneratePointsInsideSphere(num_points) :
points = []
for i in range(num_points) :
while True :
x = random.uniform(-1,1)
@kayru
kayru / generate_points_inside_disc.py
Created April 30, 2012 18:20
Generate random points on disc
import sys
import random
def GeneratePointsInsideDisc(num_points) :
points = []
for i in range(num_points) :
while True :
x = random.uniform(-1,1)
@kayru
kayru / gist:2624976
Created May 6, 2012 23:30
premake4 luajit test results
$ time ./test_release
Building configurations...
Running action 'test'...
running time : 5.01
789 tests passed, 0 failed
Done.
real 0m5.079s
user 0m0.539s
sys 0m4.531s
@kayru
kayru / gist:2624992
Created May 6, 2012 23:32
Premake4 vararg compatibility changes for LuaJIT 2.0
# HG changeset patch
# User Yuriy O'Donnell <yuriyo@gmail.com>
# Date 1336346476 -3600
# Node ID 9abcac50982464079bc7ef681fa6dccefceeb704
# Parent 1c40bd936d1f6f919f1e9bc9225621b4f9e38aad
luajit 2.0 varargs compatibility fix
diff --git a/src/base/globals.lua b/src/base/globals.lua
--- a/src/base/globals.lua
+++ b/src/base/globals.lua
@kayru
kayru / gist:3344506
Created August 13, 2012 22:27
How to compile BRDF viewer for Windows
How to compile BRDF Explorer for Windows
========================================
Use this code https://github.com/wdas/brdf.git
The following external dependencies are required (versions are ones that I used, other might also work):
- Qt 4.8.1
- GLEW 1.9.0
- ZLib 1.2.5
- GLUT 3.7
All external dependencies except Qt are packaged here: https://dl.dropbox.com/u/1010228/brdf-depends-win32.zip
@kayru
kayru / inf.patch
Created October 2, 2012 21:54
infinite projection test
diff --git a/source/reversez.cpp b/source/reversez.cpp
index eb061ff..81b165d 100644
--- a/source/reversez.cpp
+++ b/source/reversez.cpp
@@ -10,6 +10,8 @@
#include <Rush/MathPlane.h>
#include <Rush/UtilTimer.h>
+#include <math.h>
+
#include <cstdio>
#include <string>
#include <GLES2/gl2.h>
#include <tr1/memory>
#include <ppapi/cpp/instance.h>
#include <ppapi/cpp/module.h>
#include <ppapi/cpp/var.h>
#include <ppapi/gles2/gl2ext_ppapi.h>
#include <ppapi/c/ppb_opengles.h>
<!DOCTYPE html>
<html>
<head>
<title>NaCl Test</title>
<script type="text/javascript">
ApplicationModule = null; // Global application object.
statusText = 'NO-STATUS';
// Indicate load success.
Texture2D<uint> input : register( t0 );
RWTexture2D<float4> output : register( u0 );
static const uint rastafont8x8_bitmap[] =
{
0x00000000,0x00000000,0x0c1e1e0c,0x000c000c,0x00363636,0x00000000,0x367f3636,0x0036367f,
0x1e033e0c,0x000c1f30,0x18336300,0x0063660c,0x6e1c361c,0x006e333b,0x00030606,0x00000000,
0x06060c18,0x00180c06,0x18180c06,0x00060c18,0xff3c6600,0x0000663c,0x3f0c0c00,0x00000c0c,
0x00000000,0x060c0e00,0x3f000000,0x00000000,0x00000000,0x000c0c00,0x0c183060,0x00010306,
0x3f3b331e,0x001e3337,0x0c0c0f0c,0x003f0c0c,0x1c30331e,0x003f3306,0x1c30331e,0x001e3330,