diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp |
Diffstat (limited to 'Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp')
-rw-r--r-- | Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp b/Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp new file mode 100644 index 0000000..99e5d22 --- /dev/null +++ b/Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp @@ -0,0 +1,19 @@ +#include "UnityPrefix.h" +#include "BuiltinShaderParamUtility.h" +#include "Runtime/GfxDevice/GfxDevice.h" +#include "Runtime/Shaders/ShaderKeywords.h" + +static ShaderKeyword gSupportedLODFadeKeyword = keywords::Create("ENABLE_LOD_FADE"); + +void SetObjectScale (GfxDevice& device, float lodFade, float invScale) +{ + device.SetInverseScale(invScale); + + /////@TODO: Figure out why inverse scale is implemented in gfxdevice, and decide if we should do the same for lodFade? + device.GetBuiltinParamValues().SetInstanceVectorParam(kShaderInstanceVecScale, Vector4f(0,0,lodFade, invScale)); + + if (lodFade == LOD_FADE_DISABLED) + g_ShaderKeywords.Disable(gSupportedLODFadeKeyword); + else + g_ShaderKeywords.Enable(gSupportedLODFadeKeyword); +} |