您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
46 行
1.5 KiB
46 行
1.5 KiB
#ifndef UNITY_GRAPHFUNCTIONS_LW_INCLUDED
|
|
#define UNITY_GRAPHFUNCTIONS_LW_INCLUDED
|
|
|
|
#define SHADERGRAPH_SAMPLE_SCENE_DEPTH(uv) shadergraph_LWSampleSceneDepth(uv);
|
|
#define SHADERGRAPH_SAMPLE_SCENE_COLOR(uv) shadergraph_LWSampleSceneColor(uv);
|
|
|
|
#if defined(REQUIRE_DEPTH_TEXTURE)
|
|
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
|
|
TEXTURE2D_ARRAY(_CameraDepthTexture);
|
|
#else
|
|
TEXTURE2D(_CameraDepthTexture);
|
|
#endif
|
|
SAMPLER(sampler_CameraDepthTexture);
|
|
#endif // REQUIRE_DEPTH_TEXTURE
|
|
|
|
#if defined(REQUIRE_OPAQUE_TEXTURE)
|
|
TEXTURE2D(_CameraOpaqueTexture);
|
|
SAMPLER(sampler_CameraOpaqueTexture);
|
|
#endif // REQUIRE_OPAQUE_TEXTURE
|
|
|
|
float shadergraph_LWSampleSceneDepth(float2 uv)
|
|
{
|
|
#if defined(REQUIRE_DEPTH_TEXTURE)
|
|
#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)
|
|
float rawDepth = SAMPLE_TEXTURE2D_ARRAY(_CameraDepthTexture, sampler_CameraDepthTexture, i.texcoord.xy, unity_StereoEyeIndex).r;
|
|
#else
|
|
float rawDepth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, sampler_CameraDepthTexture, uv);
|
|
#endif
|
|
return Linear01Depth(rawDepth, _ZBufferParams);
|
|
#endif // REQUIRE_DEPTH_TEXTURE
|
|
return 0;
|
|
}
|
|
|
|
float3 shadergraph_LWSampleSceneColor(float2 uv)
|
|
{
|
|
#if defined(REQUIRE_OPAQUE_TEXTURE)
|
|
return SAMPLE_TEXTURE2D(_CameraOpaqueTexture, sampler_CameraOpaqueTexture, uv);
|
|
#endif
|
|
return 0;
|
|
}
|
|
|
|
// Always include Shader Graph version
|
|
// Always include last to avoid double macros
|
|
#include "ShaderGraphLibrary/Functions.hlsl"
|
|
|
|
#endif // UNITY_GRAPHFUNCTIONS_LW_INCLUDED
|