Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add clip plane changes #230

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
include:
- os: ubuntu-latest
artifact: agave-linux
- os: windows-latest
- os: windows-2019
artifact: agave-win
# note macos-14 is arm64 and macos-13 is x86_64
- os: macos-14
Expand Down Expand Up @@ -113,8 +113,8 @@ jobs:
- name: linux build and test
if: matrix.os == 'ubuntu-latest'
env:
CC: gcc-10
CXX: g++-10
CC: gcc-13
CXX: g++-13
run: |
mkdir ./build
cd build
Expand All @@ -123,29 +123,29 @@ jobs:
cmake --build . --target install --config Release
shell: bash
- name: windows install ninja
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
run: |
choco install ninja
- name: Configure MSVC console (Windows)
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
uses: ilammy/msvc-dev-cmd@v1
- name: windows install deps
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
env:
vc_arch: "x64"
CXX: cl.exe
CC: cl.exe
run: |
vcpkg install --triplet x64-windows tiff glm zlib libjpeg-turbo liblzma spdlog zstd eigen3
- name: windows get nasm
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
uses: ilammy/setup-nasm@v1
- name: Remove bad Strawberry Perl patch binary in search path
# https://github.com/actions/runner-images/issues/5459#issuecomment-1532856844
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
run: del C:\Strawberry\c\bin\patch.EXE
- name: windows build and test
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
env:
vc_arch: "x64"
CXX: cl.exe
Expand All @@ -159,7 +159,7 @@ jobs:
cpack -D CPACK_PACKAGE_FILE_NAME=${{ matrix.artifact }}
shell: cmd
- name: Upload windows artifact
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/tagged_master_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
include:
- os: ubuntu-latest
artifact: agave-linux
- os: windows-latest
- os: windows-2019
artifact: agave-win
# note macos-14 is arm64 and macos-13 is x86_64
- os: macos-14
Expand Down Expand Up @@ -68,8 +68,8 @@ jobs:
- name: linux build and test
if: matrix.os == 'ubuntu-latest'
env:
CC: gcc-10
CXX: g++-10
CC: gcc-13
CXX: g++-13
run: |
pwd
mkdir ./build
Expand All @@ -79,27 +79,27 @@ jobs:
cmake --build . --target install --config Release
shell: bash
- name: windows install ninja
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
run: |
choco install ninja
- name: Configure MSVC console (Windows)
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
uses: ilammy/msvc-dev-cmd@v1
- name: windows install deps
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
env:
vc_arch: "x64"
run: |
vcpkg install --triplet x64-windows tiff glm zlib libjpeg-turbo liblzma spdlog zstd eigen3
- name: windows get nasm
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
uses: ilammy/setup-nasm@v1
- name: Remove bad Strawberry Perl patch binary in search path
# https://github.com/actions/runner-images/issues/5459#issuecomment-1532856844
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
run: del C:\Strawberry\c\bin\patch.EXE
- name: windows build and test
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
env:
vc_arch: "x64"
run: |
Expand All @@ -111,7 +111,7 @@ jobs:
cpack -D CPACK_PACKAGE_FILE_NAME=${{ matrix.artifact }}
shell: cmd
- name: Upload windows artifact
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19)
cmake_minimum_required(VERSION 3.24)
include(FetchContent) # Needed to recognize FetchContent_Declare in renderlib

if(APPLE)
Expand Down
37 changes: 37 additions & 0 deletions agave_app/AppearanceSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,43 @@ QAppearanceSettingsWidget::QAppearanceSettingsWidget(QWidget* pParent,
QObject::connect(m_roiZ, &RangeWidget::minValueChanged, this, &QAppearanceSettingsWidget::OnSetRoiZMin);
QObject::connect(m_roiZ, &RangeWidget::maxValueChanged, this, &QAppearanceSettingsWidget::OnSetRoiZMax);

m_showUserClipPlane = new QCheckBox("Show Clip Plane");
ShrimpCryptid marked this conversation as resolved.
Show resolved Hide resolved
m_showUserClipPlane->setChecked(false);
roiSectionLayout->addWidget(m_showUserClipPlane, 3, 0, 1, 2);
QObject::connect(m_showUserClipPlane, &QCheckBox::clicked, [this](bool toggled) {
emit this->m_qrendersettings->Selected(toggled ? this->m_scene->m_clipPlane.get() : nullptr);
});
m_toggleClipPlaneControls = new QCheckBox("Rotate clip plane");
m_toggleClipPlaneControls->setChecked(false);
roiSectionLayout->addWidget(m_toggleClipPlaneControls, 4, 0, 1, 2);
QObject::connect(m_toggleClipPlaneControls, &QCheckBox::clicked, [this, pToggleRotateAction](bool toggled) {
if (toggled) {
// make sure it's selected if we clicked this.
emit this->m_qrendersettings->Selected(this->m_scene->m_clipPlane.get());
}
pToggleRotateAction->trigger();
});
m_toggleClipPlaneTranslateControls = new QCheckBox("Translate clip plane");
m_toggleClipPlaneTranslateControls->setChecked(false);
roiSectionLayout->addWidget(m_toggleClipPlaneTranslateControls, 5, 0, 1, 2);
QObject::connect(
m_toggleClipPlaneTranslateControls, &QCheckBox::clicked, [this, pToggleTranslateAction](bool toggled) {
if (toggled) {
// make sure it's selected if we clicked this.
emit this->m_qrendersettings->Selected(this->m_scene->m_clipPlane.get());
}
pToggleTranslateAction->trigger();
});
m_enableUserClipPlane = new QCheckBox("Enable Clip Plane");
m_enableUserClipPlane->setChecked(true);
roiSectionLayout->addWidget(m_enableUserClipPlane, 6, 0, 1, 2);
QObject::connect(m_enableUserClipPlane, &QCheckBox::clicked, [this](bool toggled) {
if (this->m_scene->m_clipPlane) {
this->m_scene->m_clipPlane->m_enabled = toggled;
m_qrendersettings->renderSettings()->m_DirtyFlags.SetFlag(RoiDirty);
}
});

roiSectionLayout->setColumnStretch(0, 1);
roiSectionLayout->setColumnStretch(1, 3);

Expand Down
4 changes: 4 additions & 0 deletions agave_app/AppearanceSettingsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public slots:
RangeWidget* m_roiX;
RangeWidget* m_roiY;
RangeWidget* m_roiZ;
QCheckBox* m_showUserClipPlane;
QCheckBox* m_enableUserClipPlane;
QCheckBox* m_toggleClipPlaneControls;
QCheckBox* m_toggleClipPlaneTranslateControls;

Section* m_scaleSection;
QDoubleSpinner* m_xscaleSpinner;
Expand Down
24 changes: 24 additions & 0 deletions agave_app/ViewToolbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,30 @@ ViewToolbar::ViewToolbar(QWidget* parent)
menu->exec(axisViewButton->mapToGlobal(axisViewButton->rect().bottomLeft() + QPoint(0, 4)));
});

toolbarLayout->addItem(new QSpacerItem(spacing, 0, QSizePolicy::Fixed, QSizePolicy::Expanding));

rotateButton = new QPushButton(QIcon(), "", this);
rotateButton->setCheckable(true);
rotateButton->setDisabled(true);
rotateButton->setObjectName("rotateBtn");
rotateButton->setToolTip(QString("<FONT>Rotate</FONT>"));
rotateButton->setStatusTip(tr("Rotate the selected object"));
rotateButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
rotateButton->adjustSize();
rotateButton->setFocusPolicy(Qt::NoFocus);
toolbarLayout->addWidget(rotateButton);

translateButton = new QPushButton(QIcon(), "", this);
translateButton->setCheckable(true);
translateButton->setDisabled(true);
translateButton->setObjectName("translateBtn");
translateButton->setToolTip(QString("<FONT>Translate</FONT>"));
translateButton->setStatusTip(tr("Translate the selected object"));
translateButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
translateButton->adjustSize();
translateButton->setFocusPolicy(Qt::NoFocus);
toolbarLayout->addWidget(translateButton);

toolbarLayout->addStretch();

setLayout(toolbarLayout);
Expand Down
2 changes: 2 additions & 0 deletions agave_app/ViewToolbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ class ViewToolbar : public QWidget
QPushButton* leftViewButton;
QPushButton* rightViewButton;
QPushButton* axisHelperButton;
QPushButton* rotateButton;
QPushButton* translateButton;
};
10 changes: 9 additions & 1 deletion agave_app/agaveGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

const QString darkStyleSheet = R"(
QToolTip{padding:3px;}
QPushButton#rotateBtn { icon: url(":/icons/dark/rotate.svg"); qproperty-icon: url(":/icons/dark/rotate.svg") }
QPushButton#translateBtn { icon: url(":/icons/dark/translate.svg"); qproperty-icon: url(":/icons/dark/translate.svg") }
QPushButton#axisHelperBtn { icon: url(":/icons/dark/coordinates.svg"); qproperty-icon: url(":/icons/dark/coordinates.svg") }
QPushButton#homeBtn { icon: url(":/icons/dark/Home-icon.svg"); qproperty-icon: url(":/icons/dark/Home-icon.svg") }
QPushButton#frameViewBtn { icon: url(":/icons/dark/frameView.svg"); qproperty-icon: url(":/icons/dark/frameView.svg")}
Expand All @@ -57,6 +59,8 @@ QMenu#quickViewsMenu {border-radius: 2px;}
)";
const QString lightStyleSheet = R"(
QToolTip{padding:3px;}
QPushButton#rotateBtn { icon: url(":/icons/light/rotate.svg"); qproperty-icon: url(":/icons/light/rotate.svg") }
QPushButton#translateBtn { icon: url(":/icons/light/translate.svg"); qproperty-icon: url(":/icons/light/translate.svg") }
QPushButton#axisHelperBtn { icon: url(":/icons/light/coordinates.svg"); qproperty-icon: url(":/icons/light/coordinates.svg") }
QPushButton#homeBtn { icon: url(":/icons/light/Home-icon.svg"); qproperty-icon: url(":/icons/light/Home-icon.svg") }
QPushButton#frameViewBtn { icon: url(":/icons/light/frameView.svg"); qproperty-icon: url(":/icons/light/frameView.svg") }
Expand Down Expand Up @@ -252,7 +256,6 @@ agaveGui::createActions()
// tie the action to the main app window.
addAction(m_toggleRotateControlsAction);
connect(m_toggleRotateControlsAction, &QAction::triggered, [this](bool checked) {
emit this->m_qrendersettings.Selected(checked ? this->m_appScene.SceneAreaLight() : nullptr);
this->m_glView->toggleRotateControls();
});

Expand All @@ -267,6 +270,11 @@ agaveGui::createActions()
connect(m_toggleTranslateControlsAction, &QAction::triggered, [this](bool checked) {
this->m_glView->toggleTranslateControls();
});

m_manipulatorModeGroup = new QActionGroup(this);
m_manipulatorModeGroup->setExclusionPolicy(QActionGroup::ExclusionPolicy::ExclusiveOptional);
m_manipulatorModeGroup->addAction(m_toggleRotateControlsAction);
m_manipulatorModeGroup->addAction(m_toggleTranslateControlsAction);
}

void
Expand Down
2 changes: 2 additions & 0 deletions agave_app/agaveGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ private slots:
QAction* m_toggleRotateControlsAction = nullptr;
QAction* m_toggleTranslateControlsAction = nullptr;

QActionGroup* m_manipulatorModeGroup = nullptr;

QSlider* createAngleSlider();
QSlider* createRangeSlider();

Expand Down
4 changes: 4 additions & 0 deletions agave_app/agaveGui.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<file>icons/light/frameView.svg</file>
<file>icons/light/Home-icon.svg</file>
<file>icons/light/coordinates.svg</file>
<file>icons/light/rotate.svg</file>
<file>icons/light/translate.svg</file>
</qresource>
<qresource>
<file>icons/dark/lock.png</file>
Expand All @@ -34,5 +36,7 @@
<file>icons/dark/frameView.svg</file>
<file>icons/dark/Home-icon.svg</file>
<file>icons/dark/coordinates.svg</file>
<file>icons/dark/rotate.svg</file>
<file>icons/dark/translate.svg</file>
</qresource>
</RCC>
1 change: 1 addition & 0 deletions agave_app/icons/dark/rotate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions agave_app/icons/dark/translate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions agave_app/icons/light/rotate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions agave_app/icons/light/translate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions renderlib/AppScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ Scene::initSceneFromImg(std::shared_ptr<ImageXYZC> img)
}

initBoundsFromImg(img);

m_clipPlane = std::make_shared<ScenePlane>(m_boundingBox.GetCenter());
}

void
Expand Down
2 changes: 2 additions & 0 deletions renderlib/AppScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "GradientData.h"
#include "Light.h"
#include "Object3d.h"
#include "ScenePlane.h"
#include "SceneLight.h"
#include "Timeline.h"
#include "glm.h"
Expand Down Expand Up @@ -97,6 +98,7 @@ class Scene
VolumeDisplay m_material;

CBoundingBox m_roi = CBoundingBox(glm::vec3(0, 0, 0), glm::vec3(1, 1, 1));
std::shared_ptr<ScenePlane> m_clipPlane;

Lighting m_lighting;

Expand Down
4 changes: 4 additions & 0 deletions renderlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ target_sources(renderlib PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/BoundingBox.h"
"${CMAKE_CURRENT_SOURCE_DIR}/CCamera.h"
"${CMAKE_CURRENT_SOURCE_DIR}/CCamera.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ClipPlaneTool.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ClipPlaneTool.h"
"${CMAKE_CURRENT_SOURCE_DIR}/command.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/command.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Flags.cpp"
Expand Down Expand Up @@ -61,6 +63,8 @@ target_sources(renderlib PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/ScaleBarTool.h"
"${CMAKE_CURRENT_SOURCE_DIR}/SceneLight.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SceneLight.h"
"${CMAKE_CURRENT_SOURCE_DIR}/ScenePlane.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ScenePlane.h"
"${CMAKE_CURRENT_SOURCE_DIR}/SceneView.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SceneView.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Status.cpp"
Expand Down
Loading
Loading