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); }
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); }