mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[unity] Fixed SkeletonGraphic Cull transparent mesh on additive submesh renderers. Closes #2994.
This commit is contained in:
parent
cb3da8ef95
commit
37ab2b8186
@ -1157,14 +1157,13 @@ namespace Spine.Unity {
|
||||
BlendModeMaterials blendModeMaterials = skeletonDataAsset.blendModeMaterials;
|
||||
bool hasBlendModeMaterials = blendModeMaterials.RequiresBlendModeMaterials;
|
||||
bool hasMaterialOrTextureOverride = HasMaterialOrTextureOverride;
|
||||
bool hasPMAAdditiveSlots = HasPMAAdditiveSlots(instructions);
|
||||
MeshGenerator meshGenerator = meshGenerators.Items[0];
|
||||
bool pmaVertexColors = meshGenerator.settings.pmaVertexColors;
|
||||
bool allowCullTransparentMesh = true;
|
||||
#if HAS_CULL_TRANSPARENT_MESH
|
||||
bool mainCullTransparentMesh = this.canvasRenderer.cullTransparentMesh;
|
||||
#endif
|
||||
|
||||
if (HasMaterialOrTextureOverride || hasBlendModeMaterials) {
|
||||
if (HasMaterialOrTextureOverride || hasBlendModeMaterials || hasPMAAdditiveSlots) {
|
||||
for (int i = 0, count = sharedMaterials.Length; i < count; ++i) {
|
||||
Texture originalTexture = instructionItems[i].material.mainTexture;
|
||||
|
||||
@ -1177,7 +1176,8 @@ namespace Spine.Unity {
|
||||
customTextureOverride.TryGetValue(Texture2D.whiteTexture, out replacementTexture)) // white texture entry = replace-all
|
||||
usedTextureItems[i] = replacementTexture;
|
||||
}
|
||||
if (hasBlendModeMaterials) {
|
||||
if (hasBlendModeMaterials || hasPMAAdditiveSlots) {
|
||||
bool allowCullTransparentMesh = true;
|
||||
Material blendModeMaterial = GetBlendModeMaterial(instructionItems[i], blendModeMaterials,
|
||||
pmaVertexColors, ref allowCullTransparentMesh);
|
||||
if (blendModeMaterial != null)
|
||||
@ -1198,6 +1198,17 @@ namespace Spine.Unity {
|
||||
}
|
||||
}
|
||||
|
||||
/// <returns>True if any element of the given <c>instructions</c> list has
|
||||
/// <see cref="SubmeshInstruction.hasPMAAdditiveSlot"/> set, false otherwise.</returns>
|
||||
protected bool HasPMAAdditiveSlots (ExposedList<SubmeshInstruction> instructions) {
|
||||
SubmeshInstruction[] items = instructions.Items;
|
||||
for (int i = 0, count = instructions.Count; i < count; ++i) {
|
||||
if (items[i].hasPMAAdditiveSlot)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <returns>The respective blend mode material, or null if no blend mode material is required.</returns>
|
||||
protected Material GetBlendModeMaterial (SubmeshInstruction instruction, BlendModeMaterials blendModeMaterials,
|
||||
bool pmaVertexColors, ref bool allowCullTransparentMesh) {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"name": "com.esotericsoftware.spine.spine-unity",
|
||||
"displayName": "spine-unity Runtime",
|
||||
"description": "This plugin provides the spine-unity runtime core and examples. Spine Examples can be installed via the Samples tab.",
|
||||
"version": "4.3.33",
|
||||
"version": "4.3.34",
|
||||
"unity": "2018.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user