Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
10d5fe2
refactor, use new CameraDataObject for ui
toloudis Feb 25, 2025
90365d2
move controls into subdir
toloudis Feb 25, 2025
db5890e
add properties for appearance settings
toloudis May 20, 2025
4ed90b9
adding the dockwidget
toloudis Jun 1, 2025
22d90f8
update tensorstore
toloudis Jun 2, 2025
59536c0
loading from json is broken: the ui does not update to the correct va…
toloudis Jun 12, 2025
8c5c239
still missing prtyVec3
toloudis Jun 18, 2025
061bc66
WIP
toloudis Jun 22, 2025
1fad4de
camera and appearance compiles but completely detached from the renderer
toloudis Jun 25, 2025
fd0a698
make control creation more generic
toloudis Jun 25, 2025
efa1215
wip on camera creation / lifetime
toloudis Jul 3, 2025
312e426
more object lifetime work with camera
toloudis Jul 4, 2025
5cf0b76
rename
toloudis Jul 4, 2025
e7de474
hook up render settings
toloudis Jul 5, 2025
c45c496
fix weird character
toloudis Jul 31, 2025
3fc1cd5
reinstate tensorstore version
toloudis Sep 4, 2025
15e26a6
install the scene earlier
toloudis Jun 6, 2025
a011c74
test working
toloudis Jun 19, 2025
39c0ba2
camera and appearance compiles but completely detached from the renderer
toloudis Jun 25, 2025
f7ae810
start setting up light objects
toloudis Aug 15, 2025
bc72d57
wip adding light docks to gui
toloudis Aug 15, 2025
aeb4b0d
cleanup
toloudis Aug 15, 2025
2d2be4e
wip redoing light init
toloudis Aug 15, 2025
dd3341d
light objects are now created from top down by app
toloudis Aug 15, 2025
d4809a5
fix light init
toloudis Aug 16, 2025
7fc34b6
move lights to the right panel
toloudis Aug 16, 2025
0aeca3a
small refactor
toloudis Aug 17, 2025
07017b4
fix compile errors post-rebase
toloudis Sep 5, 2025
8b89697
try to generate a universal build
toloudis Sep 5, 2025
21cdc89
case sensitive rename
toloudis Sep 5, 2025
e910b2c
fix typo
toloudis Sep 5, 2025
5b19b8c
rename case sensitive
toloudis Sep 5, 2025
70ab719
ok forget it
toloudis Sep 5, 2025
77b5c19
hook up uiInfo for a color plus intensity control
toloudis Sep 7, 2025
c545a3b
radians
toloudis Oct 26, 2025
b558c66
radians to degrees
toloudis Oct 26, 2025
9dc18e7
pass property objects into appearancesettings widget
toloudis Oct 27, 2025
e21a13c
set up controls
toloudis Oct 27, 2025
3fe74ef
remove duplicated controls
toloudis Nov 8, 2025
2f9dcd6
set up observer for rotate control
toloudis Nov 9, 2025
8842f30
skylight hook up to props
toloudis Nov 10, 2025
805e603
cleanup
toloudis Nov 10, 2025
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
3 changes: 2 additions & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ jobs:
- os: windows-latest
artifact: agave-win
# note macos-14 is arm64 and macos-13 is x86_64
- os: macos-15
# Tensorstore does not support universal builds yet
- os: macos-14
artifact: agave-macos-arm64
- os: macos-15-intel
artifact: agave-macos-x86_64
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ include(FetchContent) # Needed to recognize FetchContent_Declare in renderlib
if(APPLE)
set(ENV{MACOSX_DEPLOYMENT_TARGET} "10.15")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
# Tensorstore does not support universal builds yet:
# set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
endif(APPLE)

if(POLICY CMP0048)
Expand Down
8 changes: 6 additions & 2 deletions agave_app/AppearanceDockWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
QAppearanceWidget::QAppearanceWidget(QWidget* pParent,
QRenderSettings* qrs,
RenderSettings* rs,
AreaLightObject* alo,
SkyLightObject* slo,
QAction* pToggleRotateAction,
QAction* pToggleTranslateAction)
: QWidget(pParent)
, m_MainLayout()
, m_AppearanceSettingsWidget(nullptr, qrs, rs, pToggleRotateAction, pToggleTranslateAction)
, m_AppearanceSettingsWidget(nullptr, qrs, rs, alo, slo, pToggleRotateAction, pToggleTranslateAction)
{
// Create main layout
m_MainLayout.setAlignment(Qt::AlignTop);
Expand All @@ -25,10 +27,12 @@ QAppearanceWidget::QAppearanceWidget(QWidget* pParent,
QAppearanceDockWidget::QAppearanceDockWidget(QWidget* parent,
QRenderSettings* qrs,
RenderSettings* rs,
AreaLightObject* alo,
SkyLightObject* slo,
QAction* pToggleRotateAction,
QAction* pToggleTranslateAction)
: QDockWidget(parent)
, m_VolumeAppearanceWidget(nullptr, qrs, rs, pToggleRotateAction, pToggleTranslateAction)
, m_VolumeAppearanceWidget(nullptr, qrs, rs, alo, slo, pToggleRotateAction, pToggleTranslateAction)
{
setWindowTitle("Appearance");

Expand Down
4 changes: 4 additions & 0 deletions agave_app/AppearanceDockWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class QAppearanceWidget : public QWidget
QAppearanceWidget(QWidget* pParent = NULL,
QRenderSettings* qrs = nullptr,
RenderSettings* rs = nullptr,
AreaLightObject* alo = nullptr,
SkyLightObject* slo = nullptr,
QAction* pToggleRotateAction = nullptr,
QAction* pToggleTranslateAction = nullptr);

Expand All @@ -33,6 +35,8 @@ class QAppearanceDockWidget : public QDockWidget
QAppearanceDockWidget(QWidget* pParent = NULL,
QRenderSettings* qrs = nullptr,
RenderSettings* rs = nullptr,
AreaLightObject* alo = nullptr,
SkyLightObject* slo = nullptr,
QAction* pToggleRotateAction = nullptr,
QAction* pToggleTranslateAction = nullptr);

Expand Down
2 changes: 1 addition & 1 deletion agave_app/AppearanceDockWidget2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ QAppearanceDockWidget2::QAppearanceDockWidget2(QWidget* pParent,
ViewerWindow* vw,
AppearanceObject* ado)
: QDockWidget(pParent)
, m_AppearanceWidget(nullptr, rs, vw, ado)
, m_AppearanceWidget(nullptr, rs, ado)
{
setWindowTitle("Appearance");

Expand Down
170 changes: 19 additions & 151 deletions agave_app/AppearanceSettingsWidget.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#include "AppearanceSettingsWidget.h"

#include "QRenderSettings.h"
#include "RangeWidget.h"
#include "qtControls/Section.h"
#include "qtControls/controlFactory.h"

#include "ImageXYZC.h"
#include "renderlib/AppScene.h"
#include "renderlib/AreaLightObject.hpp"
#include "renderlib/Colormap.h"
#include "renderlib/Logging.h"
#include "renderlib/RenderSettings.h"
#include "renderlib/SkyLightObject.hpp"
#include "tfeditor/gradients.h"

#include <QFormLayout>
Expand Down Expand Up @@ -95,11 +99,15 @@ static const int MAX_CHANNELS_CHECKED = 4;
QAppearanceSettingsWidget::QAppearanceSettingsWidget(QWidget* pParent,
QRenderSettings* qrs,
RenderSettings* rs,
AreaLightObject* alo,
SkyLightObject* slo,
QAction* pToggleRotateAction,
QAction* pToggleTranslateAction)
: QGroupBox(pParent)
, m_MainLayout()
, m_qrendersettings(qrs)
, m_arealightObject(alo)
, m_skylightObject(slo)
, m_scene(nullptr)
{
Controls::initFormLayout(m_MainLayout);
Expand Down Expand Up @@ -343,73 +351,15 @@ QAppearanceSettingsWidget::createAreaLightingControls(QAction* pRotationAction)
m_lt0gui.m_RotateButton->setToolTip(tr("Show interactive controls in viewport for area light rotation angle"));
btnLayout->addWidget(m_lt0gui.m_RotateButton);
QObject::connect(m_lt0gui.m_RotateButton, &QPushButton::clicked, [this, pRotationAction]() {
toggleActionForObject(pRotationAction, this->m_scene->SceneAreaLight());
toggleActionForObject(pRotationAction, m_arealightObject->getSceneLight().get());
});
// dummy widget to fill space (TODO: Translate button?)
btnLayout->addWidget(new QWidget());
sectionLayout->addLayout(btnLayout, sectionLayout->rowCount(), 0, 1, 2);

m_lt0gui.m_thetaSlider = new QNumericSlider();
m_lt0gui.m_thetaSlider->setStatusTip(tr("Set angle theta for area light"));
m_lt0gui.m_thetaSlider->setToolTip(tr("Set angle theta for area light"));
m_lt0gui.m_thetaSlider->setRange(0.0, TWO_PI_F);
m_lt0gui.m_thetaSlider->setSingleStep(TWO_PI_F / 100.0);
m_lt0gui.m_thetaSlider->setValue(0.0);
sectionLayout->addRow("Theta", m_lt0gui.m_thetaSlider);
QObject::connect(
m_lt0gui.m_thetaSlider, &QNumericSlider::valueChanged, this, &QAppearanceSettingsWidget::OnSetAreaLightTheta);

m_lt0gui.m_phiSlider = new QNumericSlider();
m_lt0gui.m_phiSlider->setStatusTip(tr("Set angle phi for area light"));
m_lt0gui.m_phiSlider->setToolTip(tr("Set angle phi for area light"));
m_lt0gui.m_phiSlider->setRange(0.0, PI_F);
m_lt0gui.m_phiSlider->setSingleStep(PI_F / 100.0);
m_lt0gui.m_phiSlider->setValue(HALF_PI_F);
sectionLayout->addRow("Phi", m_lt0gui.m_phiSlider);
QObject::connect(
m_lt0gui.m_phiSlider, &QNumericSlider::valueChanged, this, &QAppearanceSettingsWidget::OnSetAreaLightPhi);

m_lt0gui.m_sizeSlider = new QNumericSlider();
m_lt0gui.m_sizeSlider->setStatusTip(tr("Set size for area light"));
m_lt0gui.m_sizeSlider->setToolTip(tr("Set size for area light"));
m_lt0gui.m_sizeSlider->setRange(0.1, 5.0);
m_lt0gui.m_sizeSlider->setSingleStep(5.0 / 100.0);
m_lt0gui.m_sizeSlider->setValue(1.0);
sectionLayout->addRow("Size", m_lt0gui.m_sizeSlider);
QObject::connect(
m_lt0gui.m_sizeSlider, &QNumericSlider::valueChanged, this, &QAppearanceSettingsWidget::OnSetAreaLightSize);

m_lt0gui.m_distSlider = new QNumericSlider();
m_lt0gui.m_distSlider->setStatusTip(tr("Set distance for area light"));
m_lt0gui.m_distSlider->setToolTip(tr("Set distance for area light"));
m_lt0gui.m_distSlider->setRange(0.1, 10.0);
m_lt0gui.m_distSlider->setSingleStep(1.0);
m_lt0gui.m_distSlider->setValue(10.0);
sectionLayout->addRow("Distance", m_lt0gui.m_distSlider);
QObject::connect(
m_lt0gui.m_distSlider, &QNumericSlider::valueChanged, this, &QAppearanceSettingsWidget::OnSetAreaLightDistance);

auto* arealightLayout = new QHBoxLayout();
m_lt0gui.m_intensitySlider = new QNumericSlider();
m_lt0gui.m_intensitySlider->setStatusTip(tr("Set intensity for area light"));
m_lt0gui.m_intensitySlider->setToolTip(tr("Set intensity for area light"));
m_lt0gui.m_intensitySlider->setRange(0.0, 1000.0);
m_lt0gui.m_intensitySlider->setSingleStep(10.0);
m_lt0gui.m_intensitySlider->setValue(100.0);
m_lt0gui.m_intensitySlider->setDecimals(1);
arealightLayout->addWidget(m_lt0gui.m_intensitySlider, 1);
m_lt0gui.m_areaLightColorButton = new QColorPushButton();
m_lt0gui.m_areaLightColorButton->setStatusTip(tr("Set color for area light"));
m_lt0gui.m_areaLightColorButton->setToolTip(tr("Set color for area light"));
arealightLayout->addWidget(m_lt0gui.m_areaLightColorButton, 0);
arealightLayout->setContentsMargins(0, 0, 0, 0);
sectionLayout->addRow("Intensity", arealightLayout);
QObject::connect(m_lt0gui.m_areaLightColorButton, &QColorPushButton::currentColorChanged, [this](const QColor& c) {
this->OnSetAreaLightColor(this->m_lt0gui.m_intensitySlider->value(), c);
});
QObject::connect(m_lt0gui.m_intensitySlider, &QNumericSlider::valueChanged, [this](double v) {
this->OnSetAreaLightColor(v, this->m_lt0gui.m_areaLightColorButton->GetColor());
});
if (m_arealightObject) {
createFlatList(sectionLayout, m_arealightObject);
}

section->setContentLayout(*sectionLayout);
return section;
Expand All @@ -421,62 +371,9 @@ QAppearanceSettingsWidget::createSkyLightingControls()
Section* section = new Section("Sky Light", 0);
auto* sectionLayout = Controls::createAgaveFormLayout();

auto* skylightTopLayout = new QHBoxLayout();
m_lt1gui.m_stintensitySlider = new QNumericSlider();
m_lt1gui.m_stintensitySlider->setStatusTip(tr("Set intensity for top of skylight sphere"));
m_lt1gui.m_stintensitySlider->setToolTip(tr("Set intensity for top of skylight sphere"));
m_lt1gui.m_stintensitySlider->setRange(0.0, 10.0);
m_lt1gui.m_stintensitySlider->setValue(1.0);
skylightTopLayout->addWidget(m_lt1gui.m_stintensitySlider, 1);
m_lt1gui.m_stColorButton = new QColorPushButton();
m_lt1gui.m_stColorButton->setStatusTip(tr("Set color for top of skylight sphere"));
m_lt1gui.m_stColorButton->setToolTip(tr("Set color for top of skylight sphere"));
skylightTopLayout->addWidget(m_lt1gui.m_stColorButton);
sectionLayout->addRow("Top", skylightTopLayout);
QObject::connect(m_lt1gui.m_stColorButton, &QColorPushButton::currentColorChanged, [this](const QColor& c) {
this->OnSetSkyLightTopColor(this->m_lt1gui.m_stintensitySlider->value(), c);
});
QObject::connect(m_lt1gui.m_stintensitySlider, &QNumericSlider::valueChanged, [this](double v) {
this->OnSetSkyLightTopColor(v, this->m_lt1gui.m_stColorButton->GetColor());
});

auto* skylightMidLayout = new QHBoxLayout();
m_lt1gui.m_smintensitySlider = new QNumericSlider();
m_lt1gui.m_smintensitySlider->setStatusTip(tr("Set intensity for middle of skylight sphere"));
m_lt1gui.m_smintensitySlider->setToolTip(tr("Set intensity for middle of skylight sphere"));
m_lt1gui.m_smintensitySlider->setRange(0.0, 10.0);
m_lt1gui.m_smintensitySlider->setValue(1.0);
skylightMidLayout->addWidget(m_lt1gui.m_smintensitySlider, 1);
m_lt1gui.m_smColorButton = new QColorPushButton();
m_lt1gui.m_smColorButton->setStatusTip(tr("Set color for middle of skylight sphere"));
m_lt1gui.m_smColorButton->setToolTip(tr("Set color for middle of skylight sphere"));
skylightMidLayout->addWidget(m_lt1gui.m_smColorButton);
sectionLayout->addRow("Mid", skylightMidLayout);
QObject::connect(m_lt1gui.m_smColorButton, &QColorPushButton::currentColorChanged, [this](const QColor& c) {
this->OnSetSkyLightMidColor(this->m_lt1gui.m_smintensitySlider->value(), c);
});
QObject::connect(m_lt1gui.m_smintensitySlider, &QNumericSlider::valueChanged, [this](double v) {
this->OnSetSkyLightMidColor(v, this->m_lt1gui.m_smColorButton->GetColor());
});

auto* skylightBotLayout = new QHBoxLayout();
m_lt1gui.m_sbintensitySlider = new QNumericSlider();
m_lt1gui.m_sbintensitySlider->setStatusTip(tr("Set intensity for bottom of skylight sphere"));
m_lt1gui.m_sbintensitySlider->setToolTip(tr("Set intensity for bottom of skylight sphere"));
m_lt1gui.m_sbintensitySlider->setRange(0.0, 10.0);
m_lt1gui.m_sbintensitySlider->setValue(1.0);
skylightBotLayout->addWidget(m_lt1gui.m_sbintensitySlider, 1);
m_lt1gui.m_sbColorButton = new QColorPushButton();
m_lt1gui.m_sbColorButton->setStatusTip(tr("Set color for bottom of skylight sphere"));
m_lt1gui.m_sbColorButton->setToolTip(tr("Set color for bottom of skylight sphere"));
skylightBotLayout->addWidget(m_lt1gui.m_sbColorButton);
sectionLayout->addRow("Bot", skylightBotLayout);
QObject::connect(m_lt1gui.m_sbColorButton, &QColorPushButton::currentColorChanged, [this](const QColor& c) {
this->OnSetSkyLightBotColor(this->m_lt1gui.m_sbintensitySlider->value(), c);
});
QObject::connect(m_lt1gui.m_sbintensitySlider, &QNumericSlider::valueChanged, [this](double v) {
this->OnSetSkyLightBotColor(v, this->m_lt1gui.m_sbColorButton->GetColor());
});
if (m_skylightObject) {
createFlatList(sectionLayout, m_skylightObject);
}

section->setContentLayout(*sectionLayout);
return section;
Expand Down Expand Up @@ -871,46 +768,17 @@ QAppearanceSettingsWidget::initClipPlaneControls(Scene* scene)
void
QAppearanceSettingsWidget::initLightingControls(Scene* scene)
{
m_lt0gui.m_thetaSlider->setValue(scene->AreaLight().m_Theta);
m_lt0gui.m_phiSlider->setValue(scene->AreaLight().m_Phi);
m_lt0gui.m_sizeSlider->setValue(scene->AreaLight().m_Width);
m_lt0gui.m_distSlider->setValue(scene->AreaLight().m_Distance);
// split color into color and intensity.
QColor c;
float i;
normalizeColorForGui(scene->AreaLight().m_Color, c, i);
m_lt0gui.m_intensitySlider->setValue(i * scene->AreaLight().m_ColorIntensity);
m_lt0gui.m_areaLightColorButton->SetColor(c);
m_arealightObject->updatePropsFromSceneLight();

// attach light observer to scene's area light source, to receive updates from viewport controls
// TODO FIXME clean this up - it's not removed anywhere so if light(i.e. scene) outlives "this" then we have problems.
// Currently in AGAVE this is not an issue..
scene->SceneAreaLight()->m_observers.push_back([this](const Light& light) {
m_arealightObject->getSceneLight()->m_observers.push_back([this](const Light& light) {
// update gui controls

// bring theta into 0..2pi
m_lt0gui.m_thetaSlider->setValue(light.m_Theta < 0 ? light.m_Theta + TWO_PI_F : light.m_Theta);
// bring phi into 0..pi
m_lt0gui.m_phiSlider->setValue(light.m_Phi < 0 ? light.m_Phi + PI_F : light.m_Phi);
m_lt0gui.m_sizeSlider->setValue(light.m_Width);
m_lt0gui.m_distSlider->setValue(light.m_Distance);
// split color into color and intensity.
QColor c;
float i;
normalizeColorForGui(light.m_Color, c, i);
m_lt0gui.m_intensitySlider->setValue(i * light.m_ColorIntensity);
m_lt0gui.m_areaLightColorButton->SetColor(c);
m_arealightObject->updatePropsFromSceneLight();
});

normalizeColorForGui(scene->SphereLight().m_ColorTop, c, i);
m_lt1gui.m_stintensitySlider->setValue(i * scene->SphereLight().m_ColorTopIntensity);
m_lt1gui.m_stColorButton->SetColor(c);
normalizeColorForGui(scene->SphereLight().m_ColorMiddle, c, i);
m_lt1gui.m_smintensitySlider->setValue(i * scene->SphereLight().m_ColorMiddleIntensity);
m_lt1gui.m_smColorButton->SetColor(c);
normalizeColorForGui(scene->SphereLight().m_ColorBottom, c, i);
m_lt1gui.m_sbintensitySlider->setValue(i * scene->SphereLight().m_ColorBottomIntensity);
m_lt1gui.m_sbColorButton->SetColor(c);
m_skylightObject->updatePropsFromSceneLight();
}

void
Expand Down
11 changes: 9 additions & 2 deletions agave_app/AppearanceSettingsWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <memory>

class AreaLightObject;
class SkyLightObject;
class QRenderSettings;
class ImageXYZC;
class RangeWidget;
Expand All @@ -35,6 +37,8 @@ class QAppearanceSettingsWidget : public QGroupBox
QAppearanceSettingsWidget(QWidget* pParent = NULL,
QRenderSettings* qrs = nullptr,
RenderSettings* rs = nullptr,
AreaLightObject* alo = nullptr,
SkyLightObject* slo = nullptr,
QAction* pToggleRotateAction = nullptr,
QAction* pToggleTranslateAction = nullptr);

Expand Down Expand Up @@ -89,6 +93,8 @@ public slots:
QFormLayout m_MainLayout;

QRenderSettings* m_qrendersettings;
AreaLightObject* m_arealightObject;
SkyLightObject* m_skylightObject;

Section* m_clipRoiSection;
RangeWidget* m_roiX;
Expand Down Expand Up @@ -121,8 +127,9 @@ public slots:
QNumericSlider* m_phiSlider;
QNumericSlider* m_sizeSlider;
QNumericSlider* m_distSlider;
QNumericSlider* m_intensitySlider;
QColorPushButton* m_areaLightColorButton;
// QNumericSlider* m_intensitySlider;
// QColorPushButton* m_areaLightColorButton;
QColorWithIntensity* m_areaLightColor;
} m_lt0gui;

struct lt1
Expand Down
Loading
Loading