Skip to content

Instantly share code, notes, and snippets.

@DuncanF
DuncanF / PresetHandling.cs
Last active August 24, 2020 07:57
Unity preset handling for use with editor MIDI control
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Presets;
using UnityEditor.SceneManagement;
@DuncanF
DuncanF / gist:353509dd397ea5f292fa52d1b9b5133d
Created January 29, 2020 10:43
Unity lockless (no GPU readback) marching cubes via Graphics.DrawProceduralIndirect - some slight faffing because compute shader must append full triangle (3 verts) at a time to render correctly, but this means the appendbuffer count is 3 times smaller than it needs to be, so we have to invoke a very short compute shader (FixupIndirectArgs) just…
MarchingCubesGPU.cs:
...
// DrawProceduralIndirect
ComputeBuffer argsBuffer;
[StructLayout(LayoutKind.Sequential)]
struct DrawCallArgBuffer
{
public const int size =
sizeof(int) +
sizeof(int) +