OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4ShaderCall Class Reference

#include <C4Shader.h>

Public Member Functions

 C4ShaderCall (const C4Shader *pShader)
 
 ~C4ShaderCall ()
 
GLint GetAttribute (int iAttribute) const
 
GLint AllocTexUnit (int iUniform)
 
void SetUniform1i (int iUniform, int iX) const
 
void SetUniform2i (int iUniform, int iX, int iY) const
 
void SetUniform3i (int iUniform, int iX, int iY, int iZ) const
 
void SetUniform4i (int iUniform, int iX, int iY, int iZ, int iW) const
 
void SetUniform1ui (int iUniform, unsigned int iX) const
 
void Setuniform2ui (int iUniform, unsigned int iX, unsigned int iY) const
 
void Setuniform3ui (int iUniform, unsigned int iX, unsigned int iY, unsigned int iZ) const
 
void Setuniform4ui (int iUniform, unsigned int iX, unsigned int iY, unsigned int iZ, unsigned int iW) const
 
void SetUniform1f (int iUniform, float gX) const
 
void SetUniform2f (int iUniform, float gX, float gY) const
 
void SetUniform3f (int iUniform, float gX, float gY, float gZ) const
 
void SetUniform4f (int iUniform, float gX, float gY, float gZ, float gW) const
 
void SetUniform1iv (int iUniform, int iLength, const int *pVals) const
 
void SetUniform2iv (int iUniform, int iLength, const int *pVals) const
 
void SetUniform3iv (int iUniform, int iLength, const int *pVals) const
 
void SetUniform4iv (int iUniform, int iLength, const int *pVals) const
 
void SetUniform1uiv (int iUniform, int iLength, const unsigned int *pVals) const
 
void SetUniform2uiv (int iUniform, int iLength, const unsigned int *pVals) const
 
void SetUniform3uiv (int iUniform, int iLength, const unsigned int *pVals) const
 
void SetUniform4uiv (int iUniform, int iLength, const unsigned int *pVals) const
 
void SetUniform1fv (int iUniform, int iLength, const float *pVals) const
 
void SetUniform2fv (int iUniform, int iLength, const float *pVals) const
 
void SetUniform3fv (int iUniform, int iLength, const float *pVals) const
 
void SetUniform4fv (int iUniform, int iLength, const float *pVals) const
 
void SetUniformMatrix2x3fv (int iUniform, int iLength, const float *pVals) const
 
void SetUniformMatrix3x3fv (int iUniform, int iLength, const float *pVals) const
 
void SetUniformMatrix3x4fv (int iUniform, int iLength, const float *pVals) const
 
void SetUniformMatrix4x4fv (int iUniform, int iLength, const float *pVals) const
 
void SetUniformMatrix3x3 (int iUniform, const StdMeshMatrix &matrix)
 
void SetUniformMatrix3x3Transpose (int iUniform, const StdMeshMatrix &matrix)
 
void SetUniformMatrix3x4 (int iUniform, const StdMeshMatrix &matrix)
 
void SetUniformMatrix4x4 (int iUniform, const StdMeshMatrix &matrix)
 
void SetUniformMatrix4x4 (int iUniform, const StdProjectionMatrix &matrix)
 
void Start ()
 
void Finish ()
 

Friends

class C4ScriptUniform
 

Detailed Description

Definition at line 185 of file C4Shader.h.

Constructor & Destructor Documentation

C4ShaderCall::C4ShaderCall ( const C4Shader pShader)
inline

Definition at line 189 of file C4Shader.h.

190  : fStarted(false), pShader(pShader), iUnits(0)
191  { }
C4ShaderCall::~C4ShaderCall ( )
inline

Definition at line 192 of file C4Shader.h.

References Finish().

192 { Finish(); }
void Finish()
Definition: C4Shader.cpp:703

Here is the call graph for this function:

Member Function Documentation

GLint C4ShaderCall::AllocTexUnit ( int  iUniform)

Definition at line 666 of file C4Shader.cpp.

References C4ShaderCall_MaxUnits, C4Shader::HaveUniform(), and SetUniform1i().

Referenced by C4LandscapeRenderGL::Draw(), C4FoWRegion::Render(), and CStdGL::SetupMultiBlt().

667 {
668 
669  // Want to bind uniform automatically? If not, the caller will take
670  // care of it.
671  if (iUniform >= 0) {
672 
673  // If uniform isn't used, we should skip this. Also check texunit range.
674  if (!pShader->HaveUniform(iUniform)) return 0;
675  assert(iUnits < C4ShaderCall_MaxUnits);
676  if (iUnits >= C4ShaderCall_MaxUnits) return 0;
677 
678  // Set the uniform
679  SetUniform1i(iUniform, iUnits);
680  }
681 
682  // Activate the texture
683  GLint hTex = GL_TEXTURE0 + iUnits;
684  glActiveTexture(hTex);
685  iUnits++;
686  return hTex;
687 }
void SetUniform1i(int iUniform, int iX) const
Definition: C4Shader.h:209
const int C4ShaderCall_MaxUnits
Definition: C4Shader.h:42
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::Finish ( )

Definition at line 703 of file C4Shader.cpp.

Referenced by C4LandscapeRenderGL::Draw(), C4FoWRegion::Render(), C4FoW::Render(), and ~C4ShaderCall().

704 {
705  // Remove shader
706  if (fStarted) {
707  glUseProgram(0);
708  }
709 
710  iUnits = 0;
711  fStarted = false;
712 }

Here is the caller graph for this function:

GLint C4ShaderCall::GetAttribute ( int  iAttribute) const
inline

Definition at line 194 of file C4Shader.h.

References C4Shader::GetAttribute().

Referenced by C4ParticleChunk::Draw(), C4FoWDrawLightTextureStrategy::End(), C4FoWDrawWireframeStrategy::End(), and CStdGL::PerformMultiBlt().

195  {
196  return pShader->GetAttribute(iAttribute);
197  }
GLint GetAttribute(int iAttribute) const
Definition: C4Shader.h:127

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniform1f ( int  iUniform,
float  gX 
) const
inline

Definition at line 241 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by C4LandscapeRenderGL::Draw(), and CStdGL::SetupMultiBlt().

241  {
242  if (pShader->HaveUniform(iUniform))
243  glUniform1f(pShader->GetUniform(iUniform), gX);
244  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniform1fv ( int  iUniform,
int  iLength,
const float *  pVals 
) const
inline

Definition at line 289 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

289  {
290  if (pShader->HaveUniform(iUniform))
291  glUniform1fv(pShader->GetUniform(iUniform), iLength, pVals);
292  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform1i ( int  iUniform,
int  iX 
) const
inline

Definition at line 209 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by AllocTexUnit(), and C4LandscapeRenderGL::Draw().

209  {
210  if (pShader->HaveUniform(iUniform))
211  glUniform1i(pShader->GetUniform(iUniform), iX);
212  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniform1iv ( int  iUniform,
int  iLength,
const int *  pVals 
) const
inline

Definition at line 257 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by C4LandscapeRenderGL::Draw().

257  {
258  if (pShader->HaveUniform(iUniform))
259  glUniform1iv(pShader->GetUniform(iUniform), iLength, pVals);
260  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniform1ui ( int  iUniform,
unsigned int  iX 
) const
inline

Definition at line 225 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

225  {
226  if (pShader->HaveUniform(iUniform))
227  glUniform1ui(pShader->GetUniform(iUniform), iX);
228  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform1uiv ( int  iUniform,
int  iLength,
const unsigned int *  pVals 
) const
inline

Definition at line 273 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

273  {
274  if (pShader->HaveUniform(iUniform))
275  glUniform1uiv(pShader->GetUniform(iUniform), iLength, pVals);
276  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform2f ( int  iUniform,
float  gX,
float  gY 
) const
inline

Definition at line 245 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by C4LandscapeRenderGL::Draw().

245  {
246  if (pShader->HaveUniform(iUniform))
247  glUniform2f(pShader->GetUniform(iUniform), gX, gY);
248  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniform2fv ( int  iUniform,
int  iLength,
const float *  pVals 
) const
inline

Definition at line 293 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by C4FoWDrawLightTextureStrategy::End(), and C4FoWDrawWireframeStrategy::End().

293  {
294  if (pShader->HaveUniform(iUniform))
295  glUniform2fv(pShader->GetUniform(iUniform), iLength, pVals);
296  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniform2i ( int  iUniform,
int  iX,
int  iY 
) const
inline

Definition at line 213 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

213  {
214  if (pShader->HaveUniform(iUniform))
215  glUniform2i(pShader->GetUniform(iUniform), iX, iY);
216  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform2iv ( int  iUniform,
int  iLength,
const int *  pVals 
) const
inline

Definition at line 261 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

261  {
262  if (pShader->HaveUniform(iUniform))
263  glUniform2iv(pShader->GetUniform(iUniform), iLength, pVals);
264  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::Setuniform2ui ( int  iUniform,
unsigned int  iX,
unsigned int  iY 
) const
inline

Definition at line 229 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

229  {
230  if (pShader->HaveUniform(iUniform))
231  glUniform2ui(pShader->GetUniform(iUniform), iX, iY);
232  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform2uiv ( int  iUniform,
int  iLength,
const unsigned int *  pVals 
) const
inline

Definition at line 277 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

277  {
278  if (pShader->HaveUniform(iUniform))
279  glUniform2uiv(pShader->GetUniform(iUniform), iLength, pVals);
280  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform3f ( int  iUniform,
float  gX,
float  gY,
float  gZ 
) const
inline

Definition at line 249 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

249  {
250  if (pShader->HaveUniform(iUniform))
251  glUniform3f(pShader->GetUniform(iUniform), gX, gY, gZ);
252  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform3fv ( int  iUniform,
int  iLength,
const float *  pVals 
) const
inline

Definition at line 297 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by C4LandscapeRenderGL::Draw(), and CStdGL::SetupMultiBlt().

297  {
298  if (pShader->HaveUniform(iUniform))
299  glUniform3fv(pShader->GetUniform(iUniform), iLength, pVals);
300  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniform3i ( int  iUniform,
int  iX,
int  iY,
int  iZ 
) const
inline

Definition at line 217 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

217  {
218  if (pShader->HaveUniform(iUniform))
219  glUniform3i(pShader->GetUniform(iUniform), iX, iY, iZ);
220  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform3iv ( int  iUniform,
int  iLength,
const int *  pVals 
) const
inline

Definition at line 265 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

265  {
266  if (pShader->HaveUniform(iUniform))
267  glUniform3iv(pShader->GetUniform(iUniform), iLength, pVals);
268  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::Setuniform3ui ( int  iUniform,
unsigned int  iX,
unsigned int  iY,
unsigned int  iZ 
) const
inline

Definition at line 233 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

233  {
234  if (pShader->HaveUniform(iUniform))
235  glUniform3ui(pShader->GetUniform(iUniform), iX, iY, iZ);
236  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform3uiv ( int  iUniform,
int  iLength,
const unsigned int *  pVals 
) const
inline

Definition at line 281 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

281  {
282  if (pShader->HaveUniform(iUniform))
283  glUniform3uiv(pShader->GetUniform(iUniform), iLength, pVals);
284  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform4f ( int  iUniform,
float  gX,
float  gY,
float  gZ,
float  gW 
) const
inline

Definition at line 253 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

253  {
254  if (pShader->HaveUniform(iUniform))
255  glUniform4f(pShader->GetUniform(iUniform), gX, gY, gZ, gW);
256  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform4fv ( int  iUniform,
int  iLength,
const float *  pVals 
) const
inline

Definition at line 301 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by C4LandscapeRenderGL::Draw(), and CStdGL::SetupMultiBlt().

301  {
302  if (pShader->HaveUniform(iUniform))
303  glUniform4fv(pShader->GetUniform(iUniform), iLength, pVals);
304  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniform4i ( int  iUniform,
int  iX,
int  iY,
int  iZ,
int  iW 
) const
inline

Definition at line 221 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

221  {
222  if (pShader->HaveUniform(iUniform))
223  glUniform4i(pShader->GetUniform(iUniform), iX, iY, iZ, iW);
224  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform4iv ( int  iUniform,
int  iLength,
const int *  pVals 
) const
inline

Definition at line 269 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

269  {
270  if (pShader->HaveUniform(iUniform))
271  glUniform4iv(pShader->GetUniform(iUniform), iLength, pVals);
272  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::Setuniform4ui ( int  iUniform,
unsigned int  iX,
unsigned int  iY,
unsigned int  iZ,
unsigned int  iW 
) const
inline

Definition at line 237 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

237  {
238  if (pShader->HaveUniform(iUniform))
239  glUniform4ui(pShader->GetUniform(iUniform), iX, iY, iZ, iW);
240  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniform4uiv ( int  iUniform,
int  iLength,
const unsigned int *  pVals 
) const
inline

Definition at line 285 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

285  {
286  if (pShader->HaveUniform(iUniform))
287  glUniform4uiv(pShader->GetUniform(iUniform), iLength, pVals);
288  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniformMatrix2x3fv ( int  iUniform,
int  iLength,
const float *  pVals 
) const
inline

Definition at line 307 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by C4LandscapeRenderGL::Draw(), and CStdGL::SetupMultiBlt().

307  {
308  if (pShader->HaveUniform(iUniform))
309  glUniformMatrix3x2fv(pShader->GetUniform(iUniform), iLength, GL_TRUE, pVals);
310  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniformMatrix3x3 ( int  iUniform,
const StdMeshMatrix &  matrix 
)
inline

Definition at line 327 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

328  {
329  if (pShader->HaveUniform(iUniform))
330  {
331  const float mat[9] = { matrix(0, 0), matrix(1, 0), matrix(2, 0), matrix(0, 1), matrix(1, 1), matrix(2, 1), matrix(0, 2), matrix(1, 2), matrix(2, 2) };
332  glUniformMatrix3fv(pShader->GetUniform(iUniform), 1, GL_FALSE, mat);
333  }
334  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniformMatrix3x3fv ( int  iUniform,
int  iLength,
const float *  pVals 
) const
inline

Definition at line 312 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

312  {
313  if (pShader->HaveUniform(iUniform))
314  glUniformMatrix3fv(pShader->GetUniform(iUniform), iLength, GL_TRUE, pVals);
315  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniformMatrix3x3Transpose ( int  iUniform,
const StdMeshMatrix &  matrix 
)
inline

Definition at line 336 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by CStdGL::SetupMultiBlt().

337  {
338  if (pShader->HaveUniform(iUniform))
339  {
340  const float mat[9] = { matrix(0, 0), matrix(0, 1), matrix(0, 2), matrix(1, 0), matrix(1, 1), matrix(1, 2), matrix(2, 0), matrix(2, 1), matrix(2, 2) };
341  glUniformMatrix3fv(pShader->GetUniform(iUniform), 1, GL_FALSE, mat);
342  }
343  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniformMatrix3x4 ( int  iUniform,
const StdMeshMatrix &  matrix 
)
inline

Definition at line 345 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

346  {
347  if (pShader->HaveUniform(iUniform))
348  glUniformMatrix4x3fv(pShader->GetUniform(iUniform), 1, GL_TRUE, matrix.data());
349  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniformMatrix3x4fv ( int  iUniform,
int  iLength,
const float *  pVals 
) const
inline

Definition at line 317 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

317  {
318  if (pShader->HaveUniform(iUniform))
319  glUniformMatrix4x3fv(pShader->GetUniform(iUniform), iLength, GL_TRUE, pVals);
320  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniformMatrix4x4 ( int  iUniform,
const StdMeshMatrix &  matrix 
)
inline

Definition at line 351 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

Referenced by C4LandscapeRenderGL::Draw(), C4ParticleChunk::Draw(), C4FoWRegion::Render(), C4FoW::Render(), and CStdGL::SetupMultiBlt().

352  {
353  if (pShader->HaveUniform(iUniform))
354  {
355  const float mat[16] = { matrix(0, 0), matrix(1, 0), matrix(2, 0), 0.0f, matrix(0, 1), matrix(1, 1), matrix(2, 1), 0.0f, matrix(0, 2), matrix(1, 2), matrix(2, 2), 0.0f, matrix(0, 3), matrix(1, 3), matrix(2, 3), 1.0f };
356  glUniformMatrix4fv(pShader->GetUniform(iUniform), 1, GL_FALSE, mat);
357  }
358  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

Here is the caller graph for this function:

void C4ShaderCall::SetUniformMatrix4x4 ( int  iUniform,
const StdProjectionMatrix &  matrix 
)
inline

Definition at line 360 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

361  {
362  if (pShader->HaveUniform(iUniform))
363  glUniformMatrix4fv(pShader->GetUniform(iUniform), 1, GL_TRUE, matrix.data());
364  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::SetUniformMatrix4x4fv ( int  iUniform,
int  iLength,
const float *  pVals 
) const
inline

Definition at line 322 of file C4Shader.h.

References C4Shader::GetUniform(), and C4Shader::HaveUniform().

322  {
323  if (pShader->HaveUniform(iUniform))
324  glUniformMatrix4fv(pShader->GetUniform(iUniform), iLength, GL_TRUE, pVals);
325  }
GLint GetUniform(int iUniform) const
Definition: C4Shader.h:117
bool HaveUniform(int iUniform) const
Definition: C4Shader.h:122

Here is the call graph for this function:

void C4ShaderCall::Start ( )

Definition at line 689 of file C4Shader.cpp.

References C4Shader_RefreshInterval, C4TimeMilliseconds::Now(), and ScriptShader.

Referenced by C4LandscapeRenderGL::Draw(), C4FoWRegion::Render(), C4FoW::Render(), and CStdGL::SetupMultiBlt().

690 {
691  assert(!fStarted);
692  assert(pShader->hProg != 0); // Shader must be initialized
693 
694  // Possibly refresh shader
695  if (ScriptShader.LastUpdate > pShader->LastRefresh || C4TimeMilliseconds::Now() > pShader->LastRefresh + C4Shader_RefreshInterval)
696  const_cast<C4Shader *>(pShader)->Refresh();
697 
698  // Activate shader
699  glUseProgram(pShader->hProg);
700  fStarted = true;
701 }
C4ScriptShader ScriptShader
Definition: C4Shader.cpp:717
const uint32_t C4Shader_RefreshInterval
Definition: C4Shader.cpp:23
static C4TimeMilliseconds Now()

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class C4ScriptUniform
friend

Definition at line 187 of file C4Shader.h.


The documentation for this class was generated from the following files: