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)
render/vbo.hpp
render/Shader.hpp
render/Render_alternate.hpp
render/text2D.hpp
render/texture.hpp
)
SET(VITE_SRCS
......@@ -260,8 +258,6 @@ IF(VITE_ENABLE_VBO)
render/vbo.cpp
render/Shader.cpp
render/Render_alternate.cpp
render/text2D.cpp
render/texture.cpp
)
ENDIF(VITE_ENABLE_VBO)
......
......@@ -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,13 +37,13 @@
** - MARCOUEILLE Jule
** - NOISETTE Pascal
** - REDONDY Arthur
** - VUCHENER Clément
** - VUCHENER Clément
**
*/
/**
* \file PajeFileManager.hpp
* Visual Trace Explorer
* Visual Trace Explorer
*
* Release Date: January, 2nd 2010
* ViTE is a software to vivisualize execution trace provided by
......@@ -57,45 +57,45 @@
* @author Jule Marcoueille
* @author Pascal Noisette
* @author Arthur Redondy
* @author Clément Vuchener
* @author Clément Vuchener
* @date 2010-01-02
*
**/
#ifndef FILE_HPP
#define FILE_HPP
#include <string.h>
#define _PAJE_NBMAXTKS 16
/**
* \struct PajeLine
* \struct PajeLine
*
* Brief structure to store informations read
* Brief structure to store informations read
* on each line
*
* \param _id Line number
* \param _nbtks Number of tokens found on the line
* \param _tokens Pointers on the found tokens
*
*
*/
typedef struct PajeLine {
int _id;
int _nbtks;
char **_tokens;
PajeLine() {}
} PajeLine_t;
/**
* \class PajeFileManager
*
*
* 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.
*
*
* \sa Parser
* \sa ParserPaje
* \sa ParserVite
......@@ -112,25 +112,25 @@ private:
std::string _line;
PajeFileManager(const PajeFileManager &);
public:
/*!
* \brief Constructor for the file
*/
PajeFileManager();
/*!
* \brief Constructor for the file
* \param filename : a filename
*/
PajeFileManager(const char * filename, ios_base::openmode mode = ios_base::in );
/*!
* \brief Destructor
* Destroy the file
*/
~PajeFileManager();
/*!
* \fn open(const char * filename, ios_base::openmode mode)
* \brief Open the file
......@@ -156,7 +156,7 @@ public:
* \return The size already loaded
*/
long long get_size_loaded();
/*!
* \fn get_percent_loaded()
* \return The percent of the file loaded (between 0 and 1).
......
......@@ -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
**
*/
......@@ -80,5 +80,3 @@ void Parser::finish() {
void Parser::set_canceled() {
_is_canceled = true;
}
......@@ -98,7 +98,7 @@ static bool _draw_counter;
**********************************/
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);
......
......@@ -4,17 +4,17 @@
// 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)
{
// Copie des fichiers sources
m_vertexSource = shaderACopier.m_vertexSource;
m_fragmentSource = shaderACopier.m_fragmentSource;
m_vertex_code = shaderACopier.m_vertex_code;
m_fragment_code = shaderACopier.m_fragment_code;
// Chargement du nouveau shader
......@@ -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),
m_vertexSource(vertexSource), m_fragmentSource(fragmentSource)
Shader::Shader() : m_vertexID(0), m_fragmentID(0), m_programID(0),
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)
{
// Copie des fichiers sources
m_vertexSource = shaderACopier.m_vertexSource;
m_fragmentSource = shaderACopier.m_fragmentSource;
m_vertex_code = shaderACopier.m_vertex_code;
m_fragment_code = shaderACopier.m_fragment_code;
// Chargement du nouveau shader
......@@ -75,10 +75,10 @@ bool Shader::charger()
*/
// Compilation des shaders
if(!compilerShader(m_vertexID, GL_VERTEX_SHADER, m_vertexSource))
if(!compilerShader(m_vertexID, GL_VERTEX_SHADER, m_vertex_code))
return false;
if(!compilerShader(m_fragmentID, GL_FRAGMENT_SHADER, m_fragmentSource))
if(!compilerShader(m_fragmentID, GL_FRAGMENT_SHADER, m_fragment_code))
return false;
......@@ -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
......@@ -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)
{
std::cout << "Erreur le fichier " << fichierSource << " est introuvable" << std::endl;
glDeleteShader(shader);
// if(!fichier)
// {
// std::cout << "Erreur le fichier " << fichierSource << " est introuvable" << std::endl;
// 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 codeSource;
// std::string ligne;
// std::string codeSource;
// Lecture
// // Lecture
while(getline(fichier, ligne))
codeSource += ligne + '\n';
// while(getline(fichier, ligne))
// 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
std::cout << "compilation shader" << std::endl;
const GLchar* chaineCodeSource = code.c_str();
glShaderSource(shader, 1, &chaineCodeSource, 0);
// Compilation du shader
glCompileShader(shader);
......@@ -246,8 +247,9 @@ bool Shader::compilerShader(GLuint &shader, GLenum type, std::string const &fich
// Affichage de l'erreur
std::cout << "Erreur Shader" << 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
......
......@@ -19,13 +19,13 @@ class Shader
Shader();
Shader(Shader const &shaderACopier);
Shader(std::string vertexSource, std::string fragmentSource);
//Shader();
~Shader();
Shader& operator=(Shader const &shaderACopier);
bool charger();
bool compilerShader(GLuint &shader, GLenum type, std::string const &fichierSource);
bool compilerShader(GLuint &shader, GLenum type, std::string code);
GLuint getProgramID() const;
private:
......@@ -34,8 +34,8 @@ class Shader
GLuint m_fragmentID;
GLuint m_programID;
std::string m_vertexSource;
std::string m_fragmentSource;
std::string m_vertex_code;
std::string m_fragment_code;
};
#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