Commit dcf9a4b1 authored by Thibault Soucarre's avatar Thibault Soucarre

Delete shaders map in render_alternate. Shader is now an attribute of class Vbo

parent 75002fc4
#include <string>
#include <map>
#include <iostream>
/* -- */
#include "trace/values/Value.hpp"
#include "trace/values/Color.hpp"
......@@ -25,8 +26,10 @@ Palette::~Palette() {
Color *Palette::get_color(const std::string &state_name) {
if(_pairs.find(state_name) != _pairs.end() /*&& is_visible(state_name)*/)
return _pairs[state_name];
else
else{
std::cout << state_name << " non trouvé" << std::endl;
return NULL;
}
}
bool Palette::is_visible(const std::string &state_name){
......
......@@ -300,6 +300,7 @@ void Settings_window::add_table_line(QTableWidget *table,
table->setCellWidget(row, 1, color_widget);
table->setCellWidget(row, 2, cb);
row ++;
}
void Settings_window::fill_table( QTableWidget *table,
......@@ -331,7 +332,17 @@ void Settings_window::fill_table( QTableWidget *table,
}
map<string, Color *>::const_iterator it;
for(it = colors_trace.begin();
it!= colors_trace.end();
it++){
if(p->get_color(it->first) == NULL){
std::cout << " Coucou " << pname << it->first << std::endl;
p->add_state(it->first, *(it->second), true);
Session::getSession().add_state_to_palette(pname, palette_list->currentText().toStdString(), it->first, *(it->second), true);
}
if(it->second == NULL)
std::cout << "Problème" << std::endl;
}
colors_settings.insert( colors_trace.begin(), colors_trace.end() );
for(it = colors_settings.begin();
......
This diff is collapsed.
......@@ -101,7 +101,7 @@ class Render_alternate : /*public QGLWidget,*/ public Hook_event, public Render
private:
int _glsl; //version of OpenGL Shading Language
Shader* _shader;
Shader* _wait_shader;
//Shader* _wait_shader;
Element_pos _container_height;
Element_col _r;
Element_col _g;
......@@ -125,13 +125,13 @@ private:
Vbo *_current;
GLuint _textureID;
std::map<EntityValue*, Vbo*> _states;
std::map<EntityValue*, Shader*> _states_shaders;
//std::map<EntityValue*, Shader*> _states_shaders;
//first element of the pair contains the points, second contains the lines
std::map<EntityValue*, std::pair<Vbo*, Vbo*> > _events;
std::map<EntityValue*, Shader*> _events_shaders;
//std::map<EntityValue*, Shader*> _events_shaders;
//first element of the pair contains the line of the arrow, second contains the position of the head
std::map<EntityValue*, std::pair<Vbo*, Vbo*> > _arrows;
std::map<EntityValue*, Shader*> _arrows_shaders;
//std::map<EntityValue*, Shader*> _arrows_shaders;
std::map<EntityValue*, std::vector<Element_pos> > _links;
/*!
* \brief Offset of the vertical helper line
......
......@@ -51,6 +51,7 @@
#include <glm/gtx/transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include "vbo.hpp"
#include "Shader.hpp"
#define ERROR(m) printf("%s", m);
......@@ -72,8 +73,8 @@ Vbo::Vbo(){
_nbVertex=0;
}
Vbo::Vbo(GLenum mode){
_mode = mode;
Vbo::Vbo(Shader *s){
_shader = s;
_nbVertex = 0;
}
......@@ -246,4 +247,15 @@ void Vbo::setNbVertex(int n){
_nbVertex = n;
}
Shader * Vbo::get_shader(){
return _shader;
}
void Vbo::delete_shader(){
delete _shader;
_shader = NULL;
}
void Vbo::set_shader(Shader *s){
_shader = s;
}
......@@ -52,7 +52,7 @@ using namespace std;
//macro used by OpenGL
#define BUFFER_OFFSET(a) ((char*)NULL + (a))
class Shader;
/*!
* \brief Manage the Vertex Buffer Object.
*/
......@@ -61,12 +61,13 @@ class Vbo{
private:
GLuint _vboID;
GLuint _vaoID;
Shader *_shader;
vector<Element_pos> _vertex;
vector<Element_col> _colors;
vector<char> _shaded;
vector<float> _shaded2;
vector<Element_pos> _texture_coord;
GLenum _mode;
//GLenum _mode;
int _nbVertex;
/*!
......@@ -75,12 +76,6 @@ private:
public:
enum Type{
TRIANGLES,
QUADS,
LINES
};
/***********************************
*
......@@ -92,7 +87,7 @@ public:
* \brief Constructor.
*/
Vbo();
Vbo(GLenum mode);
Vbo(Shader *s);
/*!
* \brief The destructor.
......@@ -119,6 +114,9 @@ public:
int getNbVertex();
void setNbVertex(int);
void config(int glsl);
Shader * get_shader();
void delete_shader();
void set_shader(Shader *s);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment