This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// =============== | |
namespace | |
{ | |
void Utility(ns::Struct& s) | |
{ | |
} | |
} | |
void ns::PublicAPIFunction(Struct& s) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (x > y && x > z) | |
{ | |
x_axis = up; | |
y_axis = forward; | |
} | |
else if (y > z) | |
{ | |
x_axis = forward; | |
y_axis = right; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CreateCubeMesh(scene, side) | |
{ | |
// Create vertices in the [-1, 1] domain | |
var cube_geom = CreateCubeGeometry(2, 16); | |
var vertices = cube_geom.Vertices; | |
var indices = cube_geom.Indices; | |
var thickness = 0.15; | |
for (i in vertices) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Illustration of the "hairy ball" problem | |
// http://en.wikipedia.org/wiki/Hairy_ball_theorem | |
// | |
// Continuous tangent field over the sphere built by blending two | |
// perpendicular, cylindrical fields. | |
// | |
function smoothstep(edge0, edge1, x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec3 Barycentric(ProbeTriangle tri, vec3 p) | |
{ | |
// Unpack for readability | |
vec3 a = tri.a_d01.xyz; | |
vec3 v0 = tri.v0_d00.xyz; | |
vec3 v1 = tri.v1_d11.xyz; | |
float d00 = tri.v0_d00.w; | |
float d11 = tri.v1_d11.w; | |
float d01 = tri.a_d01.w; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import winreg | |
import os | |
import string | |
# | |
# Big list of known SDK versions and their properties | |
# | |
# I wrote some automatic discovery code for building all this (300 lines) but it turns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: Storage allocation failures!! | |
#pragma once | |
#include <clcpp/clcpp.h> | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Procedural tristrip cube generation | |
// | |
function CreateTriStripCube() | |
{ | |
var positions = [ | |
0,0,0, | |
1,0,0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All types in one header file | |
// Interface and storage specified, only, to keep header file size small and easy to parse by the compiler | |
// Use of multiple containers in a public header requires only this header file be included | |
// No proliferation of multiple header includes in public header files | |
// | |
// Implementation specified in separate header files per type | |
// Only included in implementation .cpp files that need to use them | |
// Interface is member-based for convenient intellisense lookup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace core | |
{ | |
// | |
// A globally unique identifier with a generator that should allow multiple machines/users | |
// to never generate the same ID. | |
// | |
struct clcpp_attr(reflect) Guid | |
{ | |
Guid() | |
: mac_address_hash(0) |