void draw(float inter) { for (auto& elit : elements) { if (elit.second->isactive()) elit.second->draw(inter); } cursor.draw(inter); }
void draw(){ // Something change?? if(*iHasChanged != -1) { onFileChange(); *iHasChanged = -1; } shader.use(); shader.setUniform("u_time", getTime()); shader.setUniform("u_mouse", getMouseX(), getMouseY()); shader.setUniform("u_resolution",getWindowWidth(), getWindowHeight()); glm::mat4 mvp = glm::mat4(1.); if (iGeom != -1) { shader.setUniform("u_eye", -cam.getPosition()); shader.setUniform("u_normalMatrix", cam.getNormalMatrix()); shader.setUniform("u_modelMatrix", model_matrix); shader.setUniform("u_viewMatrix", cam.getViewMatrix()); shader.setUniform("u_projectionMatrix", cam.getProjectionMatrix()); mvp = cam.getProjectionViewMatrix() * model_matrix; } shader.setUniform("u_modelViewProjectionMatrix", mvp); unsigned int index = 0; for (std::map<std::string,Texture*>::iterator it = textures.begin(); it!=textures.end(); ++it) { shader.setUniform(it->first,it->second,index); shader.setUniform(it->first+"Resolution",it->second->getWidth(),it->second->getHeight()); index++; } vbo->draw(&shader); if(bCursor){ cursor.draw(); } }