Skip to content

Instantly share code, notes, and snippets.

View ryuukk's full-sized avatar

ryuukk

View GitHub Profile
@bgolus
bgolus / InfiniteGrid.shader
Last active June 12, 2024 18:15
Infinite Grid shader with procedural grid with configurable divisions and major and minor lines markings.
Shader "Unlit/InfiniteGrid"
{
Properties
{
[Toggle] _WorldUV ("Use World Space UV", Float) = 1.0
_GridScale ("Grid Scale", Float) = 1.0
_GridBias ("Grid Bias", Float) = 0.5
_GridDiv ("Grid Divisions", Float) = 10.0
_BaseColor ("Base Color", Color) = (0,0,0,1)
_LineColor ("Line Color", Color) = (1,1,1,1)
@JiayinCao
JiayinCao / tiny_fiber.h
Last active May 11, 2024 07:40
Tiny Fiber ( A razor thin cross platform fiber library )
/*
MIT License
Copyright (c) 2023 Jiayin Cao
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
#include <stdio.h>
#include <stdlib.h>
// -----------------------------------------------------------------------------
// Cross platform high resolution timer
// From https://gist.github.com/ForeverZer0/0a4f80fc02b96e19380ebb7a3debbee5
#include <stdint.h>
#include <stdbool.h>
#if defined(__linux)
@cshenton
cshenton / block_allocator.odin
Last active March 25, 2024 00:45
Allocator based on Sebastian Aaltonen's Offset Allocator, for suballocating GPU heaps
package block_allocator
// Allocator based on Sebastian Aaltonen's Offset Allocator:
// https://github.com/sebbbi/OffsetAllocator/blob/main/offsetAllocator.cpp
import "core:fmt"
import "core:math/bits"
import "core:math/rand"
assert_allocator_layout_good :: proc(allocator: ^Block_Allocator) {
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- created by lxqt-config-appearance (DO NOT EDIT!) -->
<fontconfig>
<include ignore_missing="yes">conf.d</include>
<match target="font">
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
</match>
@lithdew
lithdew / sparse.zig
Created June 26, 2022 09:26
zig: generational paged sparse set
const std = @import("std");
const sparse = @This();
/// This is an implementation of a paged sparse set that stores the payload in
/// the sparse array.
//
/// A sparse set has a dense and a sparse array. The sparse array is directly
/// indexed by a 64 bit identifier. The sparse element is linked with a dense
/// element, which allows for liveliness checking. The liveliness check itself
@slimsag
slimsag / ramblings.md
Last active December 13, 2023 08:02
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

@vurtun
vurtun / sort.c
Last active January 11, 2023 15:22
// ref: http://www.codercorner.com/RadixSortRevisited.htm
// http://stereopsis.com/radix.html
// int/float: https://github.com/lshamis/FloatRadixSort
// string: https://github.com/rantala/string-sorting/blob/master/src/msd_ce.cpp
struct str {
const char *str;
const char *end;
int len;
};
@mitchellh
mitchellh / Atlas.zig
Last active March 8, 2024 03:10
Bin-packed texture atlas implementation in Zig. https://en.wikipedia.org/wiki/Texture_atlas
//! Implements a texture atlas (https://en.wikipedia.org/wiki/Texture_atlas).
//!
//! The implementation is based on "A Thousand Ways to Pack the Bin - A
//! Practical Approach to Two-Dimensional Rectangle Bin Packing" by Jukka
//! Jylänki. This specific implementation is based heavily on
//! Nicolas P. Rougier's freetype-gl project as well as Jukka's C++
//! implementation: https://github.com/juj/RectangleBinPack
//!
//! Limitations that are easy to fix, but I didn't need them:
//!
bass_enable=false
bass_maxgain=5
compression_aggressiveness=10
compression_enable=false
compression_maxatk=0
compression_maxrel=195
convolver_enable=false
convolver_file=""
convolver_optimization_mode=0
convolver_waveform_edit="-80;-100;0;0;0;0"