Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
CAMP
campvis-public
Commits
c7c7a04a
Commit
c7c7a04a
authored
Jan 15, 2014
by
Christian Schulte zu Berge
Browse files
Implemented functionality to rebuild all GLSL shaders from file while CAMPVis is running.
parent
13b43621
Changes
4
Hide whitespace changes
Inline
Side-by-side
application/campvisapplication.cpp
View file @
c7c7a04a
...
...
@@ -36,11 +36,13 @@
#include
"application/campvispainter.h"
#include
"application/gui/mainwindow.h"
#include
"core/tools/job.h"
#include
"core/tools/opengljobprocessor.h"
#include
"core/tools/simplejobprocessor.h"
#include
"core/tools/stringutils.h"
#include
"core/tools/quadrenderer.h"
#include
"core/pipeline/abstractpipeline.h"
#include
"core/pipeline/visualizationprocessor.h"
#include
"modules/pipelinefactory.h"
namespace
campvis
{
...
...
@@ -153,6 +155,7 @@ namespace campvis {
}
GLJobProc
.
start
();
GLJobProc
.
registerContext
(
_localContext
);
_initialized
=
true
;
}
...
...
@@ -277,5 +280,26 @@ namespace campvis {
return
dc
;
}
void
CampVisApplication
::
rebuildAllShadersFromFiles
()
{
// rebuilding all shaders has to be done from OpenGL context, use the local one.
GLJobProc
.
enqueueJob
(
_localContext
,
makeJobOnHeap
(
this
,
&
CampVisApplication
::
triggerShaderRebuild
),
OpenGLJobProcessor
::
SerialJob
);
}
void
CampVisApplication
::
triggerShaderRebuild
()
{
if
(
!
ShdrMgr
.
rebuildAllShadersFromFile
())
{
LERROR
(
"Could not rebuild all shaders from file."
);
return
;
}
for
(
std
::
vector
<
AbstractPipeline
*>::
iterator
it
=
_pipelines
.
begin
();
it
!=
_pipelines
.
end
();
++
it
)
{
for
(
std
::
vector
<
AbstractProcessor
*>::
const_iterator
pit
=
(
*
it
)
->
getProcessors
().
begin
();
pit
!=
(
*
it
)
->
getProcessors
().
end
();
++
pit
)
{
if
(
VisualizationProcessor
*
tester
=
dynamic_cast
<
VisualizationProcessor
*>
(
*
pit
))
{
tester
->
invalidate
(
AbstractProcessor
::
INVALID_RESULT
);
}
}
}
}
}
application/campvisapplication.h
View file @
c7c7a04a
...
...
@@ -118,6 +118,11 @@ namespace campvis {
*/
DataContainer
*
createAndAddDataContainer
(
const
std
::
string
&
name
);
/**
* Reloads all GLSL shaders from file and rebuilds them.
*/
void
rebuildAllShadersFromFiles
();
/// Signal emitted when the collection of pipelines has changed.
sigslot
::
signal0
<>
s_PipelinesChanged
;
...
...
@@ -135,6 +140,12 @@ namespace campvis {
/// All DataContainers
std
::
vector
<
DataContainer
*>
_dataContainers
;
/**
* Triggers the ShaderManager to rebuild all shaders from file and then
* invalidates all VisualizationProcessors.
*/
void
triggerShaderRebuild
();
/// A local OpenGL context used for initialization
tgt
::
GLCanvas
*
_localContext
;
/// Main window hosting GUI stuff
...
...
application/gui/mainwindow.cpp
View file @
c7c7a04a
...
...
@@ -160,6 +160,7 @@ namespace campvis {
// Populate the file menu
QMenuBar
*
menuBar
=
this
->
menuBar
();
QMenu
*
fileMenu
=
menuBar
->
addMenu
(
tr
(
"&File"
));
fileMenu
->
addAction
(
tr
(
"&Rebuild all Shaders from File"
),
this
,
SLOT
(
onRebuildShadersClicked
()),
QKeySequence
(
Qt
::
CTRL
+
Qt
::
Key_F5
));
fileMenu
->
addAction
(
tr
(
"&Quit"
),
qApp
,
SLOT
(
closeAllWindows
()),
QKeySequence
(
Qt
::
CTRL
+
Qt
::
Key_Q
));
// Populate the visualizations menu
...
...
@@ -306,4 +307,8 @@ namespace campvis {
_application
->
addPipeline
(
name
,
p
);
}
void
MainWindow
::
onRebuildShadersClicked
()
{
_application
->
rebuildAllShadersFromFiles
();
}
}
application/gui/mainwindow.h
View file @
c7c7a04a
...
...
@@ -125,6 +125,9 @@ namespace campvis {
/// Slot to be called when _btnPipelineFactory was clicked;
void
onBtnPipelineFactoryClicked
();
/// Slot to be called when all shaders shall be rebuilt.
void
onRebuildShadersClicked
();
private:
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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