Skip to content

Commit

Permalink
Merge pull request #127 from sintefmath/jnygaard_ProxyDebugGUI
Browse files Browse the repository at this point in the history
Jnygaard proxy debug gui
  • Loading branch information
Jens Olav Nygaard authored and Jens Olav Nygaard committed Nov 20, 2014
2 parents e62fcb3 + 1c6142c commit 6030101
Show file tree
Hide file tree
Showing 6 changed files with 318 additions and 109 deletions.
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ SET(TINIA_LIBRARIES_FOR_CONFIG ${TINIA_LIBRARIES_FOR_CONFIG} tinia_trell)
ADD_SUBDIRECTORY( "src/mod_trell" )
ADD_SUBDIRECTORY( "src/trell_master" )
ENDIF()
ADD_SUBDIRECTORY( "src/utils" )
SET(TINIA_LIBRARIES_FOR_CONFIG ${TINIA_LIBRARIES_FOR_CONFIG} tinia_utils)

# --- The rest are built as applications using tinia ---------------------------
SET( TINIA_LIBRARIES ${TINIA_LIBRARIES_FOR_CONFIG} )
Expand Down Expand Up @@ -294,19 +296,19 @@ SET(TINIA_TARGETS_APPEND "")
# This is for local build directory:
IF(Tinia_DESKTOP)
IF(Tinia_SERVER)
export(TARGETS tinia_model tinia_jobcontroller tinia_modelxml tinia_qtcontroller tinia_renderlist tinia_renderlistgl tinia_javascript tiniaipc tinia_trell
export(TARGETS tinia_model tinia_jobcontroller tinia_modelxml tinia_qtcontroller tinia_renderlist tinia_renderlistgl tinia_javascript tiniaipc tinia_trell tinia_utils
FILE "${PROJECT_BINARY_DIR}/TiniaTargets${TINIA_TARGETS_APPEND}.cmake")
ELSE()
IF(LIBXML2_FOUND)
export(TARGETS tinia_model tinia_jobcontroller tinia_modelxml tinia_qtcontroller tinia_renderlist tinia_renderlistgl tinia_javascript
export(TARGETS tinia_model tinia_jobcontroller tinia_modelxml tinia_qtcontroller tinia_renderlist tinia_renderlistgl tinia_javascript tinia_utils
FILE "${PROJECT_BINARY_DIR}/TiniaTargets${TINIA_TARGETS_APPEND}.cmake")
ELSE()
export(TARGETS tinia_model tinia_jobcontroller tinia_qtcontroller tinia_renderlist tinia_renderlistgl tinia_javascript
export(TARGETS tinia_model tinia_jobcontroller tinia_qtcontroller tinia_renderlist tinia_renderlistgl tinia_javascript tinia_utils
FILE "${PROJECT_BINARY_DIR}/TiniaTargets${TINIA_TARGETS_APPEND}.cmake")
ENDIF()
ENDIF()
ELSE()
export(TARGETS tinia_model tinia_jobcontroller tinia_modelxml tinia_renderlist tinia_renderlistgl tiniaipc tinia_trell
export(TARGETS tinia_model tinia_jobcontroller tinia_modelxml tinia_renderlist tinia_renderlistgl tiniaipc tinia_trell tinia_utils
FILE "${PROJECT_BINARY_DIR}/TiniaTargets${TINIA_TARGETS_APPEND}.cmake")
ENDIF()

Expand Down
121 changes: 16 additions & 105 deletions examples/auto_proxy_test/APCJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,9 @@
#include "tinia/model/GUILayout.hpp"
#include <iostream>
#include "tinia/model/File.hpp"
#include "tinia/utils/ProxyDebugGUI.hpp"


namespace {

// NB! This list must match the one in ProxyRenderer.js, exactly!
const char *allowed_auto_proxy_algos[] = { "0) AngleCoverage-5",
"1) AngleCoverage-2",
"2) OnlyMostRecent",
"3) ReplaceOldestWhenDifferent-5",
"4) ReplaceOldest-5",
NULL };

}


namespace tinia {
namespace example {
Expand All @@ -63,103 +52,25 @@ bool APCJob::init()
m_model->addElement("viewer", viewer);
m_model->addElement<std::string>( "boundingbox", "-2.0 -2.0 -2.0 2.0 2.0 2.0" );

// Adding variables to the model
// Note that these values are not communicated to the ProxyRenderer until they are actually changed, due to the use
// of listeners. (Should maybe fix this, by some initialization routine.)
{
m_model->addElement<bool>( "ap_useAutoProxy", true ); // This turns on the new autoProxy
m_model->addElement<bool>( "ap_autoProxyDebugging", true );
m_model->addAnnotation("ap_autoProxyDebugging", "Debug mode");
int algos=0;
while ( allowed_auto_proxy_algos[algos] != NULL ) {
algos++;
}
m_model->addElementWithRestriction<std::string>( "ap_autoProxyAlgo", allowed_auto_proxy_algos[2], &allowed_auto_proxy_algos[0], &allowed_auto_proxy_algos[0]+algos );
m_model->addAnnotation("ap_autoProxyAlgo", "Proxy model replacement algo");
m_model->addElement<bool>( "ap_debugSplatCol", false );
m_model->addAnnotation("ap_debugSplatCol", "Index coloring (r, g, b, y, c, m)");
m_model->addElement<bool>( "ap_decayMode", false );
m_model->addAnnotation("ap_decayMode", "Splats decaying from center");
m_model->addElement<bool>( "ap_roundSplats", false );
m_model->addAnnotation("ap_roundSplats", "Circular splats");
m_model->addElement<bool>( "ap_screenSpaceSized", true );
m_model->addAnnotation("ap_screenSpaceSized", "Screen-space-sized splats");
m_model->addConstrainedElement<int>("ap_overlap", 200, 1, 300);
m_model->addAnnotation("ap_overlap", "Overlap factor)");
m_model->addElement<bool>( "ap_alwaysShowMostRecent", true );
m_model->addAnnotation("ap_alwaysShowMostRecent", "Most recent model in front");
m_model->addConstrainedElement<int>("ap_splats", 64, 2, 512);
m_model->addAnnotation("ap_splats", "Number of splats)");
m_model->addElement<bool>( "ap_resetAllModels", false );
m_model->addAnnotation("ap_resetAllModels", "Remove all models, update now");
m_model->addElement<bool>( "ap_useISTC", true );
m_model->addAnnotation("ap_useISTC", "Use intra-splat texcoo");
m_model->addElement<bool>( "ap_splatOutline", false );
m_model->addAnnotation("ap_splatOutline", "Square splat outline");
m_model->addElement<bool>( "ap_reloadShader", false );
m_model->addAnnotation("ap_reloadShader", "Reload shader");
m_model->addElement<bool>( "ap_useFragExt", true );
m_model->addAnnotation("ap_useFragExt", "Use FragDepthExt if available");
m_model->addElement( "ap_fragExtStatus", "---" );
m_model->addElement( "ap_consoleLog", "---" );
m_model->addElement<int>( "ap_cntr", 0 );
}
// The constructor of proxyGUI sets up "magical" elements in m_model.
tinia::utils::ProxyDebugGUI proxyGUI( m_model,
true, // autoProxy
true, // autoProxy-debugging
true, // jpgProxy
true // autoSelect proxy method
);

// Setting up the mainGrid containing the GUI elements
tinia::model::gui::Grid *mainGrid = new tinia::model::gui::Grid(100, 4);
{
int row = 0;
mainGrid->setChild(row, 0, new tinia::model::gui::CheckBox("ap_useAutoProxy"));
mainGrid->setChild(row, 1, new tinia::model::gui::CheckBox("ap_autoProxyDebugging"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::Label("ap_autoProxyAlgo"));
mainGrid->setChild(row, 1, new tinia::model::gui::ComboBox("ap_autoProxyAlgo"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::CheckBox("ap_debugSplatCol"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::CheckBox("ap_decayMode"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::CheckBox("ap_roundSplats"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::CheckBox("ap_screenSpaceSized"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::HorizontalSlider("ap_overlap"));
mainGrid->setChild(row, 1, new tinia::model::gui::Label("ap_overlap", false));
mainGrid->setChild(row, 2, new tinia::model::gui::Label("ap_overlap", true));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::CheckBox("ap_alwaysShowMostRecent"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::HorizontalSlider("ap_splats"));
mainGrid->setChild(row, 1, new tinia::model::gui::Label("ap_splats", false));
mainGrid->setChild(row, 2, new tinia::model::gui::Label("ap_splats", true));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::Button("ap_resetAllModels"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::CheckBox("ap_useISTC"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::CheckBox("ap_splatOutline"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::Button("ap_reloadShader"));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::CheckBox("ap_useFragExt"));
mainGrid->setChild(row, 1, new tinia::model::gui::Label("ap_fragExtStatus", true)); // true) We get the text string connected to the element, false) name of element
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::Label("ap_consoleLog", false));
mainGrid->setChild(row, 1, new tinia::model::gui::Label("ap_consoleLog", true));
row++;
mainGrid->setChild(row, 0, new tinia::model::gui::VerticalExpandingSpace());
}
// And this method returns a corresponding grid containing GUI elements for manipulating these elements.
tinia::model::gui::Grid *grid = proxyGUI.getGrid();

// Setting up root consisting of canvas + mainGrid
// Setting up root consisting of canvas + grid
tinia::model::gui::HorizontalLayout *rootLayout = new tinia::model::gui::HorizontalLayout();
{
tinia::model::gui::HorizontalLayout *rootLayout = new tinia::model::gui::HorizontalLayout();
{
tinia::model::gui::Canvas *canvas = new tinia::model::gui::Canvas("viewer", "renderlist", "boundingbox" );
rootLayout->addChild(canvas);
}
rootLayout->addChild(mainGrid);
m_model->setGUILayout(rootLayout, tinia::model::gui::DESKTOP);
tinia::model::gui::Canvas *canvas = new tinia::model::gui::Canvas("viewer", "renderlist", "boundingbox" );
rootLayout->addChild(canvas);
}
rootLayout->addChild(grid);
m_model->setGUILayout(rootLayout, tinia::model::gui::DESKTOP);

return true;
}
Expand Down
2 changes: 2 additions & 0 deletions examples/auto_proxy_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ IF(Tinia_DESKTOP)
${OPENGL_LIBRARIES}
${GLEW_LIBRARY}
tinia_model
tinia_utils
tinia_jobcontroller
${Boost_LIBRARIES}
)
Expand Down Expand Up @@ -50,6 +51,7 @@ IF(Tinia_SERVER)
tinia_model
tinia_modelxml
tinia_renderlist
tinia_utils
tinia_renderlistgl
tinia_jobcontroller
tinia_trell
Expand Down
57 changes: 57 additions & 0 deletions include/tinia/utils/ProxyDebugGUI.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* Copyright STIFTELSEN SINTEF 2012
*
* This file is part of the Tinia Framework.
*
* The Tinia Framework is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Tinia Framework is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with the Tinia Framework. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include <string>
#include <iostream>

// QT's moc doesn't like BOOST_JOIN ( can be removed in QT 5.0 we think)
#ifndef Q_MOC_RUN
#include <boost/shared_ptr.hpp>
#endif

#include "tinia/model/GUILayout.hpp"
#include "tinia/model/ExposedModel.hpp"




namespace tinia {
namespace utils {

class ProxyDebugGUI // : public Item
{

public:

ProxyDebugGUI( boost::shared_ptr<model::ExposedModel> model,
const bool with_ap, const bool with_ap_debugging, const bool with_jpg, const bool with_auto_select );
tinia::model::gui::Grid *getGrid();

private:

bool m_w_ap, m_w_apd, m_w_jpg, m_w_as;

};




} // of namespace utils
} // of namespace tinia
26 changes: 26 additions & 0 deletions src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FILE( GLOB utilsSrc "*.cpp" )
FILE( GLOB_RECURSE utilsHeaders "../../include/tinia/utils/*.hpp")


ADD_LIBRARY( tinia_utils ${utilsSrc} ${utilsHeaders} )

TARGET_LINK_LIBRARIES( tinia_utils ${Boost_LIBRARIES} )

# The reason for the development name to be <component>_dev is
# that using <component>-dev does not work with NSIS Windows installer.
# Remember to also update the list of components in the
# main CMakeLists.txt if you alter component names.

install( DIRECTORY
"../../include/tinia/utils"
DESTINATION include/tinia/
COMPONENT utils_dev)

install( TARGETS
tinia_utils
EXPORT TiniaTargets
LIBRARY
DESTINATION lib/
ARCHIVE DESTINATION lib/
COMPONENT utils )

Loading

0 comments on commit 6030101

Please sign in to comment.