remove external alpha IF from shaders

This commit is contained in:
2017-05-15 04:49:25 +07:00
parent d591379acc
commit a38e05f955
5 changed files with 16 additions and 16 deletions

View File

@@ -174,13 +174,14 @@ namespace FTEditor.Editors {
if ( isTargetValidForPreview ) {
_previewUtils.BeginPreview(r, background);
{
if ( targetAtlas ) {
_matPropBlock.SetTexture("_MainTex", targetAtlas);
}
_matPropBlock.SetTexture(
"_MainTex",
targetAtlas ? targetAtlas : Texture2D.whiteTexture);
if ( targetAtlasA ) {
_matPropBlock.SetTexture("_AlphaTex", targetAtlasA);
_matPropBlock.SetFloat("_ExternalAlpha", 1.0f);
} else {
_matPropBlock.SetTexture("_AlphaTex", Texture2D.whiteTexture);
_matPropBlock.SetFloat("_ExternalAlpha", 0.0f);
}
ConfigureCameraForSequence(_previewUtils.m_Camera, targetSequence);

View File

@@ -348,13 +348,14 @@ namespace FTRuntime {
var sprite = clip ? clip.Sprite : null;
var atlas = sprite && sprite.texture ? sprite.texture : Texture2D.whiteTexture;
var atlasA = sprite ? sprite.associatedAlphaSplitTexture : null;
if ( atlas ) {
_curPropBlock.SetTexture("_MainTex", atlas);
}
_curPropBlock.SetTexture(
"_MainTex",
atlas ? atlas : Texture2D.whiteTexture);
if ( atlasA ) {
_curPropBlock.SetTexture("_AlphaTex", atlasA);
_curPropBlock.SetFloat("_ExternalAlpha", 1.0f);
} else {
_curPropBlock.SetTexture("_AlphaTex", Texture2D.whiteTexture);
_curPropBlock.SetFloat("_ExternalAlpha", 0.0f);
}
_meshRenderer.SetPropertyBlock(_curPropBlock);