Skip to content

Instantly share code, notes, and snippets.

This is a collected list of the sample code for Metal that Apple has published so far. Links are subject to change, and all content is preliminary.

/*
Delta Compression by Glenn Fiedler.
This source code is placed in the public domain.
http://gafferongames.com/2015/03/14/the-networked-physics-data-compression-challenge/
*/
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
/*
Delta Compression (Round 2) by Glenn Fiedler.
This source code is placed in the public domain.
http://gafferongames.com/2015/03/14/the-networked-physics-data-compression-challenge/
*/
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
/*
http://benjithian.sg/2012/12/simple-background-subtraction/
Simple Background Subtraction. Simple stuff.
*/
#include <stdio.h>
#include <curl/curl.h>
#include <sstream>
#include <iostream>
#include <vector>
#include <opencv2/opencv.hpp>
@zloop1982
zloop1982 / fbfetch.shader
Created August 15, 2019 14:33 — forked from aras-p/fbfetch.shader
Framebuffer fetch shader in Unity
#include "UnityCG.cginc"
#pragma vertex vert
#pragma fragment frag
// in practice: only compile for gles2,gles3,metal
#pragma only_renderers framebufferfetch
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
};
@zloop1982
zloop1982 / InfiniteSky.shader
Created August 15, 2019 14:35 — forked from aras-p/InfiniteSky.shader
"Infinite sky" shader for unity
Shader "Unlit/InfiniteSky"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
// make this render super early inside transparencies
Tags { "RenderType"="Transparent-400" }
@zloop1982
zloop1982 / LightweightLightSorting.cs
Created December 11, 2019 13:31 — forked from phi-lira/LightweightLightSorting.cs
Old example of LWRP that sorted lights using the LightIndexMap
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
#if UNITY_EDITOR
using UnityEditor.Experimental.Rendering.LightweightPipeline;
#endif
using UnityEngine.Experimental.GlobalIllumination;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;