This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using Microsoft.Win32; | |
using System.Runtime.InteropServices; | |
using System; | |
using System.Text; | |
namespace WorldClock { | |
public static class TimeZoneDatabase { | |
public const string KERNEL32 = "kernel32.dll"; | |
public const string REGISTRY = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __QUATERNION__ | |
#define __QUATERNION__ | |
#define HALF_DEG2RAD 8.72664625e-3 | |
float4 quaternion(float3 normalizedAxis, float degree) { | |
float rad = degree * HALF_DEG2RAD; | |
return float4(normalizedAxis * sin(rad), cos(rad)); | |
} | |
float4 qmul(float4 a, float4 b) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
using System.IO; | |
namespace LayerComposer { | |
public static class ScriptableObjectUtil { | |
public static void Create<T>(string path) where T : ScriptableObject { | |
var data = ScriptableObject.CreateInstance<T>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
namespace Gist { | |
public static class LensShift { | |
public static void Frustum(this Camera cam, out float left, out float right, out float bottom, out float top, out float near, out float far) { | |
near = cam.nearClipPlane; | |
far = cam.farClipPlane; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UVWorld : MonoBehaviour { | |
Mesh _mesh; | |
Vector3[] _vertices; | |
int[] _triangles; | |
Vector2[] _uvs; | |
Vector3[] _normals; | |
Triangle2D[] _uvTris; | |
void Awake() { | |
_mesh = GetComponent<MeshFilter>().sharedMesh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
namespace nobnak.Blending { | |
public class AutoHideCursor : MonoBehaviour { | |
public float hideAfterSeconds = 3f; | |
public float thresholdInPixels = 3f; | |
float _lastTime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __DEPTH_CGINC__ | |
#define __DEPTH_CGINC__ | |
float Z2EyeDepth(float z) { | |
return unity_OrthoParams.w < 0.5 | |
? LinearEyeDepth(z) | |
: ((_ProjectionParams.z - _ProjectionParams.y) * z + _ProjectionParams.y); | |
} | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
namespace Gist { | |
/* | |
* A speed-improved simplex noise algorithm for 2D, 3D and 4D in Java. | |
* | |
* Based on example code by Stefan Gustavson ([email protected]). | |
* Optimisations by Peter Eastman ([email protected]). | |
* Better rank ordering method by Stefan Gustavson in 2012. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Threading; | |
namespace Gist { | |
public static class Parallel { | |
static AutoResetEvent[] _resets; | |
public static void For(int fromInclusive, int toExclusive, System.Action<int> body) { | |
var numThreads = 2 * System.Environment.ProcessorCount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
namespace Gist { | |
public static class BoxMuller { | |
public const float TWO_PI = 2f * Mathf.PI; | |
public static Vector2 Gaussian() { | |
var u1 = Random.value; |
OlderNewer