mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[unity] Added OnMeshAndMaterialsUpdated callback for SkeletonRenderSeparator and SkeletonPartsRenderer. Closes #1752.
This commit is contained in:
parent
cccd2132bf
commit
9667bd2293
@ -237,6 +237,7 @@
|
|||||||
* Added support for double-sided lighting at all `SkeletonLit` shaders (including URP and LWRP packages).
|
* Added support for double-sided lighting at all `SkeletonLit` shaders (including URP and LWRP packages).
|
||||||
* Added frustum culling update mode parameters `Update When Invisible` (Inspector parameter) and `UpdateMode` (available via code) to all Skeleton components. This provides a simple way to disable certain updates when the `Renderer` is no longer visible (outside all cameras, culled in frustum culling). The new `UpdateMode` property allows disabling updates at a finer granularity level than disabling the whole component. Available modes are: `Nothing`, `OnlyAnimationStatus`, `EverythingExceptMesh` and `FullUpdate`.
|
* Added frustum culling update mode parameters `Update When Invisible` (Inspector parameter) and `UpdateMode` (available via code) to all Skeleton components. This provides a simple way to disable certain updates when the `Renderer` is no longer visible (outside all cameras, culled in frustum culling). The new `UpdateMode` property allows disabling updates at a finer granularity level than disabling the whole component. Available modes are: `Nothing`, `OnlyAnimationStatus`, `EverythingExceptMesh` and `FullUpdate`.
|
||||||
* Added a new `Spine/Outline/OutlineOnly-ZWrite` shader to provide correct outline-only rendering. Note: the shader requires two render passes and is therefore not compatible with URP. The `Spine Examples/Other Examples/Outline Shaders` example scene has been updated to demonstrate the new shader.
|
* Added a new `Spine/Outline/OutlineOnly-ZWrite` shader to provide correct outline-only rendering. Note: the shader requires two render passes and is therefore not compatible with URP. The `Spine Examples/Other Examples/Outline Shaders` example scene has been updated to demonstrate the new shader.
|
||||||
|
* Added `OnMeshAndMaterialsUpdated` callback event to `SkeletonRenderSeparator` and `SkeletonPartsRenderer`. It is issued at the end of `LateUpdate`, before rendering.
|
||||||
|
|
||||||
* **Changes of default values**
|
* **Changes of default values**
|
||||||
* `SkeletonMecanim`'s `Layer Mix Mode` now defaults to `MixMode.MixNext` instead of `MixMode.MixAlways`.
|
* `SkeletonMecanim`'s `Layer Mix Mode` now defaults to `MixMode.MixNext` instead of `MixMode.MixAlways`.
|
||||||
|
|||||||
@ -60,6 +60,14 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Callback Delegates
|
||||||
|
public delegate void SkeletonPartsRendererDelegate (SkeletonPartsRenderer skeletonPartsRenderer);
|
||||||
|
|
||||||
|
/// <summary>OnMeshAndMaterialsUpdated is called at the end of LateUpdate after the Mesh and
|
||||||
|
/// all materials have been updated.</summary>
|
||||||
|
public event SkeletonPartsRendererDelegate OnMeshAndMaterialsUpdated;
|
||||||
|
#endregion
|
||||||
|
|
||||||
MeshRendererBuffers buffers;
|
MeshRendererBuffers buffers;
|
||||||
SkeletonRendererInstruction currentInstructions = new SkeletonRendererInstruction();
|
SkeletonRendererInstruction currentInstructions = new SkeletonRendererInstruction();
|
||||||
|
|
||||||
@ -121,6 +129,9 @@ namespace Spine.Unity {
|
|||||||
|
|
||||||
meshFilter.sharedMesh = mesh;
|
meshFilter.sharedMesh = mesh;
|
||||||
smartMesh.instructionUsed.Set(currentInstructions);
|
smartMesh.instructionUsed.Set(currentInstructions);
|
||||||
|
|
||||||
|
if (OnMeshAndMaterialsUpdated != null)
|
||||||
|
OnMeshAndMaterialsUpdated(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPropertyBlock (MaterialPropertyBlock block) {
|
public void SetPropertyBlock (MaterialPropertyBlock block) {
|
||||||
|
|||||||
@ -77,6 +77,12 @@ namespace Spine.Unity {
|
|||||||
#endif
|
#endif
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Callback Delegates
|
||||||
|
/// <summary>OnMeshAndMaterialsUpdated is called at the end of LateUpdate after the Mesh and
|
||||||
|
/// all materials have been updated.</summary>
|
||||||
|
public event SkeletonRenderer.SkeletonRendererDelegate OnMeshAndMaterialsUpdated;
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Runtime Instantiation
|
#region Runtime Instantiation
|
||||||
/// <summary>Adds a SkeletonRenderSeparator and child SkeletonPartsRenderer GameObjects to a given SkeletonRenderer.</summary>
|
/// <summary>Adds a SkeletonRenderSeparator and child SkeletonPartsRenderer GameObjects to a given SkeletonRenderer.</summary>
|
||||||
/// <returns>The to skeleton renderer.</returns>
|
/// <returns>The to skeleton renderer.</returns>
|
||||||
@ -247,6 +253,9 @@ namespace Spine.Unity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OnMeshAndMaterialsUpdated != null)
|
||||||
|
OnMeshAndMaterialsUpdated(this.skeletonRenderer);
|
||||||
|
|
||||||
// Clear extra renderers if they exist.
|
// Clear extra renderers if they exist.
|
||||||
for (; rendererIndex < rendererCount; rendererIndex++) {
|
for (; rendererIndex < rendererCount; rendererIndex++) {
|
||||||
currentRenderer = partsRenderers[rendererIndex];
|
currentRenderer = partsRenderers[rendererIndex];
|
||||||
|
|||||||
@ -236,7 +236,7 @@ namespace Spine.Unity {
|
|||||||
/// <summary>OnRebuild is raised after the Skeleton is successfully initialized.</summary>
|
/// <summary>OnRebuild is raised after the Skeleton is successfully initialized.</summary>
|
||||||
public event SkeletonRendererDelegate OnRebuild;
|
public event SkeletonRendererDelegate OnRebuild;
|
||||||
|
|
||||||
/// <summary>OnMeshAndMaterialsUpdated is at the end of LateUpdate after the Mesh and
|
/// <summary>OnMeshAndMaterialsUpdated is called at the end of LateUpdate after the Mesh and
|
||||||
/// all materials have been updated.</summary>
|
/// all materials have been updated.</summary>
|
||||||
public event SkeletonRendererDelegate OnMeshAndMaterialsUpdated;
|
public event SkeletonRendererDelegate OnMeshAndMaterialsUpdated;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user