Skip to content

Instantly share code, notes, and snippets.

@pixelnerve
pixelnerve / gist:5995780
Last active December 19, 2015 17:59
Simple Quaternion Camera
void ViewFromPositionAndOrientation( Vec3& p, Quat& q, Mat4* dst )
{
Vec3 negP = q.toMatrix44() * -p;
*dst = Mat4::createTranslation( negP ) * q.toMatrix44();
}
---- Update Method
@pixelnerve
pixelnerve / gist:6000287
Last active December 19, 2015 18:38
User input for camera control with a Byte
enum CamMoveStates
{
CamMoveNone = 0
, CamMoveForward = (1<<0)
, CamMoveBackwards = (1<<1)
, CamMoveLeft = (1<<2)
, CamMoveRight = (1<<3)
, CamMoveUp = (1<<4)
, CamMoveDown = (1<<5)
};
@pixelnerve
pixelnerve / fullscreen_tri.program
Last active December 21, 2015 06:38
Fullscreen TRIANGLE
#version 330 core
layout(location = 0) in vec4 PositionIn;
const vec2 verts[3] = vec2[]( vec2(-1, -1), vec2(3, -1), vec2(-1, 3) );
const vec2 uvs[3] = vec2[]( vec2(0, 2), vec2(2, 2), vec2(0, 0) );
out block
{
vec2 texcoord;
@pixelnerve
pixelnerve / gist:287b7193387432eaf71c
Last active August 29, 2015 14:04
converter_to_threejs.py
# @author zfedoran / http://github.com/zfedoran
import os
import sys
import math
import operator
import re
import json
import types
import shutil
@pixelnerve
pixelnerve / gist:9162bf1964c1b8a719e0
Created October 17, 2014 16:03
emscripten test app
#include <string>
#include <iostream>
#include <emscripten/emscripten.h>
using namespace std;
void onload_cb( unsigned a2, void* userData, void* data, unsigned size )
{
int sss = size;
cout << "++++ onload: " << "size: " << sss << endl;
@pixelnerve
pixelnerve / gist:eb32b47f845beb7cfe46
Last active August 29, 2015 14:07
EM 1.25.0 file log
DEBUG root: PYTHON not defined in ~/.emscripten, using "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
DEBUG root: JAVA not defined in ~/.emscripten, using "java"
mkdir -p build
/Users/vic/Desktop/Emscriptem/emscripten/1.25.0/em++ -std=c++11 -I../../src -I../../src/3rdparty/osc -I../../src/3rdparty -I../../src/3rdparty/jsoncpp/include -I../../src/3rdparty/assimp -I../../src/3rdparty/freetype_emscripten -Wall -Wextra -Wno-unused-parameter -Wno-reorder -Wno-unused-function -DCOCOON_EMSCRIPTEN -DCOCOON_GL_NO_ERROR_HANDLE -c -o ../../src/cocoon/app/AppBasic.o ../../src/cocoon/app/AppBasic.cpp
DEBUG root: PYTHON not defined in ~/.emscripten, using "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
DEBUG root: JAVA not defined in ~/.emscripten, using "java"
DEBUG root: PYTHON not defined in ~/.emscripten, using "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
DEBU
@pixelnerve
pixelnerve / gist:059c01a6c23d061ffff8
Last active August 29, 2015 14:07
EM 1.22.0 file log
DEBUG root: PYTHON not defined in ~/.emscripten, using "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
DEBUG root: JAVA not defined in ~/.emscripten, using "java"
mkdir -p build
/Users/vic/Desktop/Emscriptem122/emscripten/1.22.0/em++ -std=c++11 -I../../src -I../../src/3rdparty/osc -I../../src/3rdparty -I../../src/3rdparty/jsoncpp/include -I../../src/3rdparty/assimp -I../../src/3rdparty/freetype_emscripten -Wall -Wextra -Wno-unused-parameter -Wno-reorder -Wno-unused-function -DCOCOON_EMSCRIPTEN -DCOCOON_GL_NO_ERROR_HANDLE -c -o ../../src/cocoon/app/AppBasic.o ../../src/cocoon/app/AppBasic.cpp
DEBUG root: PYTHON not defined in ~/.emscripten, using "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
DEBUG root: JAVA not defined in ~/.emscripten, using "java"
DEBUG root: PYTHON not defined in ~/.emscripten, using "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
D
// Missing enums from android sdk
enum {
ASENSOR_TYPE_ORIENTATION = 3,
ASENSOR_TYPE_ROTATION_VECTOR = 15,
ASENSOR_TYPE_LINEAR_ACCELERATION = 10,
ASENSOR_TYPE_GRAVITY = 9
};
@pixelnerve
pixelnerve / gist:7b6b5fab26a650c0fbcc
Created August 22, 2015 12:42
metal error message
/Library/Caches/com.apple.xbs/Sources/Metal/Metal-54.26.3/ToolsLayers/Debug/MTLDebugRenderCommandEncoder.mm:520: failed assertion `Texture at depthAttachment has usage (0x01) which doesn't specify MTLTextureUsageRenderTarget (0x04)'
@pixelnerve
pixelnerve / gist:8f1e6e5065782064aa6b
Created March 17, 2016 17:20
Emscripten time output
timertest.html:1237 emscripten_get_now(): 19.000075
timertest.html:1237 emscripten_get_now(): 16.000000
timertest.html:1237 emscripten_get_now(): 22.000050
timertest.html:1237 emscripten_get_now(): 29.000050
timertest.html:1237 emscripten_get_now(): 26.000010
timertest.html:1237 emscripten_get_now(): 23.000005
timertest.html:1237 emscripten_get_now(): 29.000085
timertest.html:1237 emscripten_get_now(): 25.000095
timertest.html:1237 emscripten_get_now(): 32.000060
timertest.html:1237 emscripten_get_now(): 39.000060