Commit 85fd18da authored by thery's avatar thery

update systeme de compilation des shaders pour windows

parent 477b3868
...@@ -20,6 +20,7 @@ IF(WIN32) ...@@ -20,6 +20,7 @@ IF(WIN32)
add_subdirectory(gzstream/Build) add_subdirectory(gzstream/Build)
add_subdirectory(Numerical) add_subdirectory(Numerical)
add_subdirectory(Assimp/code) add_subdirectory(Assimp/code)
add_subdirectory(Tools)
# if(CMAKE_CONFIGURATION_TYPES) # if(CMAKE_CONFIGURATION_TYPES)
# set(CMAKE_CONFIGURATION_TYPES Release) # set(CMAKE_CONFIGURATION_TYPES Release)
# set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Use only Release configuration for ThirdParty" FORCE) # set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Use only Release configuration for ThirdParty" FORCE)
......
...@@ -4,6 +4,8 @@ project(Tools) ...@@ -4,6 +4,8 @@ project(Tools)
SET (CMAKE_BUILD_TYPE Release) SET (CMAKE_BUILD_TYPE Release)
SET(EXECUTABLE_OUTPUT_PATH ${CGoGN_ROOT_DIR}/ThirdParty/Tools)
add_executable( shader_to_h shader_to_h.cpp ) add_executable( shader_to_h shader_to_h.cpp )
target_link_libraries( shader_to_h ) target_link_libraries( shader_to_h )
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char buffer[512]; char buffer[512];
for (unsigned int i=1; i< argc; ++i) for (int i=1; i< argc; ++i)
{ {
std::string filename(argv[i]); std::string filename(argv[i]);
...@@ -54,13 +54,22 @@ int main(int argc, char **argv) ...@@ -54,13 +54,22 @@ int main(int argc, char **argv)
sso << "std::string "<<sub<< " ="; sso << "std::string "<<sub<< " =";
// text of shader // text of shader
unsigned int nbbl=0;
while (!fs.eof()) while (!fs.eof())
{ {
fs.getline(buffer,512); fs.getline(buffer,512);
if (!fs.eof() && (*buffer!=0)) //std::cout << buffer << std::endl;
if (*buffer!=0)
{
for (unsigned int i=0; i<nbbl;++i)
sso << std::endl <<"\"\\n\"";
nbbl=0;
sso << std::endl << "\"" << buffer <<"\\n\""; sso << std::endl << "\"" << buffer <<"\\n\"";
}
else
nbbl++;
}; };
sso << ";"<< std::endl<< std::endl; sso << ";"<< std::endl<< std::endl;
std::string ssostr = sso.str(); std::string ssostr = sso.str();
if (ssostr != ssi.str()) if (ssostr != ssi.str())
......
...@@ -79,10 +79,21 @@ file( ...@@ -79,10 +79,21 @@ file(
${CGoGN_ROOT_DIR}/include/Utils/Shaders*.geom ${CGoGN_ROOT_DIR}/include/Utils/Shaders*.geom
) )
IF(WIN32)
add_custom_target(shader_targetD ${CGoGN_ROOT_DIR}/ThirdParty/Tools/Release/shader_to_h ${shaders_srcD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES ${shaders_srcD}
)
ELSE(WIN32)
add_custom_target(shader_targetD ${CGoGN_ROOT_DIR}/ThirdParty/Tools/shader_to_h ${shaders_srcD} add_custom_target(shader_targetD ${CGoGN_ROOT_DIR}/ThirdParty/Tools/shader_to_h ${shaders_srcD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES ${shaders_srcD} SOURCES ${shaders_srcD}
) )
ENDIF(WIN32)
file( file(
......
...@@ -93,10 +93,19 @@ file( ...@@ -93,10 +93,19 @@ file(
${CGoGN_ROOT_DIR}/include/Utils/Shaders*.geom ${CGoGN_ROOT_DIR}/include/Utils/Shaders*.geom
) )
IF(WIN32)
add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/Tools/Release/shader_to_h ${shaders_src}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES ${shaders_src}
)
ELSE(WIN32)
add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/Tools/shader_to_h ${shaders_src} add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/Tools/shader_to_h ${shaders_src}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES ${shaders_src} SOURCES ${shaders_src}
) )
ENDIF(WIN32)
......
...@@ -7,4 +7,4 @@ FRAG_OUT_DEF; ...@@ -7,4 +7,4 @@ FRAG_OUT_DEF;
void main (void) void main (void)
{ {
float lum = texture2D(FontTexture, tex_coord).s;; float lum = texture2D(FontTexture, tex_coord).s;;
} // no "}" because it is added in the shader class code (with other things)
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
ATTRIBUTE vec4 VertexPosition; ATTRIBUTE vec4 VertexPosition;
uniform mat4 ModelViewMatrix; uniform mat4 ModelViewMatrix;
uniform mat4 ProjectionMatrix uniform mat4 ProjectionMatrix;
uniform vec3 strPos; uniform vec3 strPos;
uniform float scale; uniform float scale;
VARYING_VERT vec2 tex_coord; VARYING_VERT vec2 tex_coord;
...@@ -12,4 +12,5 @@ void main () ...@@ -12,4 +12,5 @@ void main ()
vec4 pos = ModelViewMatrix * vec4(strPos,1.0) + vec4(VertexPosition[0]*scale,VertexPosition[1]*scale,0.0,0.0); vec4 pos = ModelViewMatrix * vec4(strPos,1.0) + vec4(VertexPosition[0]*scale,VertexPosition[1]*scale,0.0,0.0);
tex_coord = vec2(VertexPosition[2],VertexPosition[3]); tex_coord = vec2(VertexPosition[2],VertexPosition[3]);
gl_Position = ProjectionMatrix * pos; gl_Position = ProjectionMatrix * pos;
} }
\ No newline at end of file
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