本文整理汇总了C++中Timer::GetAlpha方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::GetAlpha方法的具体用法?C++ Timer::GetAlpha怎么用?C++ Timer::GetAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::GetAlpha方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display
GLUSboolean display(GLUSfloat time)
{
glClearColor(0.75f, 0.75f, 1.0f, 1.0f);
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
g_camTimer.Update(time);
float cyclicAngle = g_camTimer.GetAlpha() * 6.28f;
float hOffset = cosf(cyclicAngle) * 0.25f;
float vOffset = sinf(cyclicAngle) * 0.25f;
GLfloat modelViewMatrix[16];
glusMatrix4x4LookAtf(modelViewMatrix ,
hOffset, 1.0f, -64.0f,
hOffset, -5.0f + vOffset, -44.0f,
0.0f, 1.0f, 0.0f);
glUseProgram(g_program.program);
glUniformMatrix4fv(g_program.modelViewUnif, 1, GL_FALSE, modelViewMatrix);
glActiveTexture(GL_TEXTURE0 + g_colorTexUnit);
glBindTexture(GL_TEXTURE_2D, g_useMipmapTexture ? g_mipmapTestTexture : g_checkerTexture);
glBindSampler(g_colorTexUnit, g_samplers[g_currSampler]);
Mesh *mesh = g_drawCorridor ? g_pCorridor : g_pPlane;
mesh->render("tex");
glBindSampler(g_colorTexUnit, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glUseProgram(0);
return GLUS_TRUE;
}
示例2: CalcLightPosition
glm::vec4 CalcLightPosition()
{
float fCurrTimeThroughLoop = g_LightTimer.GetAlpha();
glm::vec4 ret(0.0f, g_fLightHeight, 0.0f, 1.0f);
ret.x = cosf(fCurrTimeThroughLoop * (3.14159f * 2.0f)) * g_fLightRadius;
ret.z = sinf(fCurrTimeThroughLoop * (3.14159f * 2.0f)) * g_fLightRadius;
return ret;
}
示例3: display
//Called to update the display.
//You should call glutSwapBuffers after all of your rendering to display what you rendered.
//If you need continuous updates of the screen, call glutPostRedisplay() at the end of the function.
void display()
{
glClearColor(0.75f, 0.75f, 1.0f, 1.0f);
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(g_pPlane && g_pCorridor)
{
g_camTimer.Update();
float cyclicAngle = g_camTimer.GetAlpha() * 6.28f;
float hOffset = cosf(cyclicAngle) * 0.25f;
float vOffset = sinf(cyclicAngle) * 0.25f;
glutil::MatrixStack modelMatrix;
const glm::mat4 &worldToCamMat = glm::lookAt(
glm::vec3(hOffset, 1.0f, -64.0f),
glm::vec3(hOffset, -5.0f + vOffset, -44.0f),
glm::vec3(0.0f, 1.0f, 0.0f));
modelMatrix *= worldToCamMat;
const ProgramData &prog = g_drawGammaProgram ? g_progGamma : g_progNoGamma;
glUseProgram(prog.theProgram);
glUniformMatrix4fv(prog.modelToCameraMatrixUnif, 1, GL_FALSE,
glm::value_ptr(modelMatrix.Top()));
glActiveTexture(GL_TEXTURE0 + g_colorTexUnit);
glBindTexture(GL_TEXTURE_2D, g_drawGammaTexture ? g_gammaTexture : g_linearTexture);
glBindSampler(g_colorTexUnit, g_samplers[g_currSampler]);
if(g_drawCorridor)
g_pCorridor->Render("tex");
else
g_pPlane->Render("tex");
glBindSampler(g_colorTexUnit, 0);
glBindTexture(GL_TEXTURE_2D, 0);
glUseProgram(0);
}
glutPostRedisplay();
glutSwapBuffers();
}