예제 #1
0
bool    ImageMeshDraw(Bomb::MeshComponent* mesh, Graphic::SysGraphic* sys)
{
  Graphic::OGLContext*  ogl = sys->GetContext();
  gdl::BasicShader*     shader = ogl->GetShader();
  Graphic::TextureMap*  tgamap = sys->GetTextures();
  gdl::Texture*         tga = (*tgamap)[mesh->GetName()->c_str()];

  //TODO : throw Execption
  if (!tga)
    return false;
  Graphic::GeometryMap* geomap = sys->GetGeometrys();
  gdl::Geometry*        geo = (*geomap)[mesh->GetName()->c_str()];

  if (!geo)
    return false;
  glm::mat4 projection;
  projection = glm::ortho(0.0f, 1000.0f, 800.0f, 0.0f, -1.0f, 1.0f);

  shader->bind();
  shader->setUniform("view", glm::mat4(1));
  shader->setUniform("projection", projection);

  tga->bind();

  glDisable(GL_DEPTH_TEST);
  geo->draw(*shader, glm::mat4(1), GL_QUADS);
  glEnable(GL_DEPTH_TEST);
  ogl->AskCamUpdate();
  ogl->CamUpdate();
  return true;
}
예제 #2
0
bool    BombMeshDraw(Bomb::MeshComponent* mesh, Graphic::SysGraphic* sys)
{
  Graphic::ModelMap*    modelmap = sys->GetModels();
  Graphic::ModelTime*   modeltime = sys->GetModelTime();
  double                time = (*modeltime)[mesh->GetName()->c_str()];
  gdl::Model*           model = (*modelmap)[mesh->GetName()->c_str()];

  Graphic::OGLContext*	ogl = sys->GetContext();
  gdl::BasicShader*	shader = ogl->GetShader();
  glm::mat4		transfo = mesh->GetPosition();
  transfo = glm::translate(transfo, glm::vec3(0.0, -0.6, 0.0));
  transfo = glm::scale(transfo, glm::vec3(5.0, 5.0, 5.0));
  model->draw(*shader, transfo, time);
  (*modeltime)[mesh->GetName()->c_str()] = 0;
  return true;
}
예제 #3
0
bool	DestructibleBoxMeshDraw(Bomb::MeshComponent* mesh, Graphic::SysGraphic* sys)
{
  Graphic::OGLContext*	ogl = sys->GetContext();
  gdl::BasicShader*	shader = ogl->GetShader();
  Graphic::TextureMap*	tgamap = sys->GetTextures();
  gdl::Texture*		tga = (*tgamap)[mesh->GetName()->c_str()];

  //TODO : throw Execption
  if (!tga)
    return false;
  Graphic::GeometryMap*	geomap = sys->GetGeometrys();
  gdl::Geometry*	geo = (*geomap)[mesh->GetName()->c_str()];

  if (!geo)
    return false;
  tga->bind();
  geo->draw(*shader, mesh->GetPosition(), GL_QUADS);
  return true;
}
예제 #4
0
bool		FireAnimMeshDraw(Bomb::AnimComponent *mesh, Graphic::SysGraphic* sys,
				double x, double y)
{
  Graphic::OGLContext*	ogl = sys->GetContext();
  gdl::BasicShader*	shader = ogl->GetShader();
  Graphic::TextureMap*	tgamap = sys->GetTextures();
  gdl::Texture*		tga = (*tgamap)[mesh->GetName()->c_str()];

  //TODO : throw Execption
  if (!tga)
    return false;
  Graphic::GeometryMap*	geomap = sys->GetGeometrys();
  gdl::Geometry*	geo = (*geomap)[mesh->GetName()->c_str()];

  if (!geo)
    return false;
  glm::mat4	transfo(1.0);
  transfo = glm::translate(x - (G_GameSettings->map.x / 2), 0.0, y - (G_GameSettings->map.y / 2));
  tga->bind();
  geo->draw(*shader, transfo, GL_QUADS);
  return true;
}