mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 07:14:55 +08:00
Merge branch '4.1' into 4.2-beta
This commit is contained in:
commit
d70c31fbc5
@ -348,15 +348,39 @@ void USpineSkeletonRendererComponent::UpdateMesh(Skeleton *Skeleton) {
|
||||
indices.Add(idx + attachmentIndices[j]);
|
||||
}
|
||||
|
||||
FVector normal = FVector(0, -1, 0);
|
||||
if (numVertices > 2 &&
|
||||
FVector::CrossProduct(
|
||||
vertices[indices[firstIndex + 2]] - vertices[indices[firstIndex]],
|
||||
vertices[indices[firstIndex + 1]] - vertices[indices[firstIndex]])
|
||||
.Y > 0.f) {
|
||||
normal.Y = 1;
|
||||
|
||||
//Calculate total triangle to add on this loof.
|
||||
|
||||
int TriangleInitialCount = firstIndex / 3;
|
||||
|
||||
int TriangleToAddNum = indices.Num() / 3 - TriangleInitialCount;
|
||||
|
||||
int FirstVertexIndex = vertices.Num() - numVertices;
|
||||
|
||||
//loof through all the triangles and resolve to be reversed if the triangle has winding order as CCW.
|
||||
|
||||
for (int j = 0; j < TriangleToAddNum; j++) {
|
||||
|
||||
const int TargetTringleIndex = firstIndex + j * 3;
|
||||
|
||||
if (FVector::CrossProduct(
|
||||
vertices[indices[TargetTringleIndex + 2]] - vertices[indices[TargetTringleIndex]],
|
||||
vertices[indices[TargetTringleIndex + 1]] - vertices[indices[TargetTringleIndex]])
|
||||
.Y < 0.f) {
|
||||
|
||||
const int32 targetVertex = indices[TargetTringleIndex];
|
||||
indices[TargetTringleIndex] = indices[TargetTringleIndex + 2];
|
||||
indices[TargetTringleIndex + 2] = targetVertex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FVector normal = FVector(0, 1, 0);
|
||||
|
||||
//Add normals for vertices.
|
||||
|
||||
for (int j = 0; j < numVertices; j++) {
|
||||
|
||||
normals.Add(normal);
|
||||
}
|
||||
|
||||
@ -370,4 +394,4 @@ void USpineSkeletonRendererComponent::UpdateMesh(Skeleton *Skeleton) {
|
||||
clipper.clipEnd();
|
||||
}
|
||||
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
#undef LOCTEXT_NAMESPACE
|
||||
@ -60,7 +60,7 @@ namespace Spine.Unity.Editor {
|
||||
SerializedProperty initialFlipX, initialFlipY;
|
||||
SerializedProperty meshGeneratorSettings;
|
||||
SerializedProperty allowMultipleCanvasRenderers, separatorSlotNames, enableSeparatorSlots, updateSeparatorPartLocation;
|
||||
SerializedProperty raycastTarget;
|
||||
SerializedProperty raycastTarget, maskable;
|
||||
|
||||
readonly GUIContent UnscaledTimeLabel = new GUIContent("Unscaled Time",
|
||||
"If enabled, AnimationState uses unscaled game time (Time.unscaledDeltaTime), " +
|
||||
@ -107,6 +107,7 @@ namespace Spine.Unity.Editor {
|
||||
material = so.FindProperty("m_Material");
|
||||
color = so.FindProperty("m_Color");
|
||||
raycastTarget = so.FindProperty("m_RaycastTarget");
|
||||
maskable = so.FindProperty("m_Maskable");
|
||||
|
||||
// SkeletonRenderer
|
||||
additiveMaterial = so.FindProperty("additiveMaterial");
|
||||
@ -295,6 +296,7 @@ namespace Spine.Unity.Editor {
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("UI", EditorStyles.boldLabel);
|
||||
EditorGUILayout.PropertyField(raycastTarget);
|
||||
if (maskable != null) EditorGUILayout.PropertyField(maskable);
|
||||
|
||||
EditorGUILayout.BeginHorizontal(GUILayout.Height(EditorGUIUtility.singleLineHeight + 5));
|
||||
EditorGUILayout.PrefixLabel("Match RectTransform with Mesh");
|
||||
|
||||
@ -36,7 +36,14 @@
|
||||
#define HAS_ON_POSTPROCESS_PREFAB
|
||||
#endif
|
||||
|
||||
#if UNITY_2020_3_OR_NEWER
|
||||
#if (UNITY_2020_3 && !(UNITY_2020_3_1 || UNITY_2020_3_2 || UNITY_2020_3_3 || UNITY_2020_3_4 || UNITY_2020_3_5 || UNITY_2020_3_6 || UNITY_2020_3_7 || UNITY_2020_3_8 || UNITY_2020_3_9 || UNITY_2020_3_10 || UNITY_2020_3_11 || UNITY_2020_3_12 || UNITY_2020_3_13 || UNITY_2020_3_14 || UNITY_2020_3_15))
|
||||
#define UNITY_2020_3_16_OR_NEWER
|
||||
#endif
|
||||
#if (UNITY_2021_1 && !(UNITY_2021_1_1 || UNITY_2021_1_2 || UNITY_2021_1_3 || UNITY_2021_1_4 || UNITY_2021_1_5 || UNITY_2021_1_6 || UNITY_2021_1_7 || UNITY_2021_1_8 || UNITY_2021_1_9 || UNITY_2021_1_10 || UNITY_2021_1_11 || UNITY_2021_1_12 || UNITY_2021_1_13 || UNITY_2021_1_14 || UNITY_2021_1_15 || UNITY_2021_1_16))
|
||||
#define UNITY_2021_1_17_OR_NEWER
|
||||
#endif
|
||||
|
||||
#if UNITY_2020_3_16_OR_NEWER || UNITY_2021_1_17_OR_NEWER
|
||||
#define HAS_SAVE_ASSET_IF_DIRTY
|
||||
#endif
|
||||
|
||||
|
||||
@ -43,6 +43,22 @@ struct VertexOutputLWRP
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Vertex and Fragment functions //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if defined(_ADDITIONAL_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF)
|
||||
half4 CalculateShadowMaskBackwardsCompatible(InputData inputData)
|
||||
{
|
||||
// To ensure backward compatibility we have to avoid using shadowMask input, as it is not present in older shaders
|
||||
#if defined(SHADOWS_SHADOWMASK) && defined(LIGHTMAP_ON)
|
||||
half4 shadowMask = inputData.shadowMask;
|
||||
#elif !defined (LIGHTMAP_ON)
|
||||
half4 shadowMask = unity_ProbesOcclusion;
|
||||
#else
|
||||
half4 shadowMask = half4(1, 1, 1, 1);
|
||||
#endif
|
||||
|
||||
return shadowMask;
|
||||
}
|
||||
#endif
|
||||
|
||||
half3 LightweightLightVertexSimplified(float3 positionWS, half3 normalWS) {
|
||||
#ifdef _MAIN_LIGHT_VERTEX
|
||||
Light mainLight = GetMainLight();
|
||||
@ -101,7 +117,12 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
||||
int pixelLightCount = GetAdditionalLightsCount();
|
||||
for (int i = 0; i < pixelLightCount; ++i)
|
||||
{
|
||||
#if defined(_ADDITIONAL_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF)
|
||||
half4 shadowMask = CalculateShadowMaskBackwardsCompatible(inputData);
|
||||
Light light = GetAdditionalLight(i, inputData.positionWS, shadowMask);
|
||||
#else
|
||||
Light light = GetAdditionalLight(i, inputData.positionWS);
|
||||
#endif
|
||||
finalColor += LightingPhysicallyBased(brdfData, light, inputData.normalWS, inputData.viewDirectionWS);
|
||||
}
|
||||
#endif
|
||||
@ -142,7 +163,12 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
|
||||
int pixelLightCount = GetAdditionalLightsCount();
|
||||
for (int i = 0; i < pixelLightCount; ++i)
|
||||
{
|
||||
#if defined(_ADDITIONAL_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF)
|
||||
half4 shadowMask = CalculateShadowMaskBackwardsCompatible(inputData);
|
||||
Light light = GetAdditionalLight(i, inputData.positionWS, shadowMask);
|
||||
#else
|
||||
Light light = GetAdditionalLight(i, inputData.positionWS);
|
||||
#endif
|
||||
half3 attenuation = (light.distanceAttenuation * light.shadowAttenuation);
|
||||
half3 attenuatedLightColor = light.color * attenuation;
|
||||
#ifndef _DIFFUSE_RAMP
|
||||
|
||||
@ -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.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)",
|
||||
"version": "4.1.2",
|
||||
"version": "4.1.3",
|
||||
"unity": "2019.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user