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; | |
#if UNITY_EDITOR | |
using UnityEditor; | |
#endif | |
using System.Collections; | |
[ExecuteInEditMode] | |
public class PreviewCulling : MonoBehaviour { | |
#if UNITY_EDITOR |
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; | |
public class ConveyorBelt : MonoBehaviour { | |
public float speed = 2.0f; | |
void FixedUpdate() | |
{ | |
Rigidbody rigidbody = GetComponent<Rigidbody>(); |
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
float3 GetAxis(float3 input) { | |
input = normalize(input) ; | |
float3 signs = sign(input) ; | |
float3 abss = abs(input) ; | |
float maxs = max(abss.x, max(abss.y, abbs.z)); | |
return floor(abss/maxs) * signs; | |
} |
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
//returns 1 if 0<=x<1, 0 otherwise | |
float IsBetween0And1(float x) { | |
return 1 - saturate(floor(abs((x-0.5)*2))); | |
} |
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; | |
using System.Collections.Generic; | |
public class MeshBatcher : MonoBehaviour { | |
class MeshStrip | |
{ | |
public List<int> strip = new List<int>(); |
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
float3 Refract(float3 position, float4 surface, float refractionIndex){ | |
//ray origin is the camera position | |
float3 viewerPosition = _WorldSpaceCameraPos.xyz; | |
//ray end is the vertex's undistorted position | |
float3 vertexPosition = position; | |
//get the vector from the camera to the vertex | |
float3 worldRay = vertexPosition - viewerPosition; |
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; | |
[ExecuteInEditMode] | |
[RequireComponent(typeof(MeshRenderer))] | |
public class RefractedBounds : MonoBehaviour { | |
MeshRenderer renderer; | |
void OnEnable() { |
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; | |
using System.Runtime.InteropServices; | |
public class PointerCursor : MonoBehaviour { | |
[DllImport("__Internal")] | |
public static extern void SetPointer(bool arg); | |
} |
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; | |
using System.Runtime.InteropServices; | |
public class PointerCursor : MonoBehaviour { | |
[DllImport("__Internal")] | |
public static extern void SetPointer(bool arg); | |
} |
OlderNewer