Skip to content

Instantly share code, notes, and snippets.

Available stats:
Ai - Carving.ApplyResults - TimeNanoseconds
Ai - Carving.BuildBVTree - TimeNanoseconds
Ai - Carving.Clipping - TimeNanoseconds
Ai - Carving.ConvexHulls - TimeNanoseconds
Ai - Carving.Prepare - TimeNanoseconds
Ai - Carving.ProjectVertices - TimeNanoseconds
Ai - CollectSources - TimeNanoseconds
Ai - Colliders - TimeNanoseconds
Ai - Components.NavMeshAgent.SendMessage - TimeNanoseconds
@aaaddress1
aaaddress1 / clrHosting_v4.0.cpp
Last active March 22, 2024 14:50
CLR Hosting: running dotNet binary in C/C++ & rewrite from .NET(4+) COM interface
// CLR Hosting, by aaaddress1@chroot.org
//
// it's a new edition rewrite for .NET(4+) COM interface
// original from github.com/etormadiv/HostingCLR
// & blog.xpnsec.com/hiding-your-dotnet-etw
//
// this PoC supports the following .NET entry:
// >>>> static void Main(string[] args);
//
#include <stdio.h>
@cessen
cessen / fluv32.rs
Last active December 8, 2020 23:13
FLuv32 encoding/decoding
//! This code is licensed under CC0
//! https://creativecommons.org/publicdomain/zero/1.0/
//! Encoding/decoding for the 32-bit FLuv32 color format.
//!
//! This encoding is based on, but is slightly different than, the 32-bit
//! LogLuv format from the paper "Overcoming Gamut and Dynamic Range
//! Limitations in Digital Images" by Greg Ward:
//!
//! * It uses the same uv chroma storage approach, but with *very* slightly
@Rochet2
Rochet2 / LuaVal.h
Last active March 20, 2023 03:58
LuaVal is a C++ structure that is convertible from a lua table and to a lua table. Usage instructions at the bottom as a comment. Allows passing lua table between multiple lua states. Supports string, table, bool and number.
enum LuaTypeTag
{
TNIL,
TSTRING,
TTABLE,
TBOOL,
TNUMBER,
};
class LuaVal;
@yenmoc
yenmoc / Brenchmark serialize with unity .md
Created February 4, 2020 07:01
FlatBuffer vs MessagePack-Csharp vs JsonUtility

Brenchmark

  • Serialize and Deserialize array 2000 item
Type Size Deserialize Deserialize GC Serialize Serialize GC
FlatBuffer binary 2.846 0.0528 0.2485 0.2745 0.7279
MessagePack-Csharp binary 1.000 1.0000 1.0000 1.0000 1.0000
JsonUtility text 2.657 0.0793 0.6279 0.0341 0.3851
  • Searching item MemoryMaster is faster than FlatBuffer
@binaryfoundry
binaryfoundry / ShaderLabPBR.shader
Last active April 27, 2023 10:18
Unity PBR Shader
Shader "CustomPBRShader"
{
Properties
{
[NoScaleOffset] _Albedo("Albedo", Color) = (1.0, 1.0, 1.0, 1.0)
[NoScaleOffset] _Metalness("Conductivity", Range(0.0, 1.0)) = 0.0
[NoScaleOffset] _Roughness("Roughness", Range(0.0, 1.0)) = 0.0
[NoScaleOffset][HDR] _RadianceMap("RadianceMap", CUBE) = "" {}
[NoScaleOffset][HDR] _IrradianceMap("IrradianceMap", CUBE) = "" {}
}
@andreiagmu
andreiagmu / MToonToRealToonShaderSwapper.cs
Last active March 6, 2023 06:01
MToon to RealToon Shader Swapper for Unity
// MToon to RealToon Shader Swapper for Unity
// by Andy Miira (Andrei Müller), October 2019
//
//
// [IMPORTANT]
// You must add the file RenderPipelineHelper.cs to your project, linked below:
// https://gist.github.com/andreiagmu/b862ae47ef91be05f61ae2da26627a01
//
//
// [INSTRUCTIONS]
@jeffvella
jeffvella / PathTester.cs
Last active March 29, 2023 03:24
Find Path Tester for Unity Experimental Navigation
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.Collections;
using Unity.Mathematics;
using UnityEditor;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Experimental.AI;
@unitycoder
unitycoder / TerrainShaderTessellationDiffuse.shader
Created December 14, 2018 19:33
Terrain Shader Tesselation Diffuse
// Author: Przemyslaw Zaworski
// Modified version of original:
// https://github.com/przemyslawzaworski/Unity3D-CG-programming/blob/master/terrain_shader_tessellation_diffuse.shader
// Shader supports maximum four splat textures (Splat and Normal maps) with triangle tessellation.
// Works seamlessly with built-in Terrain Component. Lambert light model (directional) with shadow casting and receiving.
// https://forum.unity.com/threads/how-to-dynamically-tessellate-a-mesh.597469/#post-3997999
Shader "Terrain Shader Tessellation Diffuse"
{
Properties
@zeux
zeux / vertexcodec-comparison.txt
Last active May 23, 2019 16:45
Comparison of vertexcodec/indexcodec from meshoptimizer with Google Draco
Using fixed-point encoding for position (14 bits per component) and texture coordinates (12 bits per component), with 32-bit index buffer
and this vertex format:
// 12 bytes
struct PackedVertexOct
{
unsigned short px, py, pz;
unsigned char nu, nv; // octahedron encoded normal, aliases .pw
unsigned short tx, ty;
};