mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-23 18:15:13 +00:00
Change Project License to MIT (#700)
* license change replace unneeded package * reword this
This commit is contained in:
parent
487e23bfd7
commit
b876934b73
153 changed files with 167 additions and 5439 deletions
|
@ -2,7 +2,6 @@ using UnityEngine;
|
|||
using UnityEngine.UI;
|
||||
|
||||
using TMPro;
|
||||
using Starpelly;
|
||||
|
||||
public class ColorPreview : MonoBehaviour
|
||||
{
|
||||
|
@ -21,18 +20,18 @@ public class ColorPreview : MonoBehaviour
|
|||
public void ChangeColor(Color c)
|
||||
{
|
||||
colorPicker.color = c;
|
||||
hex.text = c.Color2Hex();
|
||||
hex.text = Color2Hex(c);
|
||||
}
|
||||
|
||||
public void OnColorChanged(Color c)
|
||||
{
|
||||
previewGraphic.color = c;
|
||||
hex.text = c.Color2Hex();
|
||||
hex.text = Color2Hex(c);
|
||||
}
|
||||
|
||||
public void SetColorFromHex(string hex)
|
||||
{
|
||||
colorPicker.color = Starpelly.Colors.Hex2RGB(hex);
|
||||
colorPicker.color = Hex2RGB(hex);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
|
@ -45,4 +44,38 @@ public class ColorPreview : MonoBehaviour
|
|||
{
|
||||
SetColorFromHex(hex.text);
|
||||
}
|
||||
|
||||
static string Color2Hex(Color color)
|
||||
{
|
||||
Color32 col = (Color32)color;
|
||||
string hex = col.r.ToString("X2") + col.g.ToString("X2") + col.b.ToString("X2");
|
||||
return hex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Hexadecimal Color to an RGB Color.
|
||||
/// </summary>
|
||||
static Color Hex2RGB(string hex)
|
||||
{
|
||||
if (hex is null or "") return Color.black;
|
||||
try
|
||||
{
|
||||
hex = hex.Replace("0x", "");//in case the string is formatted 0xFFFFFF
|
||||
hex = hex.Replace("#", "");//in case the string is formatted #FFFFFF
|
||||
byte a = 255;//assume fully visible unless specified in hex
|
||||
byte r = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
byte g = byte.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
//Only use alpha if the string has enough characters
|
||||
if (hex.Length >= 8)
|
||||
{
|
||||
a = byte.Parse(hex.Substring(6, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
}
|
||||
return new Color32(r, g, b, a);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Color.black;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cb987a8733a64924aa4c1bcbe27e6430
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,115 +0,0 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Starpelly
|
||||
{
|
||||
public class Anchors
|
||||
{
|
||||
//------------Top-------------------
|
||||
public static void TopLeft(GameObject uiObject)
|
||||
{
|
||||
RectTransform uitransform = uiObject.GetComponent<RectTransform>();
|
||||
|
||||
uitransform.anchorMin = new Vector2(0, 1);
|
||||
uitransform.anchorMax = new Vector2(0, 1);
|
||||
uitransform.pivot = new Vector2(0, 1);
|
||||
}
|
||||
|
||||
public static void TopMiddle(GameObject uiObject)
|
||||
{
|
||||
RectTransform uitransform = uiObject.GetComponent<RectTransform>();
|
||||
|
||||
uitransform.anchorMin = new Vector2(0.5f, 1);
|
||||
uitransform.anchorMax = new Vector2(0.5f, 1);
|
||||
uitransform.pivot = new Vector2(0.5f, 1);
|
||||
}
|
||||
|
||||
|
||||
public static void TopRight(GameObject uiObject)
|
||||
{
|
||||
RectTransform uitransform = uiObject.GetComponent<RectTransform>();
|
||||
|
||||
uitransform.anchorMin = new Vector2(1, 1);
|
||||
uitransform.anchorMax = new Vector2(1, 1);
|
||||
uitransform.pivot = new Vector2(1, 1);
|
||||
}
|
||||
|
||||
//------------Middle-------------------
|
||||
public static void MiddleLeft(GameObject uiObject)
|
||||
{
|
||||
RectTransform uitransform = uiObject.GetComponent<RectTransform>();
|
||||
|
||||
uitransform.anchorMin = new Vector2(0, 0.5f);
|
||||
uitransform.anchorMax = new Vector2(0, 0.5f);
|
||||
uitransform.pivot = new Vector2(0, 0.5f);
|
||||
}
|
||||
|
||||
public static void Mmiddle(GameObject uiObject)
|
||||
{
|
||||
RectTransform uitransform = uiObject.GetComponent<RectTransform>();
|
||||
|
||||
uitransform.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
uitransform.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
uitransform.pivot = new Vector2(0.5f, 0.5f);
|
||||
}
|
||||
|
||||
public static void MiddleRight(GameObject uiObject)
|
||||
{
|
||||
RectTransform uitransform = uiObject.GetComponent<RectTransform>();
|
||||
|
||||
uitransform.anchorMin = new Vector2(1, 0.5f);
|
||||
uitransform.anchorMax = new Vector2(1, 0.5f);
|
||||
uitransform.pivot = new Vector2(1, 0.5f);
|
||||
}
|
||||
|
||||
//------------Bottom-------------------
|
||||
public static void BottomLeft(GameObject uiObject)
|
||||
{
|
||||
RectTransform uitransform = uiObject.GetComponent<RectTransform>();
|
||||
|
||||
uitransform.anchorMin = new Vector2(0, 0);
|
||||
uitransform.anchorMax = new Vector2(0, 0);
|
||||
uitransform.pivot = new Vector2(0, 0);
|
||||
}
|
||||
|
||||
public static void BottomMiddle(GameObject uiObject)
|
||||
{
|
||||
RectTransform uitransform = uiObject.GetComponent<RectTransform>();
|
||||
|
||||
uitransform.anchorMin = new Vector2(0.5f, 0);
|
||||
uitransform.anchorMax = new Vector2(0.5f, 0);
|
||||
uitransform.pivot = new Vector2(0.5f, 0);
|
||||
}
|
||||
|
||||
public static void BottomRight(GameObject uiObject)
|
||||
{
|
||||
RectTransform uitransform = uiObject.GetComponent<RectTransform>();
|
||||
|
||||
uitransform.anchorMin = new Vector2(1, 0);
|
||||
uitransform.anchorMax = new Vector2(1, 0);
|
||||
uitransform.pivot = new Vector2(1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static class RectTransformExtensions
|
||||
{
|
||||
public static void SetLeft(this RectTransform rt, float left)
|
||||
{
|
||||
rt.offsetMin = new Vector2(left, rt.offsetMin.y);
|
||||
}
|
||||
|
||||
public static void SetRight(this RectTransform rt, float right)
|
||||
{
|
||||
rt.offsetMax = new Vector2(-right, rt.offsetMax.y);
|
||||
}
|
||||
|
||||
public static void SetTop(this RectTransform rt, float top)
|
||||
{
|
||||
rt.offsetMax = new Vector2(rt.offsetMax.x, -top);
|
||||
}
|
||||
|
||||
public static void SetBottom(this RectTransform rt, float bottom)
|
||||
{
|
||||
rt.offsetMin = new Vector2(rt.offsetMin.x, bottom);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1d8c3539b2e2fb543b570b5d5e8cc79a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,41 +0,0 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Starpelly
|
||||
{
|
||||
public static class Colors
|
||||
{
|
||||
public static string Color2Hex(this Color color)
|
||||
{
|
||||
Color32 col = (Color32)color;
|
||||
string hex = col.r.ToString("X2") + col.g.ToString("X2") + col.b.ToString("X2");
|
||||
return hex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Hexadecimal Color to an RGB Color.
|
||||
/// </summary>
|
||||
public static Color Hex2RGB(this string hex)
|
||||
{
|
||||
if (hex is null or "") return Color.black;
|
||||
try
|
||||
{
|
||||
hex = hex.Replace("0x", "");//in case the string is formatted 0xFFFFFF
|
||||
hex = hex.Replace("#", "");//in case the string is formatted #FFFFFF
|
||||
byte a = 255;//assume fully visible unless specified in hex
|
||||
byte r = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
byte g = byte.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
//Only use alpha if the string has enough characters
|
||||
if (hex.Length >= 8)
|
||||
{
|
||||
a = byte.Parse(hex.Substring(6, 2), System.Globalization.NumberStyles.HexNumber);
|
||||
}
|
||||
return new Color32(r, g, b, a);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Color.black;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 50a7b803bf8f71447b31651201c679bd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Starpelly.Enums.Windows;
|
||||
|
||||
namespace Starpelly.Common
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct POINT
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 443faccde9dc53c488a2e5a987167620
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: af122b943aa4c9b42aff726e52d9ab65
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,34 +0,0 @@
|
|||
namespace Starpelly.Enums.Strings
|
||||
{
|
||||
public enum StringType : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Both uppercase and lowercase letters in english.
|
||||
/// </summary>
|
||||
Alpha,
|
||||
/// <summary>
|
||||
/// All numbers ranging from 0-9
|
||||
/// </summary>
|
||||
Numeric,
|
||||
/// <summary>
|
||||
/// Both uppercase and lowercase letters with all numbers ranging from 0-9. (english)
|
||||
/// </summary>
|
||||
Alphanumeric,
|
||||
/// <summary>
|
||||
/// All uppercase letters in english.
|
||||
/// </summary>
|
||||
Uppercase,
|
||||
/// <summary>
|
||||
/// All lowercase letters in english.
|
||||
/// </summary>
|
||||
Lowercase,
|
||||
/// <summary>
|
||||
/// All punctuation marks on the QWERTY keyboard. (Also contains special keys)
|
||||
/// </summary>
|
||||
Punctuation,
|
||||
/// <summary>
|
||||
/// All of the above.
|
||||
/// </summary>
|
||||
ALL
|
||||
}
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
using Starpelly.Common;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Starpelly.Enums.Windows
|
||||
{
|
||||
public enum WindowsCursor : int
|
||||
{
|
||||
StandardArrowAndSmallHourglass = 32650,
|
||||
StandardArrow = 32512,
|
||||
Crosshair = 32515,
|
||||
Hand = 32649,
|
||||
ArrowAndQuestionMark = 32651,
|
||||
IBeam = 32513,
|
||||
/// <summary>
|
||||
/// Obsolete for applications marked version 4.0 or later.
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
Icon = 32641,
|
||||
SlashedCircle = 32648,
|
||||
/// <summary>
|
||||
/// Obsolete for applications marked version 4.0 or later. Use FourPointedArrowPointingNorthSouthEastAndWest
|
||||
/// </summary>
|
||||
[System.Obsolete]
|
||||
Size = 32640,
|
||||
FourPointedArrowPointingNorthSouthEastAndWest = 32646,
|
||||
DoublePointedArrowPointingNortheastAndSouthwest = 32643,
|
||||
DoublePointedArrowPointingNorthAndSouth = 32645,
|
||||
DoublePointedArrowPointingNorthwestAndSoutheast = 32642,
|
||||
DoublePointedArrowPointingWestAndEast = 32644,
|
||||
VerticalArrow = 32516,
|
||||
Hourglass = 32514
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum SendInputEventType : uint
|
||||
{
|
||||
InputMouse,
|
||||
InputKeyboard,
|
||||
InputHardware
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MOUSEINPUT
|
||||
{
|
||||
public int dx;
|
||||
public int dy;
|
||||
public uint mouseData;
|
||||
public MouseEventFlags dwFlags;
|
||||
public uint time;
|
||||
public IntPtr dwExtraInfo;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct KEYBOARDINPUT
|
||||
{
|
||||
public ushort wVk;
|
||||
public ushort wScan;
|
||||
public uint dwFlags;
|
||||
public uint time;
|
||||
public IntPtr dwExtraInfo;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct HARDWAREINPUT
|
||||
{
|
||||
public int uMsg;
|
||||
public short wParamL;
|
||||
public short wParamH;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct MOUSEANDKEYBOARDINPUT
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public MOUSEINPUT mi;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public KEYBOARDINPUT ki;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public HARDWAREINPUT hi;
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum MouseEventFlags : uint
|
||||
{
|
||||
MOUSEEVENT_MOVE = 0x0001,
|
||||
MOUSEEVENT_LEFTDOWN = 0x0002,
|
||||
MOUSEEVENT_LEFTUP = 0x0004,
|
||||
MOUSEEVENT_RIGHTDOWN = 0x0008,
|
||||
MOUSEEVENT_RIGHTUP = 0x0010,
|
||||
MOUSEEVENT_MIDDLEDOWN = 0x0020,
|
||||
MOUSEEVENT_MIDDLEUP = 0x0040,
|
||||
MOUSEEVENT_XDOWN = 0x0080,
|
||||
MOUSEEVENT_XUP = 0x0100,
|
||||
MOUSEEVENT_WHEEL = 0x0800,
|
||||
MOUSEEVENT_VIRTUALDESK = 0x4000,
|
||||
MOUSEEVENT_ABSOLUTE = 0x8000
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct INPUT
|
||||
{
|
||||
public SendInputEventType type;
|
||||
public MOUSEANDKEYBOARDINPUT mkhi;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9aa3c38600fe0124ea40791c379eb5d0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,18 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
public static T DeepClone<T>(this T obj)
|
||||
{
|
||||
using (MemoryStream stream = new MemoryStream())
|
||||
{
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
formatter.Serialize(stream, obj);
|
||||
stream.Position = 0;
|
||||
|
||||
return (T)formatter.Deserialize(stream);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 98be75cbdf7662d43bf84e7f1ac7d58e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,93 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Starpelly
|
||||
{
|
||||
public static class Mathp
|
||||
{
|
||||
/// <summary>
|
||||
/// Rounds float to nearest interval.
|
||||
/// </summary>
|
||||
public static float Round2Nearest(float a, float interval)
|
||||
{
|
||||
return a = a - (a % interval);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the difference between two floats.
|
||||
/// </summary>
|
||||
public static float Difference(float num1, float num2)
|
||||
{
|
||||
float cout;
|
||||
cout = Mathf.Max(num2, num1) - Mathf.Min(num1, num2);
|
||||
return cout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the closest value in a list compared to value given.
|
||||
/// </summary>
|
||||
public static float GetClosestInList(List<float> list, float compareTo)
|
||||
{
|
||||
if (list.Count > 0)
|
||||
return list.Aggregate((x, y) => Mathf.Abs(x - compareTo) < Mathf.Abs(y - compareTo) ? x : y);
|
||||
else
|
||||
return -40;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the numbers after a decimal.
|
||||
/// </summary>
|
||||
public static float GetDecimalFromFloat(float number)
|
||||
{
|
||||
return number % 1; // this is simple as fuck, but i'm dumb and forget this all the time
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts two numbers to a range of 0 - 1
|
||||
/// </summary>
|
||||
/// <param name="val">The input value.</param>
|
||||
/// <param name="min">The min input.</param>
|
||||
/// <param name="max">The max input.</param>
|
||||
public static float Normalize(float val, float min, float max)
|
||||
{
|
||||
return (val - min) / (max - min);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a normalized value to a normal float.
|
||||
/// </summary>
|
||||
/// <param name="val">The normalized value.</param>
|
||||
/// <param name="min">The min input.</param>
|
||||
/// <param name="max">The max input.</param>
|
||||
public static float DeNormalize(float val, float min, float max)
|
||||
{
|
||||
return (val * (max - min) + min);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if a value is within a certain range.
|
||||
/// </summary>
|
||||
public static bool IsWithin(this float val, float min, float max)
|
||||
{
|
||||
return val >= min && val <= max;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if a value is within a certain range.
|
||||
/// </summary>
|
||||
public static bool IsWithin(this Vector2 val, Vector2 min, Vector2 max)
|
||||
{
|
||||
return val.x.IsWithin(min.x, max.x) && val.y.IsWithin(min.y, max.y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if value is between two numbers.
|
||||
/// </summary>
|
||||
public static bool IsBetween<T>(this T item, T start, T end)
|
||||
{
|
||||
return Comparer<T>.Default.Compare(item, start) >= 0
|
||||
&& Comparer<T>.Default.Compare(item, end) <= 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 09ae937b4a8b92d4386ba5172d1ad67f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,23 +0,0 @@
|
|||
namespace Starpelly
|
||||
{
|
||||
public static class OS
|
||||
{
|
||||
private static readonly OperatingSystem.IOperatingSystem _os;
|
||||
|
||||
static OS()
|
||||
{
|
||||
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
||||
_os = new OperatingSystem.Windows();
|
||||
#elif UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX
|
||||
_os = new OperatingSystem.Linux();
|
||||
#elif UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX
|
||||
_os = new OperatingSystem.MacOS();
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void ChangeWindowTitle(string newTitle)
|
||||
{
|
||||
_os.ChangeWindowTitle(newTitle);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 36edcede4a1a4ef9bb0902354c3be0d1
|
||||
timeCreated: 1655775758
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7b17a1aeeb0f43bb805dc7ac03408ebb
|
||||
timeCreated: 1655775758
|
|
@ -1,7 +0,0 @@
|
|||
namespace Starpelly.OperatingSystem
|
||||
{
|
||||
public interface IOperatingSystem
|
||||
{
|
||||
public void ChangeWindowTitle(string newTitle);
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8bb82376a44e4330b6398deddb17d282
|
||||
timeCreated: 1655775758
|
|
@ -1,16 +0,0 @@
|
|||
#if UNITY_EDITOR_LINUX || UNITY_STANDALONE_LINUX
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Starpelly.OperatingSystem
|
||||
{
|
||||
public class Linux : IOperatingSystem
|
||||
{
|
||||
public void ChangeWindowTitle(string newTitle)
|
||||
{
|
||||
var pid = Process.GetCurrentProcess().Id;
|
||||
var args = $"search --all --pid {pid} --class '.' set_window --name \"{newTitle}\"";
|
||||
Process.Start("xdotool", args);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9e5d25ae0c3e4256abae4d2e07f7e14b
|
||||
timeCreated: 1655775758
|
|
@ -1,10 +0,0 @@
|
|||
namespace Starpelly.OperatingSystem
|
||||
{
|
||||
public class MacOS : IOperatingSystem
|
||||
{
|
||||
public void ChangeWindowTitle(string newTitle)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cfc6152d5db74f568b229047970f7889
|
||||
timeCreated: 1655775758
|
|
@ -1,58 +0,0 @@
|
|||
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
using Starpelly.Common;
|
||||
using Starpelly.Enums.Windows;
|
||||
|
||||
namespace Starpelly.OperatingSystem
|
||||
{
|
||||
public class User32
|
||||
{
|
||||
#region Input
|
||||
[DllImport("user32.dll", EntryPoint = "SetCursor")]
|
||||
public static extern IntPtr SetCursor(IntPtr hCursor);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "LoadCursor")]
|
||||
public static extern IntPtr LoadCursor(IntPtr hInstance, int lpCursorName);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
public static extern uint SendInput(uint numberOfInputs, INPUT[] inputs, int sizeOfInputStructure);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern long SetCursorPos(int x, int y);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool ClientToScreen(IntPtr hWnd, ref POINT point);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool GetCursorPos(out POINT p);
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
public static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetDesktopWindow();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetWindowDC(IntPtr ptr);
|
||||
#endregion
|
||||
|
||||
#region Window
|
||||
[DllImport("user32.dll", EntryPoint = "SetWindowText")]
|
||||
public static extern bool SetWindowText(IntPtr hwnd, String lpString);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "FindWindow")]
|
||||
public static extern IntPtr FindWindow(String className, String windowName);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern int GetWindowText(IntPtr hWnd, StringBuilder text, int count);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetForegroundWindow();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eaea5ea9d5c881b4cb40464086c3a1da
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,141 +0,0 @@
|
|||
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Starpelly.Enums.Windows;
|
||||
using System.Text;
|
||||
|
||||
namespace Starpelly.OperatingSystem
|
||||
{
|
||||
public class Windows : IOperatingSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the current title of the game window.
|
||||
/// </summary>
|
||||
/// <returns>The current title the window is, will probably only be used for changing the window in ChangeWindowTitle()</returns>
|
||||
private static string GetActiveWindowTitle()
|
||||
{
|
||||
const int nChars = 256;
|
||||
StringBuilder Buff = new StringBuilder(nChars);
|
||||
IntPtr handle = User32.GetForegroundWindow();
|
||||
|
||||
if (User32.GetWindowText(handle, Buff, nChars) > 0)
|
||||
{
|
||||
return Buff.ToString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Changes the game's window title.
|
||||
/// </summary>
|
||||
/// <param name="newTitle">The title the window will be changed to.</param>
|
||||
public void ChangeWindowTitle(string newTitle)
|
||||
{
|
||||
var windowPtr = User32.FindWindow(null, GetActiveWindowTitle());
|
||||
User32.SetWindowText(windowPtr, newTitle);
|
||||
}
|
||||
|
||||
#region Input
|
||||
|
||||
/// <summary>
|
||||
/// Simulates a real key press passed in.
|
||||
/// </summary>
|
||||
public static void KeyPress(KeyCodeWin keyCode)
|
||||
{
|
||||
INPUT input = new INPUT
|
||||
{
|
||||
type = SendInputEventType.InputKeyboard,
|
||||
mkhi = new MOUSEANDKEYBOARDINPUT
|
||||
{
|
||||
ki = new KEYBOARDINPUT
|
||||
{
|
||||
wVk = (ushort)keyCode,
|
||||
wScan = 0,
|
||||
dwFlags = 0, // if nothing, key down
|
||||
time = 0,
|
||||
dwExtraInfo = IntPtr.Zero,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
INPUT input2 = new INPUT
|
||||
{
|
||||
type = SendInputEventType.InputKeyboard,
|
||||
mkhi = new MOUSEANDKEYBOARDINPUT
|
||||
{
|
||||
ki = new KEYBOARDINPUT
|
||||
{
|
||||
wVk = (ushort)keyCode,
|
||||
wScan = 0,
|
||||
dwFlags = 2, // key up
|
||||
time = 0,
|
||||
dwExtraInfo = IntPtr.Zero,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
INPUT[] inputs = new INPUT[] { input, input2 }; // Combined, it's a keystroke
|
||||
User32.SendInput((uint)inputs.Length, inputs, Marshal.SizeOf(typeof(INPUT)));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets your mouse pointer.
|
||||
/// </summary>
|
||||
public static void ChangeCursor(WindowsCursor cursor)
|
||||
{
|
||||
User32.SetCursor(User32.LoadCursor(IntPtr.Zero, (int)cursor));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Immediately clicks the left mouse button.
|
||||
/// </summary>
|
||||
public static void ClickLeftMouseButton()
|
||||
{
|
||||
INPUT mouseDownInput = new INPUT();
|
||||
mouseDownInput.type = SendInputEventType.InputMouse;
|
||||
mouseDownInput.mkhi.mi.dwFlags = MouseEventFlags.MOUSEEVENT_LEFTDOWN;
|
||||
User32.SendInput(1, ref mouseDownInput, Marshal.SizeOf(new INPUT()));
|
||||
|
||||
INPUT mouseUpInput = new INPUT();
|
||||
mouseUpInput.type = SendInputEventType.InputMouse;
|
||||
mouseUpInput.mkhi.mi.dwFlags = MouseEventFlags.MOUSEEVENT_LEFTUP;
|
||||
User32.SendInput(1, ref mouseUpInput, Marshal.SizeOf(new INPUT()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Immediately clicks the right mouse button.
|
||||
/// </summary>
|
||||
public static void ClickRightMouseButton()
|
||||
{
|
||||
INPUT mouseDownInput = new INPUT();
|
||||
mouseDownInput.type = SendInputEventType.InputMouse;
|
||||
mouseDownInput.mkhi.mi.dwFlags = MouseEventFlags.MOUSEEVENT_RIGHTDOWN;
|
||||
User32.SendInput(1, ref mouseDownInput, Marshal.SizeOf(new INPUT()));
|
||||
|
||||
INPUT mouseUpInput = new INPUT();
|
||||
mouseUpInput.type = SendInputEventType.InputMouse;
|
||||
mouseUpInput.mkhi.mi.dwFlags = MouseEventFlags.MOUSEEVENT_RIGHTUP;
|
||||
User32.SendInput(1, ref mouseUpInput, Marshal.SizeOf(new INPUT()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves your cursor in the x and y params implemented, plus the current mouse pos.
|
||||
/// </summary>
|
||||
/// <param name="dx">Direction X</param>
|
||||
/// <param name="dy">Direction Y</param>
|
||||
public static void MouseMove(int dx, int dy)
|
||||
{
|
||||
INPUT mouseMove = new INPUT();
|
||||
mouseMove.type = SendInputEventType.InputMouse;
|
||||
mouseMove.mkhi.mi.dwFlags = MouseEventFlags.MOUSEEVENT_MOVE;
|
||||
mouseMove.mkhi.mi.dx = dx;
|
||||
mouseMove.mkhi.mi.dy = dy;
|
||||
User32.SendInput(1, ref mouseMove, Marshal.SizeOf(new INPUT()));
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ad72bc489623a464780ec0ff75fe7d70
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,167 +0,0 @@
|
|||
namespace Pelly
|
||||
{
|
||||
public enum KeyCodeWin : ushort
|
||||
{
|
||||
#region Media
|
||||
MEDIA_NEXT_TRACK = 0xb0,
|
||||
MEDIA_PREV_TRACK = 0xb1,
|
||||
MEDIA_STOP = 0xb2,
|
||||
MEDIA_PLAY_PAUSE = 0xb3,
|
||||
#endregion
|
||||
|
||||
#region Math Functions
|
||||
MULTIPLY = 0x6a, // '*'
|
||||
ADD = 0x6b,
|
||||
SUBTRACT = 0x6d,
|
||||
DIVIDE = 0x6f,
|
||||
#endregion
|
||||
|
||||
#region Browser
|
||||
BROWSER_BACK = 0xa6,
|
||||
BROWSER_FORWARD = 0xa7,
|
||||
BROWSER_REFRESH = 0xa8,
|
||||
BROWSER_STOP = 0xa9,
|
||||
BROWSER_SEARCH = 0xaa,
|
||||
BROWSER_FAVORITES = 0xab,
|
||||
BROWSER_HOME = 0xac,
|
||||
#endregion
|
||||
|
||||
#region Numpad numbers
|
||||
NUMPAD0 = 0x60,
|
||||
NUMPAD1 = 0x61,
|
||||
NUMPAD2 = 0x62,
|
||||
NUMPAD3 = 0x63,
|
||||
NUMPAD4 = 0x64, // 100
|
||||
NUMPAD5 = 0x65,
|
||||
NUMPAD6 = 0x66,
|
||||
NUMPAD7 = 0x67,
|
||||
NUMPAD8 = 0x68,
|
||||
NUMPAD9 = 0x69,
|
||||
#endregion
|
||||
|
||||
#region Function Keys
|
||||
F1 = 0x70,
|
||||
F2 = 0x71,
|
||||
F3 = 0x72,
|
||||
F4 = 0x73,
|
||||
F5 = 0x74,
|
||||
F6 = 0x75,
|
||||
F7 = 0x76,
|
||||
F8 = 0x77,
|
||||
F9 = 0x78,
|
||||
F10 = 0x79,
|
||||
F11 = 0x7a,
|
||||
F12 = 0x7b,
|
||||
F13 = 0x7c,
|
||||
F14 = 0x7d,
|
||||
F15 = 0x7e,
|
||||
F16 = 0x7f,
|
||||
F17 = 0x80,
|
||||
F18 = 0x81,
|
||||
F19 = 130,
|
||||
F20 = 0x83,
|
||||
F21 = 0x84,
|
||||
F22 = 0x85,
|
||||
F23 = 0x86,
|
||||
F24 = 0x87,
|
||||
#endregion
|
||||
|
||||
#region Other
|
||||
// see https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
|
||||
OEM_COLON = 0xba, // OEM_1
|
||||
OEM_102 = 0xe2,
|
||||
OEM_2 = 0xbf,
|
||||
OEM_3 = 0xc0,
|
||||
OEM_4 = 0xdb,
|
||||
OEM_BACK_SLASH = 0xdc, // OEM_5
|
||||
OEM_6 = 0xdd,
|
||||
OEM_7 = 0xde,
|
||||
OEM_8 = 0xdf,
|
||||
OEM_CLEAR = 0xfe,
|
||||
OEM_COMMA = 0xbc,
|
||||
OEM_MINUS = 0xbd, // Underscore
|
||||
OEM_PERIOD = 0xbe,
|
||||
OEM_PLUS = 0xbb,
|
||||
#endregion
|
||||
|
||||
#region KEYS
|
||||
KEY_0 = 0x30,
|
||||
KEY_1 = 0x31,
|
||||
KEY_2 = 0x32,
|
||||
KEY_3 = 0x33,
|
||||
KEY_4 = 0x34,
|
||||
KEY_5 = 0x35,
|
||||
KEY_6 = 0x36,
|
||||
KEY_7 = 0x37,
|
||||
KEY_8 = 0x38,
|
||||
KEY_9 = 0x39,
|
||||
KEY_A = 0x41,
|
||||
KEY_B = 0x42,
|
||||
KEY_C = 0x43,
|
||||
KEY_D = 0x44,
|
||||
KEY_E = 0x45,
|
||||
KEY_F = 0x46,
|
||||
KEY_G = 0x47,
|
||||
KEY_H = 0x48,
|
||||
KEY_I = 0x49,
|
||||
KEY_J = 0x4a,
|
||||
KEY_K = 0x4b,
|
||||
KEY_L = 0x4c,
|
||||
KEY_M = 0x4d,
|
||||
KEY_N = 0x4e,
|
||||
KEY_O = 0x4f,
|
||||
KEY_P = 0x50,
|
||||
KEY_Q = 0x51,
|
||||
KEY_R = 0x52,
|
||||
KEY_S = 0x53,
|
||||
KEY_T = 0x54,
|
||||
KEY_U = 0x55,
|
||||
KEY_V = 0x56,
|
||||
KEY_W = 0x57,
|
||||
KEY_X = 0x58,
|
||||
KEY_Y = 0x59,
|
||||
KEY_Z = 0x5a,
|
||||
#endregion
|
||||
|
||||
#region volume
|
||||
VOLUME_MUTE = 0xad,
|
||||
VOLUME_DOWN = 0xae,
|
||||
VOLUME_UP = 0xaf,
|
||||
#endregion
|
||||
|
||||
SNAPSHOT = 0x2c,
|
||||
RIGHT_CLICK = 0x5d,
|
||||
BACKSPACE = 8,
|
||||
CANCEL = 3,
|
||||
CAPS_LOCK = 20,
|
||||
CONTROL = 0x11,
|
||||
ALT = 18,
|
||||
DECIMAL = 110,
|
||||
DELETE = 0x2e,
|
||||
DOWN = 40,
|
||||
END = 0x23,
|
||||
ESC = 0x1b,
|
||||
HOME = 0x24,
|
||||
INSERT = 0x2d,
|
||||
LAUNCH_APP1 = 0xb6,
|
||||
LAUNCH_APP2 = 0xb7,
|
||||
LAUNCH_MAIL = 180,
|
||||
LAUNCH_MEDIA_SELECT = 0xb5,
|
||||
LCONTROL = 0xa2,
|
||||
LEFT = 0x25,
|
||||
LSHIFT = 0xa0,
|
||||
LWIN = 0x5b,
|
||||
PAGEDOWN = 0x22,
|
||||
NUMLOCK = 0x90,
|
||||
PAGE_UP = 0x21,
|
||||
RCONTROL = 0xa3,
|
||||
ENTER = 13,
|
||||
RIGHT = 0x27,
|
||||
RSHIFT = 0xa1,
|
||||
RWIN = 0x5c,
|
||||
SHIFT = 0x10,
|
||||
SPACE_BAR = 0x20,
|
||||
TAB = 9,
|
||||
UP = 0x26,
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 270c0104ad1fee346ac2cd6cdc617329
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 20020e40c9650d34a938ffef9aa986cf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,13 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Starpelly.Properties
|
||||
{
|
||||
public static class Arrays
|
||||
{
|
||||
public static void Push<T>(ref T[] table, object value)
|
||||
{
|
||||
Array.Resize(ref table, table.Length + 1);
|
||||
table.SetValue(value, table.Length - 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f44e2d87a27b15847b56b14db8a25730
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,56 +0,0 @@
|
|||
using Starpelly.Enums.Strings;
|
||||
|
||||
namespace Starpelly.Properties
|
||||
{
|
||||
public class Strings
|
||||
{
|
||||
/// <summary>
|
||||
/// Chooses a string based on the StringType chosen.
|
||||
/// </summary>
|
||||
/// <param name="stringType">The string type eg. (uppercase, lowercase, numeric)</param>
|
||||
/// <returns>A list of chars because enums don't support strings. :(</returns>
|
||||
public static string Chars(StringType stringType)
|
||||
{
|
||||
const string alpha = @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
const string numeric = @"0123456789";
|
||||
const string alphanumeric = @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
const string uppercase = @"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
const string lowercase = @"abcdefghijklmnopqrstuvwxyz";
|
||||
const string punctuation = @"!@#$%^&*()_+{}:|<>?/.,;'\[]-=`~ ";
|
||||
const string all = @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+{}:|<>?/.,;'\[]-=`~ ";
|
||||
|
||||
string returnString;
|
||||
|
||||
// I wish C# had the ability to use strings with enums
|
||||
switch (stringType)
|
||||
{
|
||||
case StringType.Alpha:
|
||||
returnString = alpha;
|
||||
break;
|
||||
case StringType.Numeric:
|
||||
returnString = numeric;
|
||||
break;
|
||||
case StringType.Alphanumeric:
|
||||
returnString = alphanumeric;
|
||||
break;
|
||||
case StringType.Uppercase:
|
||||
returnString = uppercase;
|
||||
break;
|
||||
case StringType.Lowercase:
|
||||
returnString = lowercase;
|
||||
break;
|
||||
case StringType.Punctuation:
|
||||
returnString = punctuation;
|
||||
break;
|
||||
case StringType.ALL:
|
||||
returnString = all;
|
||||
break;
|
||||
default:
|
||||
returnString = all;
|
||||
break;
|
||||
}
|
||||
|
||||
return returnString;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bbc057365bf984546b564868d853a53a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,30 +0,0 @@
|
|||
# Starpelly
|
||||
Tools for Unity
|
||||
|
||||
Simulates the "A" key press every 0.6 seconds:
|
||||
```cs
|
||||
using UnityEngine;
|
||||
|
||||
using Starpelly.OS;
|
||||
|
||||
public class test : MonoBehaviour
|
||||
{
|
||||
private float action = 0.0f;
|
||||
private float period = 0.6f;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Application.runInBackground = true;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Time.time > action)
|
||||
{
|
||||
action += period;
|
||||
Windows.KeyPress(Starpelly.KeyCodeWin.KEY_A);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
|
@ -1,7 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 420b909aa281dcb478854d7bbba95ebf
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,25 +0,0 @@
|
|||
using System.Linq;
|
||||
|
||||
using Starpelly.Enums.Strings;
|
||||
|
||||
namespace Starpelly.Random
|
||||
{
|
||||
public class Strings
|
||||
{
|
||||
private static System.Random random = new System.Random();
|
||||
|
||||
/// <summary>
|
||||
/// Function used to get a random string using the StringType and length provided.
|
||||
/// </summary>
|
||||
/// <param name="stringType">The string type. e.g, (uppercase, lowercase, numeric)</param>
|
||||
/// <param name="length">The length you want the string to be.</param>
|
||||
/// <returns>A random string of characters in a random order.</returns>
|
||||
public static string RandomString(StringType stringType, int length)
|
||||
{
|
||||
string chars = Properties.Strings.Chars(stringType);
|
||||
|
||||
return new string(Enumerable.Repeat(chars, length)
|
||||
.Select(s => s[random.Next(s.Length)]).ToArray());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2c01318b4f5f869499a36b5d80319b47
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,62 +0,0 @@
|
|||
using UnityEngine;
|
||||
|
||||
public static class RendererExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Counts the bounding box corners of the given RectTransform that are visible from the given Camera in screen space.
|
||||
/// </summary>
|
||||
/// <returns>The amount of bounding box corners that are visible from the Camera.</returns>
|
||||
/// <param name="rectTransform">Rect transform.</param>
|
||||
/// <param name="camera">Camera.</param>
|
||||
private static int CountCornersVisibleFrom(this RectTransform rectTransform, Camera camera)
|
||||
{
|
||||
Rect screenBounds = new Rect(0f, 0f, Screen.width, Screen.height); // Screen space bounds (assumes camera renders across the entire screen)
|
||||
Vector3[] objectCorners = new Vector3[4];
|
||||
rectTransform.GetWorldCorners(objectCorners);
|
||||
|
||||
int visibleCorners = 0;
|
||||
Vector3 tempScreenSpaceCorner; // Cached
|
||||
for (var i = 0; i < objectCorners.Length; i++) // For each corner in rectTransform
|
||||
{
|
||||
tempScreenSpaceCorner = camera.WorldToScreenPoint(objectCorners[i]); // Transform world space position of corner to screen space
|
||||
if (screenBounds.Contains(tempScreenSpaceCorner)) // If the corner is inside the screen
|
||||
{
|
||||
visibleCorners++;
|
||||
}
|
||||
}
|
||||
return visibleCorners;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if this RectTransform is fully visible from the specified camera.
|
||||
/// Works by checking if each bounding box corner of this RectTransform is inside the cameras screen space view frustrum.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if is fully visible from the specified camera; otherwise, <c>false</c>.</returns>
|
||||
/// <param name="rectTransform">Rect transform.</param>
|
||||
/// <param name="camera">Camera.</param>
|
||||
public static bool IsFullyVisibleFrom(this RectTransform rectTransform, Camera camera)
|
||||
{
|
||||
return CountCornersVisibleFrom(rectTransform, camera) == 4; // True if all 4 corners are visible
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if this RectTransform is at least partially visible from the specified camera.
|
||||
/// Works by checking if any bounding box corner of this RectTransform is inside the cameras screen space view frustrum.
|
||||
/// </summary>
|
||||
/// <returns><c>true</c> if is at least partially visible from the specified camera; otherwise, <c>false</c>.</returns>
|
||||
/// <param name="rectTransform">Rect transform.</param>
|
||||
/// <param name="camera">Camera.</param>
|
||||
public static bool IsVisibleFrom(this RectTransform rectTransform, Camera camera)
|
||||
{
|
||||
return CountCornersVisibleFrom(rectTransform, camera) > 0; // True if any corners are visible
|
||||
}
|
||||
|
||||
public static bool MouseIsWithin(this RectTransform rectTransform)
|
||||
{
|
||||
var normalizedMousePosition = new Vector2(Input.mousePosition.x / Screen.width, Input.mousePosition.y / Screen.height);
|
||||
return normalizedMousePosition.x > rectTransform.anchorMin.x &&
|
||||
normalizedMousePosition.x < rectTransform.anchorMax.x &&
|
||||
normalizedMousePosition.y > rectTransform.anchorMin.y &&
|
||||
normalizedMousePosition.y < rectTransform.anchorMax.y;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e8273052806a5334cbf581670753ee77
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,111 +0,0 @@
|
|||
using UnityEngine;
|
||||
|
||||
public static class ScreenUtility
|
||||
{
|
||||
public static Camera camera;
|
||||
|
||||
public static float Left
|
||||
{
|
||||
get
|
||||
{
|
||||
if (camera)
|
||||
return camera.ViewportToWorldPoint(new Vector3(0f, 0f, 0f)).x;
|
||||
|
||||
if (Camera.main)
|
||||
return Camera.main.ViewportToWorldPoint(new Vector3(0f, 0f, 0f)).x;
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public static float Right
|
||||
{
|
||||
get
|
||||
{
|
||||
if (camera)
|
||||
return camera.ViewportToWorldPoint(new Vector3(1.0f, 0f, 0f)).x;
|
||||
|
||||
if (Camera.main)
|
||||
return Camera.main.ViewportToWorldPoint(new Vector3(1.0f, 0f, 0f)).x;
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public static float Top
|
||||
{
|
||||
get
|
||||
{
|
||||
if (camera)
|
||||
return camera.ViewportToWorldPoint(new Vector3(0f, 1.0f, 0f)).y;
|
||||
|
||||
if (Camera.main)
|
||||
return Camera.main.ViewportToWorldPoint(new Vector3(0f, 1.0f, 0f)).y;
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public static float Bottom
|
||||
{
|
||||
get
|
||||
{
|
||||
if (camera)
|
||||
return camera.ViewportToWorldPoint(new Vector3(0f, 0f, 0f)).y;
|
||||
|
||||
if (Camera.main)
|
||||
return Camera.main.ViewportToWorldPoint(new Vector3(0f, 0f, 0f)).y;
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector3 Center
|
||||
{
|
||||
get
|
||||
{
|
||||
if (camera)
|
||||
return camera.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0f));
|
||||
|
||||
if (Camera.main)
|
||||
return Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0f));
|
||||
|
||||
return Vector3.zero;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ScreenContainsPoint(Vector3 worldPosition)
|
||||
{
|
||||
return Camera.main.rect.Contains(Camera.main.WorldToViewportPoint(worldPosition));
|
||||
}
|
||||
|
||||
public static void ConstrainCamera(Camera camera, Bounds bounds)
|
||||
{
|
||||
float left = camera.ViewportToWorldPoint(new Vector3(0f, 0f, 0f)).x;
|
||||
float right = camera.ViewportToWorldPoint(new Vector3(1.0f, 0f, 0f)).x;
|
||||
float top = camera.ViewportToWorldPoint(new Vector3(0f, 1.0f, 0f)).y;
|
||||
float bottom = camera.ViewportToWorldPoint(new Vector3(0f, 0f, 0f)).y;
|
||||
|
||||
if (top > bounds.max.y)
|
||||
{
|
||||
float topDiff = bounds.max.y - top;
|
||||
camera.transform.position += new Vector3(0, topDiff, 0);
|
||||
}
|
||||
else if (bottom < bounds.min.y)
|
||||
{
|
||||
float botDiff = bounds.min.y - bottom;
|
||||
camera.transform.position += new Vector3(0, botDiff, 0);
|
||||
}
|
||||
|
||||
if (right > bounds.max.x)
|
||||
{
|
||||
float rightDiff = bounds.max.x - right;
|
||||
camera.transform.position += new Vector3(rightDiff, 0, 0);
|
||||
}
|
||||
else if (left < bounds.min.x)
|
||||
{
|
||||
float leftDiff = bounds.min.x - left;
|
||||
camera.transform.position += new Vector3(leftDiff, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8ef77a2b31ced114793835fcc91d9e34
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f189f8c5d2787e84694d7f3a2be16a20
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ad209f05754ddf4a96bf4e0e02b9228
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Add"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Add(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ae724cf80d801b43b140517e4bbb12f
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: edc6b21aef727c14bb42932e92c7be29
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,233 +0,0 @@
|
|||
#ifndef PHOTOSHOP_BLENDMODES_INCLUDED
|
||||
#define PHOTOSHOP_BLENDMODES_INCLUDED
|
||||
|
||||
//
|
||||
// Ported from https://www.shadertoy.com/view/XdS3RW
|
||||
//
|
||||
// Original License:
|
||||
//
|
||||
// Creative Commons CC0 1.0 Universal (CC-0)
|
||||
//
|
||||
// 25 of the layer blending modes from Photoshop.
|
||||
//
|
||||
// The ones I couldn't figure out are from Nvidia's advanced blend equations extension spec -
|
||||
// http://www.opengl.org/registry/specs/NV/blend_equation_advanced.txt
|
||||
//
|
||||
// ~bj.2013
|
||||
//
|
||||
|
||||
// Helpers
|
||||
|
||||
const fixed3 l = fixed3(0.3, 0.59, 0.11);
|
||||
|
||||
/** @private */
|
||||
float pinLight(float s, float d)
|
||||
{
|
||||
return (2.0*s - 1.0 > d) ? 2.0*s - 1.0 : (s < 0.5 * d) ? 2.0*s : d;
|
||||
}
|
||||
|
||||
/** @private */
|
||||
float vividLight(float s, float d)
|
||||
{
|
||||
return (s < 0.5) ? 1.0 - (1.0 - d) / (2.0 * s) : d / (2.0 * (1.0 - s));
|
||||
}
|
||||
|
||||
/** @private */
|
||||
float hardLight(float s, float d)
|
||||
{
|
||||
return (s < 0.5) ? 2.0*s*d : 1.0 - 2.0*(1.0 - s)*(1.0 - d);
|
||||
}
|
||||
|
||||
/** @private */
|
||||
float softLight(float s, float d)
|
||||
{
|
||||
return (s < 0.5) ? d - (1.0 - 2.0*s)*d*(1.0 - d)
|
||||
: (d < 0.25) ? d + (2.0*s - 1.0)*d*((16.0*d - 12.0)*d + 3.0)
|
||||
: d + (2.0*s - 1.0) * (sqrt(d) - d);
|
||||
}
|
||||
|
||||
/** @private */
|
||||
float overlay( float s, float d )
|
||||
{
|
||||
return (d < 0.5) ? 2.0*s*d : 1.0 - 2.0*(1.0 - s)*(1.0 - d);
|
||||
}
|
||||
|
||||
// rgb<-->hsv functions by Sam Hocevar
|
||||
// http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
|
||||
/** @private */
|
||||
fixed3 rgb2hsv(fixed3 c)
|
||||
{
|
||||
fixed4 K = fixed4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
fixed4 p = lerp(fixed4(c.bg, K.wz), fixed4(c.gb, K.xy), step(c.b, c.g));
|
||||
fixed4 q = lerp(fixed4(p.xyw, c.r), fixed4(c.r, p.yzx), step(p.x, c.r));
|
||||
|
||||
float d = q.x - min(q.w, q.y);
|
||||
float e = 1.0e-10;
|
||||
return fixed3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
}
|
||||
|
||||
/** @private */
|
||||
fixed3 hsv2rgb(fixed3 c)
|
||||
{
|
||||
fixed4 K = fixed4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
fixed3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * lerp(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
// Public API Blend Modes
|
||||
|
||||
fixed3 ColorBurn(fixed3 s, fixed3 d)
|
||||
{
|
||||
return 1.0 - (1.0 - d) / s;
|
||||
}
|
||||
|
||||
fixed3 LinearBurn(fixed3 s, fixed3 d )
|
||||
{
|
||||
return s + d - 1.0;
|
||||
}
|
||||
|
||||
fixed3 DarkerColor(fixed3 s, fixed3 d)
|
||||
{
|
||||
return (s.x + s.y + s.z < d.x + d.y + d.z) ? s : d;
|
||||
}
|
||||
|
||||
fixed3 Lighten(fixed3 s, fixed3 d)
|
||||
{
|
||||
return max(s, d);
|
||||
}
|
||||
|
||||
fixed3 Screen(fixed3 s, fixed3 d)
|
||||
{
|
||||
return s + d - s * d;
|
||||
}
|
||||
|
||||
fixed3 ColorDodge(fixed3 s, fixed3 d)
|
||||
{
|
||||
return d / (1.0 - s);
|
||||
}
|
||||
|
||||
fixed3 LinearDodge(fixed3 s, fixed3 d)
|
||||
{
|
||||
return s + d;
|
||||
}
|
||||
|
||||
fixed3 LighterColor(fixed3 s, fixed3 d)
|
||||
{
|
||||
return (s.x + s.y + s.z > d.x + d.y + d.z) ? s : d;
|
||||
}
|
||||
|
||||
fixed3 Overlay(fixed3 s, fixed3 d)
|
||||
{
|
||||
fixed3 c;
|
||||
c.x = overlay(s.x, d.x);
|
||||
c.y = overlay(s.y, d.y);
|
||||
c.z = overlay(s.z, d.z);
|
||||
return c;
|
||||
}
|
||||
|
||||
fixed3 SoftLight(fixed3 s, fixed3 d)
|
||||
{
|
||||
fixed3 c;
|
||||
c.x = softLight(s.x, d.x);
|
||||
c.y = softLight(s.y, d.y);
|
||||
c.z = softLight(s.z, d.z);
|
||||
return c;
|
||||
}
|
||||
|
||||
fixed3 HardLight(fixed3 s, fixed3 d)
|
||||
{
|
||||
fixed3 c;
|
||||
c.x = hardLight(s.x, d.x);
|
||||
c.y = hardLight(s.y, d.y);
|
||||
c.z = hardLight(s.z, d.z);
|
||||
return c;
|
||||
}
|
||||
|
||||
fixed3 VividLight(fixed3 s, fixed3 d)
|
||||
{
|
||||
fixed3 c;
|
||||
c.x = vividLight(s.x, d.x);
|
||||
c.y = vividLight(s.y, d.y);
|
||||
c.z = vividLight(s.z, d.z);
|
||||
return c;
|
||||
}
|
||||
|
||||
fixed3 LinearLight(fixed3 s, fixed3 d)
|
||||
{
|
||||
return 2.0*s + d - 1.0;
|
||||
}
|
||||
|
||||
fixed3 PinLight(fixed3 s, fixed3 d)
|
||||
{
|
||||
fixed3 c;
|
||||
c.x = pinLight(s.x, d.x);
|
||||
c.y = pinLight(s.y, d.y);
|
||||
c.z = pinLight(s.z, d.z);
|
||||
return c;
|
||||
}
|
||||
|
||||
fixed3 HardMix(fixed3 s, fixed3 d)
|
||||
{
|
||||
return floor(s+d);
|
||||
}
|
||||
|
||||
fixed3 Difference(fixed3 s, fixed3 d)
|
||||
{
|
||||
return abs(d-s);
|
||||
}
|
||||
|
||||
fixed3 Exclusion(fixed3 s, fixed3 d)
|
||||
{
|
||||
return s + d - 2.0*s*d;
|
||||
}
|
||||
|
||||
fixed3 Subtract(fixed3 s, fixed3 d)
|
||||
{
|
||||
return s-d;
|
||||
}
|
||||
|
||||
fixed3 Divide(fixed3 s, fixed3 d)
|
||||
{
|
||||
return s/d;
|
||||
}
|
||||
|
||||
fixed3 Add(fixed3 s, fixed3 d)
|
||||
{
|
||||
return s+d;
|
||||
}
|
||||
|
||||
fixed3 Hue(fixed3 s, fixed3 d)
|
||||
{
|
||||
d = rgb2hsv(d);
|
||||
d.x = rgb2hsv(s).x;
|
||||
return hsv2rgb(d);
|
||||
}
|
||||
|
||||
fixed3 Color(fixed3 s, fixed3 d)
|
||||
{
|
||||
s = rgb2hsv(s);
|
||||
s.z = rgb2hsv(d).z;
|
||||
return hsv2rgb(s);
|
||||
}
|
||||
|
||||
fixed3 Saturation(fixed3 s, fixed3 d)
|
||||
{
|
||||
d = rgb2hsv(d);
|
||||
d.y = rgb2hsv(s).y;
|
||||
return hsv2rgb(d);
|
||||
}
|
||||
|
||||
fixed3 Luminosity(fixed3 s, fixed3 d)
|
||||
{
|
||||
float dLum = dot(d, l);
|
||||
float sLum = dot(s, l);
|
||||
float lum = sLum - dLum;
|
||||
fixed3 c = d + lum;
|
||||
float minC = min(min(c.x, c.y), c.z);
|
||||
float maxC = max(max(c.x, c.y), c.z);
|
||||
if(minC < 0.0) return sLum + ((c - sLum) * sLum) / (sLum - minC);
|
||||
else if(maxC > 1.0) return sLum + ((c - sLum) * (1.0 - sLum)) / (maxC - sLum);
|
||||
else return c;
|
||||
}
|
||||
|
||||
#endif // PHOTOSHOP_BLENDMODES_INCLUDED
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: eb4ec4a0e81584343b972b2a25f96bc2
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Color"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Color(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bb85841f8c67d2442b800ab4be4ecae5
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/ColorBurn"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = ColorBurn(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: da5b85daa127ed043af5579d10e6e49d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/ColorDodge"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = ColorDodge(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a1c1848ac45b3724483467a3f2f10326
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/DarkerColor"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = DarkerColor(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d0090e6d378db134baa8c6bf62a4a607
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Difference"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Difference(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 74ccff3d254d9644fa54c55127b3646d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Divide"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Divide(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 075fe556031b1174e8d6ca9369753b6d
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Exclusion"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Exclusion(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d292d32bbf4832745a23aa6a3a06b1de
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/HardLight"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = HardLight(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fe63576204204b1428a23c825667e2a9
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/HardMix"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = HardMix(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4dc9a51c26a36e044904b7e3a5a87c51
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Hue"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Hue(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ac709b7b6ba995046b2e357657ce6e8a
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Lighten"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Lighten(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: af52445a55f450d488ad19f3f0f7b2c6
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/LighterColor"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = LighterColor(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8c3ff3424a6646142b77fd44709ac344
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/LinearBurn"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = LinearBurn(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0cce16f4622c09c47918eeaa45e90221
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/LinearDodge"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = LinearDodge(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 57c2408124f76304286601e694c90cd9
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/LinearLight"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = LinearLight(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b2d75a74e3683154db45a2a4191be880
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Luminosity"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Luminosity(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fce1c8cc491cb9949990727c4b160df1
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Overlay"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Overlay(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2ffc151e4b55f1e468e1a7fd115dc8f8
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/PinLight"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = PinLight(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f78ab9a11343ac647b0fd6e24af945df
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Saturation"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Saturation(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9da612291cb24ba4f8ed18d8ad9ab609
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Screen"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Screen(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2b7011eeda59694449ddcd78ad15ba20
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/SoftLight"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = SoftLight(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9c5c0203c153de344acd602adb1210bb
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/Subtract"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = Subtract(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dad2fab4a5cb39846a52481a503e6d11
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,106 +0,0 @@
|
|||
Shader "Blendmodes/VividLight"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(Properties)]
|
||||
_MainTex ("Blend Texture", 2D) = "white" {}
|
||||
_Tint1 ("Tint on Texture", Color) = (1,1,1,0)
|
||||
_Tint2 ("Tint on Blended Result", Color) = (1,1,1,0)
|
||||
_Alpha ("Opacity of Blended Result", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
//blending
|
||||
|
||||
[Header(Blending)]
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5
|
||||
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10
|
||||
|
||||
// required for UI.Mask
|
||||
[Header(Stencil)]
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
|
||||
_Stencil ("Stencil ID", Float) = 0
|
||||
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
|
||||
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
||||
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
||||
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 15
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue"="Transparent" "IgnoreProjector"="true" "RenderType"="Transparent" }
|
||||
LOD 100
|
||||
Blend [_BlendSrc] [_BlendDst]
|
||||
|
||||
// required for UI.Mask
|
||||
Stencil
|
||||
{
|
||||
Ref [_Stencil]
|
||||
Comp [_StencilComp]
|
||||
Pass [_StencilOp]
|
||||
ReadMask [_StencilReadMask]
|
||||
WriteMask [_StencilWriteMask]
|
||||
}
|
||||
|
||||
GrabPass
|
||||
{
|
||||
"_BackgroundTexture"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "CGIncludes/PhotoshopBlendModes.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
float4 color : COLOR;
|
||||
float2 bguv : TEXCOORD1;
|
||||
};
|
||||
|
||||
sampler2D _MainTex;
|
||||
fixed4 _MainTex_ST;
|
||||
fixed4 _Tint1;
|
||||
fixed4 _Tint2;
|
||||
fixed _Alpha;
|
||||
|
||||
sampler2D _BackgroundTexture;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.color = v.color;
|
||||
o.bguv = ComputeGrabScreenPos(o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 mainColor = tex2D(_BackgroundTexture, i.bguv);
|
||||
fixed4 blendColor = tex2D(_MainTex, i.uv) * i.color;
|
||||
blendColor.xyz += _Tint1.xyz * _Tint1.a;
|
||||
|
||||
|
||||
// perform blend
|
||||
mainColor.xyz = VividLight(mainColor.xyz, blendColor.xyz);
|
||||
mainColor.xyz += _Tint2.xyz * _Tint2.a;
|
||||
mainColor.a = blendColor.a * _Alpha;
|
||||
|
||||
return mainColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bef33988c68cc854780ec0424181377e
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,167 +0,0 @@
|
|||
namespace Starpelly
|
||||
{
|
||||
public enum KeyCodeWin : ushort
|
||||
{
|
||||
#region Media
|
||||
MEDIA_NEXT_TRACK = 0xb0,
|
||||
MEDIA_PREV_TRACK = 0xb1,
|
||||
MEDIA_STOP = 0xb2,
|
||||
MEDIA_PLAY_PAUSE = 0xb3,
|
||||
#endregion
|
||||
|
||||
#region Math Functions
|
||||
MULTIPLY = 0x6a, // '*'
|
||||
ADD = 0x6b,
|
||||
SUBTRACT = 0x6d,
|
||||
DIVIDE = 0x6f,
|
||||
#endregion
|
||||
|
||||
#region Browser
|
||||
BROWSER_BACK = 0xa6,
|
||||
BROWSER_FORWARD = 0xa7,
|
||||
BROWSER_REFRESH = 0xa8,
|
||||
BROWSER_STOP = 0xa9,
|
||||
BROWSER_SEARCH = 0xaa,
|
||||
BROWSER_FAVORITES = 0xab,
|
||||
BROWSER_HOME = 0xac,
|
||||
#endregion
|
||||
|
||||
#region Numpad numbers
|
||||
NUMPAD0 = 0x60,
|
||||
NUMPAD1 = 0x61,
|
||||
NUMPAD2 = 0x62,
|
||||
NUMPAD3 = 0x63,
|
||||
NUMPAD4 = 0x64, // 100
|
||||
NUMPAD5 = 0x65,
|
||||
NUMPAD6 = 0x66,
|
||||
NUMPAD7 = 0x67,
|
||||
NUMPAD8 = 0x68,
|
||||
NUMPAD9 = 0x69,
|
||||
#endregion
|
||||
|
||||
#region Function Keys
|
||||
F1 = 0x70,
|
||||
F2 = 0x71,
|
||||
F3 = 0x72,
|
||||
F4 = 0x73,
|
||||
F5 = 0x74,
|
||||
F6 = 0x75,
|
||||
F7 = 0x76,
|
||||
F8 = 0x77,
|
||||
F9 = 0x78,
|
||||
F10 = 0x79,
|
||||
F11 = 0x7a,
|
||||
F12 = 0x7b,
|
||||
F13 = 0x7c,
|
||||
F14 = 0x7d,
|
||||
F15 = 0x7e,
|
||||
F16 = 0x7f,
|
||||
F17 = 0x80,
|
||||
F18 = 0x81,
|
||||
F19 = 130,
|
||||
F20 = 0x83,
|
||||
F21 = 0x84,
|
||||
F22 = 0x85,
|
||||
F23 = 0x86,
|
||||
F24 = 0x87,
|
||||
#endregion
|
||||
|
||||
#region Other
|
||||
// see https://lists.w3.org/Archives/Public/www-dom/2010JulSep/att-0182/keyCode-spec.html
|
||||
OEM_COLON = 0xba, // OEM_1
|
||||
OEM_102 = 0xe2,
|
||||
OEM_2 = 0xbf,
|
||||
OEM_3 = 0xc0,
|
||||
OEM_4 = 0xdb,
|
||||
OEM_BACK_SLASH = 0xdc, // OEM_5
|
||||
OEM_6 = 0xdd,
|
||||
OEM_7 = 0xde,
|
||||
OEM_8 = 0xdf,
|
||||
OEM_CLEAR = 0xfe,
|
||||
OEM_COMMA = 0xbc,
|
||||
OEM_MINUS = 0xbd, // Underscore
|
||||
OEM_PERIOD = 0xbe,
|
||||
OEM_PLUS = 0xbb,
|
||||
#endregion
|
||||
|
||||
#region KEYS
|
||||
KEY_0 = 0x30,
|
||||
KEY_1 = 0x31,
|
||||
KEY_2 = 0x32,
|
||||
KEY_3 = 0x33,
|
||||
KEY_4 = 0x34,
|
||||
KEY_5 = 0x35,
|
||||
KEY_6 = 0x36,
|
||||
KEY_7 = 0x37,
|
||||
KEY_8 = 0x38,
|
||||
KEY_9 = 0x39,
|
||||
KEY_A = 0x41,
|
||||
KEY_B = 0x42,
|
||||
KEY_C = 0x43,
|
||||
KEY_D = 0x44,
|
||||
KEY_E = 0x45,
|
||||
KEY_F = 0x46,
|
||||
KEY_G = 0x47,
|
||||
KEY_H = 0x48,
|
||||
KEY_I = 0x49,
|
||||
KEY_J = 0x4a,
|
||||
KEY_K = 0x4b,
|
||||
KEY_L = 0x4c,
|
||||
KEY_M = 0x4d,
|
||||
KEY_N = 0x4e,
|
||||
KEY_O = 0x4f,
|
||||
KEY_P = 0x50,
|
||||
KEY_Q = 0x51,
|
||||
KEY_R = 0x52,
|
||||
KEY_S = 0x53,
|
||||
KEY_T = 0x54,
|
||||
KEY_U = 0x55,
|
||||
KEY_V = 0x56,
|
||||
KEY_W = 0x57,
|
||||
KEY_X = 0x58,
|
||||
KEY_Y = 0x59,
|
||||
KEY_Z = 0x5a,
|
||||
#endregion
|
||||
|
||||
#region volume
|
||||
VOLUME_MUTE = 0xad,
|
||||
VOLUME_DOWN = 0xae,
|
||||
VOLUME_UP = 0xaf,
|
||||
#endregion
|
||||
|
||||
SNAPSHOT = 0x2c,
|
||||
RIGHT_CLICK = 0x5d,
|
||||
BACKSPACE = 8,
|
||||
CANCEL = 3,
|
||||
CAPS_LOCK = 20,
|
||||
CONTROL = 0x11,
|
||||
ALT = 18,
|
||||
DECIMAL = 110,
|
||||
DELETE = 0x2e,
|
||||
DOWN = 40,
|
||||
END = 0x23,
|
||||
ESC = 0x1b,
|
||||
HOME = 0x24,
|
||||
INSERT = 0x2d,
|
||||
LAUNCH_APP1 = 0xb6,
|
||||
LAUNCH_APP2 = 0xb7,
|
||||
LAUNCH_MAIL = 180,
|
||||
LAUNCH_MEDIA_SELECT = 0xb5,
|
||||
LCONTROL = 0xa2,
|
||||
LEFT = 0x25,
|
||||
LSHIFT = 0xa0,
|
||||
LWIN = 0x5b,
|
||||
PAGEDOWN = 0x22,
|
||||
NUMLOCK = 0x90,
|
||||
PAGE_UP = 0x21,
|
||||
RCONTROL = 0xa3,
|
||||
ENTER = 13,
|
||||
RIGHT = 0x27,
|
||||
RSHIFT = 0xa1,
|
||||
RWIN = 0x5c,
|
||||
SHIFT = 0x10,
|
||||
SPACE_BAR = 0x20,
|
||||
TAB = 9,
|
||||
UP = 0x26,
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 064d99289dbc58041b5102296a64ab2d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,21 +0,0 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace Starpelly.Textures
|
||||
{
|
||||
public static class Draw
|
||||
{
|
||||
public static void DrawLine(this Texture2D tex, Vector2 p1, Vector2 p2, Color col)
|
||||
{
|
||||
Vector2 t = p1;
|
||||
float frac = 1 / Mathf.Sqrt(Mathf.Pow(p2.x - p1.x, 2) + Mathf.Pow(p2.y - p1.y, 2));
|
||||
float ctr = 0;
|
||||
|
||||
while ((int)t.x != (int)p2.x || (int)t.y != (int)p2.y)
|
||||
{
|
||||
t = Vector2.Lerp(p1, p2, ctr);
|
||||
ctr += frac;
|
||||
tex.SetPixel((int)t.x, (int)t.y, col);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue