当前位置: 首页>>代码示例>>C++>>正文


C++ Timer::GetAlpha方法代码示例

本文整理汇总了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;
}
开发者ID:cntoplolicon,项目名称:grape,代码行数:35,代码来源:texture_filtering.cpp

示例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;
}
开发者ID:Nuclearfossil,项目名称:ducking-octo-dangerzone,代码行数:11,代码来源:Gaussian+Specular+Lighting.cpp

示例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();
}
开发者ID:Blisse,项目名称:OGLTicTacToe,代码行数:49,代码来源:Gamma+Checkers.cpp


注:本文中的Timer::GetAlpha方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。