Skip to content

Instantly share code, notes, and snippets.

View iOrange's full-sized avatar
💭
🎮

iOrange

💭
🎮
View GitHub Profile
@iOrange
iOrange / aes.hpp
Created January 30, 2020 15:38 — forked from Pushkoff/aes.hpp
AES header only library
#pragma once
#define AES_COMPILER_UNKNOWN 0
#define AES_COMPILER_MSVC 1
#define AES_COMPILER_GCC 2
#define AES_COMPILER_ICC 3
#define AES_COMPILER_CLANG 4
#if defined(__clang__)
#define AES_COMPILER AES_COMPILER_CLANG
@iOrange
iOrange / tbn_from_quat.c
Created August 3, 2018 14:52 — forked from reinsteam/tbn_from_quat.c
Snippet to calculate TBN basis from quaternion in 8 instructions (seems like this one is used at Crytek: http://www.crytek.com/download/izfrey_siggraph2011.pdf)
/*----------------------------------------------------------------------------------------------------------------------
Custom cross-product: mad + mul
----------------------------------------------------------------------------------------------------------------------*/
half3 crs(half3 v0, half3 v1)
{
//return cross(v0, v1);
half3 v0_0 = v0.yzx;
half3 v0_1 = v1.zxy;
half3 v1_0 = v0.zxy;
half3 v1_1 = v1.yzx;
@iOrange
iOrange / BlendModes.c
Created August 6, 2017 01:03 — forked from elringus/BlendModes.c
Popular blend modes algorithms implemented in Cg.
fixed G (fixed4 c) { return .299 * c.r + .587 * c.g + .114 * c.b; }
fixed4 Darken (fixed4 a, fixed4 b)
{
fixed4 r = min(a, b);
r.a = b.a;
return r;
}
fixed4 Multiply (fixed4 a, fixed4 b)