Skip to content

Instantly share code, notes, and snippets.

View dwilliamson's full-sized avatar

Don Williamson dwilliamson

View GitHub Profile
//
// Given a 3D point on the sphere, map to a unique, sub-divided triangle
// index in O(1) with no recursive searching or table lookups.
// Gist here https://gist.github.com/dwilliamson/65a81bf6fcd0e2000039
// Thanks to @rompa for a couple of optimisations.
//
// Generate initial octahedron and subdivide it
var octahedron_geometry = CreateOctahedronGeometry();
var depth = 3;
@dwilliamson
dwilliamson / Envelope.cpp
Created June 20, 2017 20:54
Old Reflection API
/**
* Interface reflection automatically generated from XML.
*
* DO NOT EDIT!
*/
#include "Envelope.h"
#include "fgs2/Reflection/DefaultTypes.h"
#include "fgs2/Reflection/FunctionGenerator.h"
@dwilliamson
dwilliamson / menug.asm
Created April 4, 2017 16:23
Old (1996?) mouse cursor dirty rect blitting for VESA banked modes
title SVGA.ASM
public FillBackground_
public BlitBlock_
public HLine_
public VLine_
public PutPixel_
public BlitMouseCursor_
public ResetMouse_
public CheckMouse_
@dwilliamson
dwilliamson / Pimpl.cpp
Last active May 12, 2017 16:10
How I Pimpl
struct Data
{
Data()
{
}
~Data()
{
}
extern "C" char* dtoa_simple(double value, char* dest, int size)
{
// NOTE: Very bare bones and inaccurate for very big numbers due to floating point inaccuracies dividing by 10
// Requires BigInt support to handle correctly!
char* destret = dest;
char* destend = dest + size;
// Negate and add prefix for negative numbers
if (value < 0)
@dwilliamson
dwilliamson / idl.g
Created November 7, 2016 11:21
idl.g
header
{
#ifndef _INCLUDED_IDLCOMPILER_SYMBOLTABLE_H
#include "SymbolTable.h"
#endif
#ifndef _INCLUDED_IDLCOMPILER_IDLCOMPILER_H
#include "IDLCompiler.h"
#endif
@dwilliamson
dwilliamson / Bump.dxs
Created October 19, 2016 12:31
Old rendering language I wrote
using DefaultEffect;
using VShaderFragments;
using PShaderFragments;
using Resources;
effect Bump : DefaultEffect
{
// Temporary registers used
--- GAME STARTED ------------------------------------------------------
#game Command Line: D:\dev\celtoys\Star\pub\Server\Game.exe
#game Game root: d:/dev/celtoys/star/pub/server/..
#remotery Creating Remotery connection
#remotery Localhost only: false
#windows Loading dbghelp.dll
#windows Importing dbghelp.dll functions
#windows Initialising symbols library
#windows Loading symbols for each module
#windows Loading 'D:\dev\celtoys\Star\pub\Server\Game.exe' (737280)
@dwilliamson
dwilliamson / PolyMesh.cpp
Created October 3, 2016 10:53
PolyMesh.cpp
#include "PolyMesh.h"
#include "MeshLoader.h"
#include "Exception.h"
#include <stack>
#include <algorithm>
#include "CircularList.h"
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <gl/gl.h>
#pragma comment(lib, "opengl32.lib")