From 20c421c1d4815a9e5f303a8cba91508ec41c3162 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 1 Mar 2022 19:22:30 +0100 Subject: [PATCH 01/38] [unity] Fixed changing atlas asset at SkeletonData asset not reloading automatically. Closes #2037. --- .../Asset Types/SkeletonDataAssetInspector.cs | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs index 18740d5b6e..2fa99cdf62 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Asset Types/SkeletonDataAssetInspector.cs @@ -71,6 +71,7 @@ public class SkeletonDataAssetInspector : UnityEditor.Editor { readonly List warnings = new List(); CompatibilityProblemInfo compatibilityProblemInfo = null; readonly SkeletonInspectorPreview preview = new SkeletonInspectorPreview(); + bool requiresReload = false; GUIStyle activePlayButtonStyle, idlePlayButtonStyle; readonly GUIContent DefaultMixLabel = new GUIContent("Default Mix Duration", "Sets 'SkeletonDataAsset.defaultMix' in the asset and 'AnimationState.data.defaultMix' at runtime load time."); @@ -192,13 +193,12 @@ public class SkeletonDataAssetInspector : UnityEditor.Editor { } if (changeCheck.changed) { - if (serializedObject.ApplyModifiedProperties()) { + if (requiresReload || serializedObject.ApplyModifiedProperties()) { this.Clear(); this.InitializeEditor(); - if (SpineEditorUtilities.Preferences.autoReloadSceneSkeletons) + if (SpineEditorUtilities.Preferences.autoReloadSceneSkeletons && NoProblems()) SpineEditorUtilities.DataReloadHandler.ReloadSceneSkeletonComponents(targetSkeletonDataAsset); - return; } } @@ -361,18 +361,24 @@ public class SkeletonDataAssetInspector : UnityEditor.Editor { void DrawAtlasAssetsFields () { EditorGUILayout.LabelField("Atlas", EditorStyles.boldLabel); + + using (var changeCheck = new EditorGUI.ChangeCheckScope()) { #if !SPINE_TK2D - EditorGUILayout.PropertyField(atlasAssets, true); -#else - using (new EditorGUI.DisabledGroupScope(spriteCollection.objectReferenceValue != null)) { EditorGUILayout.PropertyField(atlasAssets, true); - } - EditorGUILayout.LabelField("spine-tk2d", EditorStyles.boldLabel); - EditorGUILayout.PropertyField(spriteCollection, true); +#else + using (new EditorGUI.DisabledGroupScope(spriteCollection.objectReferenceValue != null)) { + EditorGUILayout.PropertyField(atlasAssets, true); + } + EditorGUILayout.LabelField("spine-tk2d", EditorStyles.boldLabel); + EditorGUILayout.PropertyField(spriteCollection, true); #endif + if (atlasAssets.arraySize == 0) + EditorGUILayout.HelpBox("AtlasAssets array is empty. Skeleton's attachments will load without being mapped to images.", MessageType.Info); - if (atlasAssets.arraySize == 0) - EditorGUILayout.HelpBox("AtlasAssets array is empty. Skeleton's attachments will load without being mapped to images.", MessageType.Info); + if (changeCheck.changed) { + requiresReload = true; + } + } } void HandleAtlasAssetsNulls () { From 9acc768353de54dc5d3ff24151885c00d9c99a09 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 2 Mar 2022 22:11:29 +0100 Subject: [PATCH 02/38] [unity] Added example component SkeletonRenderTexture to render to a render texture. Added fadeout example scene named 'RenderTexture FadeOut Transparency'. Closes #1337. --- CHANGELOG.md | 1 + .../RenderTexture FadeOut Transparency.unity | 1031 +++++++++++++++++ ...derTexture FadeOut Transparency.unity.meta | 7 + .../Scripts/RenderTextureFadeoutExample.cs | 52 + .../RenderTextureFadeoutExample.cs.meta | 11 + .../SkeletonRenderTexture.meta | 8 + .../RenderQuadMaterial.mat | 90 ++ .../RenderQuadMaterial.mat.meta | 8 + .../RenderQuadShader.shader | 104 ++ .../RenderQuadShader.shader.meta | 10 + .../SkeletonRenderTexture.cs | 223 ++++ .../SkeletonRenderTexture.cs.meta | 11 + 12 files changed, 1556 insertions(+) create mode 100644 spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity create mode 100644 spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity.meta create mode 100644 spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs create mode 100644 spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs.meta create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture.meta create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadMaterial.mat create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadMaterial.mat.meta create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadShader.shader create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadShader.shader.meta create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index a80ba455cd..146ff44c9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -163,6 +163,7 @@ * Improved `Advanced - Fix Prefab Override MeshFilter` property for `SkeletonRenderer` (and subclasses`SkeletonAnimation` and `SkeletonMecanim`), now providing an additional option to use a global value which can be set in `Edit - Preferences - Spine`. * Timeline naming improvements: `Spine AnimationState Clip` Inspector parameter `Custom Duration` changed and inverted to `Default Mix Duration` for more clarity. Shortened all Timeline add track menu entries from: `Spine.Unity.Playables - ` to `Spine - `, `Spine Animation State Track` to `SkeletonAnimation Track`, `Spine AnimationState Graphic Track` to `SkeletonGraphic Track`, and `Spine Skeleton Flip Track` to `Skeleton Flip Track`. * Timeline track appearance and Inspector: Tracks now show icons and track colors to make them easier to distinguish. When a Track is selected, the Inspector now shows an editable track name which was previously only editable at the Timeline asset. + * Added example component `SkeletonRenderTexture` to render a `SkeletonRenderer` to a `RenderTexture`, mainly for proper transparency. Added an example scene named `RenderTexture FadeOut Transparency` that demonstrates usage for a fadeout transparency effect. * **Changes of default values** diff --git a/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity b/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity new file mode 100644 index 0000000000..5aa4276011 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity @@ -0,0 +1,1031 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &71621966 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 71621967} + - component: {fileID: 71621969} + - component: {fileID: 71621968} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &71621967 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 71621966} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 592567554} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -60, y: -60} + m_SizeDelta: {x: 600, y: 60} + m_Pivot: {x: 0.9999999, y: 1.0000007} +--- !u!114 &71621968 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 71621966} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 55 + m_FontStyle: 1 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 55 + m_Alignment: 5 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: RenderTexture Fade-Out Transparency +--- !u!222 &71621969 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 71621966} + m_CullTransparentMesh: 1 +--- !u!1 &334034152 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 334034156} + - component: {fileID: 334034155} + - component: {fileID: 334034154} + - component: {fileID: 334034153} + m_Layer: 0 + m_Name: Spineboy Normal + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &334034153 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 334034152} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonDataAsset: {fileID: 11400000, guid: af38a3de26ed9b84abc2fe7c7f3b209d, type: 2} + initialSkinName: + fixPrefabOverrideViaMeshFilter: 2 + initialFlipX: 0 + initialFlipY: 0 + updateWhenInvisible: 3 + separatorSlotNames: [] + zSpacing: 0 + useClipping: 1 + immutableTriangles: 0 + pmaVertexColors: 1 + clearStateOnDisable: 0 + tintBlack: 0 + singleSubmesh: 0 + fixDrawOrder: 0 + addNormals: 0 + calculateTangents: 0 + maskInteraction: 0 + maskMaterials: + materialsMaskDisabled: [] + materialsInsideMask: [] + materialsOutsideMask: [] + disableRenderingOnOverride: 1 + _animationName: run + loop: 1 + timeScale: 1 +--- !u!23 &334034154 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 334034152} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &334034155 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 334034152} + m_Mesh: {fileID: 0} +--- !u!4 &334034156 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 334034152} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -5.93, y: 0, z: 5.66} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &541830406 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 541830407} + - component: {fileID: 541830409} + - component: {fileID: 541830408} + m_Layer: 5 + m_Name: Instructions + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &541830407 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 541830406} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 592567554} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -391, y: -190} + m_SizeDelta: {x: 662, y: 101.6} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &541830408 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 541830406} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 28 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 2 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: "Enter play mode to see the problem of conventional alpha transparency\n + fadeout and how this can be fixed by using a RenderTexture." +--- !u!222 &541830409 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 541830406} + m_CullTransparentMesh: 1 +--- !u!1 &592567553 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 592567554} + - component: {fileID: 592567556} + - component: {fileID: 592567555} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &592567554 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 592567553} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 71621967} + - {fileID: 541830407} + - {fileID: 1682675646} + m_Father: {fileID: 1799507978} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &592567555 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 592567553} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 200 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1920, y: 1080} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &592567556 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 592567553} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 1 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!1 &1368805070 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1368805071} + - component: {fileID: 1368805072} + m_Layer: 0 + m_Name: Transparency FadeOut Example + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1368805071 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1368805070} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -3.7153435, y: -0.0017910004, z: 5.9292965} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1368805072 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1368805070} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a4cc2b5fcffcac846aacb02b6dad0440, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonRenderTexture: {fileID: 1786065614} + normalSkeletonRenderer: {fileID: 334034153} +--- !u!1 &1369381599 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1369381601} + - component: {fileID: 1369381600} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1369381600 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1369381599} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1369381601 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1369381599} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1407691187 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1407691190} + - component: {fileID: 1407691189} + - component: {fileID: 1407691188} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1407691188 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1407691187} + m_Enabled: 1 +--- !u!20 &1407691189 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1407691187} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.43316126, g: 0.5290042, b: 0.5849056, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1407691190 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1407691187} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 4.8, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1606174180 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1606174183} + - component: {fileID: 1606174182} + - component: {fileID: 1606174181} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1606174181 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1606174180} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1606174182 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1606174180} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &1606174183 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1606174180} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1682675645 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1682675646} + - component: {fileID: 1682675648} + - component: {fileID: 1682675647} + m_Layer: 5 + m_Name: Example Notes + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1682675646 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1682675645} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 592567554} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -331.4, y: -186} + m_SizeDelta: {x: 1176.1, y: -365} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1682675647 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1682675645} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 26 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 2 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: 'This scene demonstrates the problems of using conventional alpha transparency + for a fadeout effect (left), and how this problem can be fixed by using a RenderTexture + (right). + + + Spineboy on the right uses a SkeletonRenderTexture component to + render the overlapping mesh to a RenderTexture first and then draw this texture + to the scene at once using a single quad.' +--- !u!222 &1682675648 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1682675645} + m_CullTransparentMesh: 1 +--- !u!1 &1786065613 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1786065618} + - component: {fileID: 1786065617} + - component: {fileID: 1786065616} + - component: {fileID: 1786065615} + - component: {fileID: 1786065614} + m_Layer: 0 + m_Name: Spineboy CorrectFadeout + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1786065614 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1786065613} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 25e6ceb271c9af848ae53f2af1073d0d, type: 3} + m_Name: + m_EditorClassIdentifier: + color: {r: 1, g: 1, b: 1, a: 1} + quadMaterial: {fileID: 2100000, guid: 4c507f887c6274a44a603d96e0eabf2a, type: 2} + targetCamera: {fileID: 0} + maxRenderTextureSize: 1024 + quad: {fileID: 0} + renderTexture: {fileID: 0} +--- !u!114 &1786065615 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1786065613} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d247ba06193faa74d9335f5481b2b56c, type: 3} + m_Name: + m_EditorClassIdentifier: + skeletonDataAsset: {fileID: 11400000, guid: af38a3de26ed9b84abc2fe7c7f3b209d, type: 2} + initialSkinName: + fixPrefabOverrideViaMeshFilter: 2 + initialFlipX: 0 + initialFlipY: 0 + updateWhenInvisible: 3 + separatorSlotNames: [] + zSpacing: 0 + useClipping: 1 + immutableTriangles: 0 + pmaVertexColors: 1 + clearStateOnDisable: 0 + tintBlack: 0 + singleSubmesh: 0 + fixDrawOrder: 0 + addNormals: 0 + calculateTangents: 0 + maskInteraction: 0 + maskMaterials: + materialsMaskDisabled: [] + materialsInsideMask: [] + materialsOutsideMask: [] + disableRenderingOnOverride: 1 + _animationName: run + loop: 1 + timeScale: 1 +--- !u!23 &1786065616 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1786065613} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: f89bbf05902e77242a3ad20f3c927353, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &1786065617 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1786065613} + m_Mesh: {fileID: 0} +--- !u!4 &1786065618 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1786065613} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 3.32, y: 0, z: 5.66} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1799507977 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1799507978} + m_Layer: 0 + m_Name: UI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1799507978 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1799507977} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -4.7074776, y: 0.042612553, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 592567554} + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity.meta b/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity.meta new file mode 100644 index 0000000000..ce3aa2820d --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 28687d6c4c7e84e48a6907ea466198f9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs b/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs new file mode 100644 index 0000000000..4f42ec4b25 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs @@ -0,0 +1,52 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated January 1, 2020. Replaces all prior versions. + * + * Copyright (c) 2013-2022, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, + * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +using UnityEngine; +using UnityEngine.Events; + +namespace Spine.Unity.Examples { + public class RenderTextureFadeoutExample : MonoBehaviour { + + public SkeletonRenderTexture skeletonRenderTexture; + public SkeletonRenderer normalSkeletonRenderer; + + public void Update () { + float fadeoutAlpha = 1.0f - ((0.5f * Time.time) % 1.0f); + + // changing transpacency at a MeshRenderer does not yield the desired effect + // due to overlapping attachment meshes. + normalSkeletonRenderer.Skeleton.SetColor(new Color(1, 1, 1, fadeoutAlpha)); + + // Thus we render the whole skeleton to a RenderTexture first using the + // SkeletonRenderTexture component. + // Changing transparency at a single quad with a RenderTexture works as desired. + skeletonRenderTexture.color.a = fadeoutAlpha; + } + } +} diff --git a/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs.meta b/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs.meta new file mode 100644 index 0000000000..1c8739dca9 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a4cc2b5fcffcac846aacb02b6dad0440 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture.meta b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture.meta new file mode 100644 index 0000000000..597e93d3ed --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1b5dc12395d030642b857afc9dff2ae2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadMaterial.mat b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadMaterial.mat new file mode 100644 index 0000000000..2886063aab --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadMaterial.mat @@ -0,0 +1,90 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: RenderQuadMaterial + m_Shader: {fileID: 4800000, guid: 1e0cc951f440af74dacaf86ac4ae2602, type: 3} + m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _USE8NEIGHBOURHOOD_ON + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DarkColorAlphaAdditive: 0 + - _DetailNormalMapScale: 1 + - _DstBlend: 10 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 3 + - _OcclusionStrength: 1 + - _OutlineMipLevel: 0 + - _OutlineReferenceTexWidth: 1024 + - _OutlineSmoothness: 1 + - _OutlineWidth: 3 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _StencilComp: 8 + - _StencilRef: 1 + - _StraightAlphaInput: 0 + - _ThresholdEnd: 0.25 + - _UVSec: 0 + - _Use8Neighbourhood: 1 + - _ZWrite: 0 + m_Colors: + - _Black: {r: 0, g: 0, b: 0, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _OutlineColor: {r: 1, g: 1, b: 0, a: 1} + m_BuildTextureStacks: [] diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadMaterial.mat.meta b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadMaterial.mat.meta new file mode 100644 index 0000000000..7cf1e984c4 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadMaterial.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4c507f887c6274a44a603d96e0eabf2a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadShader.shader b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadShader.shader new file mode 100644 index 0000000000..91b1fa8cb3 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadShader.shader @@ -0,0 +1,104 @@ +// Simple shader for e.g. a Quad that renders a RenderTexture. +// Texture color is multiplied by a color property, mostly for alpha fadeout. +Shader "Spine/RenderQuad" { + Properties{ + _Color("Color", Color) = (1,1,1,1) + [NoScaleOffset] _MainTex("MainTex", 2D) = "white" {} + _Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.1 + [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0 + [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default + } + SubShader{ + Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } + Blend One OneMinusSrcAlpha + Cull Off + ZWrite Off + Lighting Off + + Stencil { + Ref[_StencilRef] + Comp[_StencilComp] + Pass Keep + } + + Pass { + Name "Normal" + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #include "UnityCG.cginc" + sampler2D _MainTex; + 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 = (VertexOutput)0; + o.uv = v.uv; + o.vertexColor = v.vertexColor; + o.pos = UnityObjectToClipPos(v.vertex); + return o; + } + + float4 frag(VertexOutput i) : SV_Target { + float4 texColor = tex2D(_MainTex,i.uv); + _Color.rgb *= _Color.a; + return texColor * _Color; + } + ENDCG + } + + Pass { + Name "Caster" + Tags { "LightMode" = "ShadowCaster" } + Offset 1, 1 + ZWrite On + ZTest LEqual + + Fog { Mode Off } + Cull Off + Lighting Off + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma multi_compile_shadowcaster + #pragma fragmentoption ARB_precision_hint_fastest + #include "UnityCG.cginc" + sampler2D _MainTex; + fixed _Cutoff; + + struct VertexOutput { + V2F_SHADOW_CASTER; + float4 uvAndAlpha : TEXCOORD1; + }; + + VertexOutput vert(appdata_base v, float4 vertexColor : COLOR) { + VertexOutput o; + o.uvAndAlpha = v.texcoord; + o.uvAndAlpha.a = vertexColor.a; + TRANSFER_SHADOW_CASTER(o) + return o; + } + + float4 frag(VertexOutput i) : SV_Target { + fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy); + clip(texcol.a* i.uvAndAlpha.a - _Cutoff); + SHADOW_CASTER_FRAGMENT(i) + } + ENDCG + } + } + FallBack "Diffuse" +} diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadShader.shader.meta b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadShader.shader.meta new file mode 100644 index 0000000000..c90bb08777 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/RenderQuadShader.shader.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1e0cc951f440af74dacaf86ac4ae2602 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs new file mode 100644 index 0000000000..8ba7e5a693 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs @@ -0,0 +1,223 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated January 1, 2020. Replaces all prior versions. + * + * Copyright (c) 2013-2022, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, + * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Rendering; + +namespace Spine.Unity.Examples { + + [RequireComponent(typeof(SkeletonRenderer))] + public class SkeletonRenderTexture : MonoBehaviour { + public Color color = Color.white; + public Material quadMaterial; + public Camera targetCamera; + public int maxRenderTextureSize = 1024; + protected SkeletonRenderer skeletonRenderer; + protected MeshRenderer meshRenderer; + protected MeshFilter meshFilter; + public GameObject quad; + protected MeshRenderer quadMeshRenderer; + protected MeshFilter quadMeshFilter; + protected Mesh quadMesh; + public RenderTexture renderTexture; + + private CommandBuffer commandBuffer; + private MaterialPropertyBlock propertyBlock; + private readonly List materials = new List(); + + protected Vector2Int requiredRenderTextureSize; + protected Vector2Int allocatedRenderTextureSize; + + void Awake () { + meshRenderer = this.GetComponent(); + meshFilter = this.GetComponent(); + skeletonRenderer = this.GetComponent(); + if (targetCamera == null) + targetCamera = Camera.main; + + commandBuffer = new CommandBuffer(); + propertyBlock = new MaterialPropertyBlock(); + + CreateQuadChild(); + } + + void OnDestroy () { + if (renderTexture) + RenderTexture.ReleaseTemporary(renderTexture); + } + + void CreateQuadChild () { + quad = new GameObject(this.name + " RenderTexture", typeof(MeshRenderer), typeof(MeshFilter)); + quad.transform.SetParent(this.transform.parent, false); + quadMeshRenderer = quad.GetComponent(); + quadMeshFilter = quad.GetComponent(); + + quadMesh = new Mesh(); + quadMesh.MarkDynamic(); + quadMesh.name = "RenderTexture Quad"; + quadMesh.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor; + + if (quadMaterial != null) + quadMeshRenderer.material = new Material(quadMaterial); + else + quadMeshRenderer.material = new Material(Shader.Find("Spine/RenderQuad")); + } + + void OnEnable () { + skeletonRenderer.OnMeshAndMaterialsUpdated += RenderOntoQuad; + meshRenderer.forceRenderingOff = true; + if (quadMeshRenderer) + quadMeshRenderer.gameObject.SetActive(true); + } + + void OnDisable () { + skeletonRenderer.OnMeshAndMaterialsUpdated -= RenderOntoQuad; + meshRenderer.forceRenderingOff = false; + if (quadMeshRenderer) + quadMeshRenderer.gameObject.SetActive(false); + if (renderTexture) + RenderTexture.ReleaseTemporary(renderTexture); + allocatedRenderTextureSize = Vector2Int.zero; + } + + void RenderOntoQuad (SkeletonRenderer skeletonRenderer) { + PrepareForMesh(); + RenderToRenderTexture(); + AssignAtQuad(); + } + + protected void PrepareForMesh () { + Bounds boundsLocalSpace = meshFilter.sharedMesh.bounds; + Vector3 meshMinWorldSpace = transform.TransformPoint(boundsLocalSpace.min); + Vector3 meshMaxWorldSpace = transform.TransformPoint(boundsLocalSpace.max); + Vector3 meshMinXMaxYWorldSpace = new Vector3(meshMinWorldSpace.x, meshMaxWorldSpace.y); + Vector3 meshMaxXMinYWorldSpace = new Vector3(meshMaxWorldSpace.x, meshMinWorldSpace.y); + + // We need to get the min/max of all four corners, close position and rotation of the skeleton + // in combination with perspective projection otherwise might lead to incorrect screen space min/max. + Vector3 meshMinProjected = targetCamera.WorldToScreenPoint(meshMinWorldSpace); + Vector3 meshMaxProjected = targetCamera.WorldToScreenPoint(meshMaxWorldSpace); + Vector3 meshMinXMaxYProjected = targetCamera.WorldToScreenPoint(meshMinXMaxYWorldSpace); + Vector3 meshMaxXMinYProjected = targetCamera.WorldToScreenPoint(meshMaxXMinYWorldSpace); + // To handle 180 degree rotation and thus min/max inversion, we get min/max of all four corners + Vector3 meshMinScreenSpace = + Vector3.Min(meshMinProjected, Vector3.Min(meshMaxProjected, + Vector3.Min(meshMinXMaxYProjected, meshMaxXMinYProjected))); + Vector3 meshMaxScreenSpace = + Vector3.Max(meshMinProjected, Vector3.Max(meshMaxProjected, + Vector3.Max(meshMinXMaxYProjected, meshMaxXMinYProjected))); + + requiredRenderTextureSize = new Vector2Int( + Mathf.Min(maxRenderTextureSize, Mathf.CeilToInt(Mathf.Abs(meshMaxScreenSpace.x - meshMinScreenSpace.x))), + Mathf.Min(maxRenderTextureSize, Mathf.CeilToInt(Mathf.Abs(meshMaxScreenSpace.y - meshMinScreenSpace.y)))); + + PrepareRenderTexture(); + PrepareCommandBuffer(meshMinWorldSpace, meshMaxWorldSpace); + } + + protected void PrepareCommandBuffer (Vector3 meshMinWorldSpace, Vector3 meshMaxWorldSpace) { + commandBuffer.Clear(); + commandBuffer.SetRenderTarget(renderTexture); + commandBuffer.ClearRenderTarget(true, true, Color.clear); + + Matrix4x4 projectionMatrix = Matrix4x4.Ortho( + meshMinWorldSpace.x, meshMaxWorldSpace.x, + meshMinWorldSpace.y, meshMaxWorldSpace.y, + float.MinValue, float.MaxValue); + + commandBuffer.SetProjectionMatrix(projectionMatrix); + commandBuffer.SetViewport(new Rect(Vector2.zero, requiredRenderTextureSize)); + } + + protected void RenderToRenderTexture () { + meshRenderer.GetPropertyBlock(propertyBlock); + meshRenderer.GetSharedMaterials(materials); + + for (int i = 0; i < materials.Count; i++) + commandBuffer.DrawMesh(meshFilter.sharedMesh, transform.localToWorldMatrix, + materials[i], meshRenderer.subMeshStartIndex + i, -1, propertyBlock); + Graphics.ExecuteCommandBuffer(commandBuffer); + } + + protected void AssignAtQuad () { + Vector2 min = meshFilter.sharedMesh.bounds.min; + Vector2 max = meshFilter.sharedMesh.bounds.max; + + Vector3[] vertices = new Vector3[4] { + new Vector3(min.x, min.y, 0), + new Vector3(max.x, min.y, 0), + new Vector3(min.x, max.y, 0), + new Vector3(max.x, max.y, 0) + }; + quadMesh.vertices = vertices; + + int[] indices = new int[6] { 0, 2, 1, 2, 3, 1 }; + quadMesh.triangles = indices; + + Vector3[] normals = new Vector3[4] { + -Vector3.forward, + -Vector3.forward, + -Vector3.forward, + -Vector3.forward + }; + quadMesh.normals = normals; + + float maxU = (float)(requiredRenderTextureSize.x) / allocatedRenderTextureSize.x; + float maxV = (float)(requiredRenderTextureSize.y) / allocatedRenderTextureSize.y; + Vector2[] uv = new Vector2[4] { + new Vector2(0, 0), + new Vector2(maxU, 0), + new Vector2(0, maxV), + new Vector2(maxU, maxV) + }; + quadMesh.uv = uv; + quadMeshFilter.mesh = quadMesh; + quadMeshRenderer.sharedMaterial.mainTexture = this.renderTexture; + quadMeshRenderer.sharedMaterial.color = color; + + quadMeshRenderer.transform.position = this.transform.position; + quadMeshRenderer.transform.rotation = this.transform.rotation; + quadMeshRenderer.transform.localScale = this.transform.localScale; + } + + protected void PrepareRenderTexture () { + Vector2Int textureSize = new Vector2Int( + Mathf.NextPowerOfTwo(requiredRenderTextureSize.x), + Mathf.NextPowerOfTwo(requiredRenderTextureSize.y)); + + if (textureSize != allocatedRenderTextureSize) { + if (renderTexture) + RenderTexture.ReleaseTemporary(renderTexture); + renderTexture = RenderTexture.GetTemporary(textureSize.x, textureSize.y); + allocatedRenderTextureSize = textureSize; + } + } + } +} diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs.meta b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs.meta new file mode 100644 index 0000000000..5b9c60b411 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 25e6ceb271c9af848ae53f2af1073d0d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 5e8e4c21f11603ba1b72c220369d367582783744 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 2 Mar 2022 22:35:11 +0100 Subject: [PATCH 03/38] [unity] Previous commit did not compile on Unity 2019.2 and earlier, fixed. See #1337. --- .../SkeletonRenderTexture/SkeletonRenderTexture.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs index 8ba7e5a693..958a7c3b4b 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs @@ -27,6 +27,10 @@ * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#if UNITY_2019_3_OR_NEWER +#define HAS_FORCE_RENDER_OFF +#endif + using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; @@ -92,14 +96,21 @@ public class SkeletonRenderTexture : MonoBehaviour { void OnEnable () { skeletonRenderer.OnMeshAndMaterialsUpdated += RenderOntoQuad; +#if HAS_FORCE_RENDER_OFF meshRenderer.forceRenderingOff = true; +#else + Debug.LogError("This component requires Unity 2019.3 or newer for meshRenderer.forceRenderingOff. " + + "Otherwise you will see the mesh rendered twice."); +#endif if (quadMeshRenderer) quadMeshRenderer.gameObject.SetActive(true); } void OnDisable () { skeletonRenderer.OnMeshAndMaterialsUpdated -= RenderOntoQuad; +#if HAS_FORCE_RENDER_OFF meshRenderer.forceRenderingOff = false; +#endif if (quadMeshRenderer) quadMeshRenderer.gameObject.SetActive(false); if (renderTexture) From b8da2fa27bd7fbdc09c041c12424a2d8df70e041 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 2 Mar 2022 22:46:03 +0100 Subject: [PATCH 04/38] [unity] Previous commit did not compile on Unity 2017.1 and earlier, fixed. See #1337. --- .../Spine Examples/Scripts/RenderTextureFadeoutExample.cs | 8 ++++++++ .../SkeletonRenderTexture/SkeletonRenderTexture.cs | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs b/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs index 4f42ec4b25..8b24fe8509 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs @@ -27,6 +27,10 @@ * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ +#if UNITY_2017_2_OR_NEWER +#define HAS_VECTOR_INT +#endif + using UnityEngine; using UnityEngine.Events; @@ -43,10 +47,14 @@ public class RenderTextureFadeoutExample : MonoBehaviour { // due to overlapping attachment meshes. normalSkeletonRenderer.Skeleton.SetColor(new Color(1, 1, 1, fadeoutAlpha)); +#if HAS_VECTOR_INT // Thus we render the whole skeleton to a RenderTexture first using the // SkeletonRenderTexture component. // Changing transparency at a single quad with a RenderTexture works as desired. skeletonRenderTexture.color.a = fadeoutAlpha; +#else + Debug.LogError("The SkeletonRenderTexture component requires Unity 2017.2 or newer."); +#endif } } } diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs index 958a7c3b4b..08bf547345 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs @@ -31,6 +31,10 @@ #define HAS_FORCE_RENDER_OFF #endif +#if UNITY_2017_2_OR_NEWER +#define HAS_VECTOR_INT +#endif + using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering; @@ -39,6 +43,7 @@ namespace Spine.Unity.Examples { [RequireComponent(typeof(SkeletonRenderer))] public class SkeletonRenderTexture : MonoBehaviour { +#if HAS_VECTOR_INT public Color color = Color.white; public Material quadMaterial; public Camera targetCamera; @@ -230,5 +235,6 @@ public class SkeletonRenderTexture : MonoBehaviour { allocatedRenderTextureSize = textureSize; } } +#endif } } From 4a10e10e91985ac083edcbb2aaffcf12cdf5e1ab Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 7 Mar 2022 17:48:45 +0100 Subject: [PATCH 05/38] [unity] Corrected spine-csharp package.json file, it contained `src` as folders directory (where it already resides). --- spine-csharp/src/package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/spine-csharp/src/package.json b/spine-csharp/src/package.json index 106d9ffe81..5ca1e0caf0 100644 --- a/spine-csharp/src/package.json +++ b/spine-csharp/src/package.json @@ -11,9 +11,6 @@ }, "dependencies": { }, - "files": [ - "src" - ], "repository": { "type": "git", "url": "git@github.com:EsotericSoftware/spine-runtimes.git" From 5ff19ea31c86f83996f391bcc8259ffff6d72831 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 7 Mar 2022 17:57:18 +0100 Subject: [PATCH 06/38] [unity] Added meta file of `add spine-csharp here.txt` to prevent an error message when using Unity Package Manager and git URL. --- .../Runtime/spine-csharp/add spine-csharp here.txt.meta | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 spine-unity/Assets/Spine/Runtime/spine-csharp/add spine-csharp here.txt.meta diff --git a/spine-unity/Assets/Spine/Runtime/spine-csharp/add spine-csharp here.txt.meta b/spine-unity/Assets/Spine/Runtime/spine-csharp/add spine-csharp here.txt.meta new file mode 100644 index 0000000000..f6f23ac565 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-csharp/add spine-csharp here.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2b53e3e7c2824094b9259a24cd9a7e03 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From 6887aa617a09ecc0e980fe823342ba57ff49b08a Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 8 Mar 2022 22:03:01 +0100 Subject: [PATCH 07/38] [threejs] Fix clipping not being ended, better alpha test support. --- CHANGELOG.md | 1 + spine-ts/.vscode/launch.json | 16 ++++++++++++++- spine-ts/spine-threejs/src/SkeletonMesh.ts | 20 +++++++++++++++---- .../spine-webgl/example/drag-and-drop.html | 2 ++ spine-ts/spine-webgl/example/drag-and-drop.js | 14 ++++++++++--- 5 files changed, 45 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 146ff44c9b..0abd44897b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -238,6 +238,7 @@ * `SkeletonMesh` now takes an optional `SkeletonMeshMaterialParametersCustomizer` function that allows you to modify the `ShaderMaterialParameters` before the material is finalized. Use it to modify things like THREEJS' `Material.depthTest` etc. See #1590. * **Breaking change:** the global object `spine.canvas` no longer exists. All classes and functions are now exposed on the global `spine` object directly. Simply replace any reference to `spine.threejs.` in your source code with `spine.`. * **Breaking change:** the default fragment shader of `SkeletonMeshMaterial` now explicitely discards fragments with alpha < 0.5. See https://github.com/EsotericSoftware/spine-runtimes/issues/1985 +* **Breaking change:** reversal of the previous breaking change: the default fragment shader of `SkeletonMeshMaterial` does no longer discard fragments with alpha < 0.5. Pass a `SkeletonMeshMaterialParametersCustomizer` to the `SkeletonMesh` constructor, and modify `parameters.alphaTest` to be > 0. ### Player * Added `SpinePlayerConfig.rawDataURIs`. Allows to embed data URIs for skeletons, atlases and atlas page images directly in the HTML/JS without needing to load it from a separate file. See the example for a demonstration. diff --git a/spine-ts/.vscode/launch.json b/spine-ts/.vscode/launch.json index 109a37100a..08d870cc9e 100644 --- a/spine-ts/.vscode/launch.json +++ b/spine-ts/.vscode/launch.json @@ -17,6 +17,20 @@ "name": "drag-and-drop", "url": "http://localhost:8080/spine-webgl/example/drag-and-drop.html", "webRoot": "${workspaceFolder}" + }, + { + "type": "pwa-chrome", + "request": "launch", + "name": "barebones-dragon", + "url": "http://localhost:8080/spine-webgl/example/barebones-dragon.html", + "webRoot": "${workspaceFolder}" + }, + { + "type": "pwa-chrome", + "request": "launch", + "name": "threejs-example", + "url": "http://localhost:8080/spine-threejs/example/index.html", + "webRoot": "${workspaceFolder}" } ] -} \ No newline at end of file +} diff --git a/spine-ts/spine-threejs/src/SkeletonMesh.ts b/spine-ts/spine-threejs/src/SkeletonMesh.ts index e76b088d74..f004315bb9 100644 --- a/spine-ts/spine-threejs/src/SkeletonMesh.ts +++ b/spine-ts/spine-threejs/src/SkeletonMesh.ts @@ -50,26 +50,35 @@ export class SkeletonMeshMaterial extends THREE.ShaderMaterial { `; let fragmentShader = ` uniform sampler2D map; + #ifdef USE_ALPHATEST + uniform float alphaTest; + #endif varying vec2 vUv; varying vec4 vColor; void main(void) { gl_FragColor = texture2D(map, vUv)*vColor; - if (gl_FragColor.a < 0.5) discard; + #ifdef USE_ALPHATEST + if (gl_FragColor.a < alphaTest) discard; + #endif } `; let parameters: THREE.ShaderMaterialParameters = { uniforms: { - map: { type: "t", value: null } as any + map: { value: null }, }, vertexShader: vertexShader, fragmentShader: fragmentShader, side: THREE.DoubleSide, transparent: true, depthWrite: false, - alphaTest: 0.5 + alphaTest: 0.0 }; customizer(parameters); + if (parameters.alphaTest > 0) { + parameters.defines = { "USE_ALPHATEST": 1 }; + parameters.uniforms["alphaTest"] = { value: parameters.alphaTest }; + } super(parameters); }; } @@ -194,7 +203,10 @@ export class SkeletonMesh extends THREE.Object3D { let clip = (attachment); clipper.clipStart(slot, clip); continue; - } else continue; + } else { + clipper.clipEndWithSlot(slot); + continue; + } if (texture != null) { let skeleton = slot.bone.skeleton; diff --git a/spine-ts/spine-webgl/example/drag-and-drop.html b/spine-ts/spine-webgl/example/drag-and-drop.html index 13cc10f40b..c0fc4308e8 100644 --- a/spine-ts/spine-webgl/example/drag-and-drop.html +++ b/spine-ts/spine-webgl/example/drag-and-drop.html @@ -12,6 +12,8 @@
+ +
diff --git a/spine-ts/spine-webgl/example/drag-and-drop.js b/spine-ts/spine-webgl/example/drag-and-drop.js index f635e001f4..f7b5eebea2 100644 --- a/spine-ts/spine-webgl/example/drag-and-drop.js +++ b/spine-ts/spine-webgl/example/drag-and-drop.js @@ -3,6 +3,7 @@ class App { this.skeleton = null; this.animationState = null; this.canvas = null; + this.pma = true; } loadAssets(canvas) { @@ -20,7 +21,13 @@ class App { // Setup listener for animation selection box let animationSelectBox = document.body.querySelector("#animations"); animationSelectBox.onchange = () => { - this.animationState.setAnimation(0, animationSelectBox.value, true); + // this.animationState.setAnimation(0, animationSelectBox.value, true); + } + + // Setup listener for the PMA checkbox + let pmaCheckbox = document.body.querySelector("#pma"); + pmaCheckbox.onchange = () => { + this.pma = pmaCheckbox.checked; } // Setup the drag and drop listener @@ -117,7 +124,7 @@ class App { animationSelectBox.appendChild(option); } - if (animationName) this.animationState.setAnimation(0, animationName, true); + // if (animationName) this.animationState.setAnimation(0, animationName, true); // Center the skeleton in the viewport this.centerSkeleton(); @@ -153,10 +160,11 @@ class App { renderer.resize(spine.ResizeMode.Expand); canvas.clear(0.2, 0.2, 0.2, 1); + renderer.begin(); renderer.line(-10000, 0, 10000, 0, spine.Color.RED); renderer.line(0, -10000, 0, 10000, spine.Color.GREEN); - renderer.drawSkeleton(this.skeleton, true); + renderer.drawSkeleton(this.skeleton, this.pma); renderer.end(); } } From d485ce069614463fc042489fdfe764656c4913af Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 8 Mar 2022 22:05:22 +0100 Subject: [PATCH 08/38] [ts] 4.0.21 release. --- spine-ts/package-lock.json | 98 ++++++++++++++--------------- spine-ts/package.json | 2 +- spine-ts/spine-canvas/package.json | 4 +- spine-ts/spine-core/package.json | 2 +- spine-ts/spine-player/package.json | 4 +- spine-ts/spine-threejs/package.json | 4 +- spine-ts/spine-webgl/package.json | 4 +- 7 files changed, 59 insertions(+), 59 deletions(-) diff --git a/spine-ts/package-lock.json b/spine-ts/package-lock.json index 3fe1338352..4686945170 100644 --- a/spine-ts/package-lock.json +++ b/spine-ts/package-lock.json @@ -1,12 +1,12 @@ { "name": "@esotericsoftware/spine-ts", - "version": "4.0.20", + "version": "4.0.21", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@esotericsoftware/spine-ts", - "version": "4.0.20", + "version": "4.0.21", "license": "LicenseRef-LICENSE", "workspaces": [ "spine-core", @@ -58,13 +58,13 @@ "integrity": "sha512-XqBrP/+kbs+o0CYRhCVVE95v7FaL2bO5Z7+3VQJE0nEyjo+9LoLfeNgZITOnndKHxM+7ltEciAIR7uE0SZlsOg==" }, "node_modules/accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dev": true, "dependencies": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" }, "engines": { "node": ">= 0.6" @@ -1125,9 +1125,9 @@ } }, "node_modules/http-parser-js": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.5.tgz", - "integrity": "sha512-x+JVEkO2PoM8qqpbPbOL3cqHPwerep7OwzK7Ay+sMQjKzaKCqWvjoXm5tqMP9tXWWTnTzAjIhXg+J99XYuPhPA==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.6.tgz", + "integrity": "sha512-vDlkRPDJn93swjcjqMSaGSPABbIarsr1TLAui/gLDXzV5VsJNdXNzMYDyNBLQkjWQCJ1uizu8T2oDMhmGt0PRA==", "dev": true }, "node_modules/inflight": { @@ -1489,9 +1489,9 @@ } }, "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { "brace-expansion": "^1.1.7" @@ -1623,9 +1623,9 @@ } }, "node_modules/negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true, "engines": { "node": ">= 0.6" @@ -7693,9 +7693,9 @@ "dev": true }, "node_modules/typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -7951,41 +7951,41 @@ }, "spine-canvas": { "name": "@esotericsoftware/spine-canvas", - "version": "4.0.20", + "version": "4.0.21", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.20" + "@esotericsoftware/spine-core": "^4.0.21" } }, "spine-core": { "name": "@esotericsoftware/spine-core", - "version": "4.0.20", + "version": "4.0.21", "license": "LicenseRef-LICENSE" }, "spine-player": { "name": "@esotericsoftware/spine-player", - "version": "4.0.20", + "version": "4.0.21", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-webgl": "^4.0.20" + "@esotericsoftware/spine-webgl": "^4.0.21" } }, "spine-threejs": { "name": "@esotericsoftware/spine-threejs", - "version": "4.0.20", + "version": "4.0.21", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.20", + "@esotericsoftware/spine-core": "^4.0.21", "@types/three": "^0.133.1", "three": "^0.133.1" } }, "spine-webgl": { "name": "@esotericsoftware/spine-webgl", - "version": "4.0.20", + "version": "4.0.21", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.20" + "@esotericsoftware/spine-core": "^4.0.21" } } }, @@ -7993,7 +7993,7 @@ "@esotericsoftware/spine-canvas": { "version": "file:spine-canvas", "requires": { - "@esotericsoftware/spine-core": "^4.0.20" + "@esotericsoftware/spine-core": "^4.0.21" } }, "@esotericsoftware/spine-core": { @@ -8002,13 +8002,13 @@ "@esotericsoftware/spine-player": { "version": "file:spine-player", "requires": { - "@esotericsoftware/spine-webgl": "^4.0.20" + "@esotericsoftware/spine-webgl": "^4.0.21" } }, "@esotericsoftware/spine-threejs": { "version": "file:spine-threejs", "requires": { - "@esotericsoftware/spine-core": "^4.0.20", + "@esotericsoftware/spine-core": "^4.0.21", "@types/three": "^0.133.1", "three": "^0.133.1" } @@ -8016,7 +8016,7 @@ "@esotericsoftware/spine-webgl": { "version": "file:spine-webgl", "requires": { - "@esotericsoftware/spine-core": "^4.0.20" + "@esotericsoftware/spine-core": "^4.0.21" } }, "@types/offscreencanvas": { @@ -8031,13 +8031,13 @@ "integrity": "sha512-XqBrP/+kbs+o0CYRhCVVE95v7FaL2bO5Z7+3VQJE0nEyjo+9LoLfeNgZITOnndKHxM+7ltEciAIR7uE0SZlsOg==" }, "accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dev": true, "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" } }, "ansi-regex": { @@ -8884,9 +8884,9 @@ } }, "http-parser-js": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.5.tgz", - "integrity": "sha512-x+JVEkO2PoM8qqpbPbOL3cqHPwerep7OwzK7Ay+sMQjKzaKCqWvjoXm5tqMP9tXWWTnTzAjIhXg+J99XYuPhPA==", + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.6.tgz", + "integrity": "sha512-vDlkRPDJn93swjcjqMSaGSPABbIarsr1TLAui/gLDXzV5VsJNdXNzMYDyNBLQkjWQCJ1uizu8T2oDMhmGt0PRA==", "dev": true }, "inflight": { @@ -9169,9 +9169,9 @@ } }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "requires": { "brace-expansion": "^1.1.7" @@ -9277,9 +9277,9 @@ } }, "negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true }, "noms": { @@ -14061,9 +14061,9 @@ "dev": true }, "typescript": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz", - "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==", + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", + "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", "dev": true }, "union-value": { diff --git a/spine-ts/package.json b/spine-ts/package.json index 11a3b8dd4f..3a7b79cb20 100644 --- a/spine-ts/package.json +++ b/spine-ts/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-ts", - "version": "4.0.20", + "version": "4.0.21", "description": "The official Spine Runtimes for the web.", "files": [ "README.md" diff --git a/spine-ts/spine-canvas/package.json b/spine-ts/spine-canvas/package.json index daa137dd8b..36f57770bc 100644 --- a/spine-ts/spine-canvas/package.json +++ b/spine-ts/spine-canvas/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-canvas", - "version": "4.0.20", + "version": "4.0.21", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.20" + "@esotericsoftware/spine-core": "^4.0.21" } } \ No newline at end of file diff --git a/spine-ts/spine-core/package.json b/spine-ts/spine-core/package.json index b61797c6e0..4a2ca99f35 100644 --- a/spine-ts/spine-core/package.json +++ b/spine-ts/spine-core/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-core", - "version": "4.0.20", + "version": "4.0.21", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/spine-ts/spine-player/package.json b/spine-ts/spine-player/package.json index 85345e6cb8..e45e2e3c37 100644 --- a/spine-ts/spine-player/package.json +++ b/spine-ts/spine-player/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-player", - "version": "4.0.20", + "version": "4.0.21", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-webgl": "^4.0.20" + "@esotericsoftware/spine-webgl": "^4.0.21" } } \ No newline at end of file diff --git a/spine-ts/spine-threejs/package.json b/spine-ts/spine-threejs/package.json index e24d899067..db0ef44589 100644 --- a/spine-ts/spine-threejs/package.json +++ b/spine-ts/spine-threejs/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-threejs", - "version": "4.0.20", + "version": "4.0.21", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -32,6 +32,6 @@ "dependencies": { "@types/three": "^0.133.1", "three": "^0.133.1", - "@esotericsoftware/spine-core": "^4.0.20" + "@esotericsoftware/spine-core": "^4.0.21" } } \ No newline at end of file diff --git a/spine-ts/spine-webgl/package.json b/spine-ts/spine-webgl/package.json index 66a00b0733..caf701afbc 100644 --- a/spine-ts/spine-webgl/package.json +++ b/spine-ts/spine-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-webgl", - "version": "4.0.20", + "version": "4.0.21", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.20" + "@esotericsoftware/spine-core": "^4.0.21" } } \ No newline at end of file From 9cd38191fc036bbc42a237470a1e00f156fafdb7 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Thu, 10 Mar 2022 17:00:26 +0100 Subject: [PATCH 09/38] [unity] Added example component `SkeletonRenderTextureFadeout` and improved example scene and documentation. See #1337. --- CHANGELOG.md | 1 + .../RenderTexture FadeOut Transparency.unity | 24 ++++- .../Scripts/RenderTextureFadeoutExample.cs | 54 +++++++++--- .../SkeletonRenderTexture.cs | 8 ++ .../SkeletonRenderTextureFadeout.cs | 88 +++++++++++++++++++ .../SkeletonRenderTextureFadeout.cs.meta | 11 +++ 6 files changed, 170 insertions(+), 16 deletions(-) create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTextureFadeout.cs create mode 100644 spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTextureFadeout.cs.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index 0abd44897b..c4a7725ad7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -164,6 +164,7 @@ * Timeline naming improvements: `Spine AnimationState Clip` Inspector parameter `Custom Duration` changed and inverted to `Default Mix Duration` for more clarity. Shortened all Timeline add track menu entries from: `Spine.Unity.Playables - ` to `Spine - `, `Spine Animation State Track` to `SkeletonAnimation Track`, `Spine AnimationState Graphic Track` to `SkeletonGraphic Track`, and `Spine Skeleton Flip Track` to `Skeleton Flip Track`. * Timeline track appearance and Inspector: Tracks now show icons and track colors to make them easier to distinguish. When a Track is selected, the Inspector now shows an editable track name which was previously only editable at the Timeline asset. * Added example component `SkeletonRenderTexture` to render a `SkeletonRenderer` to a `RenderTexture`, mainly for proper transparency. Added an example scene named `RenderTexture FadeOut Transparency` that demonstrates usage for a fadeout transparency effect. + * Added another fadeout example component named `SkeletonRenderTextureFadeout` which takes over transparency fadeout when enabled. You can use this component as-is, attach it in disabled state and enable it to start a fadeout effect. * **Changes of default values** diff --git a/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity b/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity index 5aa4276011..c5ae69f867 100644 --- a/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity +++ b/spine-unity/Assets/Spine Examples/Other Examples/RenderTexture FadeOut Transparency.unity @@ -392,8 +392,10 @@ MonoBehaviour: m_HorizontalOverflow: 1 m_VerticalOverflow: 1 m_LineSpacing: 1 - m_Text: "Enter play mode to see the problem of conventional alpha transparency\n - fadeout and how this can be fixed by using a RenderTexture." + m_Text: 'Enter play mode to see the problem of conventional alpha transparency + + fadeout + and how this can be fixed by using a RenderTexture.' --- !u!222 &541830409 CanvasRenderer: m_ObjectHideFlags: 0 @@ -529,7 +531,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a4cc2b5fcffcac846aacb02b6dad0440, type: 3} m_Name: m_EditorClassIdentifier: - skeletonRenderTexture: {fileID: 1786065614} + renderTextureFadeout: {fileID: 1786065619} normalSkeletonRenderer: {fileID: 334034153} --- !u!1 &1369381599 GameObject: @@ -872,6 +874,7 @@ GameObject: - component: {fileID: 1786065616} - component: {fileID: 1786065615} - component: {fileID: 1786065614} + - component: {fileID: 1786065619} m_Layer: 0 m_Name: Spineboy CorrectFadeout m_TagString: Untagged @@ -886,7 +889,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1786065613} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 25e6ceb271c9af848ae53f2af1073d0d, type: 3} m_Name: @@ -998,6 +1001,19 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1786065619 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1786065613} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5fc94f89310427643babb41e000a8462, type: 3} + m_Name: + m_EditorClassIdentifier: + fadeoutSeconds: 2 --- !u!1 &1799507977 GameObject: m_ObjectHideFlags: 0 diff --git a/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs b/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs index 8b24fe8509..19b67376d1 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/RenderTextureFadeoutExample.cs @@ -31,30 +31,60 @@ #define HAS_VECTOR_INT #endif +using System.Collections; using UnityEngine; using UnityEngine.Events; namespace Spine.Unity.Examples { public class RenderTextureFadeoutExample : MonoBehaviour { - public SkeletonRenderTexture skeletonRenderTexture; + public SkeletonRenderTextureFadeout renderTextureFadeout; public SkeletonRenderer normalSkeletonRenderer; - public void Update () { - float fadeoutAlpha = 1.0f - ((0.5f * Time.time) % 1.0f); + float fadeoutSeconds = 2.0f; + float fadeoutSecondsRemaining; - // changing transpacency at a MeshRenderer does not yield the desired effect + IEnumerator Start () { + while (true) { + StartFadeoutBad(); + StartFadeoutGood(); + yield return new WaitForSeconds(5.0f); + } + } + void Update () { + UpdateBadFadeOutAlpha(); + } + + void UpdateBadFadeOutAlpha () { + if (fadeoutSecondsRemaining == 0) + return; + + fadeoutSecondsRemaining -= Time.deltaTime; + if (fadeoutSecondsRemaining <= 0) { + fadeoutSecondsRemaining = 0; + return; + } + float fadeoutAlpha = fadeoutSecondsRemaining / fadeoutSeconds; + + // changing transparency at a MeshRenderer does not yield the desired effect // due to overlapping attachment meshes. normalSkeletonRenderer.Skeleton.SetColor(new Color(1, 1, 1, fadeoutAlpha)); + } -#if HAS_VECTOR_INT - // Thus we render the whole skeleton to a RenderTexture first using the - // SkeletonRenderTexture component. - // Changing transparency at a single quad with a RenderTexture works as desired. - skeletonRenderTexture.color.a = fadeoutAlpha; -#else - Debug.LogError("The SkeletonRenderTexture component requires Unity 2017.2 or newer."); -#endif + void StartFadeoutBad () { + fadeoutSecondsRemaining = fadeoutSeconds; + } + + void StartFadeoutGood () { + renderTextureFadeout.gameObject.SetActive(true); + // enabling the SkeletonRenderTextureFadeout component starts the fadeout. + renderTextureFadeout.enabled = true; + renderTextureFadeout.OnFadeoutComplete -= DisableGameObject; + renderTextureFadeout.OnFadeoutComplete += DisableGameObject; + } + + void DisableGameObject (SkeletonRenderTextureFadeout target) { + target.gameObject.SetActive(false); } } } diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs index 08bf547345..60aa570e73 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs @@ -41,6 +41,14 @@ namespace Spine.Unity.Examples { + /// + /// When enabled, this component renders a skeleton to a RenderTexture and + /// then draws this RenderTexture at a quad of the same size. + /// This allows changing transparency at a single quad, which produces a more + /// natural fadeout effect. + /// Note: It is recommended to keep this component disabled as much as possible + /// because of the additional rendering overhead. Only enable it when alpha blending is required. + /// [RequireComponent(typeof(SkeletonRenderer))] public class SkeletonRenderTexture : MonoBehaviour { #if HAS_VECTOR_INT diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTextureFadeout.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTextureFadeout.cs new file mode 100644 index 0000000000..27605c9e12 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTextureFadeout.cs @@ -0,0 +1,88 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated January 1, 2020. Replaces all prior versions. + * + * Copyright (c) 2013-2022, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, + * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#if UNITY_2019_3_OR_NEWER +#define HAS_FORCE_RENDER_OFF +#endif + +#if UNITY_2017_2_OR_NEWER +#define HAS_VECTOR_INT +#endif + +using UnityEngine; + +namespace Spine.Unity.Examples { + + /// + /// A simple fadeout component that uses a for transparency fadeout. + /// Attach a and this component to a skeleton GameObject and disable both + /// components initially and keep them disabled during normal gameplay. When you need to start fadeout, + /// enable this component. + /// At the end of the fadeout, the event delegate OnFadeoutComplete is called, to which you can bind e.g. + /// a method that disables or destroys the entire GameObject. + /// + [RequireComponent(typeof(SkeletonRenderTexture))] + public class SkeletonRenderTextureFadeout : MonoBehaviour { + SkeletonRenderTexture skeletonRenderTexture; + + public float fadeoutSeconds = 2.0f; + protected float fadeoutSecondsRemaining; + + public delegate void FadeoutCallback (SkeletonRenderTextureFadeout skeleton); + public event FadeoutCallback OnFadeoutComplete; + + protected void Awake () { + skeletonRenderTexture = this.GetComponent(); + } + + protected void OnEnable () { + fadeoutSecondsRemaining = fadeoutSeconds; + skeletonRenderTexture.enabled = true; + } + + protected void Update () { + if (fadeoutSecondsRemaining == 0) + return; + + fadeoutSecondsRemaining -= Time.deltaTime; + if (fadeoutSecondsRemaining <= 0) { + fadeoutSecondsRemaining = 0; + if (OnFadeoutComplete != null) + OnFadeoutComplete(this); + return; + } + float fadeoutAlpha = fadeoutSecondsRemaining / fadeoutSeconds; +#if HAS_VECTOR_INT + skeletonRenderTexture.color.a = fadeoutAlpha; +#else + Debug.LogError("The SkeletonRenderTexture component requires Unity 2017.2 or newer."); +#endif + } + } +} diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTextureFadeout.cs.meta b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTextureFadeout.cs.meta new file mode 100644 index 0000000000..44a4f0d915 --- /dev/null +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTextureFadeout.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fc94f89310427643babb41e000a8462 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From f4a92fbfaea5dda00a603e58e62f6b09fad49f2b Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 11 Mar 2022 18:07:30 +0100 Subject: [PATCH 10/38] [c] Fixes #2041, adds sanitizer support via Cmake flag SPINE_SANITIZER=TRUE --- CMakeLists.txt | 20 ++++++++++++------- spine-c/spine-c/src/spine/SkeletonBinary.c | 2 +- spine-c/spine-c/src/spine/SkeletonJson.c | 16 +++++++++------ .../spine-cpp/src/spine/SkeletonJson.cpp | 4 ---- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e038894b06..6ed6cc4908 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,13 @@ cmake_minimum_required(VERSION 3.17) project(spine) +set(CMAKE_INSTALL_PREFIX "./") +set(CMAKE_VERBOSE_MAKEFILE ON) +set(SPINE_SFML FALSE CACHE BOOL FALSE) +set(SPINE_COCOS2D_OBJC FALSE CACHE BOOL FALSE) +set(SPINE_COCOS2D_X FALSE CACHE BOOL FALSE) +set(SPINE_SANITIZE FALSE CACHE BOOL FALSE) + if(MSVC) message("MSCV detected") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") @@ -8,13 +15,12 @@ if(MSVC) else() set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wunused-value -Wno-c++11-long-long -Wno-variadic-macros -Werror -Wextra -pedantic -Wnonportable-include-path -Wshadow -std=c89") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunused-value -Wno-c++11-long-long -Wno-variadic-macros -Werror -Wextra -Wnon-virtual-dtor -pedantic -Wnonportable-include-path -Wshadow -std=c++11 -fno-exceptions -fno-rtti") -endif() -set(CMAKE_INSTALL_PREFIX "./") -set(CMAKE_VERBOSE_MAKEFILE ON) -set(SPINE_SFML FALSE CACHE BOOL FALSE) -set(SPINE_COCOS2D_OBJC FALSE CACHE BOOL FALSE) -set(SPINE_COCOS2D_X FALSE CACHE BOOL FALSE) + if (${SPINE_SANITIZE}) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined") + endif() +endif() if((${SPINE_SFML}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-sfml")) add_subdirectory(spine-c) @@ -34,4 +40,4 @@ if((${SPINE_COCOS2D_X}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-cocos2dx" endif() # add_subdirectory(spine-c/spine-c-unit-tests) -add_subdirectory(spine-cpp/spine-cpp-unit-tests) \ No newline at end of file +add_subdirectory(spine-cpp/spine-cpp-unit-tests) diff --git a/spine-c/spine-c/src/spine/SkeletonBinary.c b/spine-c/spine-c/src/spine/SkeletonBinary.c index db9431c1c4..b997f9143b 100644 --- a/spine-c/spine-c/src/spine/SkeletonBinary.c +++ b/spine-c/spine-c/src/spine/SkeletonBinary.c @@ -1189,7 +1189,7 @@ spSkeletonData *spSkeletonBinary_readSkeletonData(spSkeletonBinary *self, const highHash = readInt(input); sprintf(buffer, "%x%x", highHash, lowHash); buffer[31] = 0; - skeletonData->hash = strdup(buffer); + MALLOC_STR(skeletonData->hash, buffer); skeletonData->version = readString(input); if (!strlen(skeletonData->version)) { diff --git a/spine-c/spine-c/src/spine/SkeletonJson.c b/spine-c/spine-c/src/spine/SkeletonJson.c index e6bbf63020..349c83743d 100644 --- a/spine-c/spine-c/src/spine/SkeletonJson.c +++ b/spine-c/spine-c/src/spine/SkeletonJson.c @@ -34,10 +34,6 @@ #include #include -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) -#define strdup _strdup -#endif - typedef struct { const char *parent; const char *skin; @@ -938,9 +934,17 @@ spSkeletonData *spSkeletonJson_readSkeletonData(spSkeletonJson *self, const char skeletonData->height = Json_getFloat(skeleton, "height", 0); skeletonData->fps = Json_getFloat(skeleton, "fps", 30); skeletonData->imagesPath = Json_getString(skeleton, "images", 0); - if (skeletonData->imagesPath) skeletonData->imagesPath = strdup(skeletonData->imagesPath); + if (skeletonData->imagesPath) { + char *tmp = NULL; + MALLOC_STR(tmp, skeletonData->imagesPath); + skeletonData->imagesPath = tmp; + } skeletonData->audioPath = Json_getString(skeleton, "audio", 0); - if (skeletonData->audioPath) skeletonData->audioPath = strdup(skeletonData->audioPath); + if (skeletonData->audioPath) { + char *tmp = NULL; + MALLOC_STR(tmp, skeletonData->audioPath); + skeletonData->audioPath = tmp; + } } /* Bones. */ diff --git a/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp b/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp index 6238307522..80ce30bee4 100644 --- a/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp +++ b/spine-cpp/spine-cpp/src/spine/SkeletonJson.cpp @@ -73,10 +73,6 @@ #include #include -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) -#define strdup _strdup -#endif - using namespace spine; static float toColor(const char *value, size_t index) { From 58f0bc0d0c6c0cab2171c01600dcbd30f51b458d Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Mon, 14 Mar 2022 11:23:53 +0100 Subject: [PATCH 11/38] Added promise based AssetManager.loadAll(), Skeleton.getBoundsRect() helper method. --- CHANGELOG.md | 2 + spine-ts/index.html | 1 + spine-ts/spine-canvas/example/index.html | 207 +++++------------- .../spine-canvas/example/mouse-click.html | 111 ++++++++++ spine-ts/spine-core/src/AssetManagerBase.ts | 15 ++ spine-ts/spine-core/src/Skeleton.ts | 9 + 6 files changed, 194 insertions(+), 151 deletions(-) create mode 100644 spine-ts/spine-canvas/example/mouse-click.html diff --git a/CHANGELOG.md b/CHANGELOG.md index c4a7725ad7..39acf1dbd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -634,6 +634,8 @@ * Added `MeshAttachment#newLinkedMesh()`, creates a linked mesh linkted to either the original mesh, or the parent of the original mesh. * Added IK softness. * Added `AssetManager.setRawDataURI(path, data)`. Allows to embed data URIs for skeletons, atlases and atlas page images directly in the HTML/JS without needing to load it from a separate file. + * Added `AssetManager.loadAll()` to allow Promise/async/await based waiting for completion of asset load. See the `spine-canvas` examples. + * Added `Skeleton.getBoundRect()` helper method to calculate the bouding rectangle of the current pose, returning the result as `{ x, y, width, height }`. Note that this method will create temporary objects which can add to garbage collection pressure. ### WebGL backend * `Input` can now take a partially defined implementation of `InputListener`. diff --git a/spine-ts/index.html b/spine-ts/index.html index 1d87877942..205e9416eb 100644 --- a/spine-ts/index.html +++ b/spine-ts/index.html @@ -14,6 +14,7 @@

spine-ts Examples

  • Canvas
  • Player
    • diff --git a/spine-ts/spine-canvas/example/index.html b/spine-ts/spine-canvas/example/index.html index a6b4209880..52c537d253 100644 --- a/spine-ts/spine-canvas/example/index.html +++ b/spine-ts/spine-canvas/example/index.html @@ -1,181 +1,86 @@ + - - - + + + + - - + + - \ No newline at end of file diff --git a/spine-ts/spine-canvas/example/mouse-click.html b/spine-ts/spine-canvas/example/mouse-click.html new file mode 100644 index 0000000000..a8a16f36c0 --- /dev/null +++ b/spine-ts/spine-canvas/example/mouse-click.html @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spine-ts/spine-core/src/AssetManagerBase.ts b/spine-ts/spine-core/src/AssetManagerBase.ts index deb8d6fb52..607ac9a36c 100644 --- a/spine-ts/spine-core/src/AssetManagerBase.ts +++ b/spine-ts/spine-core/src/AssetManagerBase.ts @@ -65,6 +65,21 @@ export class AssetManagerBase implements Disposable { if (callback) callback(path, message); } + loadAll () { + let promise = new Promise((resolve: (assetManager: AssetManagerBase) => void, reject: (errors: StringMap) => void) => { + let check = () => { + if (this.isLoadingComplete()) { + if (this.hasErrors()) reject(this.errors); + else resolve(this); + return; + } + requestAnimationFrame(check); + } + requestAnimationFrame(check); + }); + return promise; + } + setRawDataURI (path: string, data: string) { this.downloader.rawDataUris[this.pathPrefix + path] = data; } diff --git a/spine-ts/spine-core/src/Skeleton.ts b/spine-ts/spine-core/src/Skeleton.ts index 3be52c8f25..eca98def0e 100644 --- a/spine-ts/spine-core/src/Skeleton.ts +++ b/spine-ts/spine-core/src/Skeleton.ts @@ -585,6 +585,15 @@ export class Skeleton { return null; } + /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose as `{ x: number, y: number, width: number, height: number }`. + * Note that this method will create temporary objects which can add to garbage collection pressure. Use `getBounds()` if garbage collection is a concern. */ + getBoundsRect () { + let offset = new Vector2(); + let size = new Vector2(); + this.getBounds(offset, size); + return { x: offset.x, y: offset.y, width: size.x, height: size.y }; + } + /** Returns the axis aligned bounding box (AABB) of the region and mesh attachments for the current pose. * @param offset An output value, the distance from the skeleton origin to the bottom left corner of the AABB. * @param size An output value, the width and height of the AABB. From 3ca76acdca8d5611063ec4d9f20229a9e71da571 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Mon, 14 Mar 2022 11:25:53 +0100 Subject: [PATCH 12/38] [ts] Release 4.0.22 --- spine-ts/package-lock.json | 58 ++++++++++++++--------------- spine-ts/package.json | 2 +- spine-ts/spine-canvas/package.json | 4 +- spine-ts/spine-core/package.json | 2 +- spine-ts/spine-player/package.json | 4 +- spine-ts/spine-threejs/package.json | 4 +- spine-ts/spine-webgl/package.json | 4 +- 7 files changed, 39 insertions(+), 39 deletions(-) diff --git a/spine-ts/package-lock.json b/spine-ts/package-lock.json index 4686945170..d8eed17c16 100644 --- a/spine-ts/package-lock.json +++ b/spine-ts/package-lock.json @@ -1,12 +1,12 @@ { "name": "@esotericsoftware/spine-ts", - "version": "4.0.21", + "version": "4.0.22", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@esotericsoftware/spine-ts", - "version": "4.0.21", + "version": "4.0.22", "license": "LicenseRef-LICENSE", "workspaces": [ "spine-core", @@ -1468,21 +1468,21 @@ } }, "node_modules/mime-db": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", - "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.34", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", - "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "dependencies": { - "mime-db": "1.51.0" + "mime-db": "1.52.0" }, "engines": { "node": ">= 0.6" @@ -7951,41 +7951,41 @@ }, "spine-canvas": { "name": "@esotericsoftware/spine-canvas", - "version": "4.0.21", + "version": "4.0.22", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.21" + "@esotericsoftware/spine-core": "^4.0.22" } }, "spine-core": { "name": "@esotericsoftware/spine-core", - "version": "4.0.21", + "version": "4.0.22", "license": "LicenseRef-LICENSE" }, "spine-player": { "name": "@esotericsoftware/spine-player", - "version": "4.0.21", + "version": "4.0.22", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-webgl": "^4.0.21" + "@esotericsoftware/spine-webgl": "^4.0.22" } }, "spine-threejs": { "name": "@esotericsoftware/spine-threejs", - "version": "4.0.21", + "version": "4.0.22", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.21", + "@esotericsoftware/spine-core": "^4.0.22", "@types/three": "^0.133.1", "three": "^0.133.1" } }, "spine-webgl": { "name": "@esotericsoftware/spine-webgl", - "version": "4.0.21", + "version": "4.0.22", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.21" + "@esotericsoftware/spine-core": "^4.0.22" } } }, @@ -7993,7 +7993,7 @@ "@esotericsoftware/spine-canvas": { "version": "file:spine-canvas", "requires": { - "@esotericsoftware/spine-core": "^4.0.21" + "@esotericsoftware/spine-core": "^4.0.22" } }, "@esotericsoftware/spine-core": { @@ -8002,13 +8002,13 @@ "@esotericsoftware/spine-player": { "version": "file:spine-player", "requires": { - "@esotericsoftware/spine-webgl": "^4.0.21" + "@esotericsoftware/spine-webgl": "^4.0.22" } }, "@esotericsoftware/spine-threejs": { "version": "file:spine-threejs", "requires": { - "@esotericsoftware/spine-core": "^4.0.21", + "@esotericsoftware/spine-core": "^4.0.22", "@types/three": "^0.133.1", "three": "^0.133.1" } @@ -8016,7 +8016,7 @@ "@esotericsoftware/spine-webgl": { "version": "file:spine-webgl", "requires": { - "@esotericsoftware/spine-core": "^4.0.21" + "@esotericsoftware/spine-core": "^4.0.22" } }, "@types/offscreencanvas": { @@ -9154,18 +9154,18 @@ "dev": true }, "mime-db": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", - "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true }, "mime-types": { - "version": "2.1.34", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", - "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, "requires": { - "mime-db": "1.51.0" + "mime-db": "1.52.0" } }, "minimatch": { diff --git a/spine-ts/package.json b/spine-ts/package.json index 3a7b79cb20..f48a3a5767 100644 --- a/spine-ts/package.json +++ b/spine-ts/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-ts", - "version": "4.0.21", + "version": "4.0.22", "description": "The official Spine Runtimes for the web.", "files": [ "README.md" diff --git a/spine-ts/spine-canvas/package.json b/spine-ts/spine-canvas/package.json index 36f57770bc..257cb1e5b9 100644 --- a/spine-ts/spine-canvas/package.json +++ b/spine-ts/spine-canvas/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-canvas", - "version": "4.0.21", + "version": "4.0.22", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.21" + "@esotericsoftware/spine-core": "^4.0.22" } } \ No newline at end of file diff --git a/spine-ts/spine-core/package.json b/spine-ts/spine-core/package.json index 4a2ca99f35..6fe89b804b 100644 --- a/spine-ts/spine-core/package.json +++ b/spine-ts/spine-core/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-core", - "version": "4.0.21", + "version": "4.0.22", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/spine-ts/spine-player/package.json b/spine-ts/spine-player/package.json index e45e2e3c37..b3b5882970 100644 --- a/spine-ts/spine-player/package.json +++ b/spine-ts/spine-player/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-player", - "version": "4.0.21", + "version": "4.0.22", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-webgl": "^4.0.21" + "@esotericsoftware/spine-webgl": "^4.0.22" } } \ No newline at end of file diff --git a/spine-ts/spine-threejs/package.json b/spine-ts/spine-threejs/package.json index db0ef44589..57b12d96be 100644 --- a/spine-ts/spine-threejs/package.json +++ b/spine-ts/spine-threejs/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-threejs", - "version": "4.0.21", + "version": "4.0.22", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -32,6 +32,6 @@ "dependencies": { "@types/three": "^0.133.1", "three": "^0.133.1", - "@esotericsoftware/spine-core": "^4.0.21" + "@esotericsoftware/spine-core": "^4.0.22" } } \ No newline at end of file diff --git a/spine-ts/spine-webgl/package.json b/spine-ts/spine-webgl/package.json index caf701afbc..fb548d9af0 100644 --- a/spine-ts/spine-webgl/package.json +++ b/spine-ts/spine-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-webgl", - "version": "4.0.21", + "version": "4.0.22", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.21" + "@esotericsoftware/spine-core": "^4.0.22" } } \ No newline at end of file From 6d4b8e68bc05b7935e7ee03c36ff57f519abbf34 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Mon, 14 Mar 2022 11:29:21 +0100 Subject: [PATCH 13/38] [ts][canvas] Improve examples --- spine-ts/spine-canvas/example/index.html | 5 ++++- spine-ts/spine-canvas/example/mouse-click.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spine-ts/spine-canvas/example/index.html b/spine-ts/spine-canvas/example/index.html index 52c537d253..eac1ddce3e 100644 --- a/spine-ts/spine-canvas/example/index.html +++ b/spine-ts/spine-canvas/example/index.html @@ -6,7 +6,7 @@ - + @@ -45,6 +45,9 @@ animationStateData.defaultMix = 0.2; animationState = new spine.AnimationState(animationStateData); + // Set the run animation, looping. + animationState.setAnimation(0, "run", true); + // Start rendering. requestAnimationFrame(render); } diff --git a/spine-ts/spine-canvas/example/mouse-click.html b/spine-ts/spine-canvas/example/mouse-click.html index a8a16f36c0..56920f649a 100644 --- a/spine-ts/spine-canvas/example/mouse-click.html +++ b/spine-ts/spine-canvas/example/mouse-click.html @@ -6,7 +6,7 @@ - + From 5a32e002b864d3dea0cf1d8fb208e5399a491eb7 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 15 Mar 2022 19:17:51 +0100 Subject: [PATCH 14/38] [unity] Fixed URP lit shaders ignoring straight alpha settings during fallback to unlit. Affected SkeletonRenderTexture. Closes #2044. --- .../Spine-SkeletonLit-UnlitPass-URP-2D.hlsl | 47 +++++++++++++++++++ ...ine-SkeletonLit-UnlitPass-URP-2D.hlsl.meta | 10 ++++ .../2D/Spine-SkeletonLit-URP-2D.shader | 44 +---------------- .../Shaders/2D/Spine-Sprite-URP-2D.shader | 23 ++++++++- .../Shaders/Spine-Sprite-URP.shader | 32 ++++++++++++- 5 files changed, 112 insertions(+), 44 deletions(-) create mode 100644 spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl create mode 100644 spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl.meta diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl new file mode 100644 index 0000000000..9dc2ae9ebc --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl @@ -0,0 +1,47 @@ +#ifndef SKELETONLIT_UNLIT_PASS_INCLUDED +#define SKELETONLIT_UNLIT_PASS_INCLUDED + +struct Attributes +{ + float3 positionOS : POSITION; + float4 color : COLOR; + float2 uv : TEXCOORD0; +}; + +struct Varyings +{ + float4 positionCS : SV_POSITION; + float4 color : COLOR; + float2 uv : TEXCOORD0; +}; + +TEXTURE2D(_MainTex); +SAMPLER(sampler_MainTex); +float4 _MainTex_ST; + +Varyings UnlitVertex(Attributes attributes) +{ + Varyings o = (Varyings)0; + + o.positionCS = TransformObjectToHClip(attributes.positionOS); + o.uv = TRANSFORM_TEX(attributes.uv, _MainTex); + o.uv = attributes.uv; + o.color = attributes.color; + return o; +} + +float4 UnlitFragment(Varyings i) : SV_Target +{ + half4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); + half4 main; + #if defined(_STRAIGHT_ALPHA_INPUT) + main.rgb = tex.rgb * i.color.rgb * tex.a; + #else + main.rgb = tex.rgb * i.color.rgb; + #endif + main.a = tex.a * i.color.a; + + return main; +} + +#endif diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl.meta b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl.meta new file mode 100644 index 0000000000..aa35dcbc01 --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 580dd7e812fc63c4a9330abe519946de +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + preprocessorOverride: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-SkeletonLit-URP-2D.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-SkeletonLit-URP-2D.shader index 77d99f1d7e..d6731c66a2 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-SkeletonLit-URP-2D.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-SkeletonLit-URP-2D.shader @@ -193,52 +193,12 @@ Blend One OneMinusSrcAlpha HLSLPROGRAM + #pragma shader_feature _ _STRAIGHT_ALPHA_INPUT #pragma prefer_hlslcc gles #pragma vertex UnlitVertex #pragma fragment UnlitFragment - struct Attributes - { - float3 positionOS : POSITION; - float4 color : COLOR; - float2 uv : TEXCOORD0; - }; - - struct Varyings - { - float4 positionCS : SV_POSITION; - float4 color : COLOR; - float2 uv : TEXCOORD0; - }; - - TEXTURE2D(_MainTex); - SAMPLER(sampler_MainTex); - float4 _MainTex_ST; - - Varyings UnlitVertex(Attributes attributes) - { - Varyings o = (Varyings)0; - - o.positionCS = TransformObjectToHClip(attributes.positionOS); - o.uv = TRANSFORM_TEX(attributes.uv, _MainTex); - o.uv = attributes.uv; - o.color = attributes.color; - return o; - } - - float4 UnlitFragment(Varyings i) : SV_Target - { - half4 tex = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); - half4 main; - #if defined(_STRAIGHT_ALPHA_INPUT) - main.rgb = tex.rgb * i.color.rgb * tex.a; - #else - main.rgb = tex.rgb * i.color.rgb; - #endif - main.a = tex.a * i.color.a; - - return main; - } + #include "Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl" ENDHLSL } } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-Sprite-URP-2D.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-Sprite-URP-2D.shader index 7a50d36220..1d737398d5 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-Sprite-URP-2D.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/2D/Spine-Sprite-URP-2D.shader @@ -147,7 +147,28 @@ Shader "Universal Render Pipeline/2D/Spine/Sprite" ENDHLSL } - UsePass "Universal Render Pipeline/2D/Spine/Skeleton Lit/UNLIT" + Pass + { + Name "Unlit" + Tags { "LightMode" = "UniversalForward" "Queue" = "Transparent" "RenderType" = "Transparent"} + + ZWrite Off + Cull Off + Blend One OneMinusSrcAlpha + + HLSLPROGRAM + #pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAPREMULTIPLY_VERTEX_ONLY _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2 + #if defined(_ALPHAPREMULTIPLY_VERTEX_ONLY) || defined(_ALPHABLEND_ON) + #define _STRAIGHT_ALPHA_INPUT + #endif + + #pragma prefer_hlslcc gles + #pragma vertex UnlitVertex + #pragma fragment UnlitFragment + + #include "Include/Spine-SkeletonLit-UnlitPass-URP-2D.hlsl" + ENDHLSL + } } FallBack "Universal Render Pipeline/2D/Spine/Skeleton Lit" diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Sprite-URP.shader b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Sprite-URP.shader index 6b72b7f202..79118a0f15 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Sprite-URP.shader +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/Shaders/Spine-Sprite-URP.shader @@ -113,7 +113,7 @@ Shader "Universal Render Pipeline/Spine/Sprite" #pragma multi_compile _ DIRLIGHTMAP_COMBINED #pragma multi_compile _ LIGHTMAP_ON - //-------------------------------------- + //-------------------------------------- // GPU Instancing #pragma multi_compile_instancing @@ -202,6 +202,36 @@ Shader "Universal Render Pipeline/Spine/Sprite" #include "Include/Spine-Sprite-DepthOnlyPass-URP.hlsl" ENDHLSL } + + Pass + { + Name "Unlit" + Tags { "LightMode" = "UniversalForward" "Queue" = "Transparent" "RenderType" = "Transparent"} + + ZWrite Off + Cull Off + Blend One OneMinusSrcAlpha + + HLSLPROGRAM + #pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ALPHAPREMULTIPLY_VERTEX_ONLY _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2 + #if defined(_ALPHAPREMULTIPLY_VERTEX_ONLY) || defined(_ALPHABLEND_ON) + #define _STRAIGHT_ALPHA_INPUT + #endif + + #pragma prefer_hlslcc gles + #pragma vertex vert + #pragma fragment frag + + #undef LIGHTMAP_ON + + #define USE_URP + #define fixed4 half4 + #define fixed3 half3 + #define fixed half + #include "Include/Spine-Input-URP.hlsl" + #include "Include/Spine-Skeleton-ForwardPass-URP.hlsl" + ENDHLSL + } } FallBack "Hidden/InternalErrorShader" From dbabe96e6c4a0161dc728f3de8d982e20324db3f Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 15 Mar 2022 19:21:46 +0100 Subject: [PATCH 15/38] [unity] Increased package.json version number of URP shaders UPM package. --- .../Modules/com.esotericsoftware.spine.urp-shaders/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json index ae33b43fa0..f9e4aa320d 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json +++ b/spine-unity/Modules/com.esotericsoftware.spine.urp-shaders/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.urp-shaders", "displayName": "Spine Universal RP Shaders", "description": "This plugin provides universal render pipeline (URP) shaders for the spine-unity runtime.\n\nPrerequisites:\nIt requires a working installation of the spine-unity runtime, version 4.0.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)", - "version": "4.0.6", + "version": "4.0.7", "unity": "2019.3", "author": { "name": "Esoteric Software", From e436d873fa4d671253cd2f864583a53849e4904d Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 16 Mar 2022 23:48:47 +0100 Subject: [PATCH 16/38] [ts][webgl] Fix drag-and-drop.js not setting animation. --- spine-ts/spine-webgl/example/drag-and-drop.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spine-ts/spine-webgl/example/drag-and-drop.js b/spine-ts/spine-webgl/example/drag-and-drop.js index f7b5eebea2..9b38c87848 100644 --- a/spine-ts/spine-webgl/example/drag-and-drop.js +++ b/spine-ts/spine-webgl/example/drag-and-drop.js @@ -21,7 +21,7 @@ class App { // Setup listener for animation selection box let animationSelectBox = document.body.querySelector("#animations"); animationSelectBox.onchange = () => { - // this.animationState.setAnimation(0, animationSelectBox.value, true); + this.animationState.setAnimation(0, animationSelectBox.value, true); } // Setup listener for the PMA checkbox @@ -123,8 +123,7 @@ class App { option.selected = animation.name == animationName; animationSelectBox.appendChild(option); } - - // if (animationName) this.animationState.setAnimation(0, animationName, true); + this.animationState.setAnimation(0, animationName, true); // Center the skeleton in the viewport this.centerSkeleton(); From c14cef967f22240ae8cd627aa80a09c0bb68b87e Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 17 Mar 2022 00:07:46 +0100 Subject: [PATCH 17/38] [ts][threejs] Clipping not properly ended for all code paths. --- spine-ts/spine-threejs/src/SkeletonMesh.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spine-ts/spine-threejs/src/SkeletonMesh.ts b/spine-ts/spine-threejs/src/SkeletonMesh.ts index f004315bb9..46927fd2e7 100644 --- a/spine-ts/spine-threejs/src/SkeletonMesh.ts +++ b/spine-ts/spine-threejs/src/SkeletonMesh.ts @@ -173,7 +173,10 @@ export class SkeletonMesh extends THREE.Object3D { for (let i = 0, n = drawOrder.length; i < n; i++) { let vertexSize = clipper.isClipping() ? 2 : SkeletonMesh.VERTEX_SIZE; let slot = drawOrder[i]; - if (!slot.bone.active) continue; + if (!slot.bone.active) { + clipper.clipEndWithSlot(slot); + continue; + } let attachment = slot.getAttachment(); let attachmentColor: Color = null; let texture: ThreeJsTexture = null; @@ -290,8 +293,10 @@ export class SkeletonMesh extends THREE.Object3D { finalIndicesLength = triangles.length; } - if (finalVerticesLength == 0 || finalIndicesLength == 0) + if (finalVerticesLength == 0 || finalIndicesLength == 0) { + clipper.clipEndWithSlot(slot); continue; + } // Start new batch if this one can't hold vertices/indices if (!batch.canBatch(finalVerticesLength, finalIndicesLength)) { From 4df4bcfb760a2fad81530ef8ac10cb25cfade9be Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 17 Mar 2022 00:09:41 +0100 Subject: [PATCH 18/38] [ts] 4.0.23 release. --- spine-ts/package-lock.json | 30 ++++++++++++++--------------- spine-ts/package.json | 2 +- spine-ts/spine-canvas/package.json | 4 ++-- spine-ts/spine-core/package.json | 2 +- spine-ts/spine-player/package.json | 4 ++-- spine-ts/spine-threejs/package.json | 4 ++-- spine-ts/spine-webgl/package.json | 4 ++-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/spine-ts/package-lock.json b/spine-ts/package-lock.json index d8eed17c16..9f52e01a06 100644 --- a/spine-ts/package-lock.json +++ b/spine-ts/package-lock.json @@ -1,12 +1,12 @@ { "name": "@esotericsoftware/spine-ts", - "version": "4.0.22", + "version": "4.0.23", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@esotericsoftware/spine-ts", - "version": "4.0.22", + "version": "4.0.23", "license": "LicenseRef-LICENSE", "workspaces": [ "spine-core", @@ -7951,41 +7951,41 @@ }, "spine-canvas": { "name": "@esotericsoftware/spine-canvas", - "version": "4.0.22", + "version": "4.0.23", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.22" + "@esotericsoftware/spine-core": "^4.0.23" } }, "spine-core": { "name": "@esotericsoftware/spine-core", - "version": "4.0.22", + "version": "4.0.23", "license": "LicenseRef-LICENSE" }, "spine-player": { "name": "@esotericsoftware/spine-player", - "version": "4.0.22", + "version": "4.0.23", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-webgl": "^4.0.22" + "@esotericsoftware/spine-webgl": "^4.0.23" } }, "spine-threejs": { "name": "@esotericsoftware/spine-threejs", - "version": "4.0.22", + "version": "4.0.23", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.22", + "@esotericsoftware/spine-core": "^4.0.23", "@types/three": "^0.133.1", "three": "^0.133.1" } }, "spine-webgl": { "name": "@esotericsoftware/spine-webgl", - "version": "4.0.22", + "version": "4.0.23", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.22" + "@esotericsoftware/spine-core": "^4.0.23" } } }, @@ -7993,7 +7993,7 @@ "@esotericsoftware/spine-canvas": { "version": "file:spine-canvas", "requires": { - "@esotericsoftware/spine-core": "^4.0.22" + "@esotericsoftware/spine-core": "^4.0.23" } }, "@esotericsoftware/spine-core": { @@ -8002,13 +8002,13 @@ "@esotericsoftware/spine-player": { "version": "file:spine-player", "requires": { - "@esotericsoftware/spine-webgl": "^4.0.22" + "@esotericsoftware/spine-webgl": "^4.0.23" } }, "@esotericsoftware/spine-threejs": { "version": "file:spine-threejs", "requires": { - "@esotericsoftware/spine-core": "^4.0.22", + "@esotericsoftware/spine-core": "^4.0.23", "@types/three": "^0.133.1", "three": "^0.133.1" } @@ -8016,7 +8016,7 @@ "@esotericsoftware/spine-webgl": { "version": "file:spine-webgl", "requires": { - "@esotericsoftware/spine-core": "^4.0.22" + "@esotericsoftware/spine-core": "^4.0.23" } }, "@types/offscreencanvas": { diff --git a/spine-ts/package.json b/spine-ts/package.json index f48a3a5767..ca152a5afe 100644 --- a/spine-ts/package.json +++ b/spine-ts/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-ts", - "version": "4.0.22", + "version": "4.0.23", "description": "The official Spine Runtimes for the web.", "files": [ "README.md" diff --git a/spine-ts/spine-canvas/package.json b/spine-ts/spine-canvas/package.json index 257cb1e5b9..55bec6035b 100644 --- a/spine-ts/spine-canvas/package.json +++ b/spine-ts/spine-canvas/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-canvas", - "version": "4.0.22", + "version": "4.0.23", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.22" + "@esotericsoftware/spine-core": "^4.0.23" } } \ No newline at end of file diff --git a/spine-ts/spine-core/package.json b/spine-ts/spine-core/package.json index 6fe89b804b..097d390428 100644 --- a/spine-ts/spine-core/package.json +++ b/spine-ts/spine-core/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-core", - "version": "4.0.22", + "version": "4.0.23", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/spine-ts/spine-player/package.json b/spine-ts/spine-player/package.json index b3b5882970..efd384e347 100644 --- a/spine-ts/spine-player/package.json +++ b/spine-ts/spine-player/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-player", - "version": "4.0.22", + "version": "4.0.23", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-webgl": "^4.0.22" + "@esotericsoftware/spine-webgl": "^4.0.23" } } \ No newline at end of file diff --git a/spine-ts/spine-threejs/package.json b/spine-ts/spine-threejs/package.json index 57b12d96be..cbc7387d51 100644 --- a/spine-ts/spine-threejs/package.json +++ b/spine-ts/spine-threejs/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-threejs", - "version": "4.0.22", + "version": "4.0.23", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -32,6 +32,6 @@ "dependencies": { "@types/three": "^0.133.1", "three": "^0.133.1", - "@esotericsoftware/spine-core": "^4.0.22" + "@esotericsoftware/spine-core": "^4.0.23" } } \ No newline at end of file diff --git a/spine-ts/spine-webgl/package.json b/spine-ts/spine-webgl/package.json index fb548d9af0..7cee493b8a 100644 --- a/spine-ts/spine-webgl/package.json +++ b/spine-ts/spine-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-webgl", - "version": "4.0.22", + "version": "4.0.23", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.22" + "@esotericsoftware/spine-core": "^4.0.23" } } \ No newline at end of file From dd7a6511444f1e1f818f7e3339ff79a44a8f0e2d Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 17 Mar 2022 11:48:32 +0100 Subject: [PATCH 19/38] [ts][threejs] Allow passing material customizer to SkeletonMesh. --- spine-ts/spine-threejs/example/index.html | 3 ++- spine-ts/spine-threejs/src/SkeletonMesh.ts | 8 +++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/spine-ts/spine-threejs/example/index.html b/spine-ts/spine-threejs/example/index.html index ca632b15d4..fdeda06d36 100644 --- a/spine-ts/spine-threejs/example/index.html +++ b/spine-ts/spine-threejs/example/index.html @@ -81,8 +81,9 @@ var skeletonData = skeletonJson.readSkeletonData(assetManager.require(skeletonFile)); // Create a SkeletonMesh from the data and attach it to the scene - skeletonMesh = new spine.SkeletonMesh(skeletonData, function (parameters) { + skeletonMesh = new spine.SkeletonMesh(skeletonData, (parameters) => { parameters.depthTest = false; + parameters.alphaTest = 0.5; }); skeletonMesh.state.setAnimation(0, animation, true); mesh.add(skeletonMesh); diff --git a/spine-ts/spine-threejs/src/SkeletonMesh.ts b/spine-ts/spine-threejs/src/SkeletonMesh.ts index 46927fd2e7..3d4eb5903e 100644 --- a/spine-ts/spine-threejs/src/SkeletonMesh.ts +++ b/spine-ts/spine-threejs/src/SkeletonMesh.ts @@ -32,9 +32,7 @@ import { MeshBatcher } from "./MeshBatcher"; import * as THREE from "three"; import { ThreeJsTexture } from "./ThreeJsTexture"; -export interface SkeletonMeshMaterialParametersCustomizer { - (materialParameters: THREE.ShaderMaterialParameters): void; -} +export type SkeletonMeshMaterialParametersCustomizer = (materialParameters: THREE.ShaderMaterialParameters) => void; export class SkeletonMeshMaterial extends THREE.ShaderMaterial { constructor (customizer: SkeletonMeshMaterialParametersCustomizer) { @@ -103,7 +101,7 @@ export class SkeletonMesh extends THREE.Object3D { private vertices = Utils.newFloatArray(1024); private tempColor = new Color(); - constructor (skeletonData: SkeletonData) { + constructor (skeletonData: SkeletonData, private materialCustomerizer: SkeletonMeshMaterialParametersCustomizer = (material) => { }) { super(); this.skeleton = new Skeleton(skeletonData); @@ -138,7 +136,7 @@ export class SkeletonMesh extends THREE.Object3D { private nextBatch () { if (this.batches.length == this.nextBatchIndex) { - let batch = new MeshBatcher(); + let batch = new MeshBatcher(10920, this.materialCustomerizer); this.add(batch); this.batches.push(batch); } From b23ff3b216af1eb684644f41159636b059f9f117 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 17 Mar 2022 11:54:09 +0100 Subject: [PATCH 20/38] [ts] 4.0.24 release. --- spine-ts/package-lock.json | 30 ++++++++++++++--------------- spine-ts/package.json | 2 +- spine-ts/spine-canvas/package.json | 4 ++-- spine-ts/spine-core/package.json | 2 +- spine-ts/spine-player/package.json | 4 ++-- spine-ts/spine-threejs/package.json | 4 ++-- spine-ts/spine-webgl/package.json | 4 ++-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/spine-ts/package-lock.json b/spine-ts/package-lock.json index 9f52e01a06..f6c616669d 100644 --- a/spine-ts/package-lock.json +++ b/spine-ts/package-lock.json @@ -1,12 +1,12 @@ { "name": "@esotericsoftware/spine-ts", - "version": "4.0.23", + "version": "4.0.24", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@esotericsoftware/spine-ts", - "version": "4.0.23", + "version": "4.0.24", "license": "LicenseRef-LICENSE", "workspaces": [ "spine-core", @@ -7951,41 +7951,41 @@ }, "spine-canvas": { "name": "@esotericsoftware/spine-canvas", - "version": "4.0.23", + "version": "4.0.24", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.23" + "@esotericsoftware/spine-core": "^4.0.24" } }, "spine-core": { "name": "@esotericsoftware/spine-core", - "version": "4.0.23", + "version": "4.0.24", "license": "LicenseRef-LICENSE" }, "spine-player": { "name": "@esotericsoftware/spine-player", - "version": "4.0.23", + "version": "4.0.24", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-webgl": "^4.0.23" + "@esotericsoftware/spine-webgl": "^4.0.24" } }, "spine-threejs": { "name": "@esotericsoftware/spine-threejs", - "version": "4.0.23", + "version": "4.0.24", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.23", + "@esotericsoftware/spine-core": "^4.0.24", "@types/three": "^0.133.1", "three": "^0.133.1" } }, "spine-webgl": { "name": "@esotericsoftware/spine-webgl", - "version": "4.0.23", + "version": "4.0.24", "license": "LicenseRef-LICENSE", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.23" + "@esotericsoftware/spine-core": "^4.0.24" } } }, @@ -7993,7 +7993,7 @@ "@esotericsoftware/spine-canvas": { "version": "file:spine-canvas", "requires": { - "@esotericsoftware/spine-core": "^4.0.23" + "@esotericsoftware/spine-core": "^4.0.24" } }, "@esotericsoftware/spine-core": { @@ -8002,13 +8002,13 @@ "@esotericsoftware/spine-player": { "version": "file:spine-player", "requires": { - "@esotericsoftware/spine-webgl": "^4.0.23" + "@esotericsoftware/spine-webgl": "^4.0.24" } }, "@esotericsoftware/spine-threejs": { "version": "file:spine-threejs", "requires": { - "@esotericsoftware/spine-core": "^4.0.23", + "@esotericsoftware/spine-core": "^4.0.24", "@types/three": "^0.133.1", "three": "^0.133.1" } @@ -8016,7 +8016,7 @@ "@esotericsoftware/spine-webgl": { "version": "file:spine-webgl", "requires": { - "@esotericsoftware/spine-core": "^4.0.23" + "@esotericsoftware/spine-core": "^4.0.24" } }, "@types/offscreencanvas": { diff --git a/spine-ts/package.json b/spine-ts/package.json index ca152a5afe..fd468f0c36 100644 --- a/spine-ts/package.json +++ b/spine-ts/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-ts", - "version": "4.0.23", + "version": "4.0.24", "description": "The official Spine Runtimes for the web.", "files": [ "README.md" diff --git a/spine-ts/spine-canvas/package.json b/spine-ts/spine-canvas/package.json index 55bec6035b..2dd386a1ae 100644 --- a/spine-ts/spine-canvas/package.json +++ b/spine-ts/spine-canvas/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-canvas", - "version": "4.0.23", + "version": "4.0.24", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.23" + "@esotericsoftware/spine-core": "^4.0.24" } } \ No newline at end of file diff --git a/spine-ts/spine-core/package.json b/spine-ts/spine-core/package.json index 097d390428..996c9f98c8 100644 --- a/spine-ts/spine-core/package.json +++ b/spine-ts/spine-core/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-core", - "version": "4.0.23", + "version": "4.0.24", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/spine-ts/spine-player/package.json b/spine-ts/spine-player/package.json index efd384e347..05fa16f003 100644 --- a/spine-ts/spine-player/package.json +++ b/spine-ts/spine-player/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-player", - "version": "4.0.23", + "version": "4.0.24", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-webgl": "^4.0.23" + "@esotericsoftware/spine-webgl": "^4.0.24" } } \ No newline at end of file diff --git a/spine-ts/spine-threejs/package.json b/spine-ts/spine-threejs/package.json index cbc7387d51..6b38c2e99d 100644 --- a/spine-ts/spine-threejs/package.json +++ b/spine-ts/spine-threejs/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-threejs", - "version": "4.0.23", + "version": "4.0.24", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -32,6 +32,6 @@ "dependencies": { "@types/three": "^0.133.1", "three": "^0.133.1", - "@esotericsoftware/spine-core": "^4.0.23" + "@esotericsoftware/spine-core": "^4.0.24" } } \ No newline at end of file diff --git a/spine-ts/spine-webgl/package.json b/spine-ts/spine-webgl/package.json index 7cee493b8a..75878e9f38 100644 --- a/spine-ts/spine-webgl/package.json +++ b/spine-ts/spine-webgl/package.json @@ -1,6 +1,6 @@ { "name": "@esotericsoftware/spine-webgl", - "version": "4.0.23", + "version": "4.0.24", "description": "The official Spine Runtimes for the web.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -30,6 +30,6 @@ }, "homepage": "https://github.com/esotericsoftware/spine-runtimes#readme", "dependencies": { - "@esotericsoftware/spine-core": "^4.0.23" + "@esotericsoftware/spine-core": "^4.0.24" } } \ No newline at end of file From ec539646036859cf49fad7c5c402f7a7a7af778e Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 18 Mar 2022 15:43:51 +0100 Subject: [PATCH 21/38] [unity] Hopefully fixed some occurrances of a build crash when building many prefabs and textures. See #2047. --- .../Editor/Utility/SpineBuildProcessor.cs | 101 +++++++++++------- .../Asset Types/SpineAtlasAsset.cs | 5 + .../Components/SkeletonAnimation.cs | 4 + .../spine-unity/Components/SkeletonGraphic.cs | 12 ++- .../spine-unity/Components/SkeletonMecanim.cs | 10 +- .../Components/SkeletonRenderer.cs | 5 +- .../spine-unity/Utility/BuildUtilities.cs | 42 ++++++++ .../Utility/BuildUtilities.cs.meta | 11 ++ 8 files changed, 140 insertions(+), 50 deletions(-) create mode 100644 spine-unity/Assets/Spine/Runtime/spine-unity/Utility/BuildUtilities.cs create mode 100644 spine-unity/Assets/Spine/Runtime/spine-unity/Utility/BuildUtilities.cs.meta diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineBuildProcessor.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineBuildProcessor.cs index b42b45f884..6b994b4cda 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineBuildProcessor.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/SpineBuildProcessor.cs @@ -71,62 +71,83 @@ public class SpineBuildProcessor { #if HAS_ON_POSTPROCESS_PREFAB internal static void PreprocessSpinePrefabMeshes () { - AssetDatabase.StartAssetEditing(); - prefabsToRestore.Clear(); - var prefabAssets = AssetDatabase.FindAssets("t:Prefab"); - foreach (var asset in prefabAssets) { - string assetPath = AssetDatabase.GUIDToAssetPath(asset); - GameObject prefabGameObject = AssetDatabase.LoadAssetAtPath(assetPath); - if (SpineEditorUtilities.CleanupSpinePrefabMesh(prefabGameObject)) { - prefabsToRestore.Add(assetPath); + BuildUtilities.IsInSkeletonAssetBuildPreProcessing = true; + try { + AssetDatabase.StartAssetEditing(); + prefabsToRestore.Clear(); + var prefabAssets = AssetDatabase.FindAssets("t:Prefab"); + foreach (var asset in prefabAssets) { + string assetPath = AssetDatabase.GUIDToAssetPath(asset); + GameObject prefabGameObject = AssetDatabase.LoadAssetAtPath(assetPath); + if (SpineEditorUtilities.CleanupSpinePrefabMesh(prefabGameObject)) { + prefabsToRestore.Add(assetPath); + } + EditorUtility.UnloadUnusedAssetsImmediate(); } - EditorUtility.UnloadUnusedAssetsImmediate(); + AssetDatabase.StopAssetEditing(); + if (prefabAssets.Length > 0) + AssetDatabase.SaveAssets(); + } finally { + BuildUtilities.IsInSkeletonAssetBuildPreProcessing = false; } - AssetDatabase.StopAssetEditing(); - if (prefabAssets.Length > 0) - AssetDatabase.SaveAssets(); } internal static void PostprocessSpinePrefabMeshes () { - foreach (string assetPath in prefabsToRestore) { - GameObject g = AssetDatabase.LoadAssetAtPath(assetPath); - SpineEditorUtilities.SetupSpinePrefabMesh(g, null); + BuildUtilities.IsInSkeletonAssetBuildPostProcessing = true; + try { + foreach (string assetPath in prefabsToRestore) { + GameObject g = AssetDatabase.LoadAssetAtPath(assetPath); + SpineEditorUtilities.SetupSpinePrefabMesh(g, null); + } + if (prefabsToRestore.Count > 0) + AssetDatabase.SaveAssets(); + prefabsToRestore.Clear(); + + } finally { + BuildUtilities.IsInSkeletonAssetBuildPostProcessing = false; } - if (prefabsToRestore.Count > 0) - AssetDatabase.SaveAssets(); - prefabsToRestore.Clear(); } #endif internal static void PreprocessSpriteAtlases () { - AssetDatabase.StartAssetEditing(); - spriteAtlasTexturesToRestore.Clear(); - var spriteAtlasAssets = AssetDatabase.FindAssets("t:SpineSpriteAtlasAsset"); - foreach (var asset in spriteAtlasAssets) { - string assetPath = AssetDatabase.GUIDToAssetPath(asset); - SpineSpriteAtlasAsset atlasAsset = AssetDatabase.LoadAssetAtPath(assetPath); - if (atlasAsset && atlasAsset.materials.Length > 0) { - spriteAtlasTexturesToRestore[assetPath] = AssetDatabase.GetAssetPath(atlasAsset.materials[0].mainTexture); - atlasAsset.materials[0].mainTexture = null; + BuildUtilities.IsInSpriteAtlasBuildPreProcessing = true; + try { + AssetDatabase.StartAssetEditing(); + spriteAtlasTexturesToRestore.Clear(); + var spriteAtlasAssets = AssetDatabase.FindAssets("t:SpineSpriteAtlasAsset"); + foreach (var asset in spriteAtlasAssets) { + string assetPath = AssetDatabase.GUIDToAssetPath(asset); + SpineSpriteAtlasAsset atlasAsset = AssetDatabase.LoadAssetAtPath(assetPath); + if (atlasAsset && atlasAsset.materials.Length > 0) { + spriteAtlasTexturesToRestore[assetPath] = AssetDatabase.GetAssetPath(atlasAsset.materials[0].mainTexture); + atlasAsset.materials[0].mainTexture = null; + } + EditorUtility.UnloadUnusedAssetsImmediate(); } - EditorUtility.UnloadUnusedAssetsImmediate(); + AssetDatabase.StopAssetEditing(); + if (spriteAtlasAssets.Length > 0) + AssetDatabase.SaveAssets(); + } finally { + BuildUtilities.IsInSpriteAtlasBuildPreProcessing = false; } - AssetDatabase.StopAssetEditing(); - if (spriteAtlasAssets.Length > 0) - AssetDatabase.SaveAssets(); } internal static void PostprocessSpriteAtlases () { - foreach (var pair in spriteAtlasTexturesToRestore) { - string assetPath = pair.Key; - SpineSpriteAtlasAsset atlasAsset = AssetDatabase.LoadAssetAtPath(assetPath); - if (atlasAsset && atlasAsset.materials.Length > 0) { - Texture atlasTexture = AssetDatabase.LoadAssetAtPath(pair.Value); - atlasAsset.materials[0].mainTexture = atlasTexture; + BuildUtilities.IsInSpriteAtlasBuildPostProcessing = true; + try { + foreach (var pair in spriteAtlasTexturesToRestore) { + string assetPath = pair.Key; + SpineSpriteAtlasAsset atlasAsset = AssetDatabase.LoadAssetAtPath(assetPath); + if (atlasAsset && atlasAsset.materials.Length > 0) { + Texture atlasTexture = AssetDatabase.LoadAssetAtPath(pair.Value); + atlasAsset.materials[0].mainTexture = atlasTexture; + } } + if (spriteAtlasTexturesToRestore.Count > 0) + AssetDatabase.SaveAssets(); + spriteAtlasTexturesToRestore.Clear(); + } finally { + BuildUtilities.IsInSpriteAtlasBuildPostProcessing = false; } - if (spriteAtlasTexturesToRestore.Count > 0) - AssetDatabase.SaveAssets(); - spriteAtlasTexturesToRestore.Clear(); } } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SpineAtlasAsset.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SpineAtlasAsset.cs index 41354b9575..6afda5abae 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SpineAtlasAsset.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Asset Types/SpineAtlasAsset.cs @@ -238,6 +238,11 @@ public class MaterialsTextureLoader : TextureLoader { } public void Load (AtlasPage page, string path) { +#if UNITY_EDITOR + if (BuildUtilities.IsInSkeletonAssetBuildPreProcessing || + BuildUtilities.IsInSkeletonAssetBuildPostProcessing) + return; +#endif String name = Path.GetFileNameWithoutExtension(path); Material material = null; foreach (Material other in atlasAsset.materials) { diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs index e607460087..54467ea67f 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs @@ -166,6 +166,10 @@ public class SkeletonAnimation : SkeletonRenderer, ISkeletonAnimation, IAnimatio public override void Initialize (bool overwrite, bool quiet = false) { if (valid && !overwrite) return; +#if UNITY_EDITOR + if (BuildUtilities.IsInSkeletonAssetBuildPreProcessing) + return; +#endif base.Initialize(overwrite, quiet); if (!valid) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index e796cd3de9..96f35d3a2b 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -102,7 +102,7 @@ public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationSt #if UNITY_EDITOR protected override void OnValidate () { // This handles Scene View preview. - base.OnValidate (); + base.OnValidate(); if (this.IsValid) { if (skeletonDataAsset == null) { Clear(); @@ -360,8 +360,7 @@ public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationSt separatorSlots.Add(slot); } #if UNITY_EDITOR - else - { + else { Debug.LogWarning(slotName + " is not a slot in " + skeletonDataAsset.skeletonJSON.name); } #endif @@ -521,7 +520,10 @@ public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationSt public void Initialize (bool overwrite) { if (this.IsValid && !overwrite) return; - +#if UNITY_EDITOR + if (BuildUtilities.IsInSkeletonAssetBuildPreProcessing) + return; +#endif if (this.skeletonDataAsset == null) return; var skeletonData = this.skeletonDataAsset.GetSkeletonData(false); if (skeletonData == null) return; @@ -839,7 +841,7 @@ public class SkeletonGraphic : MaskableGraphic, ISkeletonComponent, IAnimationSt #if UNITY_EDITOR if (Application.isEditor && !Application.isPlaying) { - for (int i = separatorParts.Count-1; i >= 0; --i) { + for (int i = separatorParts.Count - 1; i >= 0; --i) { if (separatorParts[i] == null) { separatorParts.RemoveAt(i); } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs index c32f0fa558..c58d0abc5b 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs @@ -72,7 +72,10 @@ public class SkeletonMecanim : SkeletonRenderer, ISkeletonAnimation { public override void Initialize (bool overwrite, bool quiet = false) { if (valid && !overwrite) return; - +#if UNITY_EDITOR + if (BuildUtilities.IsInSkeletonAssetBuildPreProcessing) + return; +#endif base.Initialize(overwrite, quiet); if (!valid) @@ -104,8 +107,7 @@ public class SkeletonMecanim : SkeletonRenderer, ISkeletonAnimation { if (Application.isPlaying) { translator.Apply(skeleton); - } - else { + } else { if (translatorAnimator != null && translatorAnimator.isInitialized && translatorAnimator.isActiveAndEnabled && translatorAnimator.runtimeAnimatorController != null) { // Note: Rebind is required to prevent warning "Animator is not playing an AnimatorController" with prefabs @@ -535,7 +537,7 @@ protected class ClipInfos { } #if UNITY_EDITOR - void GetLayerBlendModes() { + void GetLayerBlendModes () { if (layerBlendModes.Length < animator.layerCount) { System.Array.Resize(ref layerBlendModes, animator.layerCount); } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs index 730bd7f671..63617cd790 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonRenderer.cs @@ -367,7 +367,10 @@ public class SpriteMaskInteractionMaterials { public virtual void Initialize (bool overwrite, bool quiet = false) { if (valid && !overwrite) return; - +#if UNITY_EDITOR + if (BuildUtilities.IsInSkeletonAssetBuildPreProcessing) + return; +#endif // Clear { // Note: do not reset meshFilter.sharedMesh or meshRenderer.sharedMaterial to null, diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/BuildUtilities.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/BuildUtilities.cs new file mode 100644 index 0000000000..0d3c1b408b --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/BuildUtilities.cs @@ -0,0 +1,42 @@ +/****************************************************************************** + * Spine Runtimes License Agreement + * Last updated January 1, 2020. Replaces all prior versions. + * + * Copyright (c) 2013-2022, Esoteric Software LLC + * + * Integration of the Spine Runtimes into software or otherwise creating + * derivative works of the Spine Runtimes is permitted under the terms and + * conditions of Section 2 of the Spine Editor License Agreement: + * http://esotericsoftware.com/spine-editor-license + * + * Otherwise, it is permitted to integrate the Spine Runtimes into software + * or otherwise create derivative works of the Spine Runtimes (collectively, + * "Products"), provided that each user of the Products must obtain their own + * Spine Editor license and redistribution of the Products in any form must + * include this license and copyright notice. + * + * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, + * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + *****************************************************************************/ + +#if UNITY_EDITOR + +namespace Spine.Unity { + + public static class BuildUtilities { + public static bool IsInSkeletonAssetBuildPreProcessing = false; + public static bool IsInSkeletonAssetBuildPostProcessing = false; + public static bool IsInSpriteAtlasBuildPreProcessing = false; + public static bool IsInSpriteAtlasBuildPostProcessing = false; + } +} + +#endif diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/BuildUtilities.cs.meta b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/BuildUtilities.cs.meta new file mode 100644 index 0000000000..074be476c4 --- /dev/null +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/BuildUtilities.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a2f1169aaf0063f4da1c2b6033bbc13f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 5365d661b68b608db0459736542ef6a80a3a8fb4 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Mon, 21 Mar 2022 19:26:29 +0100 Subject: [PATCH 22/38] [ts][threejs] Update to latest THREE, fix shader compilation error in THREE 138. --- spine-ts/package-lock.json | 32 +++++++++++----------- spine-ts/spine-threejs/example/index.html | 2 +- spine-ts/spine-threejs/package.json | 4 +-- spine-ts/spine-threejs/src/SkeletonMesh.ts | 6 ++-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/spine-ts/package-lock.json b/spine-ts/package-lock.json index f6c616669d..d25c26233b 100644 --- a/spine-ts/package-lock.json +++ b/spine-ts/package-lock.json @@ -53,9 +53,9 @@ "dev": true }, "node_modules/@types/three": { - "version": "0.133.1", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.133.1.tgz", - "integrity": "sha512-XqBrP/+kbs+o0CYRhCVVE95v7FaL2bO5Z7+3VQJE0nEyjo+9LoLfeNgZITOnndKHxM+7ltEciAIR7uE0SZlsOg==" + "version": "0.138.0", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.138.0.tgz", + "integrity": "sha512-D8AoV7h2kbCfrv/DcebHOFh1WDwyus3HdooBkAwcBikXArdqnsQ38PQ85JCunnvun160oA9jz53GszF3zch3tg==" }, "node_modules/accepts": { "version": "1.3.8", @@ -7553,9 +7553,9 @@ } }, "node_modules/three": { - "version": "0.133.1", - "resolved": "https://registry.npmjs.org/three/-/three-0.133.1.tgz", - "integrity": "sha512-WydohO8ll949B0FTD6MGz59Yv2Lwj8hvObg/0Heh2r42S6+tQC1WByfCNRdmG4D7+odfGod+n8JPV1I2xrboWw==" + "version": "0.138.3", + "resolved": "https://registry.npmjs.org/three/-/three-0.138.3.tgz", + "integrity": "sha512-4t1cKC8gimNyJChJbaklg8W/qj3PpsLJUIFm5LIuAy/hVxxNm1ru2FGTSfbTSsuHmC/7ipsyuGKqrSAKLNtkzg==" }, "node_modules/through": { "version": "2.3.8", @@ -7976,8 +7976,8 @@ "license": "LicenseRef-LICENSE", "dependencies": { "@esotericsoftware/spine-core": "^4.0.24", - "@types/three": "^0.133.1", - "three": "^0.133.1" + "@types/three": "^0.138.0", + "three": "^0.138.3" } }, "spine-webgl": { @@ -8009,8 +8009,8 @@ "version": "file:spine-threejs", "requires": { "@esotericsoftware/spine-core": "^4.0.24", - "@types/three": "^0.133.1", - "three": "^0.133.1" + "@types/three": "^0.138.0", + "three": "^0.138.3" } }, "@esotericsoftware/spine-webgl": { @@ -8026,9 +8026,9 @@ "dev": true }, "@types/three": { - "version": "0.133.1", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.133.1.tgz", - "integrity": "sha512-XqBrP/+kbs+o0CYRhCVVE95v7FaL2bO5Z7+3VQJE0nEyjo+9LoLfeNgZITOnndKHxM+7ltEciAIR7uE0SZlsOg==" + "version": "0.138.0", + "resolved": "https://registry.npmjs.org/@types/three/-/three-0.138.0.tgz", + "integrity": "sha512-D8AoV7h2kbCfrv/DcebHOFh1WDwyus3HdooBkAwcBikXArdqnsQ38PQ85JCunnvun160oA9jz53GszF3zch3tg==" }, "accepts": { "version": "1.3.8", @@ -13938,9 +13938,9 @@ } }, "three": { - "version": "0.133.1", - "resolved": "https://registry.npmjs.org/three/-/three-0.133.1.tgz", - "integrity": "sha512-WydohO8ll949B0FTD6MGz59Yv2Lwj8hvObg/0Heh2r42S6+tQC1WByfCNRdmG4D7+odfGod+n8JPV1I2xrboWw==" + "version": "0.138.3", + "resolved": "https://registry.npmjs.org/three/-/three-0.138.3.tgz", + "integrity": "sha512-4t1cKC8gimNyJChJbaklg8W/qj3PpsLJUIFm5LIuAy/hVxxNm1ru2FGTSfbTSsuHmC/7ipsyuGKqrSAKLNtkzg==" }, "through": { "version": "2.3.8", diff --git a/spine-ts/spine-threejs/example/index.html b/spine-ts/spine-threejs/example/index.html index fdeda06d36..f63dd8ac33 100644 --- a/spine-ts/spine-threejs/example/index.html +++ b/spine-ts/spine-threejs/example/index.html @@ -3,7 +3,7 @@ spine-threejs - +