Skip to content

Instantly share code, notes, and snippets.

View Kaminate's full-sized avatar
🙃
Killin' it

白★能盛 Kaminate

🙃
Killin' it
  • United States
View GitHub Profile
@Kaminate
Kaminate / ThatGameProfiler.h
Created August 6, 2013 05:59
Cute little profiler from ThatGameCompany. Constructor starts ticking, Destructor prints the time taken.
class Profiler
{
public:
Profiler();
~Profiler(); // couts the amount of time the profiler was alive
private:
float GetTime();
float startSeconds;
float endSeconds;
@Kaminate
Kaminate / PartitionProblem
Created August 6, 2013 06:04
C++ solution of the "easiest hard problem", the partition problem. (the problem itself and algorithm described on wikipedia). It includes a file called Array2D.h (another one of my gists), which is just a wrapper around a dynamic 2d array which deletes the array in the destructor.
//////////////////////////
// Nathan Park (age 21) //
// August 4, 2013 //
//////////////////////////
#include <iostream>
#include <fstream>
#include <vector>
#include <numeric> // std::accumulate
@Kaminate
Kaminate / Array2D.h
Created August 6, 2013 06:06
2D dynamic array wrapper. Allocates memory in the constructor, deallocates memory in the destructor. Everything is inline, so it can be used as a header-only (library?).
////////////////////
// Nathan Park //
// August 3, 2013 //
////////////////////
#ifndef __ARRAY2D_H_
#define __ARRAY2D_H_
#include <iostream>
#include <iomanip>
@Kaminate
Kaminate / HowSphericalCoordinatesWork.txt
Created August 6, 2013 06:07
How Spherical Coordinates work (no pictures, sorry)
say you have a coordinate system
x axis
y axis
z axis
and a vector v
if you think of the coordinates as a vector (say x) and a plane (say yz)
v makes a half-angle alpha [0,180] with x
@Kaminate
Kaminate / NumberOfPrimes
Created August 6, 2013 06:10
Returns the number of primes before int N. This is my implementation of a programming internship practice test problem from some game company. I used the sieve of eratosthenes I saw on wiki once.
// Nathan Park
//
// This is my implementation of a programming intership practice test problem
// from some company.
#include <vector>
int getNumberOfPrimes(int N)
{
std:vector <int> primes(N, 1); // 0 = prime, 1 means not prime
@Kaminate
Kaminate / BloodAlcoholConcentration.cpp
Created August 6, 2013 06:12
Describes a person and (alcoholic) drink class. When a person drinks a drink, it takes the timestamp into account when calculating the person's BAC (blood alcohol concentration). I made this for 2013 Angelhack in Seattle.
// 2013 Nathan Park
// Angelhack in Seattle
#include <iostream>
#include <string>
#include <vector>
typedef float Date;
const float grams_per_lb = 453.592f;
const float lbs_per_gram = 1.0f / grams_per_lb;
/******************************************************************************
File: PB_gjk.c
Description: this file contains the functions for collision detection using
the gjk algorithm.
******************************************************************************/
#include "PB_gjk.h"
#include "PB_n8math.h" //vector math operations
#include "PB_physics_debug_draw.h" //debug draw purposes
@Kaminate
Kaminate / PB_perlin..h
Created August 6, 2013 06:29
Perlin Noise. Justin wrote this, I haven't actually looked at it yet... ANSI C
#ifndef PB_PERLIN_H
#define PB_PERLIN_H
#include "PB_geom.h"
#include "PB_texture.h"
#include <stdlib.h>
#include <math.h>
typedef struct PerlinNoise
{
@Kaminate
Kaminate / MemoryManager.cpp
Created August 6, 2013 06:36
Just the implementation of some c style memory manager functions
/*!
Memory Manager
Nathan Park
*/
#include "MemoryManager.h"
// #include <new.h> placement new
@Kaminate
Kaminate / ShaderPixels.v.glsl
Last active March 25, 2016 22:48
Shader storage buffer
#version 430
in vec4 vColor;
out vec4 outColor;
void main()
{
outColor = vColor;
}