Skip to content

Instantly share code, notes, and snippets.

View arxae's full-sized avatar

Andy Maesen arxae

View GitHub Profile
@arxae
arxae / ArxOrthoShadows.shader
Created August 19, 2014 10:20
Dynamic shadows in Unity pro using an orthogonal camera. Use as shader for all objects that need to cast and/or receive shadows.
Shader "ArxOrthoShadows" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
_Detail ("Detail (RGB)", 2D) = "gray" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 400
@arxae
arxae / DispatchTables.cs
Last active December 26, 2015 14:49
Dispatch tables
// Regular dispatch table
Dictionary<string, Action> dispatch = new Dictionary<string, Action>();
dispatch["help"] = new Action(() => Console.WriteLine("Hello :3"));
dispatch["dosomething"] = new Action(() =>
{
Console.WriteLine("Do Something else");
});
dispatch["help"]();
@arxae
arxae / RendererExtensions.cs
Created October 24, 2013 14:48
Checks if an object is in view of a camera (Unity)
using UnityEngine;
public static class RendererExtensions
{
public static bool IsVisibleFrom( this Renderer renderer, Camera camera )
{
Plane[] planes = GeometryUtility.CalculateFrustumPlanes( camera );
return GeometryUtility.TestPlanesAABB( planes, renderer.bounds );
}
}
@arxae
arxae / Box2DBasic.cs
Last active December 23, 2015 17:29
Basic SFML.NET / Box2DX example
using System;
using System.Diagnostics;
using Box2DX.Collision;
using Box2DX.Common;
using Box2DX.Dynamics;
using SFML.Graphics;
using SFML.Window;
using Color = SFML.Graphics.Color;
namespace TestingSFML