Skip to content

Instantly share code, notes, and snippets.

View jesta88's full-sized avatar

Jeremie St-Amand jesta88

View GitHub Profile
@rygorous
rygorous / gist:2144712
Created March 21, 2012 05:20
half->float variants
// half->float variants.
// by Fabian "ryg" Giesen.
//
// I hereby place this code in the public domain.
//
// half_to_float_fast: table based
// tables could be done in a more compact fashion (in particular, can store tab2 in low word of tab1!)
// but something of a dead end since not very SIMD-friendly. pretty much abandoned at this point.
//
// half_to_float_fast2: use FP adder hardware to deal with denormals.
@efranford
efranford / ObjectDictionary.cs
Created December 9, 2012 15:21
Unity3D: Class that behaves like a Dictionary<K, V>, but can still be serialized and edited by the Unity Editor.
// Copyright (c) 2012 Calvin Rien
// http://the.darktable.com
//
// This software is provided 'as-is', without any express or implied warranty. In
// no event will the authors be held liable for any damages arising from the use
// of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
@MattRix
MattRix / RXDivider.cs
Last active May 1, 2024 18:15
Adds dividers into the inspector. Based on a brilliant idea by Matthew Wegner, see: https://twitter.com/mwegner/status/355147544818495488
//Based on a brilliant idea by Matthew Wegner - https://twitter.com/mwegner/status/355147544818495488
//Code for drawing the base PropertyDrawers is from here: http://forum.unity3d.com/threads/173401-Getting-Default-SerializedProperty-Drawing-within-a-PropertyDrawer?p=1186347&viewfull=1#post1186347
//My implementation is super lazy with magic numbers everywhere! :D
#if UNITY_EDITOR
using System;
using UnityEngine;
using System.Collections.Generic;
using UnityEditor;
Texture2D<uint> input : register( t0 );
RWTexture2D<float4> output : register( u0 );
static const uint rastafont8x8_bitmap[] =
{
0x00000000,0x00000000,0x0c1e1e0c,0x000c000c,0x00363636,0x00000000,0x367f3636,0x0036367f,
0x1e033e0c,0x000c1f30,0x18336300,0x0063660c,0x6e1c361c,0x006e333b,0x00030606,0x00000000,
0x06060c18,0x00180c06,0x18180c06,0x00060c18,0xff3c6600,0x0000663c,0x3f0c0c00,0x00000c0c,
0x00000000,0x060c0e00,0x3f000000,0x00000000,0x00000000,0x000c0c00,0x0c183060,0x00010306,
0x3f3b331e,0x001e3337,0x0c0c0f0c,0x003f0c0c,0x1c30331e,0x003f3306,0x1c30331e,0x001e3330,
@ChemiKhazi
ChemiKhazi / EnumFlagAttribute.cs
Created April 29, 2014 09:59
Unity3d property drawer for automatically making enums flags into mask fields in the inspector.
using UnityEngine;
public class EnumFlagAttribute : PropertyAttribute
{
public string enumName;
public EnumFlagAttribute() {}
public EnumFlagAttribute(string name)
{
@leegrey
leegrey / TileMapPathField.ts
Last active May 4, 2020 12:52
Pathfinding on a Grid with Flow Fields
// Copyright Lee Grey, 2014
// License: MIT
module lg.tileSystem {
import Vector2D = lg.math.geometry.Vector2D;
export class FieldInfo {
distanceFromTarget: number = -1;
@AngryAnt
AngryAnt / MoveComponentContext.cs
Last active July 5, 2017 05:44
Adds "Move to Top" and "Move to Bottom" items to the inspector context menu of components.
using UnityEngine;
using UnityEditor;
public class MoveComponentContext
{
enum Destination
{
Top,
Bottom
@bkaradzic
bkaradzic / orthodoxc++.md
Last active June 20, 2024 20:52
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@t0chas
t0chas / CustomEditorBase.cs
Last active March 5, 2024 16:47
Default Custom Inspector-Editor for Unity3D with ReorderableLists for arrays handling
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System.Collections.Generic;
using UnityEditor.AnimatedValues;
[CustomEditor(typeof(UnityEngine.Object), true, isFallback = true)]
[CanEditMultipleObjects]
public class CustomEditorBase : Editor
{