Original article: https://iquilezles.org/www/articles/noacos/noacos.htm
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
// From: https://web.archive.org/web/20080228213915/http://www.devmaster.net/forums/showthread.php?t=5784 | |
float sinApprox(float x) | |
{ | |
const float kPI32 = 3.14159265359f; | |
const float B = 4/kPI32; | |
const float C = -4/(kPI32*kPI32); | |
float y = B * x + C * x * abs(x); |
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
// Source: https://www.youtube.com/watch?v=1xlCVBIF_ig | |
float cubicSinf(float x) | |
{ | |
float t = x * 0.15915f; | |
t = t - (int)t; | |
return 20.785f * t * (t - 0.5f) * (t - 1.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
#include <windows.h> | |
#include <mmdeviceapi.h> | |
#include <audioclient.h> | |
#include <assert.h> | |
#define _USE_MATH_DEFINES | |
#include <math.h> // for sin() | |
#include <stdint.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
// Simple example code to load a Wav file and play it with WASAPI | |
// This is NOT complete Wav loading code. It is a barebones example | |
// that makes a lot of assumptions, see the assert() calls for details | |
// | |
// References: | |
// http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html | |
// Handmade Hero Day 138: Loading WAV Files | |
#include <windows.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
// Minimal Murmur3 implementation shared by Demetri Spanos on Handmade Network Discord | |
// | |
// Code is deliberately terse and simplistic | |
// Intended to be the first hash function you reach for e.g. a simple hash table | |
// *** NB THIS IS NOT A CRYPTOGRAPHIC HASH *** | |
// | |
// @demetrispanos: | |
// "yes let me reiterate the moral of this story | |
// there is never any reason to use a dumb made up hash function | |
// use murmur3 or jenkins-one-at-a-time for a 0-effort version |
- The Perils of Future-Coding - Sebastian Sylvan
- John Carmack on Inlined Code
- CppCon 2014: Mike Acton "Data-Oriented Design and C++"
- Semantic Compression - Casey Muratori
- Learning From Failure - Alex Evans. Talk about the long development of Media Molecule's Dreams.
- Thirteen Years of Bad Game Code - Evan Todd
- Memory Allocation Strategies blog series
- The Mundanity of Excellence - Daniel F. Chambliss. Really accessible academic paper on how people achieve excellence, literally everyone on earth should read this.
- [Mike
- encoding: http://www.unicode.org/versions/Unicode13.0.0/
- shaping: https://harfbuzz.github.io/
- font file format: https://docs.microsoft.com/en-us/typography/opentype/spec/
- rasterization:
- https://nothings.org/gamedev/rasterize/
- http://rastertragedy.com/
- https://www.grc.com/cleartype.htm
- https://www.freetype.org/freetype2/docs/text-rendering-general.html
- Rendering Resolution Independent Fonts in Games and 3D Applications (Master's Thesis - Olle Alvin): https://lup.lub.lu.se/luur/download?func=downloadFile&recordOId=9024910&fileOId=9024911
- Adventures in Text Rendering: Kerning and Glyph Atlases: https://www.warp.dev/blog/adventures-text-rendering-kerning-glyph-atlases
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
enum EntityProperty | |
{ | |
EntityProperty_IsActive, | |
EntityProperty_RenderModel, | |
EntityProperty_Hostile, | |
EntityProperty_OnFire, | |
EntityProperty_SomethingElse, | |
EntityProperty_Count | |
}; |
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
// Source: "xoshiro / xoroshiro generators and the PRNG shootout" | |
// https://prng.di.unimi.it/ | |
#include <stdint.h> | |
static inline double u64ToDoubleBetween01(uint64_t x) { | |
return (x >> 11) * 0x1.0p-53; | |
} | |
// I came up with the following function for 32-bit floats based on the above, let me know if it's wrong |
OlderNewer