本文整理汇总了C++中SolarSystem::addPlayerItem方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::addPlayerItem方法的具体用法?C++ SolarSystem::addPlayerItem怎么用?C++ SolarSystem::addPlayerItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::addPlayerItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
player.move(playerObject->position);
//player.position = playerObject->position;
std::cout << playerObject->position << std::endl;
}
handleEvents(&window, states, &item, playerObject, &player, dt);
player.lookAtUpdate(dt);
// Plocka ut all planeters positioner
std::list<Object*> allObjects;
solsystem.getObjects(&allObjects);
std::vector<cv::Vec3f> positionVector;
std::vector<cv::Vec3f> radiusVector;
std::list<Object*>::iterator i = allObjects.begin();
for (i++ ; i != allObjects.end(); ++i)
{
positionVector.push_back((*i)->position);
radiusVector.push_back((*i)->scale);
//std::cout << "Scale: " << (*i)->scale << std::endl;
}
int numberOfPlanets = positionVector.size();
GLfloat* positions = makeArray(positionVector);
GLfloat* radius = makeArray(radiusVector);
///////////////////////////////// SKYBOX /////////////////////////////////////////
window.setActive();
//drawSkybox(&player, &skyboxModel, skyboxShader, skyboxTexture);
glDisable(GL_DEPTH_TEST);
//skybox.set(player.position, cv::Vec3f(5,5,5), cv::Vec3f(0,0,0), cv::Vec3f(0,0,0), 1);
//skybox.draw(&player);
skysphere.set(player.position, cv::Vec3f(5,5,5), cv::Vec3f(0,0,0), cv::Vec3f(0,0,0), 1);
skysphere.draw(&player, 0, dt);
glEnable(GL_DEPTH_TEST);
///////////////////////////////// ALX /////////////////////////////////////////
if (states[NORMALMAP])
{
squareNormalMap.draw(&player, dt, numberOfPlanets, positions, radius);
}
if (states[SPECULARITYMAP])
{
squareSpecularityMap.draw(&player, dt, numberOfPlanets, positions, radius);
}
///////////////////////////////// ALX /////////////////////////////////////////
if(!states[COOLDOWN] && item == 1)
{
Object* newItem = presetMap["Earth"]->clone();
newItem->set(player.position, cv::Vec3f(0.25,0.25,0.25), cv::Vec3f(0,0,0), 10*player.getLookAtDirection(), 1);
solsystem.addItem(newItem);
std::cout << 10*normalize(player.position - player.lookAtVector) << std::endl;
states[COOLDOWN] = true;
}
item = 0;
if(states[ENABLEGRAVITY] && playerObject == NULL)
{
playerObject = presetMap["Earth"]->clone();
playerObject->set(player.position, cv::Vec3f(1.25,1.25,1.25), cv::Vec3f(0,0,0), cv::Vec3f(0,0,0), 1);
solsystem.addPlayerItem(playerObject);
states[ENABLEGRAVITY] = false;
}
if(states[DISABLEGRAVITY] && playerObject != NULL)
{
solsystem.removePlayerItem();
playerObject = NULL;
states[DISABLEGRAVITY] = false;
}
solsystem.update(physEngine, dt*0.5);
solsystem.draw(&player, accTime);
accTime += dt;
window.display();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
cv::waitKey(0);
}
// release resources...
glDeleteVertexArrays(1, &sphereModel.VAO);
//glDeleteVertexArrays(1, &skyboxModel.VAO);
//glDeleteVertexArrays(1, &unitSquareModel.VAO);
//glDeleteVertexArrays(1, &groundModel.VAO);
return 0;
}