Insanely huge initial commit

This commit is contained in:
2026-02-21 16:40:15 -08:00
parent 2ba1c94b88
commit ee9aee0a1b
33825 changed files with 5213498 additions and 0 deletions

View File

@@ -0,0 +1,100 @@
using System;
using UnityEngine;
using System.Collections;
namespace Com.LuisPedroFonseca.ProCamera2D
{
[ExecuteInEditMode]
public class ProCamera2DLetterbox : MonoBehaviour
{
[Range(0, .5f)] public float Amount = 0f;
public Color Color;
Material _material;
private int TopPropertyID;
private int BottomPropertyID;
private int ColorPropertyID;
private float _previousAmount = float.MaxValue;
Material material
{
get
{
if (_material != null) return _material;
_material = new Material(Shader.Find("Hidden/ProCamera2D/Letterbox")) {hideFlags = HideFlags.HideAndDontSave};
return _material;
}
}
private void OnEnable()
{
_previousAmount = float.MaxValue;
if(TopPropertyID == 0)
TopPropertyID = Shader.PropertyToID("_Top");
if(BottomPropertyID == 0)
BottomPropertyID = Shader.PropertyToID("_Bottom");
if(ColorPropertyID == 0)
ColorPropertyID = Shader.PropertyToID("_Color");
}
void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
{
if (Mathf.Approximately(Amount, 0f) || material == null)
{
Graphics.Blit(sourceTexture, destTexture);
return;
}
if (Math.Abs(Amount - _previousAmount) > 0.0001f)
{
Amount = Mathf.Clamp01(Amount);
material.SetFloat(TopPropertyID, 1 - Amount);
material.SetFloat(BottomPropertyID, Amount);
material.SetColor(ColorPropertyID, Color);
}
Graphics.Blit(sourceTexture, destTexture, material);
_previousAmount = Amount;
}
void OnDisable()
{
if (_material)
{
DestroyImmediate(_material);
}
}
public void TweenTo(float targetAmount, float duration)
{
StopAllCoroutines();
StartCoroutine(TweenToRoutine(targetAmount, duration));
}
IEnumerator TweenToRoutine(float targetAmount, float duration)
{
var initialAmount = Amount;
var t = 0f;
while (t <= 1.0f)
{
t += (ProCamera2D.Instance.IgnoreTimeScale ? Time.unscaledDeltaTime : Time.deltaTime) / duration;
Amount = Utils.EaseFromTo(initialAmount, targetAmount, t, EaseType.EaseOut);
yield return null;
}
Amount = targetAmount;
yield return null;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1f6c9f1aed605415dbee05337f61d59a
timeCreated: 1445532889
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c0bbfbb0cfe67457db027809e1cdeeb9
folderAsset: yes
timeCreated: 1445955187
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
Shader "Hidden/ProCamera2D/Letterbox"
{
Properties
{
_MainTex("Base (RGB)", 2D) = "white" {}
_Top("Top Bar", Range(0.0,1.0)) = 1.0
_Bottom("Bottom Bar", Range(0.0,1.0)) = 1.0
_Color("Base(RGB)", Color) = (1,1,1,1)
}
SubShader
{
ZTest Always Cull Off ZWrite Off Fog{ Mode Off }
Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
uniform float4 _Color;
uniform float _Top;
uniform float _Bottom;
fixed4 frag(v2f_img i) : COLOR
{
fixed4 screen = tex2D(_MainTex, i.uv);
if (i.uv.y < _Bottom || i.uv.y > _Top)
{
screen.xyz = _Color;
}
return screen;
}
ENDCG
}
}
FallBack "Diffuse"
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 793e285a2632244d6bfaf202e00b88cd
timeCreated: 1445526368
licenseType: Store
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant: