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


C++ CStopWatch::delta方法代码示例

本文整理汇总了C++中CStopWatch::delta方法的典型用法代码示例。如果您正苦于以下问题:C++ CStopWatch::delta方法的具体用法?C++ CStopWatch::delta怎么用?C++ CStopWatch::delta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CStopWatch的用法示例。


在下文中一共展示了CStopWatch::delta方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SpecialKeys

/**
 * Respond to arrow keys by moving the camera frame of reference
 */
void SpecialKeys(int key, int x, int y)
{
	static CStopWatch timer;
	float fTime = timer.delta();
	float linear = fTime / 100;

	if (key == GLUT_KEY_UP) { // Increase the scene exposure
		if ((exposure + linear) < 20.0f) {
			exposure += linear;
		}
	}
	else if (key == GLUT_KEY_DOWN) { // Decrease the scene exposure
		if ((exposure - linear) > 0.01f)
			exposure -= linear;
	}
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:19,代码来源:09_hdr_imaging.cpp

示例2: SpecialKeys

/**
 * Respond to arrow keys by moving the camera frame of reference
 */
void SpecialKeys(int key, int x, int y)
{
	static CStopWatch cameraTimer;
	float fTime = cameraTimer.delta();
	cameraTimer.reset();

	float linear = fTime * 3.0f;
	float angular = fTime * float(m3dDegToRad(60.0f));

	if (key == GLUT_KEY_LEFT)
	{
		worldAngle += angular * 50;
		if (worldAngle > 360)
			worldAngle -= 360;
	}

	if (key == GLUT_KEY_RIGHT)
	{
		worldAngle -= angular * 50;
		if (worldAngle < 360)
			worldAngle += 360;
	}
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:26,代码来源:10_oit.cpp

示例3: RenderScene

/**
 * Called to draw scene
 */
void RenderScene(void)
{
	static CStopWatch animationTimer;
	float yRot = animationTimer.delta() * 60.0f;

	// first, draw to FBO at full FBO resolution

	// bind FBO with 8b attachment
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fboName);
	glViewport(0, 0, hdrTexturesWidth[curHDRTex], hdrTexturesHeight[curHDRTex]);
	glClear(GL_COLOR_BUFFER_BIT);

	// bind texture with HDR image
	glBindTexture(GL_TEXTURE_2D, hdrTextures[curHDRTex]);

	// render pass, downsample to 8b using selected program
	projectionMatrix.setMatrix(fboOrthoMatrix);
	SetupHDRProg();
	fboQuad.draw();

	// then draw the resulting image to the screen, maintain image proporions
	glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
	glViewport(0, 0, screenWidth, screenHeight);
	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);

	// attach 8b texture with HDR image
	glBindTexture(GL_TEXTURE_2D, fboTextures[0]);

	// draw screen sized, proportional quad with 8b texture
	projectionMatrix.setMatrix(orthoMatrix);
	SetupStraightTexProg();
	screenQuad.draw();

	// Perform the buffer swap to display back buffer
	glutSwapBuffers();
	glutPostRedisplay();
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:40,代码来源:09_hdr_imaging.cpp

示例4: RenderScene

/**
 * Called to draw scene
 */
void RenderScene(void)
{
	static GLfloat vFloorColor[] = { 1.0f, 1.0f, 1.0f, 0.75f };
	static CStopWatch rotTimer;
	float yRot = rotTimer.delta() * 60.0f;

	// Clear the window with current clearing color
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

	modelViewMatrix.push();

	M3DMatrix44f mCamera;
	cameraFrame.GetCameraMatrix(mCamera);
	modelViewMatrix.MultMatrix(mCamera);

	// draw the world upside down
	modelViewMatrix.push();
	modelViewMatrix.scaleTo(1.0f, -1.0f, 1.0f); // flips the Y axis
	modelViewMatrix.moveTo(0.0f, 0.8f, 0.0f); // scootch the world down a bit...

	glFrontFace(GL_CW);
	DrawSongAndDance(yRot);
	glFrontFace(GL_CCW); // restore it

	modelViewMatrix.pop();

	// draw the solid ground
	glEnable(GL_BLEND);
	glBindTexture(GL_TEXTURE_2D, uiTextures[0]);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	shaderManager.useStockShader(GLT_SHADER_TEXTURE_MODULATE, 
		transformPipeline.GetMVPMatrix(), 
		vFloorColor, 
		0);
	floorBatch.draw();
	glDisable(GL_BLEND);

	DrawSongAndDance(yRot);

	modelViewMatrix.pop();

	// Render the overlay

	// Creating this matrix really doesn't need to be done every frame. I'll leave it here
	// so all the pertenant code is together
	M3DMatrix44f mScreenSpace;
	m3dMakeOrthographicMatrix(mScreenSpace, 0.0f, 800.0f, 0.0f, 600.0f, -1.0f, 1.0f);

	// turn blending on, and dephth testing off
	glEnable(GL_BLEND);
	glDisable(GL_DEPTH_TEST);

	glUseProgram(rectReplaceShader);
	glUniform1i(locRectTexture, 0);
	glUniformMatrix4fv(locRectMVP, 1, GL_FALSE, mScreenSpace);
	glBindTexture(GL_TEXTURE_RECTANGLE, uiTextures[3]);
	logoBatch.draw();

	// restore no blending and depth test
	glDisable(GL_BLEND);
	glEnable(GL_DEPTH_TEST);

	// Perform the buffer swap to display back buffer
	glutSwapBuffers();
	glutPostRedisplay();
}
开发者ID:zijuan0810,项目名称:supberbile5,代码行数:69,代码来源:07_TextureRect.cpp


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