Skip to content

Instantly share code, notes, and snippets.

View GeorgeAdamon's full-sized avatar
🎯
Focusing

George Adamopoulos GeorgeAdamon

🎯
Focusing
View GitHub Profile
@Minimally
Minimally / LayerMenu.cs
Created April 19, 2014 19:52
Unity Editor script for filtering layers via keyboard
using UnityEditor;
using UnityEngine;
public static class LayerMenu
{
/* PLACE IN EDITOR FOLDER.
* Feel free to change hotkeys depending on your preference.
* Modifier Keys % (ctrl on Windows, cmd on OS X), # (shift), & (alt), _ (no key modifiers) */
#region Layer Visibility
@sebbbi
sebbbi / ConeTraceAnalytic.txt
Created August 27, 2018 07:02
Cone trace analytic solution
Spherical cap cone analytic solution is a 1d problem, since the cone cap sphere slides along the ray. The intersection point to empty space sphere is always on the ray.
S : radius of cone cap sphere at t=1
r(d) : cone cap sphere radius at distance d
r(d) = d*S
p = distance of current SDF sample
SDF(p) = sdf function result at location p
x = distance after conservative step
using System;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
public class NativeMesh : IDisposable
{
public NativeArray<float3> VertexBuffer;
public NativeArray<float3> NormalBuffer;
@phi-lira
phi-lira / DrawMeshPass
Last active September 6, 2022 14:50
Custom Pass injected by script
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
[ExecuteInEditMode]
public class CustomPass : MonoBehaviour
{
public Mesh mesh;
public Material material;
DrawMeshPass m_DrawMeshPass;
@dericed
dericed / ffmpeg pixel formats
Created August 11, 2012 00:35
snapshot of pixel format list from ffmpeg, ffmpeg version 0.11.1.git built on Aug 8 2012 11:29:53
Pixel formats:
I.... = Supported Input format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
....B = Bitstream format
FLAGS NAME NB_COMPONENTS BITS_PER_PIXEL
-----
IO... yuv420p 3 12
IO... yuyv422 3 16
@patricknelson
patricknelson / Quaternion.shader
Last active May 11, 2023 15:49 — forked from nkint/pointTowards.vertex
Shader functions to facilitate rotation of vertex around point with a quaternion (Unity / HLSL / Cg)
// Full shader example demonstrating how to use a quaterionion to rotate a vertex around a specific point. Note that this is just a plain
// vanilla unlit shader which includes the necessary functions (see section below) and example code in the vertex shader.
//
// Forked from https://gist.github.com/nkint/7449c893fb7d6b5fa83118b8474d7dcb
// Converted from GLSL to Cg. For help with that, see https://alastaira.wordpress.com/2015/08/07/unity-shadertoys-a-k-a-converting-glsl-shaders-to-cghlsl/
//
// quaternion code from https://github.com/stackgl/gl-quat
// rotation from https://twistedpairdevelopment.wordpress.com/2013/02/11/rotating-a-vector-by-a-quaternion-in-glsl/
Shader "Unlit/Quaternion"
@JakubNei
JakubNei / MyQuaternion.cs
Last active June 8, 2023 17:14
A custom completely managed implementation of UnityEngine.Quaternion. Base is decompiled UnityEngine.Quaternion. Doesn't implement methods marked Obsolete. Does implicit coversions to and from UnityEngine.Quaternion
using System;
using UnityEngine.Internal;
using UnityEngine;
using System.Runtime.Serialization;
using System.Xml.Serialization;
/// <summary>
/// Quaternions are used to represent rotations.
/// A custom completely managed implementation of UnityEngine.Quaternion
/// Base is decompiled UnityEngine.Quaternion
// This doesn't seem to work properly
//#define USE_UNITY_PIN_FUNCTION
using System;
using System.Runtime.InteropServices;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.Assertions;
// Trick for creating a temporary NativeArray which points to the contents of a managed array.
@benkitzelman
benkitzelman / SineWave.cs
Created April 25, 2013 10:30
Generate WAV formatted dtmf tones in C#
using System;
using System.Collections.Generic;
using System.Text;
namespace ConversionLayer.Wave
{
internal class SineWave
{
#region Fields
@johnbanq
johnbanq / cast.h
Created August 24, 2023 19:32
fixed header file for pytorch3d #1024
/*
pybind11/cast.h: Partial template specializations to cast between
C++ and Python types
Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
All rights reserved. Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.
*/