mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[unity] URP shaders: Fixed more compile errors with old URP versions.
This commit is contained in:
parent
a1f27d74b1
commit
1fe8f95e27
@ -3,21 +3,37 @@
|
||||
|
||||
#ifdef USE_FORWARD_PLUS
|
||||
#define IS_URP_14_OR_NEWER 1
|
||||
#define IS_URP_12_OR_NEWER 1
|
||||
#else
|
||||
#define IS_URP_14_OR_NEWER 0
|
||||
#ifdef UNIVERSAL_REALTIME_LIGHTS_INCLUDED
|
||||
#define IS_URP_12_OR_NEWER 1
|
||||
#else
|
||||
#define IS_URP_12_OR_NEWER 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WRITE_RENDERING_LAYERS) && IS_URP_14_OR_NEWER
|
||||
#define USE_WRITE_RENDERING_LAYERS
|
||||
#endif
|
||||
|
||||
#ifdef _LIGHT_LAYERS
|
||||
#if defined(_LIGHT_LAYERS) && IS_URP_12_OR_NEWER
|
||||
#define USE_LIGHT_LAYERS
|
||||
#endif
|
||||
|
||||
#if defined(_LIGHT_COOKIES) && IS_URP_12_OR_NEWER
|
||||
#define USE_LIGHT_COOKIES
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIGHT_LAYERS
|
||||
uint GetMeshRenderingLayerBackwardsCompatible()
|
||||
{
|
||||
#if IS_URP_14_OR_NEWER
|
||||
return GetMeshRenderingLayer();
|
||||
#else
|
||||
#elif IS_URP_12_OR_NEWER
|
||||
return GetMeshRenderingLightLayer();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
|
||||
@ -46,7 +46,7 @@ struct VertexOutput {
|
||||
half3 ProcessLight(float3 positionWS, half3 normalWS, uint meshRenderingLayers, int lightIndex)
|
||||
{
|
||||
Light light = GetAdditionalLight(lightIndex, positionWS);
|
||||
#ifdef _LIGHT_LAYERS
|
||||
#ifdef USE_LIGHT_LAYERS
|
||||
if (!IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
|
||||
return half3(0, 0, 0);
|
||||
#endif
|
||||
|
||||
@ -109,7 +109,7 @@ half3 ProcessLightPBRSimplified(InputData inputData, BRDFData brdfData, half4 sh
|
||||
#else
|
||||
Light light = GetAdditionalLight(lightIndex, inputData.positionWS);
|
||||
#endif
|
||||
#ifdef _LIGHT_LAYERS
|
||||
#ifdef USE_LIGHT_LAYERS
|
||||
if (!IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
|
||||
return half3(0, 0, 0);
|
||||
#endif
|
||||
@ -136,7 +136,7 @@ half4 LightweightFragmentPBRSimplified(InputData inputData, half4 texAlbedoAlpha
|
||||
#else
|
||||
Light mainLight = GetMainLight();
|
||||
#endif
|
||||
#if defined(_LIGHT_COOKIES)
|
||||
#if defined(USE_LIGHT_COOKIES)
|
||||
half3 cookieColor = SampleMainLightCookie(inputData.positionWS);
|
||||
mainLight.color *= cookieColor;
|
||||
#endif
|
||||
@ -187,7 +187,7 @@ half3 ProcessLightLambert(InputData inputData, half4 shadowMask, uint meshRender
|
||||
Light light = GetAdditionalLight(lightIndex, inputData.positionWS);
|
||||
#endif
|
||||
|
||||
#ifdef _LIGHT_LAYERS
|
||||
#ifdef USE_LIGHT_LAYERS
|
||||
if (!IsMatchingLightLayer(light.layerMask, meshRenderingLayers))
|
||||
return half3(0, 0, 0);
|
||||
#endif
|
||||
@ -215,7 +215,7 @@ half4 LightweightFragmentBlinnPhongSimplified(InputData inputData, half4 texDiff
|
||||
#else
|
||||
Light mainLight = GetMainLight();
|
||||
#endif
|
||||
#if defined(_LIGHT_COOKIES)
|
||||
#if defined(USE_LIGHT_COOKIES)
|
||||
half3 cookieColor = SampleMainLightCookie(inputData.positionWS);
|
||||
mainLight.color *= cookieColor;
|
||||
#endif
|
||||
|
||||
@ -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.14",
|
||||
"version": "4.1.15",
|
||||
"unity": "2019.3",
|
||||
"author": {
|
||||
"name": "Esoteric Software",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user