本文整理汇总了C++中SolarSystem::getPlanetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::getPlanetPosition方法的具体用法?C++ SolarSystem::getPlanetPosition怎么用?C++ SolarSystem::getPlanetPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::getPlanetPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyDown
void keyDown(unsigned char key, int x, int y)
{
if (key==0x1b){exit(0);}
//if(key=='1'){printf("Mercury\n");}
//if(key=='2'){printf("Venus\n");}
//if(key=='3'){printf("Earth\n");}
//if(key=='4'){printf("Mars\n");}
//if(key=='5'){printf("Jupiter\n");}
//if(key=='6'){printf("Saturn\n");}
//if(key=='7'){printf("Uranus\n");}
//if(key=='8'){printf("Neptune\n");}
//if(key=='9'){printf("Pluto\n");}
// printf("Key is %c %d\n",key,(int)key);
// check for numerical keys
if (key > '0' && key <= '9')
{
//printf("Key is %c %d\n",key,(int)key);
// point at the specified planet
float vec[3];
solarSystem.getPlanetPosition(key - '0', vec);
camera.pointAt(vec);
// printf("VECTOR %f - %f - %f \n", vec[0], vec[1], vec[2]);
// select that planet
planetSelected = key - '0';
}
switch (key)
{
case '-':
timeSpeed /= 2.0f; // half the rate of time passing
break;
case '=':
timeSpeed *= 2.0f; // double the rate of time passing
break;
case 'h':
helpDialogue = !helpDialogue; // toggle the dialogue
break;
case '[':
planetSizeScale /= 1.2; // make planet scale smaller
break;
case ']':
planetSizeScale *= 1.2; // make planet scale bigger
break;
case 'o':
showOrbits = !showOrbits; // toggle show orbits
break;
case 'm':
addMoon(); // add a moon to the selected planet
break;
case 't':
planetSizeScale = 0.000050f;
break;
case 'u':
timeSpeed = 0.10f;
break;
case 'v':
planetSizeScale = 0.0000050f;
break;
case 'r':
planetSizeScale = distanceScale;
break;
case ',':
camera.slowDown(); // slow down camera
break;
case '.':
camera.speedUp(); // speed up camera
break;
// these are all camera controls
case 'w':
controls.forward = true;
break;
case 's':
controls.backward = true;
break;
case 'a':
controls.left = true;
break;
case 'd':
controls.right = true;
break;
case 'l':
controls.rollRight = true;
break;
case 'j':
controls.rollLeft = true;
break;
case 'i':
controls.pitchDown = true;
break;
case 'k':
controls.pitchUp = true;
break;
case 'q':
controls.yawLeft = true;
break;
case 'e':
controls.yawRight = true;
break;
}
}