forked from Mirrors/openclonk
Add resolution uniform for sprite and mesh shaders (#2031)
The landscape shader already has such a uniform.master
parent
9a6772c27e
commit
9fed69f3fa
|
@ -203,6 +203,7 @@ bool CStdGL::PrepareSpriteShader(C4Shader& shader, const char* name, int ssc, C4
|
|||
uniformNames[C4SSU_NormalMatrix] = "normalMatrix";
|
||||
uniformNames[C4SSU_ClrMod] = "clrMod";
|
||||
uniformNames[C4SSU_Gamma] = "gamma";
|
||||
uniformNames[C4SSU_Resolution] = "resolution";
|
||||
uniformNames[C4SSU_BaseTex] = "baseTex";
|
||||
uniformNames[C4SSU_OverlayTex] = "overlayTex";
|
||||
uniformNames[C4SSU_OverlayClr] = "overlayClr";
|
||||
|
@ -609,6 +610,10 @@ void CStdGL::PerformMultiBlt(C4Surface* sfcTarget, DrawOperation op, const C4Blt
|
|||
assert(sfcTarget->IsRenderTarget());
|
||||
if(!PrepareRendering(sfcTarget)) return;
|
||||
|
||||
// Set resolution. The other uniforms are set in SetupMultiBlt, but the
|
||||
// surface size is still unknown there.
|
||||
shader_call->SetUniform2f(C4SSU_Resolution, sfcTarget->Wdt, sfcTarget->Hgt);
|
||||
|
||||
// Select a buffer
|
||||
const unsigned int vbo_index = CurrentVBO;
|
||||
CurrentVBO = (CurrentVBO + 1) % N_GENERIC_VBOS;
|
||||
|
|
|
@ -55,6 +55,7 @@ enum C4SS_Uniforms
|
|||
|
||||
C4SSU_ClrMod, // always
|
||||
C4SSU_Gamma, // always
|
||||
C4SSU_Resolution, // always
|
||||
|
||||
C4SSU_BaseTex, // C4SSC_BASE
|
||||
C4SSU_OverlayTex, // C4SSC_OVERLAY
|
||||
|
|
|
@ -513,6 +513,7 @@ namespace
|
|||
};
|
||||
call.SetUniform4fv(C4SSU_ClrMod, 1, fMod);
|
||||
call.SetUniform3fv(C4SSU_Gamma, 1, pDraw->gammaOut);
|
||||
call.SetUniform2f(C4SSU_Resolution, outRect.Wdt, outRect.Hgt);
|
||||
|
||||
// Player color
|
||||
const float fPlrClr[3] = {
|
||||
|
|
|
@ -852,6 +852,7 @@ bool StdMeshMaterialProgram::CompileShader(StdMeshMaterialLoader& loader, C4Shad
|
|||
uniformNames[C4SSU_NormalMatrix] = "normalMatrix";
|
||||
uniformNames[C4SSU_ClrMod] = "clrMod";
|
||||
uniformNames[C4SSU_Gamma] = "gamma";
|
||||
uniformNames[C4SSU_Resolution] = "resolution";
|
||||
uniformNames[C4SSU_BaseTex] = "baseTex"; // unused
|
||||
uniformNames[C4SSU_OverlayTex] = "overlayTex"; // unused
|
||||
uniformNames[C4SSU_OverlayClr] = "oc_PlayerColor";
|
||||
|
|
Loading…
Reference in New Issue