This file contains 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
using System.Collections.Generic; | |
/// <summary> | |
/// Creates a very simple linear graph that can be sampled along arbitrary points. Clamps to | |
/// the nearest value when sampled out of range. This class assumes that all points given are | |
/// ALREADY SORTED from smallest to largest in the X axis. There is NO automatic sorting. | |
/// </summary> | |
public class InterpolatedCurve | |
{ | |
public List<(float, float)> Points = new List<(float, float)>(); |
This file contains 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
// This is a basic dummy version of a Stability Augmentation System. There's a bunch of technical | |
// terms for this, but I'm not a control systems engineer so feel free to correct me. I found a | |
// really awesome document (video?) somewhere that explained all this stuff but it was a while ago | |
// but I forgot where I saw it. | |
// This is meant to be set up per channel. It's serializable so you can change | |
// the authority and power of it per channel in the Inspector. | |
[System.Serializable] | |
public class SASChannel |
This file contains 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
inline half3 GammaToLinearSpace (half3 sRGB) | |
{ | |
// Approximate version from http://chilliant.blogspot.com.au/2012/08/srgb-approximations-for-hlsl.html?m=1 | |
return sRGB * (sRGB * (sRGB * 0.305306011h + 0.682171111h) + 0.012522878h); | |
} | |
inline half3 LinearToGammaSpace (half3 linRGB) | |
{ | |
linRGB = max(linRGB, half3(0.h, 0.h, 0.h)); | |
// An almost-perfect approximation from http://chilliant.blogspot.com.au/2012/08/srgb-approximations-for-hlsl.html?m=1 |
OlderNewer