当前位置: 首页>>代码示例>>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;未经允许,请勿转载。