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


C++ SolarSystem::Initialize方法代码示例

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


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

示例1: main

int main(int argc, char * argv[])
{
	glewInit();
	glutInit(&argc, argv);
	glutInitWindowSize(1024, 512);
	glutInitWindowPosition(0, 0);
	glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);

	//Initialize object's colors / values
	torus.color = vec3(1.0f, 0.1f, 0.0f);
	square.color1 = vec3(1.0, 1.0, 1.0);
	square2.color1 = vec3(0.95f, 0.1f, 0.7f);
	square2.color2 = vec3(1.0f, 1.0f, 0.0f);
	disc.color = vec3(0.1f, 0.5f, 1.0f);
	sphere.color = vec3(0.15f, 0.45f, 0.0f);
	sphere2.color = vec3(0.45f, 0.05f, 0.25f);
	cylinder.color = vec3(0.0f, 0.5f, 0.0f);
	arena.texID = 18;
	egg.texID = 20;
	star.texID = 22;
	magneton.texID = 25;
	haunter.texID = 26;
	frog.texID = 27;
	goldeen.texID = 76;
	rain2.color = vec3(0.4f, 0.4f, 1.0f);
	snow2.color = vec3(1.0f, 1.0f, 1.0f);
	fontfilename = "Pokemon.ttf";

	//Initialize the precipitation
	numParts = 300;
	partX = new float[numParts];
	partY = new float[numParts];
	partOffset = new float[numParts];
	for(int i=0; i<numParts; i++){
		partX[i] = (float)(rand() % 1200);
		partX[i] = (partX[i] - 600)/100;

		partY[i] = (float)(rand() % 1200);
		partY[i] = (partY[i] - 600)/100;
		partOffset[i] = (float)(rand() % 360 + 1);
	}
	sphere.lava = true;sphere2.lava = false; //Initialize sphere statuses

	window.window_handle = glutCreateWindow("Solar System");
	glutReshapeFunc(ReshapeFunc);
	glutCloseFunc(CloseFunc);
	
	glutMotionFunc(mouseMovement);
	glutPassiveMotionFunc(mouseMovement); //check for mouse movement
	glutKeyboardFunc(KeyboardFunc);
	glutSpecialFunc(SpecialFunc);
	glutTimerFunc(window.interval, TimerFunc, 0);
	
	glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_CONTINUE_EXECUTION);
	
	//Initialize everything

	if (glewInit() != GLEW_OK)
	{
		cerr << "GLEW failed to initialize." << endl;
		return 0;
	}

	init_resources();
	glutDisplayFunc(DisplayFunc);

	if (!fbo.Initialize(glm::ivec2(512, 512), 1, true)){
		cerr << "Frame buffer failed to initialize." << endl;
		return 0;
	}

	sph1.color = vec3(1.0f, 0.85f, 0.0f);
	if (!sph1.Initialize(8,1.0f, "phong3.vert", "phong3.frag")){return 0;}
	enm.color = vec3(0.75f, 0.0f, 0.75f);
	if (!enm.Initialize(2,0.05f, "phong.vert", "phong.frag")){return 0;}
	usr.color = vec3(0.0f, 0.0f, 0.5f);
	if (!usr.Initialize(2,0.05f, "phong.vert", "phong.frag")){return 0;}
	//if (!sb.Initialize()){return 0;}
	//if (!coin.Initialize()){return 0;}
	//if (!stadium.Initialize(0)){return 0;}
	if (!skybox.Initialize(0, 5000, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;}
	if (!skybox2.Initialize(1, 5025, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;}
	if (!skybox3.Initialize(2, 5050, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;}
	if (!skyboxUW.Initialize(3, 5075, "basic_skybox_shader.vert", "basic_skybox_shader.frag")){return 0;}


	arena.order = 1;
	
	if (!sphere.Initialize(15, 1, "sphereShader2.vert", "sphereShader2.frag")){return 0;}
	if (!sphere2.Initialize(15, 1, "sphereShader2.vert", "sphereShader2.frag")){return 0;}
	if (!rain2.Initialize(2, 0.02f, "phong.vert", "phong.frag")){return 0;}
	if (!snow2.Initialize(3, 0.02f, "phong.vert", "phong.frag")){return 0;}
	//if (!egg.Initialize(15, 1, "./textures/alienEgg.jpg", "basic_texture_shader.vert", "basic_texture_shader.frag")){return 0;}
	if (!square.Initialize(1, 3.0f, "phong.vert", "phong.frag")) {return 0;}
	if (!sq4.Initialize(1, 5.0f, "basic_texture_shader.vert", "basic_texture_shader.frag")) {return 0;}
	if (!disc.Initialize(8, 1.0f, "phong3.vert", "phong3.frag")) {return 0;}
	if (!healthBar.Initialize(2, 1.0f, 1.f, 1.f, "phong3.vert", "phong3.frag")) {return 0;}
	if (!soldier.Initialize()) {return 0;}
	if (!ss.Initialize()) {return 0;}

//.........这里部分代码省略.........
开发者ID:claytonsuplinski,项目名称:SolarSystem,代码行数:101,代码来源:main.cpp


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