Commit 96ffbb82 authored by Thibault Soucarre's avatar Thibault Soucarre

Whitespaces

parent 80d574d0
......@@ -6,13 +6,13 @@
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
......@@ -23,7 +23,7 @@
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
......@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
** - VUCHENER Clément
**
*/
/*!
......@@ -95,7 +95,7 @@ Render_alternate::Render_alternate(Core* core, QWidget *parent, const QGLFormat&
_vbos.clear();
setAutoFillBackground(false);
}
......@@ -123,106 +123,106 @@ void Render_alternate::initializeGL() {
void Render_alternate::resizeGL(int width, int height) {
glViewport(0, 0, width, height);
/* update informations about widget size */
Info::Screen::width = width;
Info::Screen::height = height;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(DRAWING_STATE_WAITING == _state){// A wait is drawn
glOrtho(-50, 50, -50, 50, 0, 1000);
}else if (DRAWING_STATE_DRAWING == _state){// A trace is drawn
}else if (DRAWING_STATE_DRAWING == _state){// A trace is drawn
glOrtho(0, Info::Render::width, 0, Info::Render::height, 0, -1000);
}else{
message << tr("Undefined value for the drawing state attribute - Render area").toStdString() << Message::ende;
}
glMatrixMode(GL_MODELVIEW);
}
void Render_alternate::paintGL(){
resizeGL(Render_alternate::QGLWidget::width(), Render_alternate::QGLWidget::height());
Render_alternate::QGLWidget::setFocus(Qt::ActiveWindowFocusReason);/* give the focus to the render area for mouse and keyboard events */
glClearDepth(1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
if(DRAWING_STATE_WAITING == _state){/* A wait is drawn */
/* turn around y axis */
_wait_angle+=0.1f;
if (_wait_angle>=360) _wait_angle=0.0f;
glPushMatrix();
glScalef(15, 15, 0);
glRotatef(-_wait_angle,0, 1, 0);
glRotatef(_wait_angle_y, 1, 0, 0);
glPopMatrix();
}else if (DRAWING_STATE_DRAWING == _state){/* A trace is drawn */
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glPushMatrix();
{
{
glTranslated(0.0, Info::Render::height, 100.0);
glRotated(180.0, 1.0, 0.0, 0.0);
glRotated(180.0, 1.0, 0.0, 0.0);
glPushMatrix();
{
glTranslated(_default_entity_x_translate - _x_state_translate, _ruler_y + _ruler_height - _y_state_translate, 0.0);
glScalef(_x_state_scale, _y_state_scale, 1.0);
for (unsigned int i=0 ;
for (unsigned int i=0 ;
i<_vbos.size() ;
i++){
_vbos[i]->display();
}
}
glPopMatrix();
glPopMatrix();
call_ruler();
if (false == Info::Render::_no_arrows)/* display arrows */
draw_stored_arrows();
if (false == Info::Render::_no_events)/* display events */
draw_stored_circles();
}
glPopMatrix();
glPushMatrix();
{
glTranslated(0.0, 0.0, 100.0);/* not accurate */
if (_mouse_pressed){
glTranslated(0.0, 0.0, _z_container_under);
Element_pos old_x, old_y, new_x, new_y;
old_x = _mouse_x*(Info::Render::width/Info::Screen::width);
old_y = Info::Render::height - _mouse_y*(Info::Render::height/Info::Screen::height);
......@@ -230,14 +230,14 @@ void Render_alternate::paintGL(){
new_y = Info::Render::height - _new_mouse_y*(Info::Render::height/Info::Screen::height);
#ifdef DEBUG_MODE_RENDER_OPENGL
cerr << __FILE__ << " l." << __LINE__ << ":" << endl;
cerr << "Selection rectangle position: (" << old_x << ", " << old_y << ") - (" << new_x << ", " << new_y << ")" << endl;
cerr << __FILE__ << " l." << __LINE__ << ":" << endl;
cerr << "Selection rectangle position: (" << old_x << ", " << old_y << ") - (" << new_x << ", " << new_y << ")" << endl;
#endif
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* Square for selection */
glBegin(GL_QUADS);
{
......@@ -247,9 +247,9 @@ void Render_alternate::paintGL(){
glColor4d(0.9, 0.9, 0.9, _selection_rectangle_alpha);glVertex2d(new_x, old_y);
}
glEnd();
glDisable(GL_BLEND);
}/* end if (true==_mouse_pressed) */
}
glPopMatrix();
......@@ -259,7 +259,7 @@ void Render_alternate::paintGL(){
}else{
message << tr("Undefined value for the drawing state attribute - Render area").toStdString() << Message::ende;
}
glFlush();
......@@ -321,26 +321,26 @@ void Render_alternate::paintGL(){
renderText (render_to_screen_x(
trace_to_render_x(
(Info::Render::_x_min_visible +
Info::Render::_x_max_visible) / 2)),
(Info::Render::_x_min_visible +
Info::Render::_x_max_visible) / 2)),
render_to_screen_y(3),
buf_txt.str().c_str(),
arial_font);
arial_font.setPointSize(10);
for (Element_pos i = Info::Render::_x_min_visible ;
i < Info::Render::_x_max_visible ;
for (Element_pos i = Info::Render::_x_min_visible ;
i < Info::Render::_x_max_visible ;
i+=graduation_diff){
buf_txt.str("");/* flush the buffer */
buf_txt << Ruler::get_variable_part(i, coeff_prefix, 2);
renderText (render_to_screen_x(trace_to_render_x(i)+1),
render_to_screen_y(8),
buf_txt.str().c_str(),
arial_font);
}
}
}
......@@ -360,7 +360,7 @@ void Render_alternate::paintGL(){
bool Render_alternate::build(){
_state = DRAWING_STATE_DRAWING;/* change the drawing state */
/* disable some OpenGL features to enhance the rendering */
......@@ -373,7 +373,7 @@ bool Render_alternate::build(){
_y_state_translate = 0;/* for states translation */
_x_scroll_pos = 0;/* horizontal bar placed on 0 */
_y_scroll_pos = 0;/* vertical bar placed on 0 */
if (NULL == _render_instance)
return true;
......@@ -383,7 +383,7 @@ bool Render_alternate::build(){
bool Render_alternate::unbuild(){
/**********************
*
* Init OpenGL features
......@@ -393,10 +393,10 @@ bool Render_alternate::unbuild(){
/* enable some OpenGL features*/
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);/* enable blending for the alpha color */
glEnable(GL_BLEND);/* enable blending for the alpha color */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor3d(1.0, 1.0, 1.0);/* init color to white */
......@@ -413,7 +413,7 @@ bool Render_alternate::unbuild(){
_wait_angle=0.0f;/* begin with 0 rad angle */
_wait_angle_y=0.0f;/* begin with 0 rad angle */
/* init measurement attributes */
/* init measurement attributes */
Info::Container::x_max = 0;
Info::Container::y_max = 0;
Info::Container::x_min = 0;
......@@ -437,7 +437,7 @@ bool Render_alternate::unbuild(){
_circles.clear();
_texts.clear();
for (unsigned int i=0 ;
for (unsigned int i=0 ;
i<_vbos.size() ;
i++){
delete _vbos[i];
......@@ -449,7 +449,7 @@ bool Render_alternate::unbuild(){
/* clear the arrow vector */
// _arrows.clear();
/* empty the selection stack */
while(false == _previous_selection.empty())
_previous_selection.pop();
......@@ -460,7 +460,7 @@ bool Render_alternate::unbuild(){
/* Now, timer is set */
if (_wait_timer == NULL){
_wait_angle = 0.0f;
/* _wait_timer = new QTimer(this);
connect(_wait_timer, SIGNAL(timeout()), _render_instance, SLOT(updateGL()));
_wait_timer->start(_wait_spf);*/
......@@ -490,26 +490,26 @@ GLuint Render_alternate::draw_wait() {
GLuint object;
GLuint texture;
glGenTextures(1, &texture);/* create the texture and link it with the list previously created */
glGenTextures(1, &texture);/* create the texture and link it with the list previously created */
QFile texture_file(QString(":/img/img/logo") + QDate::currentDate().toString("MMdd") + QString(".png"));
if (true == texture_file.exists())/* The texture exists */
texture = bindTexture(QPixmap(texture_file.fileName()), GL_TEXTURE_2D);
else/* use the default picture */
texture = bindTexture(QPixmap(":/img/img/logo.png"), GL_TEXTURE_2D);
/* apply some parameters on the texture */
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);/* enable blending for the alpha color */
glEnable(GL_BLEND);/* enable blending for the alpha color */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* Now, timer is set */
if (_wait_timer == NULL){
_wait_angle = 0.0f;
......@@ -533,12 +533,12 @@ void Render_alternate::call_ruler(){
const Element_pos offset_y = _ruler_y + _ruler_height+3.5;
update_visible_interval_value();
graduation_diff = Ruler::get_graduation_diff(Info::Render::_x_min_visible, Info::Render::_x_max_visible);
coeff_prefix = Ruler::get_coeff_for_common_prefix(Info::Render::_x_min_visible, Info::Render::_x_max_visible);
set_color(1.0, 1.0, 1.0);
for (Element_pos i = Info::Render::_x_min_visible ; i < Info::Render::_x_max_visible ; i+=graduation_diff){
const Element_pos grad_div_by_5 = graduation_diff/5;
for (Element_pos j = (i+grad_div_by_5) ; j<(i+graduation_diff) ; j+= grad_div_by_5){
......@@ -549,7 +549,7 @@ void Render_alternate::call_ruler(){
draw_line( trace_to_render_x(i) + offset_x, offset_y-1 ,
trace_to_render_x(i) + offset_x, 4+offset_y, _z_ruler);
}
glBegin(GL_QUADS);
{
glColor4d(0.0, 0.0, 1.0, 0.8);
......@@ -559,7 +559,7 @@ void Render_alternate::call_ruler(){
glVertex3d(trace_to_render_x(Info::Render::_x_max_visible) , 0, _z_ruler_under );
}
glEnd();
glBegin(GL_QUADS);
{
glColor4d(0.0, 0.0, 0.0, 1.0);
......@@ -569,9 +569,9 @@ void Render_alternate::call_ruler(){
glVertex3d(trace_to_render_x(Info::Render::_x_max_visible) , 0, _z_ruler_over );
}
glEnd();
return;
}
}
......@@ -608,7 +608,7 @@ void Render_alternate::draw_quad(Element_pos x, Element_pos y, Element_pos z, El
data[0] = x + offset_x;
data[1] = y + offset_y;
data[2] = x + offset_x;
data[2] = x + offset_x;
data[3] = y + h + offset_y;
data[4] = x + w + offset_x;
data[5] = y + h + offset_y;
......@@ -622,8 +622,8 @@ void Render_alternate::draw_quad(Element_pos x, Element_pos y, Element_pos z, El
if (Vbo::VBO_OUT_OF_MEMORY == state){
/* Store the current vbo */
_vbos.push_back(_current_vbo);
_vbos.push_back(_current_vbo);
/* Create a new vbo */
_current_vbo = NULL;/* DO NOT DEALLOCATE BEFORE! */
_current_vbo = new Vbo(100000, _current_vbo->QUADS);
......@@ -678,7 +678,7 @@ void Render_alternate::start_draw(){
_draw_event = false;
_current_vbo = NULL;
}
void Render_alternate::start_draw_containers(){
......@@ -686,13 +686,13 @@ void Render_alternate::start_draw_containers(){
if (_list_containers == 0) {
*Message::get_instance() << tr("Error when creating list.").toStdString() << Message::endw;
}
glNewList(_list_containers, GL_COMPILE);/* open the list */
_draw_container = true;
}
void Render_alternate::draw_container(const Element_pos , const Element_pos , const Element_pos , const Element_pos ){
}
void Render_alternate::draw_container_text(const Element_pos , const Element_pos , const std::string ){
......@@ -805,14 +805,14 @@ void Render_alternate::draw_stored_arrows(){
const unsigned int arrow_size = _arrows.size();
for (unsigned int i=0 ; i<arrow_size ; i++){
start_time = _arrows[i].start_time;// + _x_state_scale*_x_state_translate;
end_time = _arrows[i].end_time;// + _x_state_scale*_x_state_translate;
start_height = _arrows[i].start_height;
end_height = _arrows[i].end_height;
set_color(_arrows[i].red, _arrows[i].green, _arrows[i].blue);
scaled_start_time = start_time * _x_state_scale;
scaled_end_time = end_time * _x_state_scale;
scaled_start_height = start_height * _y_state_scale;
......@@ -820,8 +820,8 @@ void Render_alternate::draw_stored_arrows(){
glPushMatrix();
{
glTranslated(_default_entity_x_translate + _x_state_scale*end_time - _x_state_translate,
glTranslated(_default_entity_x_translate + _x_state_scale*end_time - _x_state_translate,
_ruler_y + _ruler_height + _y_state_scale*end_height - _y_state_translate,
_z_arrow);
......@@ -831,7 +831,7 @@ void Render_alternate::draw_stored_arrows(){
}
else
glRotatef(90, 0, 0, 1);/* vertical alignment */
glBegin(GL_TRIANGLES);
{
// glColor3d(_red, _green, _blue);
......@@ -840,18 +840,18 @@ void Render_alternate::draw_stored_arrows(){
glVertex2d(-1.2, 0.4);
}
glEnd();
}
glPopMatrix();
glPushMatrix();
{
glTranslated(_default_entity_x_translate - _x_state_translate,
_ruler_y + _ruler_height - _y_state_translate,
_z_arrow);
glScalef(_x_state_scale, _y_state_scale, 1.0);
glBegin(GL_LINES);
{
glVertex2d(start_time, start_height);
......@@ -872,44 +872,44 @@ void Render_alternate::draw_stored_circles(){
const unsigned int size = _circles.size();
for (unsigned int i=0 ; i<size ; i++){
glPushMatrix();
{
set_color(1.0 - _circles[i].red, 1.0 - _circles[i].green, 1.0 - _circles[i].blue);
set_color(1.0 - _circles[i].red, 1.0 - _circles[i].green, 1.0 - _circles[i].blue);
glTranslated(_default_entity_x_translate - _x_state_translate,
_ruler_y + _ruler_height - _y_state_translate,
_z_arrow);
glScalef(_x_state_scale, _y_state_scale, 1.0);
glScalef(_x_state_scale, _y_state_scale, 1.0);
/* Draw the circle */
glBegin(GL_POLYGON);
{
for(int j = 0 ; j < step ; j ++){
glVertex2d(_circles[i].time + cos(angle+delta_angle*j)*radius/_x_state_scale,
_circles[i].height + sin(angle+delta_angle*j)*(radius/_y_state_scale)*Info::Screen::width/Info::Screen::height);
_circles[i].height + sin(angle+delta_angle*j)*(radius/_y_state_scale)*Info::Screen::width/Info::Screen::height);
}
}
glEnd();
set_color(_circles[i].red, _circles[i].green, _circles[i].blue);
set_color(_circles[i].red, _circles[i].green, _circles[i].blue);
/* Draw the sub-circle */
glBegin(GL_POLYGON);
{
for(int j = 0 ; j < step ; j ++){
glVertex3d(_circles[i].time + cos(angle+delta_angle*j)*radius/(1.2*_x_state_scale) ,
_circles[i].height + sin(angle+delta_angle*j)*radius/(1.2*_y_state_scale)*Info::Screen::width/Info::Screen::height ,
_circles[i].height + sin(angle+delta_angle*j)*radius/(1.2*_y_state_scale)*Info::Screen::width/Info::Screen::height ,
0.1);
}
}
glEnd();
glLineWidth( 3.0 );
/* Draw the line */
glBegin(GL_LINES);
......@@ -927,6 +927,5 @@ void Render_alternate::draw_stored_circles(){
}
set_color(1.0, 1.0, 1.0);
}
......@@ -6,13 +6,13 @@
** use, modify and/or redistribute the software under the terms of the
** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info".
**
**
** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited
** liability.
**
**
** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software,
......@@ -23,7 +23,7 @@
** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security.
**
**
** The fact that you are presently reading this means that you have had
** knowledge of the CeCILL-A license and that you accept its terms.
**
......@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
** - VUCHENER Clément
**
*/
/*!
......@@ -87,9 +87,9 @@ struct Event_{
class Render_alternate : /*public QGLWidget,*/ public Hook_event, public Render_template
{
Q_OBJECT
protected:
/*!
* \brief Contains the parent instance.
*/
......@@ -105,25 +105,25 @@ protected:
* \brief The container GLu list.
*/
GLuint _list_containers;
/*!
* \brief The state GLu list.
*/
GLuint _list_states;
/*!
* \brief The counter GLu list.
*/
GLuint _list_counters;
/*!
* \brief The wait GLu list.
*/
// GLuint _wait_list;
float _red, _green, _blue;