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
#pragma once | |
#include <cstdint> | |
#include <algorithm> | |
struct float2 { | |
float x, y; | |
}; | |
struct float3 { |
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
#pragma once | |
#include <cassert> | |
#include <array> | |
#include <cmath> | |
#include <intrin.h> | |
#include "GL.h" | |
#include "math.h" | |
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
#include <cassert> | |
#include <cstdint> | |
#define _SDL_main_h | |
#include <SDL/SDL.h> | |
struct app_t { | |
app_t() : _screen(nullptr), _active(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
#define _SDL_main_h | |
#include <SDL/SDL.h> | |
#include <assert.h> | |
#include <stdint.h> | |
#include <array> | |
struct coord_t { | |
float x, y; |
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
#include <cstdint> | |
#include <cstring> | |
// float to int | |
int32_t float_to_int(float myfloat) { | |
uint32_t fint = 0; | |
memcpy(&fint, (void*)&myfloat, 4); | |
constexpr uint32_t mask_fract = (1u << 23) - 1; | |
const uint32_t fract = (fint & mask_fract) | (1u << 23); | |
const uint32_t fexpn = (fint >> 23) & 0xff; |
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
import sys | |
class ObjGroup(object): | |
def __init__(self, name, v_base, vt_base): | |
self._name = name | |
self._mtl = '' | |
self._vertex = [] | |
self._uv = [] |
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
#define _SDL_main_h | |
#include <SDL/SDL.h> | |
#include <assert.h> | |
#include <stdint.h> | |
#include <array> | |
struct coord_t { | |
float x, y; |
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
#include <cstdint> | |
#include <array> | |
uint64_t PearsonHash(const uint8_t *x, size_t len) | |
{ | |
static const std::array<uint8_t, 256> T = { | |
// 0-255 shuffled in any (random) order suffices | |
98, 6, 85,150, 36, 23,112,164,135,207,169, 5, 26, 64,165,219, | |
61, 20, 68, 89,130, 63, 52,102, 24,229,132,245, 80,216,195,115, | |
90,168,156,203,177,120, 2,190,188, 7,100,185,174,243,162, 10, |
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
#include <stdint.h> | |
#include <stddef.h> | |
size_t lz77_decode(const uint8_t *src, uint8_t *dst) { | |
// size of ring buffer | |
static const uint32_t N = 4096; | |
// upper limit for match_length | |
static const uint32_t F = 18; | |
// wrap mask for ring buffer |
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
// convert world to screen | |
vec2f_t to_screen(const vec3f_t &p) const { | |
return vec2f_t{ | |
2.f * (p.x - p.y), | |
p.x + p.y - p.z, | |
}; | |
} | |
// convert screen to world |