Skip to content

Instantly share code, notes, and snippets.

View garettbass's full-sized avatar
🤓

Garett Bass garettbass

🤓
View GitHub Profile
@aras-p
aras-p / package_builds_vs2017.cmd
Created April 9, 2019 19:36
Packaging up Visual Studio & Windows 10 SDK for in-repository usage
@echo off
@rem Packages up VS2017 toolchain into builds.7z archive
@set TOOLS_VERSION=14.13.26128
@cd "%~dp0"
@set VC_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\VC\
@if not exist "%VC_PATH%" goto error_no_vs
@if not exist "%VC_PATH%"Tools\MSVC\%TOOLS_VERSION% goto error_no_vs
@maluoi
maluoi / tga.h
Last active November 24, 2023 16:51
A super short and streamlined C/C++ function for writing .tga images to file! No dependencies, and no cruft.
// Copyright(c) 2019 Nick Klingensmith (@koujaku). All rights reserved.
//
// This work is licensed under the terms of the MIT license.
// For a copy of this license, see < https://opensource.org/licenses/MIT >
#pragma once
#include <stdio.h>
#include <stdint.h>
@samloeschen
samloeschen / BloomFilter.cs
Last active November 22, 2024 21:57
A fast and simple bloom filter for Unity using the double-kawase method
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BloomFilter : MonoBehaviour {
[Range(1, 16)]
public int iterations = 1;
[Range(0f, 1f)]
public float threshold = 0.8f;
[Range(0f, 1f)]
@garcia556
garcia556 / get.c
Created December 3, 2017 21:08
POSIX shared memory IPC example (shm_open, mmap), working on Linux and macOS
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define STORAGE_ID "/SHM_TEST"
#define STORAGE_SIZE 32
int main(int argc, char *argv[])
// SmoothDamp based head bob
// Not so good, yet
//
// 1. Turn off other head bobs
// 2. Put the script on the Character root
// 3. Assign the player's camera as 'Head'
// 4. Play, fiddle with values
//
// It requires Character Controller component to function
//
@mortenson
mortenson / ghpages.js
Last active January 22, 2021 19:56
Publish a sub-directory in your repository as the contents of your gh-pages branch
/**
This script takes a sub-directory of your repository, renames relative links
in HTML files to point to a Github Pages subdirectory, and publishes to your
gh-pages branch.
Use:
1. Download this script into the root of your project.
2. Run npm install --save-dev fs-extra rebase gh-pages
3. Rename "your-project" to the name of your Github project
4. If you have more than one HTML file, add it to the "files"
@Kinwailo
Kinwailo / FrustumAABBIntersect.cpp
Last active May 28, 2024 12:49
Frustum AABB Intersect
// Returns: INTERSECT : 0
// INSIDE : 1
// OUTSIDE : 2
int FrustumAABBIntersect(Plane *planes, Vector &mins, Vector &maxs) {
int ret = INSIDE;
Vector vmin, vmax;
for(int i = 0; i < 6; ++i) {
// X axis
if(planes[i].normal.x > 0) {
@tenmyo
tenmyo / initializer.c
Created December 21, 2016 06:11
Initializer/finalizer sample for MSVC and GCC/Clang.
// c - __attribute__((constructor)) equivalent in VC? - Stack Overflow
// http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc/2390626#2390626
// Rev.5
// Initializer/finalizer sample for MSVC and GCC/Clang.
// 2010-2016 Joe Lowe. Released into the public domain.
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
@reinsteam
reinsteam / atmosphere_clouds_rendering.md
Last active July 1, 2025 13:31
A collection of links to various materials on atmosphere / clouds rendering

Atmosphere / Clouds Rendering

Research papers

Atmosphere

  • A fast, simple method to render sky color using gradients maps [[Abad06]]
  • A Framework for the Experimental Comparison of Solar and Skydome Illumination [[Kider14]]
  • A Method for Modeling Clouds based on Atmospheric Fluid Dynamics [[Miyazaki01]]
  • A Physically-Based Night Sky Model [[Jensen01]]
@ruby0x1
ruby0x1 / hash_fnv1a.h
Last active May 30, 2025 19:22
FNV1a c++11 constexpr compile time hash functions, 32 and 64 bit
#pragma once
#include <stdint.h>
//fnv1a 32 and 64 bit hash functions
// key is the data to hash, len is the size of the data (or how much of it to hash against)
// code license: public domain or equivalent
// post: https://notes.underscorediscovery.com/constexpr-fnv1a/
inline const uint32_t hash_32_fnv1a(const void* key, const uint32_t len) {