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/DitherTransparency" | |
{ | |
Properties | |
{ | |
_Color("Color", Color) = (1,1,1,1) | |
_Alpha("Alpha", Range(0,1))=1 | |
} | |
SubShader | |
{ | |
Tags { "RenderType"="Opaque" } |
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
float Log10Slider(float v, float min, float max, string label) | |
{ | |
using (new GUILayout.HorizontalScope()) | |
{ | |
GUILayout.Label(label); | |
var log = GUILayout.HorizontalSlider(Mathf.Log10(v), Mathf.Log10(min), Mathf.Log10(max), GUILayout.MinWidth(200f)); | |
v = Mathf.Pow(10, log); | |
v = GUIUtil.Field(v); | |
} | |
return v; |
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 TONE_INCLUDED | |
#define TONE_INCLUDED | |
half4 _Tone; | |
half3 CalcTone(half3 c) | |
{ | |
return lerp(c, _Tone.x*pow(c, _Tone.y) + _Tone.z, _Tone.w); | |
} |
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_INCLUDED | |
#define QUATERNION_INCLUDED | |
#include "./Random.cginc" | |
#define PI2 6.28318530718 | |
// Quaternion multiplication. | |
// http://mathworld.wolfram.com/Quaternion.html | |
float4 qmul(float4 q1, float4 q2) | |
{ | |
return float4( |
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 NOISE_INCLUDED | |
#define NOISE_INCLUDED | |
// | |
// Description : Array and textureless GLSL 2D simplex noise function. | |
// Author : Ian McEwan, Ashima Arts. | |
// Maintainer : ijm | |
// Lastmod : 20110822 (ijm) | |
// License : Copyright (C) 2011 Ashima Arts. All rights reserved. | |
// Distributed under the MIT License. See LICENSE file. | |
// https://github.com/ashima/webgl-noise |
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 static class ComputerShaderExtension | |
{ | |
public static void DispatchThreadNum(this ComputeShader cs, int kernel, int threadNumX, int threadNumY, int threadNumZ) | |
{ | |
uint x, y, z; | |
cs.GetKernelThreadGroupSizes(kernel, out x, out y, out z); | |
cs.Dispatch(kernel, Mathf.CeilToInt((float)threadNumX / x), Mathf.CeilToInt((float)threadNumY / y), Mathf.CeilToInt((float)threadNumZ / z)); | |
} | |
} |
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 "Custom/SimplestGSBillboard" | |
{ | |
Properties | |
{ | |
_Size ("Size", Float) = 1.0 | |
} | |
SubShader | |
{ | |
Tags { "RenderType"="Opaque" } |
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 static class IEnumerableExtensions | |
{ | |
public static IEnumerable<IEnumerable<T>> Chunks<T>(this IEnumerable<T> list, int size) | |
{ | |
var buf = list; | |
while (buf.Any()) | |
{ | |
yield return buf.Take(size); | |
buf = buf.Skip(size); | |
} |
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 BoolDataTemplateSelector : DataTemplateSelector | |
{ | |
public DataTemplate TrueTemplate { get; set; } | |
public DataTemplate FalseTemplate { get; set; } | |
public override DataTemplate SelectTemplate(object item, DependencyObject container) | |
{ | |
// Null value can be passed by IDE designer | |
if (item == null) return null; |
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; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class GUIOutSideDraggableSample : MonoBehaviour { | |
public Vector2 mousePos; | |
Vector2 boxSize = new Vector2(100f, 100f); | |
GUIStyle whiteBoxStyle; |