Skip to content

Commit 8e8bf9d

Browse files
committed
[pre-commit] run all.
1 parent 5f91916 commit 8e8bf9d

19 files changed

Lines changed: 299 additions & 396 deletions

CLISubdivider/CMakeLists.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
cmake_minimum_required(VERSION 3.18)
22

3-
#-------------------------------------------------------------------------------
3+
# -------------------------------------------------------------------------------
44
# exampleApp executables setup
55
project(Radium-CLI-Subdivider)
66

7-
find_package( Radium REQUIRED Core IO)
7+
find_package(Radium REQUIRED Core IO)
88

9-
#------------------------------------------------------------------------------
9+
# ------------------------------------------------------------------------------
1010
# Application specific
1111

12-
1312
add_executable(${PROJECT_NAME} main.cpp)
14-
target_link_libraries (${PROJECT_NAME} PUBLIC Radium::Core Radium::IO)
13+
target_link_libraries(${PROJECT_NAME} PUBLIC Radium::Core Radium::IO)
1514

1615
# call the installation configuration (defined in RadiumConfig.cmake)
17-
configure_radium_app(
18-
NAME ${PROJECT_NAME}
19-
)
16+
configure_radium_app(NAME ${PROJECT_NAME})

CLISubdivider/main.cpp

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
/// Macro used for testing only, to add attibutes to the TopologicalMesh
1010
/// before subdivisition
1111
/// \FIXME Must be removed once using Radium::IO with attribute loading.
12-
//#define TEST_ATTRIBUTES_SUBDIV
12+
// #define TEST_ATTRIBUTES_SUBDIV
1313

1414
struct args {
1515
bool valid;
1616
int iteration;
1717
std::string outputFilename;
1818
std::string inputFilename;
19-
std::unique_ptr<
20-
OpenMesh::Subdivider::Uniform::SubdividerT<Ra::Core::Geometry::deprecated::TopologicalMesh, Scalar>>
19+
std::unique_ptr<OpenMesh::Subdivider::Uniform::
20+
SubdividerT<Ra::Core::Geometry::deprecated::TopologicalMesh, Scalar>>
2121
subdivider;
2222
};
2323

@@ -41,42 +41,34 @@ void printHelp( char* argv[] ) {
4141

4242
args processArgs( int argc, char* argv[] ) {
4343
args ret;
44-
bool outputFilenameSet{false};
45-
bool subdividerSet{false};
44+
bool outputFilenameSet { false };
45+
bool subdividerSet { false };
4646
ret.iteration = 1;
4747

48-
for ( int i = 1; i < argc; i += 2 )
49-
{
50-
if ( std::string( argv[i] ) == std::string( "-i" ) )
51-
{
48+
for ( int i = 1; i < argc; i += 2 ) {
49+
if ( std::string( argv[i] ) == std::string( "-i" ) ) {
5250
if ( i + 1 < argc ) { ret.inputFilename = argv[i + 1]; }
5351
}
54-
else if ( std::string( argv[i] ) == std::string( "-o" ) )
55-
{
56-
if ( i + 1 < argc )
57-
{
52+
else if ( std::string( argv[i] ) == std::string( "-o" ) ) {
53+
if ( i + 1 < argc ) {
5854
ret.outputFilename = argv[i + 1];
5955
outputFilenameSet = true;
6056
}
6157
}
62-
else if ( std::string( argv[i] ) == std::string( "-s" ) )
63-
{
64-
if ( i + 1 < argc )
65-
{
66-
std::string a{argv[i + 1]};
58+
else if ( std::string( argv[i] ) == std::string( "-s" ) ) {
59+
if ( i + 1 < argc ) {
60+
std::string a { argv[i + 1] };
6761
subdividerSet = true;
68-
if ( a == std::string( "catmull" ) )
69-
{
62+
if ( a == std::string( "catmull" ) ) {
7063
ret.subdivider = std::make_unique<Ra::Core::Geometry::CatmullClarkSubdivider>();
7164
}
72-
else if ( a == std::string( "loop" ) )
73-
{ ret.subdivider = std::make_unique<Ra::Core::Geometry::LoopSubdivider>(); }
74-
else
75-
{ subdividerSet = false; }
65+
else if ( a == std::string( "loop" ) ) {
66+
ret.subdivider = std::make_unique<Ra::Core::Geometry::LoopSubdivider>();
67+
}
68+
else { subdividerSet = false; }
7669
}
7770
}
78-
else if ( std::string( argv[i] ) == std::string( "-n" ) )
79-
{
71+
else if ( std::string( argv[i] ) == std::string( "-n" ) ) {
8072
if ( i + 1 < argc ) { ret.iteration = std::stoi( std::string( argv[i + 1] ) ); }
8173
}
8274
}
@@ -88,14 +80,13 @@ int main( int argc, char* argv[] ) {
8880
using namespace Ra::Core::Utils; // log
8981
args a = processArgs( argc, argv );
9082
if ( !a.valid ) { printHelp( argv ); }
91-
else
92-
{
83+
else {
9384
Ra::Core::Geometry::TriangleMesh mesh;
9485
Ra::IO::OBJFileManager obj;
9586

9687
// Load geometry as triangle
9788
if ( a.inputFilename.empty() ) { mesh = Ra::Core::Geometry::makeBox(); }
98-
else { obj.load( a.inputFilename, mesh ); }
89+
else { obj.load( a.inputFilename, mesh ); }
9990

10091
// Create topological structure
10192
Ra::Core::Geometry::deprecated::TopologicalMesh topologicalMesh( mesh );

CMakeLists.txt

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required (VERSION 3.18)
1+
cmake_minimum_required(VERSION 3.18)
22
project(Radium-apps)
33

44
# Set default build type to Release
@@ -7,24 +7,28 @@ if(NOT CMAKE_BUILD_TYPE)
77
set(CMAKE_BUILD_TYPE "Release")
88
endif()
99

10-
# set the installation directory for all the apps at once. This will make the same definition ignore on all the
11-
# included applications
12-
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
13-
14-
# Compute default paths following Radium's logic
15-
if (CMAKE_BUILD_TYPE STREQUAL "Release")
16-
set(RADIUM_APPS_BUNDLE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/installed-${CMAKE_CXX_COMPILER_ID})
17-
else ()
18-
set(RADIUM_APPS_BUNDLE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/installed-${CMAKE_CXX_COMPILER_ID}-${CMAKE_BUILD_TYPE})
19-
endif ()
20-
21-
set (CMAKE_INSTALL_PREFIX "${RADIUM_APPS_BUNDLE_DIRECTORY}/" CACHE PATH
22-
"Install path prefix, prepended onto install directories." FORCE )
23-
message( "Set install prefix to ${CMAKE_INSTALL_PREFIX}" )
24-
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT False)
10+
# set the installation directory for all the apps at once. This will make the
11+
# same definition ignore on all the included applications
12+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
13+
14+
# Compute default paths following Radium's logic
15+
if(CMAKE_BUILD_TYPE STREQUAL "Release")
16+
set(RADIUM_APPS_BUNDLE_DIRECTORY
17+
${CMAKE_CURRENT_BINARY_DIR}/installed-${CMAKE_CXX_COMPILER_ID})
18+
else()
19+
set(RADIUM_APPS_BUNDLE_DIRECTORY
20+
${CMAKE_CURRENT_BINARY_DIR}/installed-${CMAKE_CXX_COMPILER_ID}-${CMAKE_BUILD_TYPE}
21+
)
22+
endif()
23+
24+
set(CMAKE_INSTALL_PREFIX
25+
"${RADIUM_APPS_BUNDLE_DIRECTORY}/"
26+
CACHE PATH "Install path prefix, prepended onto install directories."
27+
FORCE)
28+
message("Set install prefix to ${CMAKE_INSTALL_PREFIX}")
29+
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT False)
2530
endif()
2631

27-
2832
# Be nice to visual studio
2933
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
3034

Sandbox/CMakeLists.txt

Lines changed: 43 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -2,88 +2,72 @@
22
cmake_minimum_required(VERSION 3.18)
33

44
if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER "3.9")
5-
cmake_policy(SET CMP0071 NEW)
5+
cmake_policy(SET CMP0071 NEW)
66
endif()
77

8-
#-------------------------------------------------------------------------------
8+
# -------------------------------------------------------------------------------
99
# exampleApp executables setup
1010
project(Radium-Sandbox)
11-
# Set default install location to installed-<Compiler_ID> folder in build dir
12-
# we do not want to install to /usr by default
13-
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
14-
set (CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/installed-${CMAKE_CXX_COMPILER_ID}" CACHE PATH
15-
"Install path prefix, prepended onto install directories." FORCE )
16-
message( "Set install prefix to ${CMAKE_INSTALL_PREFIX}" )
11+
# Set default install location to installed-<Compiler_ID> folder in build dir we
12+
# do not want to install to /usr by default
13+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
14+
set(CMAKE_INSTALL_PREFIX
15+
"${CMAKE_CURRENT_BINARY_DIR}/installed-${CMAKE_CXX_COMPILER_ID}"
16+
CACHE PATH "Install path prefix, prepended onto install directories."
17+
FORCE)
18+
message("Set install prefix to ${CMAKE_INSTALL_PREFIX}")
1719
endif()
1820

19-
find_package( Radium REQUIRED Core Engine Gui PluginBase IO)
21+
find_package(
22+
Radium
23+
REQUIRED
24+
Core
25+
Engine
26+
Gui
27+
PluginBase
28+
IO)
2029

21-
#------------------------------------------------------------------------------
30+
# ------------------------------------------------------------------------------
2231
# Application specific
2332

24-
2533
find_qt_package(COMPONENTS Core Widgets OpenGL REQUIRED)
26-
set( Qt_LIBRARIES Qt::Core Qt::Widgets Qt::OpenGL )
34+
set(Qt_LIBRARIES Qt::Core Qt::Widgets Qt::OpenGL)
2735

2836
set(CMAKE_AUTOMOC ON)
2937
set(CMAKE_AUTORCC ON)
3038

3139
set(app_sources
32-
main.cpp
33-
MainApplication.cpp
34-
Gui/ColorWidget.cpp
35-
Gui/MainWindow.cpp
36-
Gui/MaterialEditor.cpp
37-
Gui/TransformEditorWidget.cpp
38-
)
40+
main.cpp MainApplication.cpp Gui/ColorWidget.cpp Gui/MainWindow.cpp
41+
Gui/MaterialEditor.cpp Gui/TransformEditorWidget.cpp)
3942

4043
set(app_headers
41-
MainApplication.hpp
42-
Gui/ColorWidget.hpp
43-
Gui/MainWindow.hpp
44-
Gui/MaterialEditor.hpp
45-
Gui/RotationEditor.hpp
46-
Gui/TransformEditorWidget.hpp
47-
Gui/VectorEditor.hpp
48-
)
49-
50-
set(app_uis
51-
Gui/ui/MainWindow.ui
52-
Gui/ui/RotationEditor.ui
53-
Gui/ui/VectorEditor.ui
54-
)
44+
MainApplication.hpp
45+
Gui/ColorWidget.hpp
46+
Gui/MainWindow.hpp
47+
Gui/MaterialEditor.hpp
48+
Gui/RotationEditor.hpp
49+
Gui/TransformEditorWidget.hpp
50+
Gui/VectorEditor.hpp)
5551

56-
qt_wrap_ui(app_uis_moc ${app_uis})
52+
set(app_uis Gui/ui/MainWindow.ui Gui/ui/RotationEditor.ui
53+
Gui/ui/VectorEditor.ui)
5754

58-
set(app_resources
59-
Resources/ApplicationIcons.qrc
60-
)
55+
qt_wrap_ui(app_uis_moc ${app_uis})
6156

57+
set(app_resources Resources/ApplicationIcons.qrc)
6258

6359
set(CMAKE_INCLUDE_CURRENT_DIR ON)
64-
include_directories(
65-
${CMAKE_CURRENT_BINARY_DIR} # Moc
66-
)
60+
include_directories(${CMAKE_CURRENT_BINARY_DIR} # Moc
61+
)
6762

6863
add_executable(
69-
${PROJECT_NAME} MACOSX_BUNDLE
70-
${app_sources}
71-
${app_headers}
72-
${app_inlines}
73-
${app_uis_moc}
74-
${app_resources}
75-
)
76-
77-
target_link_libraries (${PROJECT_NAME} PUBLIC
78-
Radium::Core
79-
Radium::Engine
80-
Radium::Gui
81-
Radium::IO
82-
${Qt_LIBRARIES})
83-
84-
configure_radium_app(
85-
NAME ${PROJECT_NAME}
86-
USE_PLUGINS
87-
)
64+
${PROJECT_NAME} MACOSX_BUNDLE ${app_sources} ${app_headers} ${app_inlines}
65+
${app_uis_moc} ${app_resources})
66+
67+
target_link_libraries(
68+
${PROJECT_NAME} PUBLIC Radium::Core Radium::Engine Radium::Gui Radium::IO
69+
${Qt_LIBRARIES})
70+
71+
configure_radium_app(NAME ${PROJECT_NAME} USE_PLUGINS)
8872

8973
# radium_cotire( ${app_target} )

Sandbox/Gui/ColorWidget.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ void ColorWidget::colorChanged() {
2828
void ColorWidget::mousePressEvent( QMouseEvent* /*event*/ ) {
2929

3030
QColor color = QColorDialog::getColor( m_currentColor );
31-
if ( color != m_currentColor )
32-
{
31+
if ( color != m_currentColor ) {
3332
m_currentColor = color;
3433
colorChanged();
3534

0 commit comments

Comments
 (0)