summaryrefslogtreecommitdiff
path: root/Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp')
-rw-r--r--Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp19
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);
+}