Commit 6f3d5c5f authored by Thibault Soucarre's avatar Thibault Soucarre

Files vertexshader and fragment shader aren't needed anymore. They're replace...

Files vertexshader and fragment shader aren't needed anymore. They're replace by code strings. Some white-spaces cleanups.
parent 9c035500
...@@ -251,8 +251,6 @@ IF(VITE_ENABLE_VBO) ...@@ -251,8 +251,6 @@ IF(VITE_ENABLE_VBO)
render/vbo.hpp render/vbo.hpp
render/Shader.hpp render/Shader.hpp
render/Render_alternate.hpp render/Render_alternate.hpp
render/text2D.hpp
render/texture.hpp
) )
SET(VITE_SRCS SET(VITE_SRCS
...@@ -260,8 +258,6 @@ IF(VITE_ENABLE_VBO) ...@@ -260,8 +258,6 @@ IF(VITE_ENABLE_VBO)
render/vbo.cpp render/vbo.cpp
render/Shader.cpp render/Shader.cpp
render/Render_alternate.cpp render/Render_alternate.cpp
render/text2D.cpp
render/texture.cpp
) )
ENDIF(VITE_ENABLE_VBO) ENDIF(VITE_ENABLE_VBO)
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
** use, modify and/or redistribute the software under the terms of the ** 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 ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info". ** URL: "http://www.cecill.info".
** **
** As a counterpart to the access to the source code and rights to copy, ** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided ** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of ** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited ** the economic rights, and the successive licensors have only limited
** liability. ** liability.
** **
** In this respect, the user's attention is drawn to the risks associated ** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the ** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software, ** software by the user in light of its specific status of free software,
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
** their requirements in conditions enabling the security of their ** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and ** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security. ** operate it in the same conditions as regards security.
** **
** The fact that you are presently reading this means that you have had ** 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. ** knowledge of the CeCILL-A license and that you accept its terms.
** **
...@@ -37,13 +37,13 @@ ...@@ -37,13 +37,13 @@
** - MARCOUEILLE Jule ** - MARCOUEILLE Jule
** - NOISETTE Pascal ** - NOISETTE Pascal
** - REDONDY Arthur ** - REDONDY Arthur
** - VUCHENER Clément ** - VUCHENER Clément
** **
*/ */
/** /**
* \file PajeFileManager.hpp * \file PajeFileManager.hpp
* Visual Trace Explorer * Visual Trace Explorer
* *
* Release Date: January, 2nd 2010 * Release Date: January, 2nd 2010
* ViTE is a software to vivisualize execution trace provided by * ViTE is a software to vivisualize execution trace provided by
...@@ -57,45 +57,45 @@ ...@@ -57,45 +57,45 @@
* @author Jule Marcoueille * @author Jule Marcoueille
* @author Pascal Noisette * @author Pascal Noisette
* @author Arthur Redondy * @author Arthur Redondy
* @author Clément Vuchener * @author Clément Vuchener
* @date 2010-01-02 * @date 2010-01-02
* *
**/ **/
#ifndef FILE_HPP #ifndef FILE_HPP
#define FILE_HPP #define FILE_HPP
#include <string.h> #include <string.h>
#define _PAJE_NBMAXTKS 16 #define _PAJE_NBMAXTKS 16
/** /**
* \struct PajeLine * \struct PajeLine
* *
* Brief structure to store informations read * Brief structure to store informations read
* on each line * on each line
* *
* \param _id Line number * \param _id Line number
* \param _nbtks Number of tokens found on the line * \param _nbtks Number of tokens found on the line
* \param _tokens Pointers on the found tokens * \param _tokens Pointers on the found tokens
* *
*/ */
typedef struct PajeLine { typedef struct PajeLine {
int _id; int _id;
int _nbtks; int _nbtks;
char **_tokens; char **_tokens;
PajeLine() {} PajeLine() {}
} PajeLine_t; } PajeLine_t;
/** /**
* \class PajeFileManager * \class PajeFileManager
* *
* File manager to read files using Paje syntax. * File manager to read files using Paje syntax.
* Each line is read one after one and stored in * Each line is read one after one and stored in
* the PajeLine structure associated to the class. * the PajeLine structure associated to the class.
* *
* \sa Parser * \sa Parser
* \sa ParserPaje * \sa ParserPaje
* \sa ParserVite * \sa ParserVite
...@@ -112,25 +112,25 @@ private: ...@@ -112,25 +112,25 @@ private:
std::string _line; std::string _line;
PajeFileManager(const PajeFileManager &); PajeFileManager(const PajeFileManager &);
public: public:
/*! /*!
* \brief Constructor for the file * \brief Constructor for the file
*/ */
PajeFileManager(); PajeFileManager();
/*! /*!
* \brief Constructor for the file * \brief Constructor for the file
* \param filename : a filename * \param filename : a filename
*/ */
PajeFileManager(const char * filename, ios_base::openmode mode = ios_base::in ); PajeFileManager(const char * filename, ios_base::openmode mode = ios_base::in );
/*! /*!
* \brief Destructor * \brief Destructor
* Destroy the file * Destroy the file
*/ */
~PajeFileManager(); ~PajeFileManager();
/*! /*!
* \fn open(const char * filename, ios_base::openmode mode) * \fn open(const char * filename, ios_base::openmode mode)
* \brief Open the file * \brief Open the file
...@@ -156,7 +156,7 @@ public: ...@@ -156,7 +156,7 @@ public:
* \return The size already loaded * \return The size already loaded
*/ */
long long get_size_loaded(); long long get_size_loaded();
/*! /*!
* \fn get_percent_loaded() * \fn get_percent_loaded()
* \return The percent of the file loaded (between 0 and 1). * \return The percent of the file loaded (between 0 and 1).
......
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
** use, modify and/or redistribute the software under the terms of the ** 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 ** CeCILL-A license as circulated by CEA, CNRS and INRIA at the following
** URL: "http://www.cecill.info". ** URL: "http://www.cecill.info".
** **
** As a counterpart to the access to the source code and rights to copy, ** As a counterpart to the access to the source code and rights to copy,
** modify and redistribute granted by the license, users are provided ** modify and redistribute granted by the license, users are provided
** only with a limited warranty and the software's author, the holder of ** only with a limited warranty and the software's author, the holder of
** the economic rights, and the successive licensors have only limited ** the economic rights, and the successive licensors have only limited
** liability. ** liability.
** **
** In this respect, the user's attention is drawn to the risks associated ** In this respect, the user's attention is drawn to the risks associated
** with loading, using, modifying and/or developing or reproducing the ** with loading, using, modifying and/or developing or reproducing the
** software by the user in light of its specific status of free software, ** software by the user in light of its specific status of free software,
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
** their requirements in conditions enabling the security of their ** their requirements in conditions enabling the security of their
** systems and/or data to be ensured and, more generally, to use and ** systems and/or data to be ensured and, more generally, to use and
** operate it in the same conditions as regards security. ** operate it in the same conditions as regards security.
** **
** The fact that you are presently reading this means that you have had ** 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. ** knowledge of the CeCILL-A license and that you accept its terms.
** **
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
** - MARCOUEILLE Jule ** - MARCOUEILLE Jule
** - NOISETTE Pascal ** - NOISETTE Pascal
** - REDONDY Arthur ** - REDONDY Arthur
** - VUCHENER Clément ** - VUCHENER Clément
** **
*/ */
...@@ -80,5 +80,3 @@ void Parser::finish() { ...@@ -80,5 +80,3 @@ void Parser::finish() {
void Parser::set_canceled() { void Parser::set_canceled() {
_is_canceled = true; _is_canceled = true;
} }
...@@ -98,7 +98,7 @@ static bool _draw_counter; ...@@ -98,7 +98,7 @@ static bool _draw_counter;
**********************************/ **********************************/
Render_alternate::Render_alternate(Core* core, QWidget *parent, const QGLFormat& format) Render_alternate::Render_alternate(Core* core, QWidget *parent, const QGLFormat& format)
: Hook_event(this, core, parent, format), _containers(GL_QUADS), _states(GL_QUADS), _circles(GL_POLYGON), _arrows(GL_LINE), _counters(GL_LINE), _ruler(GL_QUADS), _shader("vertexshader.vertexshader", "fragmentshader.fragmentshader"), _modelview(glm::mat4(1.0)), _projection(glm::mat4(1.0)){ : Hook_event(this, core, parent, format), _containers(GL_QUADS), _states(GL_QUADS), _circles(GL_POLYGON), _arrows(GL_LINE), _counters(GL_LINE), _ruler(GL_QUADS), _shader(/*"vertexshader.vertexshader", "fragmentshader.fragmentshader"*/), _modelview(glm::mat4(1.0)), _projection(glm::mat4(1.0)){
setAutoFillBackground(false); setAutoFillBackground(false);
......
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
// Constructeurs et Destructeur // Constructeurs et Destructeur
Shader::Shader() : m_vertexID(0), m_fragmentID(0), m_programID(0), m_vertexSource(), m_fragmentSource() /*Shader::Shader() : m_vertexID(0), m_fragmentID(0), m_programID(0), m_vertexSource(), m_fragmentSource()
{ {
} }
*/
Shader::Shader(Shader const &shaderACopier) Shader::Shader(Shader const &shaderACopier)
{ {
// Copie des fichiers sources // Copie des fichiers sources
m_vertexSource = shaderACopier.m_vertexSource; m_vertex_code = shaderACopier.m_vertex_code;
m_fragmentSource = shaderACopier.m_fragmentSource; m_fragment_code = shaderACopier.m_fragment_code;
// Chargement du nouveau shader // Chargement du nouveau shader
...@@ -23,8 +23,8 @@ Shader::Shader(Shader const &shaderACopier) ...@@ -23,8 +23,8 @@ Shader::Shader(Shader const &shaderACopier)
} }
Shader::Shader(std::string vertexSource, std::string fragmentSource) : m_vertexID(0), m_fragmentID(0), m_programID(0), Shader::Shader() : m_vertexID(0), m_fragmentID(0), m_programID(0),
m_vertexSource(vertexSource), m_fragmentSource(fragmentSource) m_vertex_code("#version 330 core \n in vec2 in_Vertex; \n in vec3 in_Color; \n uniform mat4 MVP; \n out vec3 color; \n void main(){ \n gl_Position = MVP * vec4(in_Vertex, 0.0, 1.0); \n color = in_Color; \n }"), m_fragment_code("#version 330 core \n in vec3 color; \n out vec4 out_Color; \n void main(){ \n out_Color = vec4(color, 0.5); \n }")
{ {
} }
...@@ -45,8 +45,8 @@ Shader& Shader::operator=(Shader const &shaderACopier) ...@@ -45,8 +45,8 @@ Shader& Shader::operator=(Shader const &shaderACopier)
{ {
// Copie des fichiers sources // Copie des fichiers sources
m_vertexSource = shaderACopier.m_vertexSource; m_vertex_code = shaderACopier.m_vertex_code;
m_fragmentSource = shaderACopier.m_fragmentSource; m_fragment_code = shaderACopier.m_fragment_code;
// Chargement du nouveau shader // Chargement du nouveau shader
...@@ -75,10 +75,10 @@ bool Shader::charger() ...@@ -75,10 +75,10 @@ bool Shader::charger()
*/ */
// Compilation des shaders // Compilation des shaders
if(!compilerShader(m_vertexID, GL_VERTEX_SHADER, m_vertexSource)) if(!compilerShader(m_vertexID, GL_VERTEX_SHADER, m_vertex_code))
return false; return false;
if(!compilerShader(m_fragmentID, GL_FRAGMENT_SHADER, m_fragmentSource)) if(!compilerShader(m_fragmentID, GL_FRAGMENT_SHADER, m_fragment_code))
return false; return false;
...@@ -154,7 +154,7 @@ bool Shader::charger() ...@@ -154,7 +154,7 @@ bool Shader::charger()
} }
bool Shader::compilerShader(GLuint &shader, GLenum type, std::string const &fichierSource) bool Shader::compilerShader(GLuint &shader, GLenum type, std::string code)
{ {
// Création du shader // Création du shader
...@@ -170,49 +170,50 @@ bool Shader::compilerShader(GLuint &shader, GLenum type, std::string const &fich ...@@ -170,49 +170,50 @@ bool Shader::compilerShader(GLuint &shader, GLenum type, std::string const &fich
} }
// Flux de lecture // // Flux de lecture
std::ifstream fichier(fichierSource.c_str()); // std::ifstream fichier(fichierSource.c_str());
// Test d'ouverture // // Test d'ouverture
if(!fichier) // if(!fichier)
{ // {
std::cout << "Erreur le fichier " << fichierSource << " est introuvable" << std::endl; // std::cout << "Erreur le fichier " << fichierSource << " est introuvable" << std::endl;
glDeleteShader(shader); // glDeleteShader(shader);
return false; // return false;
} // }
// Strings permettant de lire le code source // // Strings permettant de lire le code source
std::string ligne; // std::string ligne;
std::string codeSource; // std::string codeSource;
// Lecture // // Lecture
while(getline(fichier, ligne)) // while(getline(fichier, ligne))
codeSource += ligne + '\n'; // codeSource += ligne + '\n';
// Fermeture du fichier // // Fermeture du fichier
fichier.close(); // fichier.close();
// Récupération de la chaine C du code source // // Récupération de la chaine C du code source
const GLchar* chaineCodeSource = codeSource.c_str(); // const GLchar* chaineCodeSource = codeSource.c_str();
// Envoi du code source au shader // Envoi du code source au shader
std::cout << "compilation shader" << std::endl;
const GLchar* chaineCodeSource = code.c_str();
glShaderSource(shader, 1, &chaineCodeSource, 0); glShaderSource(shader, 1, &chaineCodeSource, 0);
// Compilation du shader // Compilation du shader
glCompileShader(shader); glCompileShader(shader);
...@@ -246,8 +247,9 @@ bool Shader::compilerShader(GLuint &shader, GLenum type, std::string const &fich ...@@ -246,8 +247,9 @@ bool Shader::compilerShader(GLuint &shader, GLenum type, std::string const &fich
// Affichage de l'erreur // Affichage de l'erreur
std::cout << "Erreur Shader" << std::endl;
std::cout << erreur << std::endl; std::cout << erreur << std::endl;
std::cout << "compilation terminée" << std::endl;
// Libération de la mémoire et retour du booléen false // Libération de la mémoire et retour du booléen false
......
...@@ -19,13 +19,13 @@ class Shader ...@@ -19,13 +19,13 @@ class Shader
Shader(); Shader();
Shader(Shader const &shaderACopier); Shader(Shader const &shaderACopier);
Shader(std::string vertexSource, std::string fragmentSource); //Shader();
~Shader(); ~Shader();
Shader& operator=(Shader const &shaderACopier); Shader& operator=(Shader const &shaderACopier);
bool charger(); bool charger();
bool compilerShader(GLuint &shader, GLenum type, std::string const &fichierSource); bool compilerShader(GLuint &shader, GLenum type, std::string code);
GLuint getProgramID() const; GLuint getProgramID() const;
private: private:
...@@ -34,8 +34,8 @@ class Shader ...@@ -34,8 +34,8 @@ class Shader
GLuint m_fragmentID; GLuint m_fragmentID;
GLuint m_programID; GLuint m_programID;
std::string m_vertexSource; std::string m_vertex_code;
std::string m_fragmentSource; std::string m_fragment_code;
}; };
#endif #endif
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