Skip to content

Instantly share code, notes, and snippets.

View pema99's full-sized avatar

Pema Malling pema99

View GitHub Profile
@pema99
pema99 / WorldPositionFromDepth.shader
Created September 15, 2023 19:24
WorldPositionFromDepth thx d4rkpl4y3r and lox
Shader "Unlit/GridAllocation"
{
SubShader
{
Tags { "Queue" = "Overlay" }
ZTest Always
Pass
{
CGPROGRAM
@pema99
pema99 / AudioLinkUI.shader
Last active February 26, 2024 09:12
AudioLinkUI V3
Shader "AudioLink/AudioLinkUI"
{
Properties
{
_Gain("Gain", Range(0, 2)) = 1.0
[ToggleUI] _Autogain("Autogain", Float) = 0.0
_Threshold0("Low Threshold", Range(0, 1)) = 0.5
_Threshold1("Low Mid Threshold", Range(0, 1)) = 0.5
_Threshold2("High Mid Threshold", Range(0, 1)) = 0.5
Shader "Unlit/Shadowed"
{
SubShader
{
Pass
{
Tags { "LightMode"="Always" }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
Shader "Unlit/AudioLinkUI"
{
Properties
{
}
SubShader
{
Pass
{
CGPROGRAM
float3 drawTopArea(float2 uv)
{
float3 color = FOREGROUND_COLOR;
float areaWidth = 1.0 - FRAME_MARGIN * 2;
float areaHeight = 0.35;
float boxWidth = areaWidth / 4.0;
for (uint i = 0; i < 4; i++)
{
float3 drawTopArea(float2 uv)
{
float3 color = FOREGROUND_COLOR;
float areaWidth = 1.0 - FRAME_MARGIN * 2;
float areaHeight = 0.35;
float boxWidth = areaWidth / 4.0;
for (uint i = 0; i < 4; i++)
{
This file has been truncated, but you can view the full file.
Module {
types: {
[1]: Type {
name: None,
inner: Scalar {
kind: Float,
width: 4,
},
},
[2]: Type {
This file has been truncated, but you can view the full file.
Module {
types: {
[1]: Type {
name: None,
inner: Scalar {
kind: Float,
width: 4,
},
},
[2]: Type {
// Input program
sum List 'a =
| Cons 'a * List 'a
| Nil unit
let iota = [n]
let inner = rec [inner] [acc]
if acc >= n then Nil ()
else Cons (acc, inner (acc + 1))
// Hindley-Milner type inference, 2022 Pema Malling
// Resources:
// - https://course.ccs.neu.edu/cs4410sp19/lec_type-inference_notes.html
// - http://dev.stephendiehl.com/fun/006_hindley_milner.html#inference-monad
// AST and types
type Lit =
| Int of int
| Bool of bool