Merge branch '4.1' into 4.2-beta

This commit is contained in:
Harald Csaszar 2022-10-03 11:00:14 +02:00
commit 05d152867b
15 changed files with 155 additions and 218 deletions

View File

@ -12,6 +12,7 @@ com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
selection: { name: white, color: selection },
dim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.3 } },
list-selection: { name: list-selection, color: selection },
slider-handle-disabled: { name: slider-handle, color: disabled },
},
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
default: {
@ -61,6 +62,6 @@ com.badlogic.gdx.scenes.scene2d.ui.CheckBox$CheckBoxStyle: {
},
},
com.badlogic.gdx.scenes.scene2d.ui.Slider$SliderStyle: {
default-horizontal: { background: slider-bg, knob: slider-handle },
default-horizontal: { background: slider-bg, knob: slider-handle, disabledKnob: slider-handle-disabled },
},
}

View File

@ -209,7 +209,7 @@ public class SkeletonViewer extends ApplicationAdapter {
entry = state.setAnimation(track, ui.animationList.getSelected(), ui.loopCheckbox.isChecked());
entry.setHoldPrevious(track > 0 && ui.holdPrevCheckbox.isChecked());
}
entry.setMixBlend(ui.addCheckbox.isChecked() ? MixBlend.add : MixBlend.replace);
entry.setMixBlend(track > 0 && ui.addCheckbox.isChecked() ? MixBlend.add : MixBlend.replace);
entry.setReverse(ui.reverseCheckbox.isChecked());
entry.setAlpha(ui.alphaSlider.getValue());
}

View File

@ -62,6 +62,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.WidgetGroup;
import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Null;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
@ -125,7 +126,9 @@ class SkeletonViewerUI {
ButtonGroup<TextButton> trackButtons = new ButtonGroup();
CheckBox loopCheckbox = new CheckBox("Loop", skin);
CheckBox addCheckbox = new CheckBox("Add", skin);
CheckBox reverseCheckbox = new CheckBox("Reverse", skin);
CheckBox holdPrevCheckbox = new HigherTrackCheckBox("Hold previous");
CheckBox addCheckbox = new HigherTrackCheckBox("Add");
Slider alphaSlider = new Slider(0, 1, 0.01f, false, skin);
Label alphaLabel = new Label("100%", skin);
@ -137,9 +140,6 @@ class SkeletonViewerUI {
Label speedLabel = new Label("1.0x", skin);
TextButton speedResetButton = new TextButton("Reset", skin);
CheckBox reverseCheckbox = new CheckBox("Reverse", skin);
CheckBox holdPrevCheckbox = new CheckBox("Hold previous", skin);
Slider mixSlider = new Slider(0, 4, 0.01f, false, skin);
Label mixLabel = new Label("0.3s", skin);
@ -194,6 +194,7 @@ class SkeletonViewerUI {
alphaSlider.setValue(1);
alphaSlider.setDisabled(true);
alphaLabel.setColor(skin.getColor("disabled"));
addCheckbox.setDisabled(true);
holdPrevCheckbox.setDisabled(true);
@ -557,6 +558,7 @@ class SkeletonViewerUI {
animationList.getSelection().setProgrammaticChangeEvents(true);
alphaSlider.setDisabled(track == 0);
alphaLabel.setColor(track == 0 ? skin.getColor("disabled") : Color.WHITE);
alphaSlider.setValue(current == null ? 1 : current.alpha);
addCheckbox.setDisabled(track == 0);
@ -564,9 +566,11 @@ class SkeletonViewerUI {
if (current != null) {
loopCheckbox.setChecked(current.getLoop());
addCheckbox.setChecked(current.getMixBlend() == MixBlend.add);
reverseCheckbox.setChecked(current.getReverse());
holdPrevCheckbox.setChecked(current.getHoldPrevious());
if (track > 0) {
addCheckbox.setChecked(current.getMixBlend() == MixBlend.add);
holdPrevCheckbox.setChecked(current.getHoldPrevious());
}
}
}
};
@ -762,4 +766,15 @@ class SkeletonViewerUI {
ex.printStackTrace();
}
}
class HigherTrackCheckBox extends CheckBox {
public HigherTrackCheckBox (String text) {
super(text, skin);
}
protected Drawable getImageDrawable () {
if (trackButtons.getCheckedIndex() == 0) return getStyle().checkboxOffDisabled;
return super.getImageDrawable();
}
}
}

View File

@ -162,6 +162,9 @@ namespace Spine.Unity.Editor {
const string COMPONENTMATERIAL_WARNING_KEY = "SPINE_COMPONENTMATERIAL_WARNING";
public static bool componentMaterialWarning = SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING;
const string SKELETONDATA_ASSET_NO_FILE_ERROR_KEY = "SPINE_SKELETONDATA_ASSET_NO_FILE_ERROR";
public static bool skeletonDataAssetNoFileError = SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR;
public const float DEFAULT_MIPMAPBIAS = SpinePreferences.DEFAULT_MIPMAPBIAS;
public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE";
@ -199,6 +202,7 @@ namespace Spine.Unity.Editor {
atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
componentMaterialWarning = EditorPrefs.GetBool(COMPONENTMATERIAL_WARNING_KEY, SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING);
skeletonDataAssetNoFileError = EditorPrefs.GetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR);
timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION);
handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE);
preferencesLoaded = true;
@ -219,6 +223,7 @@ namespace Spine.Unity.Editor {
newPreferences.atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING);
newPreferences.textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING);
newPreferences.componentMaterialWarning = EditorPrefs.GetBool(COMPONENTMATERIAL_WARNING_KEY, SpinePreferences.DEFAULT_COMPONENTMATERIAL_WARNING);
newPreferences.skeletonDataAssetNoFileError = EditorPrefs.GetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, SpinePreferences.DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR);
newPreferences.timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION);
newPreferences.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE);
}
@ -237,6 +242,7 @@ namespace Spine.Unity.Editor {
EditorPrefs.SetBool(ATLASTXT_WARNING_KEY, preferences.atlasTxtImportWarning);
EditorPrefs.SetBool(TEXTUREIMPORTER_WARNING_KEY, preferences.textureImporterWarning);
EditorPrefs.SetBool(COMPONENTMATERIAL_WARNING_KEY, preferences.componentMaterialWarning);
EditorPrefs.SetBool(SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, preferences.skeletonDataAssetNoFileError);
EditorPrefs.SetBool(TIMELINE_USE_BLEND_DURATION_KEY, preferences.timelineUseBlendDuration);
EditorPrefs.SetFloat(SCENE_ICONS_SCALE_KEY, preferences.handleScale);
}
@ -312,6 +318,8 @@ namespace Spine.Unity.Editor {
SpineEditorUtilities.BoolPrefsField(ref atlasTxtImportWarning, ATLASTXT_WARNING_KEY, new GUIContent("Atlas Extension Warning", "Log a warning and recommendation whenever a `.atlas` file is found."));
SpineEditorUtilities.BoolPrefsField(ref textureImporterWarning, TEXTUREIMPORTER_WARNING_KEY, new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts."));
SpineEditorUtilities.BoolPrefsField(ref componentMaterialWarning, COMPONENTMATERIAL_WARNING_KEY, new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible."));
SpineEditorUtilities.BoolPrefsField(ref skeletonDataAssetNoFileError, SKELETONDATA_ASSET_NO_FILE_ERROR_KEY, new GUIContent("SkeletonDataAsset no file Error", "Log an error when querying SkeletonData from SkeletonDataAsset with no json or binary file assigned."));
SkeletonDataAsset.errorIfSkeletonFileNullGlobal = skeletonDataAssetNoFileError;
}
EditorGUILayout.Space();

View File

@ -98,8 +98,8 @@ namespace Spine.Unity.Editor {
#endif
prefabsToRestore.Add(assetPath);
}
EditorUtility.UnloadUnusedAssetsImmediate();
}
EditorUtility.UnloadUnusedAssetsImmediate();
AssetDatabase.StopAssetEditing();
#if !HAS_SAVE_ASSET_IF_DIRTY
if (prefabAssets.Length > 0)
@ -147,8 +147,8 @@ namespace Spine.Unity.Editor {
#if HAS_SAVE_ASSET_IF_DIRTY
AssetDatabase.SaveAssetIfDirty(atlasAsset);
#endif
EditorUtility.UnloadUnusedAssetsImmediate();
}
EditorUtility.UnloadUnusedAssetsImmediate();
AssetDatabase.StopAssetEditing();
#if !HAS_SAVE_ASSET_IF_DIRTY
if (spriteAtlasAssets.Length > 0)

View File

@ -165,6 +165,9 @@ namespace Spine.Unity.Editor {
internal const bool DEFAULT_COMPONENTMATERIAL_WARNING = true;
public bool componentMaterialWarning = DEFAULT_COMPONENTMATERIAL_WARNING;
internal const bool DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR = true;
public bool skeletonDataAssetNoFileError = DEFAULT_SKELETONDATA_ASSET_NO_FILE_ERROR;
public const float DEFAULT_MIPMAPBIAS = -0.5f;
public const bool DEFAULT_AUTO_RELOAD_SCENESKELETONS = true;
@ -211,6 +214,7 @@ namespace Spine.Unity.Editor {
#if HAS_ON_POSTPROCESS_PREFAB
SkeletonRenderer.fixPrefabOverrideViaMeshFilterGlobal = settings.fixPrefabOverrideViaMeshFilter;
#endif
SkeletonDataAsset.errorIfSkeletonFileNullGlobal = settings.skeletonDataAssetNoFileError;
return settings;
}
@ -298,6 +302,8 @@ namespace Spine.Unity.Editor {
EditorGUILayout.PropertyField(settings.FindProperty("atlasTxtImportWarning"), new GUIContent("Atlas & Skel Extension Warning", "Log a warning and recommendation whenever a `.atlas` or `.skel` file is found."));
EditorGUILayout.PropertyField(settings.FindProperty("textureImporterWarning"), new GUIContent("Texture Settings Warning", "Log a warning and recommendation whenever Texture Import Settings are detected that could lead to undesired effects, e.g. white border artifacts."));
EditorGUILayout.PropertyField(settings.FindProperty("componentMaterialWarning"), new GUIContent("Component & Material Warning", "Log a warning and recommendation whenever Component and Material settings are not compatible."));
EditorGUILayout.PropertyField(settings.FindProperty("skeletonDataAssetNoFileError"), new GUIContent("SkeletonDataAsset no file Error", "Log an error when querying SkeletonData from SkeletonDataAsset with no json or binary file assigned."));
SkeletonDataAsset.errorIfSkeletonFileNullGlobal = settings.FindProperty("skeletonDataAssetNoFileError").boolValue;
}
EditorGUILayout.Space();

View File

@ -63,6 +63,10 @@ namespace Spine.Unity {
public float defaultMix;
public RuntimeAnimatorController controller;
#if UNITY_EDITOR
public static bool errorIfSkeletonFileNullGlobal = true;
#endif
public bool IsLoaded { get { return this.skeletonData != null; } }
void Reset () {
@ -112,6 +116,9 @@ namespace Spine.Unity {
/// <summary>Loads, caches and returns the SkeletonData from the skeleton data file. Returns the cached SkeletonData after the first time it is called. Pass false to prevent direct errors from being logged.</summary>
public SkeletonData GetSkeletonData (bool quiet) {
if (skeletonJSON == null) {
#if UNITY_EDITOR
if (!errorIfSkeletonFileNullGlobal) quiet = true;
#endif
if (!quiet)
Debug.LogError("Skeleton JSON file not set for SkeletonData asset: " + name, this);
Clear();

View File

@ -263,7 +263,6 @@ namespace Spine.Unity {
var clip = GetAnimation(info.clip);
if (clip == null)
return false;
var time = AnimationTime(stateInfo.normalizedTime, info.clip.length,
info.clip.isLooping, stateInfo.speed < 0);
weight = useClipWeight1 ? layerWeight : weight;
@ -289,7 +288,7 @@ namespace Spine.Unity {
return false;
var time = AnimationTime(stateInfo.normalizedTime + interruptingClipTimeAddition,
info.clip.length, stateInfo.speed < 0);
info.clip.length, info.clip.isLooping, stateInfo.speed < 0);
weight = useClipWeight1 ? layerWeight : weight;
clip.Apply(skeleton, 0, time, info.clip.isLooping, null,
weight, layerBlendMode, MixDirection.In);
@ -502,17 +501,17 @@ namespace Spine.Unity {
}
static float AnimationTime (float normalizedTime, float clipLength, bool loop, bool reversed) {
float time = AnimationTime(normalizedTime, clipLength, reversed);
float time = ToSpineAnimationTime(normalizedTime, clipLength, loop, reversed);
if (loop) return time;
const float EndSnapEpsilon = 1f / 30f; // Workaround for end-duration keys not being applied.
return (clipLength - time < EndSnapEpsilon) ? clipLength : time; // return a time snapped to clipLength;
}
static float AnimationTime (float normalizedTime, float clipLength, bool reversed) {
static float ToSpineAnimationTime (float normalizedTime, float clipLength, bool loop, bool reversed) {
if (reversed)
normalizedTime = (1 - normalizedTime);
if (normalizedTime < 0.0f)
normalizedTime = (normalizedTime % 1.0f) + 1.0f;
normalizedTime = loop ? (normalizedTime % 1.0f) + 1.0f : 0.0f;
return normalizedTime * clipLength;
}

View File

@ -43,45 +43,8 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" {
Pass {
Name "Normal"
CGPROGRAM
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "../CGIncludes/Spine-Common.cginc"
uniform sampler2D _MainTex;
uniform float4 _Color;
struct VertexInput {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
VertexOutput vert (VertexInput v) {
VertexOutput o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.vertexColor = PMAGammaToTargetSpace(v.vertexColor) * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
return o;
}
float4 frag (VertexOutput i) : SV_Target {
float4 texColor = tex2D(_MainTex, i.uv);
#if defined(_STRAIGHT_ALPHA_INPUT)
texColor.rgb *= texColor.a;
#endif
return (texColor * i.vertexColor);
}
#include "../CGIncludes/Spine-BlendModes-NormalPass.cginc"
ENDCG
}
@ -94,35 +57,7 @@ Shader "Spine/Blend Modes/Skeleton PMA Additive" {
ZTest LEqual
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_shadowcaster
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
struct v2f {
V2F_SHADOW_CASTER;
float4 uvAndAlpha : TEXCOORD1;
};
uniform float4 _MainTex_ST;
v2f vert (appdata_base v, float4 vertexColor : COLOR) {
v2f o;
TRANSFER_SHADOW_CASTER(o)
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.uvAndAlpha.z = 0;
o.uvAndAlpha.a = vertexColor.a;
return o;
}
uniform sampler2D _MainTex;
uniform fixed _Cutoff;
float4 frag (v2f i) : SV_Target {
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
SHADOW_CASTER_FRAGMENT(i)
}
#include "../CGIncludes/Spine-BlendModes-ShadowCasterPass.cginc"
ENDCG
}
}

View File

@ -43,86 +43,21 @@ Shader "Spine/Blend Modes/Skeleton PMA Multiply" {
Pass {
Name "Normal"
CGPROGRAM
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "../CGIncludes/Spine-Common.cginc"
uniform sampler2D _MainTex;
uniform float4 _Color;
struct VertexInput {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
VertexOutput vert (VertexInput v) {
VertexOutput o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.vertexColor = PMAGammaToTargetSpace(v.vertexColor) * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
return o;
}
float4 frag (VertexOutput i) : SV_Target {
float4 texColor = tex2D(_MainTex, i.uv);
#if defined(_STRAIGHT_ALPHA_INPUT)
texColor.rgb *= texColor.a;
#endif
return (texColor * i.vertexColor);
}
#include "../CGIncludes/Spine-BlendModes-NormalPass.cginc"
ENDCG
}
Pass {
Name "Caster"
Tags { "LightMode"="ShadowCaster" }
Tags { "LightMode" = "ShadowCaster" }
Offset 1, 1
ZWrite On
ZTest LEqual
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_shadowcaster
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
struct v2f {
V2F_SHADOW_CASTER;
float4 uvAndAlpha : TEXCOORD1;
};
uniform float4 _MainTex_ST;
v2f vert (appdata_base v, float4 vertexColor : COLOR) {
v2f o;
TRANSFER_SHADOW_CASTER(o)
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.uvAndAlpha.z = 0;
o.uvAndAlpha.a = vertexColor.a;
return o;
}
uniform sampler2D _MainTex;
uniform fixed _Cutoff;
float4 frag (v2f i) : SV_Target {
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
SHADOW_CASTER_FRAGMENT(i)
}
#include "../CGIncludes/Spine-BlendModes-ShadowCasterPass.cginc"
ENDCG
}
}

View File

@ -43,86 +43,21 @@ Shader "Spine/Blend Modes/Skeleton PMA Screen" {
Pass {
Name "Normal"
CGPROGRAM
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "../CGIncludes/Spine-Common.cginc"
uniform sampler2D _MainTex;
uniform float4 _Color;
struct VertexInput {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
VertexOutput vert (VertexInput v) {
VertexOutput o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.vertexColor = PMAGammaToTargetSpace(v.vertexColor) * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
return o;
}
float4 frag (VertexOutput i) : SV_Target {
float4 texColor = tex2D(_MainTex, i.uv);
#if defined(_STRAIGHT_ALPHA_INPUT)
texColor.rgb *= texColor.a;
#endif
return (texColor * i.vertexColor);
}
#include "../CGIncludes/Spine-BlendModes-NormalPass.cginc"
ENDCG
}
Pass {
Name "Caster"
Tags { "LightMode"="ShadowCaster" }
Tags { "LightMode" = "ShadowCaster" }
Offset 1, 1
ZWrite On
ZTest LEqual
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_shadowcaster
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
struct v2f {
V2F_SHADOW_CASTER;
float4 uvAndAlpha : TEXCOORD1;
};
uniform float4 _MainTex_ST;
v2f vert (appdata_base v, float4 vertexColor : COLOR) {
v2f o;
TRANSFER_SHADOW_CASTER(o)
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.uvAndAlpha.z = 0;
o.uvAndAlpha.a = vertexColor.a;
return o;
}
uniform sampler2D _MainTex;
uniform fixed _Cutoff;
float4 frag (v2f i) : SV_Target {
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
clip(texcol.a * i.uvAndAlpha.a - _Cutoff);
SHADOW_CASTER_FRAGMENT(i)
}
#include "../CGIncludes/Spine-BlendModes-ShadowCasterPass.cginc"
ENDCG
}
}

View File

@ -0,0 +1,42 @@
#ifndef BLENDMODES_NORMAL_PASS_INCLUDED
#define BLENDMODES_NORMAL_PASS_INCLUDED
#pragma shader_feature _ _STRAIGHT_ALPHA_INPUT
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "../CGIncludes/Spine-Common.cginc"
uniform sampler2D _MainTex;
uniform float4 _Color;
struct VertexInput {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
VertexOutput vert(VertexInput v) {
VertexOutput o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.vertexColor = PMAGammaToTargetSpace(v.vertexColor) * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
return o;
}
float4 frag(VertexOutput i) : SV_Target{
float4 texColor = tex2D(_MainTex, i.uv);
#if defined(_STRAIGHT_ALPHA_INPUT)
texColor.rgb *= texColor.a;
#endif
return (texColor * i.vertexColor);
}
#endif

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6e28a50646b0e9542a1c93c2d9d993d0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,34 @@
#ifndef BLENDMODES_SHADOWCASTER_PASS_INCLUDED
#define BLENDMODES_SHADOWCASTER_PASS_INCLUDED
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_shadowcaster
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
struct v2f {
V2F_SHADOW_CASTER;
float4 uvAndAlpha : TEXCOORD1;
};
uniform float4 _MainTex_ST;
v2f vert(appdata_base v, float4 vertexColor : COLOR) {
v2f o;
TRANSFER_SHADOW_CASTER(o)
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.uvAndAlpha.z = 0;
o.uvAndAlpha.a = vertexColor.a;
return o;
}
uniform sampler2D _MainTex;
uniform fixed _Cutoff;
float4 frag(v2f i) : SV_Target{
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
clip(texcol.a* i.uvAndAlpha.a - _Cutoff);
SHADOW_CASTER_FRAGMENT(i)
}
#endif

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 76beace455f83a8488bf044605212b2c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant: