$ uname -r
This file contains hidden or 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
// This LUT follows the following tile code: | |
// 1 2 4 | |
// 8 X 16 | |
// 32 64 128 | |
static const int NUM_DIR = 8; | |
static const glm::ivec2 dir[NUM_DIR] = { | |
{ -1, -1 }, | |
{ 0, -1 }, | |
{ 1, -1 }, | |
{ -1, 0 }, |
This file contains hidden or 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
#ifndef __FPS_H__ | |
#define __FPS_H__ | |
// FPS Counter class | |
// Keep an instance in the main app context, and call update every frame | |
// Use the () operator to get the current FPS | |
class FPSCounter { | |
private: | |
unsigned long _frames = 0; |
This file contains hidden or 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
uint8_t* checkerTexture(int w, int h, int num) { | |
const int dataSize = w * h * 3; | |
uint8_t* texData = new uint8_t[dataSize]; | |
uint8_t c1r = 0x25, c1g = 0x25, c1b = 0x25; | |
uint8_t c2r = 0x30, c2g = 0x30, c2b = 0x30; | |
for (int i = 0; i < h; ++i) { | |
bool odd = true; | |
if ((i / num) % 2) odd = false; |
This file contains hidden or 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
#ifndef __ELAPSED_H__ | |
#define __ELAPSED_H__ | |
/* | |
Simple C++11 timer class to profile your function calls, etc. | |
Usage: | |
Elapsed e; | |
e.begin(); | |
myFunctionToBeProfiled(); |
This file contains hidden or 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
#ifndef __RANDOM_H__ | |
#define __RANDOM_H__ | |
// Wrapper for the C++11 random generators | |
#include <chrono> | |
#include <random> | |
class Random { |
This file contains hidden or 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
void init() { | |
// Generate PBO | |
glGenBuffers(1, &_pbo); | |
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, _pbo); | |
glBufferData(GL_PIXEL_UNPACK_BUFFER, TEX_SIZE * TEX_SIZE * 3, nullptr, GL_STREAM_DRAW); | |
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); | |
// Generate a texture | |
glGenTextures(1, &_texID); |
This file contains hidden or 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
PROMPT=" | |
%{$FG[159]%}:: %{$FG[154]%}%n%{$FG[255]%} @ %{$FG[166]%}%m %{$FG[159][%}%{$FG[045]%}%*%{$FG[159]%}] | |
%{$FG[159]:: %}%{$FG[105]%~%} | |
%{$FG[045]%} ~> %{%f%}" |
This file contains hidden or 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
/* | |
Copyright (c) 2020 Chan Jer Shyan | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |