Skip to content

Instantly share code, notes, and snippets.

@mini3d
mini3d / contactstest.cpp
Last active October 24, 2018 12:24
One dimensional contacts test for stable contacts in physics engine (not working)
// ONE DIMENSIONAL CONTACT TEST
// The cordinate system in the y-direction is 0 for the surface, positive above and negative below.
// Distances are measured in pixels. Time is measured in frames. So velocity = pixles / frame
// Surface line is white
// positive slop line is green
// Negative slop line is red
// Velocity threshold contact works as follows:
// Distributed as Public Domain
#include <ctime>
#include <string>
#include <iostream>
typedef unsigned long ulong;
using namespace std;
struct Experiment {
@mini3d
mini3d / attribpanel.py
Last active December 17, 2015 04:08
Vertex Attribute Panel for Blender 2.66
import bpy
vertexAttributes = [("POSITION", "Position", "" , "MAN_TRANS", 0 ),
("NORMAL", "Normal", "", "MANIPUL", 1),
("TANGENT", "Tangent", "", "OUTLINER_OB_EMPTY", 2),
("BITANGENT", "Bitangent", "", "EMPTY_DATA", 3),
("TEXTURE", "Texture Coordinates", "", "GROUP_UVS", 4),
("GROUPS", "Vertex Groups", "", "GROUP_VERTEX", 5),
("COLOR", "Vertex Color", "", "GROUP_VCOL", 6)]
@mini3d
mini3d / win32_opengl.cpp
Last active December 13, 2015 23:59
Template for win32 OpenGL app.
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <gl/GL.h>
const bool IS_EVENT_DRIVEN = true; // TRUE: Wait for update event. FALSE: 30 fps
bool isRunning = true;
bool needsRefresh = true;
// Window Callback
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
@mini3d
mini3d / gc_ptr.cpp
Created September 9, 2012 15:46
Minimalistic Garbage Collecting Smart Pointers
#include "gc_ptr.h"
#include <new>
#include <list>
#include <stack>
// A NULL owner pointer signifies that a gc_poiner is owned by the stack
// (or a manually managed heap block)
const unsigned int SOLID_REFERENCE = 0;