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 UnityEngine.XR; | |
[DefaultExecutionOrder(-10000)] | |
public class VRSettings : MonoBehaviour { | |
public float resolutionScale = 1.4f; | |
void Awake() { | |
XRSettings.eyeTextureResolutionScale = resolutionScale; | |
Time.fixedDeltaTime = Time.timeScale / XRDevice.refreshRate; |
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; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public static class VRMath { | |
#region Vector/Quaternion Functions | |
public static Quaternion FromToQuaternion(Quaternion from, Quaternion to) => to * Quaternion.Inverse(from); | |
public static Vector3 EulerDelta(Quaternion from, Quaternion to) { | |
var rot = to * Quaternion.Inverse(from); |
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
Shader "Unlit/OutlineShader" { | |
Properties { | |
[HDR] _OutlineColor ("Outline Color", Color) = (1,1,1,1) | |
_OutlineRadius ("Outline Radius", Float) = 0.1 | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } | |
LOD 100 | |
Pass { |
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
// source: Math for Game Programmers: Noise-Based RNG | |
// https://www.youtube.com/watch?v=LWFzPP8ZbdU | |
public static class CynNoise { | |
const uint BIT_NOISE0 = 0xB5297A4D; | |
const uint BIT_NOISE1 = 0x68E31DA4; | |
const uint BIT_NOISE2 = 0x1B56C4E9; | |
const uint PRIME0 = 3175861097; | |
const uint PRIME1 = 198491317; | |
const uint PRIME2 = 6542989; |
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; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public static class Utilities { | |
// shifts all array elements to the right, inserting newValue at the beginning | |
public static void ShiftInto<T>(T[] array, T newValue) { | |
T carry = newValue; | |
for (int i=0; i<array.Length; i++) { | |
// this is basically swapping carry and the array index |