Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
CGoGN
CGoGN
Commits
4dc1bdba
Commit
4dc1bdba
authored
Feb 06, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into 'develop'
Develop See merge request !41
parents
19976f90
280b6faa
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
114 deletions
+47
-114
CMakeLists.txt
CMakeLists.txt
+0
-3
README.md
README.md
+20
-83
SCHNApps/CMakeLists.txt
SCHNApps/CMakeLists.txt
+0
-4
SCHNApps/Plugins/CMakeLists.txt
SCHNApps/Plugins/CMakeLists.txt
+1
-1
ThirdParty/Zinri/CMakeLists.txt
ThirdParty/Zinri/CMakeLists.txt
+4
-1
include/Utils/shaderMutator.h
include/Utils/shaderMutator.h
+0
-1
src/Utils/shaderMutator.cpp
src/Utils/shaderMutator.cpp
+22
-21
No files found.
CMakeLists.txt
View file @
4dc1bdba
...
@@ -89,7 +89,6 @@ IF(WIN32)
...
@@ -89,7 +89,6 @@ IF(WIN32)
ENDIF
(
WIN32
)
ENDIF
(
WIN32
)
find_package
(
OpenGL REQUIRED
)
find_package
(
OpenGL REQUIRED
)
find_package
(
Boost COMPONENTS regex REQUIRED
)
find_package
(
ZLIB REQUIRED
)
find_package
(
ZLIB REQUIRED
)
find_package
(
GLEW REQUIRED
)
find_package
(
GLEW REQUIRED
)
...
@@ -130,7 +129,6 @@ SET (CGoGN_EXT_INCLUDES
...
@@ -130,7 +129,6 @@ SET (CGoGN_EXT_INCLUDES
${
OPENGL_INCLUDE_DIR
}
${
OPENGL_INCLUDE_DIR
}
${
GLEW_INCLUDE_DIRS
}
${
GLEW_INCLUDE_DIRS
}
${
ZLIB_INCLUDE_DIRS
}
${
ZLIB_INCLUDE_DIRS
}
${
Boost_INCLUDE_DIRS
}
)
)
# define libs for external libs
# define libs for external libs
...
@@ -139,7 +137,6 @@ SET (CGoGN_EXT_LIBS
...
@@ -139,7 +137,6 @@ SET (CGoGN_EXT_LIBS
${
OPENGL_LIBRARY
}
${
OPENGL_LIBRARY
}
${
GLEW_LIBRARIES
}
${
GLEW_LIBRARIES
}
${
ZLIB_LIBRARIES
}
${
ZLIB_LIBRARIES
}
${
Boost_REGEX_LIBRARY
}
tinyxml2
tinyxml2
)
)
...
...
README.md
View file @
4dc1bdba
English version bellow
Dpendences Linux
Linux dependencies
=================
==================
installer les paquets suivants:
install the following packages:
cmake cmake-curses-gui cmake-qt-gui libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev libqglviewer-dev
cmake cmake-curses-gui cmake-qt-gui libXi-dev libXmu-dev libglew-dev zlib1g-dev libqt4-dev qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev libqglviewer-dev
Pour compiler CGoGN
===================
*
on compile tout d'abord les bibliothques third-party :
```
cd CGoGN/ThirdParty/build
cmake ..
make (-j x si vous avez x cores)
make install
```
La mme chose en debug:
```
cd ../buildDebug
cmake ..
make (-j x si vous avez x cores)
```
On peut fixer certaines option pour ne pas tout compiler:
*
WITH_ASSIMP -> compile et utilise la librairie Assimp
*
WITH_ZINRI -> compile et utilise la librairie Zinri
*
WITH_PYTHONQT -> pour SCHNApps
*
ensuite on compile CGoGN :
```
cd CGoGN/build
cmake ..
make (-j x si vous avez x cores)
```
Et en Debug avec:
```
cd ../buildDebug
cmake ..
make (-j x si vous avez x cores)
```
Certaines options sont disponibles :
* BUILD_SHARED_LIBS -Q experimental !
* ONELIB -> compilation en une seule lib (libcgogn.a) au lieu de 4
* WITH_ASSIMP -> utilise Assimp (auto set par third party compil)
* WITH_ZINRI -> utilise Zinri (auto set par third party compil)
* WITH_QT -> minimize les dependence si pas besoin de Qt (VRJuggler)
* WITH_GLEWMX -> pour utiliser GLEWMX a la place de GELW (pour VRJuggler)
Les librairies sont generees dans lib/Release et lib/Debug
Les binaires sont generes dans bin/Release et bin/Debug
*
on peut ensuite compiler SCHNApps ainsi que les plugins fournis :
```
cd CGoGN/SCHNApps/build
cmake ..
make (-j x si vous avez x cores)
```
Et en Debug avec:
```
cd ../buildDebug
cmake ..
make (-j x si vous avez x cores)
```
Mac Dependencies
=================
To compile CGoGN on MAC
Des exemples de donnes (fichiers trianbgz, off, etc..) sont accessible l'adresse suivante:
*
install XCode and command line tools.
https://iggservis.u-strasbg.fr/Data/data.zip
*
install Qt4 (4.8) and QtCreator
*
install (or build) libQGLViewer
*
install cmake (native or with homebrew)
*
install with homebrew : lzlib, glew, suite-sparse
To install suite-sparse package, you must first
add the homebrew/science repository with the following command :
brew tap homebrew/science
ENGLISH VERSION
Compilation is the same as on Linux for CGoGN
===============
Linux dependencies
==================
install the following packages:
cmake cmake-curses-gui cmake-qt-gui libXi-dev libXmu-dev libglew-dev libxml2-dev libboost-all-dev zlib1g-dev qt4-designer qt4-dev-tools uuid-dev libgsl0-dev libsuitesparse-dev libqglviewer-dev
To compile CGoGN
To compile CGoGN
================
================
...
@@ -93,7 +28,7 @@ To compile CGoGN
...
@@ -93,7 +28,7 @@ To compile CGoGN
```
```
cd CGoGN/ThirdParty/build
cd CGoGN/ThirdParty/build
cmake ..
cmake ..
make (-j x if you have x cores)
make (-j x if you have x cores)
make install
make install
```
```
...
@@ -101,7 +36,8 @@ To compile CGoGN
...
@@ -101,7 +36,8 @@ To compile CGoGN
```
```
cd ../buildDebug
cd ../buildDebug
cmake ..
cmake ..
make
make (-j x if you have x cores)
make install
```
```
Some options are available to not compile everything:
Some options are available to not compile everything:
...
@@ -133,6 +69,7 @@ To compile CGoGN
...
@@ -133,6 +69,7 @@ To compile CGoGN
* WITH_QT -> to minimize dependencies and compilation time
* WITH_QT -> to minimize dependencies and compilation time
* WITH_GLEWMX -> to use GLEWMX (for VRJuggler users)
* WITH_GLEWMX -> to use GLEWMX (for VRJuggler users)
*
we can then compile SCHNApps and the provided plugins :
*
we can then compile SCHNApps and the provided plugins :
```
```
...
...
SCHNApps/CMakeLists.txt
View file @
4dc1bdba
...
@@ -21,7 +21,6 @@ SET( USE_OGL_CORE_PROFILE OFF CACHE BOOL "use OpenGL 3.3 core profile (do not wo
...
@@ -21,7 +21,6 @@ SET( USE_OGL_CORE_PROFILE OFF CACHE BOOL "use OpenGL 3.3 core profile (do not wo
find_package
(
OpenGL REQUIRED
)
find_package
(
OpenGL REQUIRED
)
find_package
(
Boost COMPONENTS regex system REQUIRED
)
find_package
(
ZLIB REQUIRED
)
find_package
(
ZLIB REQUIRED
)
find_package
(
GLEW REQUIRED
)
find_package
(
GLEW REQUIRED
)
find_package
(
Qt4 REQUIRED
)
find_package
(
Qt4 REQUIRED
)
...
@@ -74,7 +73,6 @@ SET (EXT_INCLUDES
...
@@ -74,7 +73,6 @@ SET (EXT_INCLUDES
${
OPENGL_INCLUDE_DIR
}
${
OPENGL_INCLUDE_DIR
}
${
GLEW_INCLUDE_DIRS
}
${
GLEW_INCLUDE_DIRS
}
${
ZLIB_INCLUDE_DIRS
}
${
ZLIB_INCLUDE_DIRS
}
${
Boost_INCLUDE_DIRS
}
${
QT_INCLUDE_DIR
}
${
QT_INCLUDE_DIR
}
${
QGLVIEWER_INCLUDE_DIR
}
${
QGLVIEWER_INCLUDE_DIR
}
${
PYTHON_INCLUDE_DIRS
}
${
PYTHON_INCLUDE_DIRS
}
...
@@ -90,8 +88,6 @@ SET (EXT_LIBS
...
@@ -90,8 +88,6 @@ SET (EXT_LIBS
${
OPENGL_LIBRARY
}
${
OPENGL_LIBRARY
}
${
GLEW_LIBRARIES
}
${
GLEW_LIBRARIES
}
${
ZLIB_LIBRARIES
}
${
ZLIB_LIBRARIES
}
${
Boost_SYSTEM_LIBRARY
}
${
Boost_REGEX_LIBRARY
}
${
QT_LIBRARIES
}
${
QT_LIBRARIES
}
${
PYTHON_LIBRARIES
}
${
PYTHON_LIBRARIES
}
${
SUITESPARSE_LIBRARIES
}
${
SUITESPARSE_LIBRARIES
}
...
...
SCHNApps/Plugins/CMakeLists.txt
View file @
4dc1bdba
...
@@ -17,4 +17,4 @@ ADD_SUBDIRECTORY(surface_radiance)
...
@@ -17,4 +17,4 @@ ADD_SUBDIRECTORY(surface_radiance)
ADD_SUBDIRECTORY
(
volume_import
)
ADD_SUBDIRECTORY
(
volume_import
)
#ADD_SUBDIRECTORY(volume_render)
#ADD_SUBDIRECTORY(volume_render)
ADD_SUBDIRECTORY
(
volumetric
)
#
ADD_SUBDIRECTORY(volumetric)
ThirdParty/Zinri/CMakeLists.txt
View file @
4dc1bdba
...
@@ -2,7 +2,9 @@ cmake_minimum_required(VERSION 2.6)
...
@@ -2,7 +2,9 @@ cmake_minimum_required(VERSION 2.6)
project
(
Zinri
)
project
(
Zinri
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
)
find_package
(
ZLIB REQUIRED
)
include_directories
(
${
CMAKE_CURRENT_SOURCE_DIR
}
${
ZLIB_INCLUDE_DIRS
}
)
file
(
file
(
GLOB_RECURSE
GLOB_RECURSE
...
@@ -11,3 +13,4 @@ file(
...
@@ -11,3 +13,4 @@ file(
)
)
add_library
(
Zinri
${
source_files
}
)
add_library
(
Zinri
${
source_files
}
)
target_link_libraries
(
Zinri
${
ZLIB_LIBRARIES
}
)
include/Utils/shaderMutator.h
View file @
4dc1bdba
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#undef toupper
#undef toupper
#include "Utils/cgognStream.h"
#include "Utils/cgognStream.h"
#include <boost/regex.hpp>
#include <string>
#include <string>
#include <sstream>
#include <sstream>
...
...
src/Utils/shaderMutator.cpp
View file @
4dc1bdba
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
*******************************************************************************/
*******************************************************************************/
#include "Utils/shaderMutator.h"
#include "Utils/shaderMutator.h"
#include <regex>
namespace
CGoGN
namespace
CGoGN
{
{
...
@@ -451,15 +452,15 @@ bool ShaderMutator::srcContainsVariableDeclaration(const std::string& variableNa
...
@@ -451,15 +452,15 @@ bool ShaderMutator::srcContainsVariableDeclaration(const std::string& variableNa
{
{
// Regular expression for variable declaration
// Regular expression for variable declaration
// <',' OR white-space[1 or more times]> <variableName> <',' OR ';' OR white-space>
// <',' OR white-space[1 or more times]> <variableName> <',' OR ';' OR white-space>
boost
::
regex
var_re
(
"(,|
\\
s+)"
+
variableName
+
"(,|;|
\\
s)"
);
std
::
regex
var_re
(
"(,|
\\
s+)"
+
variableName
+
"(,|;|
\\
s)"
);
// Matches results
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Search for the first expression that matches and isn't commented
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
src
.
begin
();
std
::
string
::
iterator
start
=
src
.
begin
();
std
::
string
::
iterator
end
=
src
.
end
();
std
::
string
::
iterator
end
=
src
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
var_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
var_re
,
std
::
regex_constants
::
format_first_only
))
{
{
// Start position of the match
// Start position of the match
size_t
startPosition
=
std
::
distance
(
src
.
begin
(),
matches
[
0
].
first
);
size_t
startPosition
=
std
::
distance
(
src
.
begin
(),
matches
[
0
].
first
);
...
@@ -480,10 +481,10 @@ bool ShaderMutator::srcSetMinShadingLanguageVersion(int version, std::string& mo
...
@@ -480,10 +481,10 @@ bool ShaderMutator::srcSetMinShadingLanguageVersion(int version, std::string& mo
{
{
// Regular expression for shading language version
// Regular expression for shading language version
// <#version> <white-space>[1 or more times] <digit>[1 or more times]
// <#version> <white-space>[1 or more times] <digit>[1 or more times]
boost
::
regex
version_re
(
"#version
\\
s+(
\\
d+)"
);
std
::
regex
version_re
(
"#version
\\
s+(
\\
d+)"
);
// Matches results
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Build the version string
// Build the version string
std
::
string
versionStr
;
std
::
string
versionStr
;
...
@@ -494,7 +495,7 @@ bool ShaderMutator::srcSetMinShadingLanguageVersion(int version, std::string& mo
...
@@ -494,7 +495,7 @@ bool ShaderMutator::srcSetMinShadingLanguageVersion(int version, std::string& mo
// Search for the first expression that matches and isn't commented
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
version_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
version_re
,
std
::
regex_constants
::
format_first_only
))
{
{
// Start position of the match
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
@@ -535,10 +536,10 @@ bool ShaderMutator::srcChangeIntConstantValue(int newVal, const std::string& con
...
@@ -535,10 +536,10 @@ bool ShaderMutator::srcChangeIntConstantValue(int newVal, const std::string& con
{
{
// Regular expression for constant expression
// Regular expression for constant expression
// <#define> <white-space>[1 or more times] <constant name> <white-space>[1 or more times] <digit>[1 or more times]
// <#define> <white-space>[1 or more times] <constant name> <white-space>[1 or more times] <digit>[1 or more times]
boost
::
regex
const_re
(
"#define
\\
s+"
+
constantName
+
"
\\
s+(
\\
d+)"
);
std
::
regex
const_re
(
"#define
\\
s+"
+
constantName
+
"
\\
s+(
\\
d+)"
);
// Matches results
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Build the constant value string
// Build the constant value string
std
::
string
newValStr
;
std
::
string
newValStr
;
...
@@ -549,7 +550,7 @@ bool ShaderMutator::srcChangeIntConstantValue(int newVal, const std::string& con
...
@@ -549,7 +550,7 @@ bool ShaderMutator::srcChangeIntConstantValue(int newVal, const std::string& con
// Search for the first expression that matches and isn't commented
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
const_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
const_re
,
std
::
regex_constants
::
format_first_only
))
{
{
// Start position of the match
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
@@ -582,10 +583,10 @@ bool ShaderMutator::srcChangeFloatConstantValue(float newVal, const std::string&
...
@@ -582,10 +583,10 @@ bool ShaderMutator::srcChangeFloatConstantValue(float newVal, const std::string&
// Regular expression for constant expression
// Regular expression for constant expression
// <#define> <white-space>[1 or more times] <constant name> <white-space>[1 or more times]
// <#define> <white-space>[1 or more times] <constant name> <white-space>[1 or more times]
// <digit>[1 or more times] <.>[0 or 1 time] <digit>[0 or more times]
// <digit>[1 or more times] <.>[0 or 1 time] <digit>[0 or more times]
boost
::
regex
const_re
(
"#define
\\
s+"
+
constantName
+
"
\\
s+(
\\
d+
\\
.?
\\
d*)"
);
std
::
regex
const_re
(
"#define
\\
s+"
+
constantName
+
"
\\
s+(
\\
d+
\\
.?
\\
d*)"
);
// Matches results
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Build the constant value string
// Build the constant value string
std
::
string
newValStr
;
std
::
string
newValStr
;
...
@@ -596,7 +597,7 @@ bool ShaderMutator::srcChangeFloatConstantValue(float newVal, const std::string&
...
@@ -596,7 +597,7 @@ bool ShaderMutator::srcChangeFloatConstantValue(float newVal, const std::string&
// Search for the first expression that matches and isn't commented
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
const_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
const_re
,
std
::
regex_constants
::
format_first_only
))
{
{
// Start position of the match
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
@@ -628,15 +629,15 @@ bool ShaderMutator::srcInsertCodeBeforeMainFunction(const std::string& insertedC
...
@@ -628,15 +629,15 @@ bool ShaderMutator::srcInsertCodeBeforeMainFunction(const std::string& insertedC
{
{
// Regular expression for main function
// Regular expression for main function
// <void> <white-space>[1 or more times] <main> <white-space>[0 or more times] <'('>
// <void> <white-space>[1 or more times] <main> <white-space>[0 or more times] <'('>
boost
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
("
);
std
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
("
);
// Matches results
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Search for the first expression that matches and isn't commented
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
main_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
main_re
,
std
::
regex_constants
::
format_first_only
))
{
{
// Start position of the match
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
@@ -664,15 +665,15 @@ bool ShaderMutator::srcInsertCodeAtMainFunctionBeginning(const std::string& inse
...
@@ -664,15 +665,15 @@ bool ShaderMutator::srcInsertCodeAtMainFunctionBeginning(const std::string& inse
// <void> <white-space>[1 or more times] <main> <white-space>[0 or more times]
// <void> <white-space>[1 or more times] <main> <white-space>[0 or more times]
// <'('> <white-space>[0 or more times] <')'>
// <'('> <white-space>[0 or more times] <')'>
// <white-space>[0 or more times] <'{'>
// <white-space>[0 or more times] <'{'>
boost
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
(
\\
s*
\\
)
\\
s*
\\
{"
);
std
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
(
\\
s*
\\
)
\\
s*
\\
{"
);
// Matches results
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Search for the first expression that matches and isn't commented
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
while
(
regex_search
(
start
,
end
,
matches
,
main_re
,
boost
::
format_first_only
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
main_re
,
std
::
regex_constants
::
format_first_only
))
{
{
// Start position of the match
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
@@ -703,16 +704,16 @@ bool ShaderMutator::srcInsertCodeAtMainFunctionEnd(const std::string& insertedCo
...
@@ -703,16 +704,16 @@ bool ShaderMutator::srcInsertCodeAtMainFunctionEnd(const std::string& insertedCo
// <void> <white-space>[1 or more times] <main> <white-space>[0 or more times]
// <void> <white-space>[1 or more times] <main> <white-space>[0 or more times]
// <'('> <white-space>[0 or more times] <')'>
// <'('> <white-space>[0 or more times] <')'>
// <white-space>[0 or more times] <'{'>
// <white-space>[0 or more times] <'{'>
boost
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
(
\\
s*
\\
)
\\
s*
\\
{"
);
std
::
regex
main_re
(
"(void)
\\
s+(main)
\\
s*
\\
(
\\
s*
\\
)
\\
s*
\\
{"
);
// Matches results
// Matches results
boost
::
match_results
<
std
::
string
::
iterator
>
matches
;
std
::
match_results
<
std
::
string
::
iterator
>
matches
;
// Search for the first expression that matches and isn't commented
// Search for the first expression that matches and isn't commented
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
start
=
modifiedSrc
.
begin
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
std
::
string
::
iterator
end
=
modifiedSrc
.
end
();
size_t
mainFirstBracePos
=
0
;
// The aim is first to find this position
size_t
mainFirstBracePos
=
0
;
// The aim is first to find this position
while
(
regex_search
(
start
,
end
,
matches
,
main_re
,
boost
::
format_first_only
)
&&
(
mainFirstBracePos
==
0
))
while
(
std
::
regex_search
(
start
,
end
,
matches
,
main_re
,
std
::
regex_constants
::
format_first_only
)
&&
(
mainFirstBracePos
==
0
))
{
{
// Start position of the match
// Start position of the match
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
size_t
startPosition
=
std
::
distance
(
modifiedSrc
.
begin
(),
matches
[
0
].
first
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment