Skip to content

Instantly share code, notes, and snippets.

View zao's full-sized avatar

Lars Viklund zao

View GitHub Profile
@zao
zao / units.lua
Created February 2, 2012 09:14
Excerpt from brigade build
local sqlite3 = StaticLibrary {
Name = "sqlite3",
Sources = {
{ "sqlite3/sqlite3.c" }
},
Propagate = { Env = {
CPPPATH = {
"sqlite3",
},
}, },
@zao
zao / draw.cc
Created February 2, 2012 21:02
Pixel shader for mesh
ctx->PSSetShader(shaders.ps, NULL, 0);
ctx->PSSetShaderResources(0, 1, &diffuse_texture.view.p);
ctx->PSSetSamplers(0, 1, &diffuse_texture.state.p);
@zao
zao / at_c.cc
Created February 29, 2012 18:23
at_c test
#include <boost/phoenix.hpp>
#include <boost/fusion/adapted.hpp>
#include <iostream>
struct S
{
int a0, a1, a2, a3, a4, a5, a6, a7;
};
@zao
zao / toy-protocol.text
Created March 18, 2012 04:22
TOY protocol description
Messages begin with one octet of message tag.
Primitives
==========
sized-string: one octet of size followed by that many printable low-ascii characters
Client -> Server
================
0x3F: HELLO
Payload: username :: sized-string
@zao
zao / unfilled_outline.fx
Created April 24, 2012 06:40
Seekbar - Unfilled line outline
#define LINE_WEIGHT (1)
#define LINE_POWER (1)
texture tex : WAVEFORMDATA;
sampler sTex = sampler_state
{
Texture = (tex);
MipFilter = LINEAR;
MinFilter = LINEAR;
@zao
zao / pacbard.fx
Created May 4, 2012 14:42
Pacman-like position indicator
texture tex : WAVEFORMDATA;
sampler sTex = sampler_state
{
Texture = (tex);
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = Clamp;
@zao
zao / seekbar-mipped.fx
Created July 30, 2012 00:12
Samples mipmaps for average.
texture tex : WAVEFORMDATA;
sampler sTex = sampler_state
{
Texture = (tex);
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = Clamp;
@zao
zao / IndexedMesh.java
Created August 14, 2012 18:15
OBJ loading
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package se.zao.obj;
/**
*
* @author Lars
*/
@zao
zao / gl_stuff.cc
Created October 29, 2012 18:19
Render function
void DrawGame()
{
double const t = glfwGetTime();
glUseProgram(tileProgram);
BindStreams(tileCoord->vbs, tileCoord->bindings);
geom::ShaderLocations::Semantic semantics[] = {
geom::MakeSemantic("MODEL"),
geom::MakeSemantic("VIEW"),
geom::MakeSemantic("PROJECTION"),
@zao
zao / clang-darwin.diff
Created December 17, 2012 15:08
FindHPX_Boost.cmake patch for OS X clang-based toolchain
diff --git a/cmake/FindHPX_Boost.cmake b/cmake/FindHPX_Boost.cmake
index e2ad0d9..f3977f0 100644
--- a/cmake/FindHPX_Boost.cmake
+++ b/cmake/FindHPX_Boost.cmake
@@ -57,7 +57,11 @@ macro(build_boost_libname BOOST_RAW_NAME)
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"
OR "${CMAKE_CXX_COMPILER}" MATCHES "clang")
- set(BOOST_COMPILER_VERSION "-clang")
+ if(APPLE)