當前位置: 首頁>>代碼示例>>C++>>正文


C++ ObjectManager::setGravity方法代碼示例

本文整理匯總了C++中ObjectManager::setGravity方法的典型用法代碼示例。如果您正苦於以下問題:C++ ObjectManager::setGravity方法的具體用法?C++ ObjectManager::setGravity怎麽用?C++ ObjectManager::setGravity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ObjectManager的用法示例。


在下文中一共展示了ObjectManager::setGravity方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: Setup

bool Setup()
{
	shader.LoadVertexShader("quad3d.vert");
	shader.LoadFragmentShader("basic.frag");
	shader.Create();

	shaderSkybox.LoadVertexShader("quad3d_texture.vert");
	shaderSkybox.LoadFragmentShader("basic_texture.frag");
	shaderSkybox.Create();

	camera.position = vec3(0.f, 300.f, -150.f); //vec3(3.f, 10.f, 20.f);vec3(0.0f, 3.f, 4.f); (3.f, 10.f, 70.f); (3.f, 20.f, 100.f)
	camera.orientation = vec3(0.f, 1.f, 0.f);
	camera.target = vec3(0.f, 0.f, 1.f);
	
	mousePosition = vec3(WINDOW_WIDTH / 2.0f, WINDOW_HEIGHT / 2.0f, 0.0f);

	generateGround();
	
	EsgiTexture * texturesSkybox[] = { esgiReadTGAFile("img/skybox_left.tga"), esgiReadTGAFile("img/skybox_front.tga"), esgiReadTGAFile("img/skybox_right.tga"),
		esgiReadTGAFile("img/skybox_back.tga"), esgiReadTGAFile("img/skybox_top.tga"), esgiReadTGAFile("img/skybox_bottom.tga") };
	for (int i = 0; i < 6; ++i)
	{
		EsgiTexture * texture = texturesSkybox[i];
		glGenTextures(1, &skyboxTextureIds[i]);
		glBindTexture(GL_TEXTURE_2D, skyboxTextureIds[i]);
		glTexImage2D(GL_TEXTURE_2D, 0, texture->internalFormat, texture->width, texture->height, 0, texture->format, texture->datatype, texture->texels);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16 );
		delete[] texture->texels;
		delete texture;
	}

	EsgiTexture * texturesGround[] = { esgiReadTGAFile("img/sand.tga"), esgiReadTGAFile("img/sandhole.tga") };
	for (int i = 0; i < 2; ++i)
	{
		EsgiTexture * texture = texturesGround[i];
		glGenTextures(1, &groundTextureIds[i]);
		glBindTexture(GL_TEXTURE_2D, groundTextureIds[i]);
		glTexImage2D(GL_TEXTURE_2D, 0, texture->internalFormat, texture->width, texture->height, 0, texture->format, texture->datatype, texture->texels);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
		glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16 );
		delete[] texture->texels;
		delete texture;
	}


	objectManager.setGravity(9.8f);

	return true;
}
開發者ID:bibiGN,項目名稱:annualproject,代碼行數:56,代碼來源:main.cpp


注:本文中的ObjectManager::setGravity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。