Skip to content

Instantly share code, notes, and snippets.

View S-V's full-sized avatar

Vyacheslav S. S-V

  • Earth
View GitHub Profile
@S-V
S-V / compile_time_fnv1a_hash.h
Created March 16, 2023 13:11
Compile-time strings hashing using FNV-1a algorithm (compiles in C++20)
#include <cstdint>
template< typename Result >
struct FnvHashTraits;
template <>
struct FnvHashTraits<std::uint32_t> {
static constexpr std::uint32_t basis = 2166136261ul;
static constexpr std::uint32_t prime = 16777619ul;
};
@S-V
S-V / VoxelGridIterator.h
Last active September 10, 2016 14:51
Uniform Grid Ray Casting
/**
* An iterator for a cubic grid of voxels.
*
* The iterator traverses all voxels along a specified direction starting from
* a given position.
*/
mxBIBREF(
"Ray casting technique described in paper:"
"A Fast Voxel Traversal Algorithm for Ray Tracing - John Amanatides, Andrew Woo [1987]"
"http://www.cse.yorku.ca/~amana/research/grid.pdf"