Skip to content

Instantly share code, notes, and snippets.

@BLaZeKiLL
BLaZeKiLL / marchingcube.cpp
Created July 19, 2021 17:33
Marching Cubes Data
const int VertexOffset[8][3] = {
{0, 0, 0}, {1, 0, 0}, {1, 1, 0}, {0, 1, 0},
{0, 0, 1}, {1, 0, 1}, {1, 1, 1}, {0, 1, 1}
};
const int EdgeConnection[12][2] = {
{0, 1}, {1, 2}, {2, 3}, {3, 0},
{4, 5}, {5, 6}, {6, 7}, {7, 4},
{0, 4}, {1, 5}, {2, 6}, {3, 7}
};
@BLaZeKiLL
BLaZeKiLL / vertexao.shader
Created May 10, 2021 16:07
Ao shader for greedy meshing in unity
Shader "VloxyEngine/Lit/VertexColorAO" {
Properties {
_Glossiness ("Smoothness", Range(0,1)) = 0.0
_Metallic ("Metallic", Range(0,1)) = 0.0
_AOColor ("AO Color", Color) = (0,0,0,1)
_AOCurve ("AO Curve", Vector) = (0.25, 0.175, 0.1, 0)
_AOIntensity ("AO Intensity", Range(0, 1)) = 1.0
_AOPower ("AO Power", Range(0, 1)) = 0.5
}
SubShader {
@BLaZeKiLL
BLaZeKiLL / mesher.cs
Created May 10, 2021 16:06
Greedy Meshing with AO in C# for Unity
using System.Linq;
using CodeBlaze.Vloxy.Engine.Data;
using UnityEngine;
namespace CodeBlaze.Vloxy.Engine.Mesher {
public class GreedyMesher<B> : IMesher<B> where B : IBlock {