コード例 #1
0
ファイル: AObject.hpp プロジェクト: koolkt/Bomberman
  virtual bool initialize()
  {
    //_speed = 2.0f;
    // On charge la texture qui sera affichee sur chaque face du cube
    if (_texture.load("assets/textures/tmp/grass.tga") == false)
      {
	std::cerr << "Cannot load the cube texture" << std::endl;
	return (false);
      }

    _geometry.setColor(glm::vec4(1, 1, 1, 1));

    _geometry.pushVertex(glm::vec3(1, -1, -1));
    _geometry.pushVertex(glm::vec3(1, -1, 1));
    _geometry.pushVertex(glm::vec3(-1, -1, 1));
    _geometry.pushVertex(glm::vec3(-1, -1, -1));

    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    // Tres important, on n'oublie pas de build la geometrie pour envoyer ses informations a la carte graphique
    _geometry.build();
    return (true); 
  }
コード例 #2
0
ファイル: Map.hpp プロジェクト: Horkoss/Bomberman
  bool		initialize()
  {
    if (_texture.load("./assets/herbe.tga") == false)
      {
	std::cerr << "Cannot load the map texture" << std::endl;
	return (false);
      }

    _geometry.pushVertex(glm::vec3(_x, 0, 0));
    _geometry.pushVertex(glm::vec3(_x, 0, _z));
    _geometry.pushVertex(glm::vec3(0, 0, _z));
    _geometry.pushVertex(glm::vec3(0, 0, 0));

    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    _geometry.build();
    return (true);
  }
コード例 #3
0
ファイル: Cube.hpp プロジェクト: MadPhoenix/cpp_bomberman
  bool		initialize()
  {
    if (_texture.load(_path) == false)
      {
	std::cerr << "Cannot load the cube texture" << std::endl;
	return (false);
      }
    _geometry.pushVertex(glm::vec3(this->_x, 0, this->_z));
    _geometry.pushVertex(glm::vec3(this->_x, 1, this->_z));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 1, this->_z));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 0, this->_z));

    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    _geometry.pushVertex(glm::vec3(this->_x, 0, this->_z + 1));
    _geometry.pushVertex(glm::vec3(this->_x, 1, this->_z + 1));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 1, this->_z + 1));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 0, this->_z + 1));

    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    _geometry.pushVertex(glm::vec3(this->_x, 0, this->_z + 1));
    _geometry.pushVertex(glm::vec3(this->_x, 1, this->_z + 1));
    _geometry.pushVertex(glm::vec3(this->_x, 1, this->_z));
    _geometry.pushVertex(glm::vec3(this->_x, 0, this->_z));

    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    _geometry.pushVertex(glm::vec3(this->_x + 1, 0, this->_z));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 1, this->_z));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 1, this->_z + 1));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 0, this->_z + 1));

    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    _geometry.pushVertex(glm::vec3(this->_x, 0, this->_z));
    _geometry.pushVertex(glm::vec3(this->_x, 1, this->_z + 1));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 1, this->_z + 1));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 0, this->_z));

    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    _geometry.pushVertex(glm::vec3(this->_x, 1, this->_z + 1));
    _geometry.pushVertex(glm::vec3(this->_x, 1, this->_z));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 1, this->_z));
    _geometry.pushVertex(glm::vec3(this->_x + 1, 1, this->_z + 1));

    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    _geometry.build();
    return (true);
  }
コード例 #4
0
ファイル: Cube.hpp プロジェクト: Raphy/bomberman
  virtual bool initialize()
  {
    _speed = 10.0f;
    if (_texture.load("./LibBomberman_linux_x64/assets/textures/blank.tga")==false)
      {
	       std::cerr << "Cannot load the cube texture" << std::endl;
	       return (false);
      }

    _geometry.setColor(glm::vec4(1, 0, 0, 1));

    _geometry.pushVertex(glm::vec3(0.5, -0.5, 0.5));
    _geometry.pushVertex(glm::vec3(0.5, 0.5, 0.5));
    _geometry.pushVertex(glm::vec3(-0.5, 0.5, 0.5));
    _geometry.pushVertex(glm::vec3(-0.5, -0.5, 0.5));

    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    _geometry.setColor(glm::vec4(1, 1, 1, 1));
    _geometry.pushVertex(glm::vec3(0.5, -0.5, -0.5));
    _geometry.pushVertex(glm::vec3(0.5, 0.5, -0.5));
    _geometry.pushVertex(glm::vec3(-0.5, 0.5, -0.5));
    _geometry.pushVertex(glm::vec3(-0.5, -0.5, -0.5));
    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));
    _geometry.setColor(glm::vec4(0, 1, 1, 1));
    _geometry.pushVertex(glm::vec3(0.5, -0.5, -0.5));
    _geometry.pushVertex(glm::vec3(0.5, 0.5, -0.5));
    _geometry.pushVertex(glm::vec3(0.5, 0.5, 0.5));
    _geometry.pushVertex(glm::vec3(0.5, -0.5, 0.5));
    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));
    _geometry.setColor(glm::vec4(1, 0, 1, 1));
    _geometry.pushVertex(glm::vec3(-0.5, -0.5, 0.5));
    _geometry.pushVertex(glm::vec3(-0.5, 0.5, 0.5));
    _geometry.pushVertex(glm::vec3(-0.5, 0.5, -0.5));
    _geometry.pushVertex(glm::vec3(-0.5, -0.5, -0.5));
    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));
    _geometry.setColor(glm::vec4(0, 1, 0, 1));
    _geometry.pushVertex(glm::vec3(0.5, 0.5, 0.5));
    _geometry.pushVertex(glm::vec3(0.5, 0.5, -0.5));
    _geometry.pushVertex(glm::vec3(-0.5, 0.5, -0.5));
    _geometry.pushVertex(glm::vec3(-0.5, 0.5, 0.5));
    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));
    _geometry.setColor(glm::vec4(0, 0, 1, 1));
    _geometry.pushVertex(glm::vec3(0.5, -0.5, -0.5));
    _geometry.pushVertex(glm::vec3(0.5, -0.5, 0.5));
    _geometry.pushVertex(glm::vec3(-0.5, -0.5, 0.5));
    _geometry.pushVertex(glm::vec3(-0.5, -0.5, -0.5));
    _geometry.pushUv(glm::vec2(0.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 0.0f));
    _geometry.pushUv(glm::vec2(1.0f, 1.0f));
    _geometry.pushUv(glm::vec2(0.0f, 1.0f));

    _geometry.build();
    return (true);
  }