Skip to content

Instantly share code, notes, and snippets.

View warmwaffles's full-sized avatar
🛠️
Code Wrestling

Matthew Johnston warmwaffles

🛠️
Code Wrestling
View GitHub Profile

Object Files (.obj)

Object files define the geometry and other properties for objects in Wavefront's Advanced Visualizer. Object files can also be used to transfer geometric data back and forth between the Advanced Visualizer and other applications.

Object files can be in ASCII format (.obj) or binary format (.mod). This appendix describes the ASCII format for object files. These files must have the extension .obj.

@warmwaffles
warmwaffles / latency.markdown
Created December 9, 2015 06:36 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

require 'pp'
class Model
def initialize(args={})
set(args)
end
def set(attributes={})
return if attributes.nil? || attributes.empty? || !attributes.is_a?(Hash)
attributes.each do |k, v|
#ifndef _COMMON_H
#define _COMMON_H
#include <math.h>
#define square(v) ((v) * (v))
#define cube(v) ((v) * (v) * (v))
#define deg_to_rad(deg) ((deg) * (M_PI / 180.0))
#define rad_to_deg(rad) ((rad) * (180.0 / M_PI))
#include <stdint.h>
#include <string.h>
uint32_t float_to_raw_bits(float x)
{
uint32_t y;
memcpy(&y, &x, 4);
return y;
}
/*
* Generic hashmap manipulation functions
* SEE: http://elliottback.com/wp/hashmap-implementation-in-c/
*/
#ifndef __HASHMAP_H__
#define __HASHMAP_H__
#define MAP_MISSING -3 /* No such element */
#define MAP_FULL -2 /* Hashmap is full */
.
├── assets
├── build
│   ├── book.epub
│   ├── book.epub3
│   └── book.html
├── Rakefile
├── scratch
├── src
│   ├── backmatter
#ifndef UTILS_LOGGING_H
#define UTILS_LOGGING_H
#include <stdio.h>
/**
* Default logging level will be INFO
*/
#ifndef LOGLEVEL
#define LOGLEVEL 4
#include "minitest.h"
int main(int argc, const char *argv[]) {
ASSERT_TRUE(0, "expected 0 to be true");
ASSERT_FALSE(0, "expected 0 to be false");
return 0;
}
/// Seed of Andromeda Icosphere Generator
/// Written by Frank McCoy
/// Use it for whatever, but remember where you got it from.
///
/// SEE: https://www.seedofandromeda.com/blogs/49-procedural-gas-giant-rendering-with-gpu-noise
/// SEE: http://pastebin.com/aFdWi5eQ
#include <cstdint>
#include <unordered_map>
#include <vector>