Пример #1
0
void CGame::addEnemies()
{
   const int id = mGameObjects.size();

   ///@todo: add later: read these params from a style file
   const std::size_t numOfCircles = 16;
   const std::size_t numOfSegments = 32;
   const std::string filePath = "../AeroSimulator/res/smile.dds";
   const SSphereParams params(2.0f, numOfCircles, numOfSegments, glm::pi<float>(), 2.0f * glm::pi<float>());

   SRenderableData data(mShaders[eShaders::TEXTURE_SHADER], &params, filePath, glm::vec4());

   CTransform transform;
   transform.setTranslate(glm::vec3(0.0f, 30.0f, -10.0f));
   transform.setRotate(glm::vec3(0.0f, 90.0f, 0.0f));
   tGoSharedPtr pObject(new CFigure(id, eGameObjects::AIRPLANE, CFigure::eFigure::SPHERE, data, transform));

   addObject(id, pObject, "* CGame::addEnemy ");
}
Пример #2
0
void CGame::addCameras()
{
   // currently just 1 camera
   const int id = mGameObjects.size();
   const glm::vec3 translate(0.0f, 29.0f, -3.0f);
   const glm::vec3 rotate(0.0f, 180.0f, 0.0f);
   CTransform transform;
   transform.setTranslate(translate);
   transform.setRotate(rotate);

   ///@todo: add the type and the id of the game object to the constructor of the CCamera
   const SFrustum frustum(45.0f, 16.0f / 9.0f, 0.1f, 1100.0f);
   std::shared_ptr<CCamera> camera( new CCamera(id, CAMERA, transform, frustum));
   if (camera)
   {
      GCameraManager.addCamera(camera);
      LOG("* CGame: a camera has been just added to the camera manager.");

      addObject(id, camera, "* CGame::addCamera() ");
   }
}