summaryrefslogtreecommitdiff
path: root/Runtime/Camera/RenderLoops/BuiltinShaderParamUtility.cpp
blob: 99e5d22ae4e71b282bf11df3fbe232888eccb84b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
}