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


C++ Player::AcquireCamera方法代码示例

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


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

示例1: 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.0f, 0.0f, 0.0f, 0.0f);
	glClearDepth(1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);


	if(g_pConeMesh && g_pCylinderMesh && g_pCubeTintMesh && g_pCubeColorMesh && g_pPlaneMesh)
	{
		g_camMatrix.SetMatrix(mainCharacter.AcquireCamera().CalcLookAtMatrix());

		glutil::MatrixStack modelMatrix;

		//Render the ground plane.
		{
			glutil::PushStack push(modelMatrix);
			modelMatrix.ApplyMatrix(g_camMatrix.Top());

			modelMatrix.Scale(glm::vec3(100.0f, 1.0f, 100.0f));

			glUseProgram(UniformColor.theProgram);
			glUniformMatrix4fv(UniformColor.modelToCameraMatrixUnif, 1, GL_FALSE, glm::value_ptr(modelMatrix.Top()));
			glUniform4f(UniformColor.baseColorUnif, 0.302f, 0.416f, 0.0589f, 1.0f);
			g_pPlaneMesh->Render();
			glUseProgram(0);
		}

		//Draw the trees
		DrawForest(UniformColorTint, modelMatrix, g_camMatrix);

		//Draw the building.
		{
			glutil::PushStack push(modelMatrix);
			modelMatrix.ApplyMatrix(g_camMatrix.Top());

			modelMatrix.Translate(glm::vec3(20.0f, 0.0f, -10.0f));

			DrawParthenon(UniformColorTint, ObjectColor, modelMatrix);
		}

		//Draw the treasure
		for(int i = 0; i < COUNT; i++)
		{
			if(littleTreasures[i].IsRemoved() == false)
			{
				glutil::PushStack push(modelMatrix);
				modelMatrix.ApplyMatrix(g_camMatrix.Top());
			
				littleTreasures[i].Update();
				littleTreasures[i].Render(UniformColorTint, modelMatrix);
			}
			else
			{
				littleTreasures[i].Spawn(g_parthenonBaseVolume, g_treeVolumes, ARRAY_COUNT(g_forest), mainCharacter.GetCollisionVolume()); 
			}
		}
	}

	HandleMouse();

	glutPostRedisplay();
	glutSwapBuffers();

	userMouse.OverrideLastPosition(userMouse.GetCurrentPosition());
}
开发者ID:emdeha,项目名称:blackflame-opengl-tutorials,代码行数:68,代码来源:Main.cpp


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