Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
32a52d1
Remove unused image renderer and add two-dimensional renderer
ThomasKroes Mar 20, 2025
d0e88ff
Work on Renderer2D class
ThomasKroes Mar 20, 2025
3c2c17e
Work on Renderer2D class
ThomasKroes Mar 20, 2025
d2afe65
Added a two-dimensional navigator class for two-dimensional renderers
ThomasKroes Mar 20, 2025
1768a0e
Work on two-dimensional navigator
ThomasKroes Mar 20, 2025
e0dbbd5
Work on navigator
ThomasKroes Mar 21, 2025
34765e6
Zooming around and panning is working properly
ThomasKroes Mar 21, 2025
d85253f
Work on Renderer2D
ThomasKroes Mar 23, 2025
6fdbd99
Fixed point scaling
ThomasKroes Mar 23, 2025
07ceb6f
Fixed shaders
ThomasKroes Mar 23, 2025
d74a7a3
Relative point sizing works
ThomasKroes Mar 23, 2025
f0f37b1
Navigation is more or less working properly now, end of day commit
ThomasKroes Mar 23, 2025
b924d50
Fixes problem with data bounds
ThomasKroes Mar 26, 2025
bd50e83
Fixes issues with randomized depth
ThomasKroes Mar 26, 2025
7efd065
Working on selections
ThomasKroes Mar 27, 2025
362c2ae
Zoom around also working now
ThomasKroes Mar 27, 2025
9626ca4
Zoom around and panning is working nicely again
ThomasKroes Mar 27, 2025
79f0025
Fixed zoom to extents
ThomasKroes Mar 27, 2025
06453e8
Work on margins
ThomasKroes Mar 27, 2025
f4b126b
Made some fixes in the view plugin sampler action
ThomasKroes Mar 28, 2025
6e729cf
Work on density renderer
ThomasKroes Mar 31, 2025
b3aa704
Work on density renderer
ThomasKroes Mar 31, 2025
5655aa3
Landscape rendering is working
ThomasKroes Mar 31, 2025
06e521f
Add generic naviagtion action and use it in the navigator 2D action
ThomasKroes Apr 1, 2025
3345fa2
Work on navigation action
ThomasKroes Apr 1, 2025
610254b
Work on navigation action
ThomasKroes Apr 1, 2025
1877b49
getZoomPercentage is working
ThomasKroes Apr 1, 2025
e4e489a
Fix setZoomPercentage
ThomasKroes Apr 1, 2025
ea0643f
Re-instate widget action override size hint
ThomasKroes Apr 1, 2025
d9ca1a5
Work on view alignment
ThomasKroes Apr 1, 2025
4cc77cf
Fix zoom percentage
ThomasKroes Apr 1, 2025
2c706f8
Fix shortcuts
ThomasKroes Apr 2, 2025
9a66102
All shortcuts are working and the shortcuts dialog has also been updated
ThomasKroes Apr 2, 2025
71ac352
Added numerical, decimal and integral point action
ThomasKroes Apr 2, 2025
439f9cd
Synchronize zoom percentage
ThomasKroes Apr 3, 2025
6cadbfd
Zoom to selection is working
ThomasKroes Apr 3, 2025
ad763a2
Fix cursors
ThomasKroes Apr 3, 2025
70d9a2f
Add icon modifier support
ThomasKroes Apr 3, 2025
1ce5e4c
Added zoom margins back in
ThomasKroes Apr 3, 2025
66ec4e6
Change how the default size is overridden
ThomasKroes Apr 3, 2025
dba3127
Work navigation freezing
ThomasKroes Apr 3, 2025
78fe6cd
Align density renderer with point renderer and fix shortcuts
ThomasKroes Apr 7, 2025
8b2e017
Merge remote-tracking branch 'origin/master' into feature/renderer_up…
ThomasKroes Apr 7, 2025
994569b
Some explicit default inits
alxvth Apr 14, 2025
f48a5f4
Add several helper functions
alxvth Apr 14, 2025
1c86bef
Remove unused image renderer and add two-dimensional renderer
ThomasKroes Mar 20, 2025
3337999
Work on Renderer2D class
ThomasKroes Mar 20, 2025
2144202
Work on Renderer2D class
ThomasKroes Mar 20, 2025
8bdb918
Added a two-dimensional navigator class for two-dimensional renderers
ThomasKroes Mar 20, 2025
5dcc0c2
Work on two-dimensional navigator
ThomasKroes Mar 20, 2025
a5073f9
Work on navigator
ThomasKroes Mar 21, 2025
ecacae0
Zooming around and panning is working properly
ThomasKroes Mar 21, 2025
44f24ce
Work on Renderer2D
ThomasKroes Mar 23, 2025
7c984a2
Fixed point scaling
ThomasKroes Mar 23, 2025
ce6d270
Fixed shaders
ThomasKroes Mar 23, 2025
24853c5
Relative point sizing works
ThomasKroes Mar 23, 2025
74410b1
Navigation is more or less working properly now, end of day commit
ThomasKroes Mar 23, 2025
8adb53c
Fixes problem with data bounds
ThomasKroes Mar 26, 2025
7a7e68e
Fixes issues with randomized depth
ThomasKroes Mar 26, 2025
e8e2640
Working on selections
ThomasKroes Mar 27, 2025
16b80ba
Zoom around also working now
ThomasKroes Mar 27, 2025
5ec2478
Zoom around and panning is working nicely again
ThomasKroes Mar 27, 2025
c411c0c
Fixed zoom to extents
ThomasKroes Mar 27, 2025
a40c92d
Work on margins
ThomasKroes Mar 27, 2025
88b2957
Made some fixes in the view plugin sampler action
ThomasKroes Mar 28, 2025
5c86d3d
Work on density renderer
ThomasKroes Mar 31, 2025
a78ca34
Work on density renderer
ThomasKroes Mar 31, 2025
3e860c8
Landscape rendering is working
ThomasKroes Mar 31, 2025
1074473
Add generic naviagtion action and use it in the navigator 2D action
ThomasKroes Apr 1, 2025
9b138b3
Work on navigation action
ThomasKroes Apr 1, 2025
16c3846
Work on navigation action
ThomasKroes Apr 1, 2025
458979e
getZoomPercentage is working
ThomasKroes Apr 1, 2025
0d7ca30
Fix setZoomPercentage
ThomasKroes Apr 1, 2025
770512e
Re-instate widget action override size hint
ThomasKroes Apr 1, 2025
c2cf9a1
Work on view alignment
ThomasKroes Apr 1, 2025
897c3b4
Fix zoom percentage
ThomasKroes Apr 1, 2025
bd37721
Fix shortcuts
ThomasKroes Apr 2, 2025
447bd4b
All shortcuts are working and the shortcuts dialog has also been updated
ThomasKroes Apr 2, 2025
080db93
Added numerical, decimal and integral point action
ThomasKroes Apr 2, 2025
82a5158
Synchronize zoom percentage
ThomasKroes Apr 3, 2025
4317215
Zoom to selection is working
ThomasKroes Apr 3, 2025
ef8b44e
Fix cursors
ThomasKroes Apr 3, 2025
a4819a9
Add icon modifier support
ThomasKroes Apr 3, 2025
1f0c93c
Added zoom margins back in
ThomasKroes Apr 3, 2025
e0e77f6
Change how the default size is overridden
ThomasKroes Apr 3, 2025
4f61261
Work navigation freezing
ThomasKroes Apr 3, 2025
47ff612
Align density renderer with point renderer and fix shortcuts
ThomasKroes Apr 7, 2025
41c7e5d
Some explicit default inits
alxvth Apr 14, 2025
f53cc7d
Add several helper functions
alxvth Apr 14, 2025
ca3a5c4
Merge branch 'feature/renderer_upgrade' of https://github.com/ManiVau…
ThomasKroes Apr 28, 2025
9ca8ee3
Merge remote-tracking branch 'origin/master' into feature/renderer_up…
ThomasKroes Apr 28, 2025
78602d5
Skip opening project requirement if view reset is forced
ThomasKroes Apr 28, 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
40 changes: 18 additions & 22 deletions ManiVault/cmake/CMakeMvSourcesPublic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ set(PUBLIC_NUMERICAL_ACTIONS_HEADERS
src/actions/NumericalRangeAction.h
src/actions/DecimalRangeAction.h
src/actions/IntegralRangeAction.h
src/actions/NumericalPointAction.h
src/actions/DecimalPointAction.h
src/actions/IntegralPointAction.h
src/actions/RectangleAction.h
src/actions/IntegralRectangleAction.h
src/actions/DecimalRectangleAction.h
)

set(PUBLIC_NUMERICAL_ACTIONS_SOURCES
Expand All @@ -102,30 +108,19 @@ set(PUBLIC_NUMERICAL_ACTIONS_SOURCES
src/actions/NumericalRangeAction.cpp
src/actions/DecimalRangeAction.cpp
src/actions/IntegralRangeAction.cpp
src/actions/NumericalPointAction.cpp
src/actions/DecimalPointAction.cpp
src/actions/IntegralPointAction.cpp
src/actions/RectangleAction.cpp
src/actions/IntegralRectangleAction.cpp
src/actions/DecimalRectangleAction.cpp
)

set(PUBLIC_NUMERICAL_ACTIONS_FILES
${PUBLIC_NUMERICAL_ACTIONS_HEADERS}
${PUBLIC_NUMERICAL_ACTIONS_SOURCES}
)

set(PUBLIC_RECTANGLE_ACTIONS_HEADERS
src/actions/RectangleAction.h
src/actions/IntegralRectangleAction.h
src/actions/DecimalRectangleAction.h
)

set(PUBLIC_RECTANGLE_ACTIONS_SOURCES
src/actions/RectangleAction.cpp
src/actions/IntegralRectangleAction.cpp
src/actions/DecimalRectangleAction.cpp
)

set(PUBLIC_RECTANGLE_ACTIONS_FILES
${PUBLIC_RECTANGLE_ACTIONS_HEADERS}
${PUBLIC_RECTANGLE_ACTIONS_SOURCES}
)

set(PUBLIC_TEXTUAL_ACTIONS_HEADERS
src/actions/StringAction.h
src/actions/StringsAction.h
Expand Down Expand Up @@ -355,6 +350,7 @@ set(PUBLIC_ACTIONS_INTERNAL_HEADERS
src/actions/PaletteColorRoleAction.h
src/actions/ColorSchemeAction.h
src/actions/EditColorSchemeAction.h
src/actions/NavigationAction.h
)

set(PUBLIC_ACTIONS_INTERNAL_SOURCES
Expand Down Expand Up @@ -393,6 +389,7 @@ set(PUBLIC_ACTIONS_INTERNAL_SOURCES
src/actions/PaletteColorRoleAction.cpp
src/actions/ColorSchemeAction.cpp
src/actions/EditColorSchemeAction.cpp
src/actions/NavigationAction.cpp
)

set(PUBLIC_ACTIONS_INTERNAL_FILES
Expand Down Expand Up @@ -472,13 +469,15 @@ set(PUBLIC_RENDERERS_HEADERS
src/renderers/Renderer.h
src/renderers/PointRenderer.h
src/renderers/DensityRenderer.h
src/renderers/ImageRenderer.h
src/renderers/Renderer2D.h
src/renderers/Navigator2D.h
)

set(PUBLIC_RENDERERS_SOURCES
src/renderers/PointRenderer.cpp
src/renderers/DensityRenderer.cpp
src/renderers/ImageRenderer.cpp
src/renderers/Renderer2D.cpp
src/renderers/Navigator2D.cpp
)

set(PUBLIC_RENDERERS_FILES
Expand Down Expand Up @@ -1069,7 +1068,6 @@ set(PUBLIC_HEADERS
${PUBLIC_EVENT_HEADERS}
${PUBLIC_COLOR_MAP_ACTION_HEADERS}
${PUBLIC_NUMERICAL_ACTIONS_HEADERS}
${PUBLIC_RECTANGLE_ACTIONS_HEADERS}
${PUBLIC_TEXTUAL_ACTIONS_HEADERS}
${PUBLIC_GROUPING_ACTIONS_HEADERS}
${PUBLIC_TRIGGER_ACTIONS_HEADERS}
Expand Down Expand Up @@ -1118,7 +1116,6 @@ set(PUBLIC_SOURCES
${PUBLIC_EVENT_SOURCES}
${PUBLIC_COLOR_MAP_ACTION_SOURCES}
${PUBLIC_NUMERICAL_ACTIONS_SOURCES}
${PUBLIC_RECTANGLE_ACTIONS_SOURCES}
${PUBLIC_TEXTUAL_ACTIONS_SOURCES}
${PUBLIC_GROUPING_ACTIONS_SOURCES}
${PUBLIC_TRIGGER_ACTIONS_SOURCES}
Expand Down Expand Up @@ -1180,7 +1177,6 @@ source_group(CoreInterface FILES ${PUBLIC_CORE_INTERFACE_FILES})
source_group(Event FILES ${PUBLIC_EVENT_FILES})
source_group(Actions\\Colormap FILES ${PUBLIC_COLOR_MAP_ACTION_FILES})
source_group(Actions\\Numerical FILES ${PUBLIC_NUMERICAL_ACTIONS_FILES})
source_group(Actions\\Rectangle FILES ${PUBLIC_RECTANGLE_ACTIONS_FILES})
source_group(Actions\\Textual FILES ${PUBLIC_TEXTUAL_ACTIONS_FILES})
source_group(Actions\\Grouping FILES ${PUBLIC_GROUPING_ACTIONS_FILES})
source_group(Actions\\Trigger FILES ${PUBLIC_TRIGGER_ACTIONS_FILES})
Expand Down
6 changes: 3 additions & 3 deletions ManiVault/res/shaders/DensityDraw.frag
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
uniform sampler2D tex;
uniform float norm;

in vec2 pass_texCoord;
in vec2 passUv;

out vec4 fragColor;

void main() {
float f = 1 - (texture(tex, pass_texCoord).r * norm);
float f = 1 - (texture(tex, passUv).r * norm);
fragColor = vec4(vec3(f), 1);
}
}
16 changes: 8 additions & 8 deletions ManiVault/res/shaders/IsoDensityDraw.frag
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ uniform sampler2D densityMap;
uniform vec2 renderParams;
uniform vec3 colorMapRange;

in vec2 pass_texCoord;
in vec2 passUv;

out vec4 fragColor;

// Get the normalized density from the color map range
float getNormalizedDensity(vec2 uv)
float getNormalizedDensity(vec2 passUv)
{
float density = texture(densityMap, uv).r;
float density = texture(densityMap, passUv).r;
return (density - colorMapRange.x) / colorMapRange.z;
}

void main() {
float density = getNormalizedDensity(pass_texCoord);
float density = getNormalizedDensity(passUv);

if (density < renderParams.y)
discard;
Expand All @@ -40,10 +40,10 @@ void main() {
// Central differences to find out if we draw the iso contour instead of the color
vec4 neighborDensities;

neighborDensities.x = getNormalizedDensity(pass_texCoord + texelSize.xz);
neighborDensities.y = getNormalizedDensity(pass_texCoord - texelSize.xz);
neighborDensities.z = getNormalizedDensity(pass_texCoord + texelSize.zy);
neighborDensities.w = getNormalizedDensity(pass_texCoord - texelSize.zy);
neighborDensities.x = getNormalizedDensity(passUv + texelSize.xz);
neighborDensities.y = getNormalizedDensity(passUv - texelSize.xz);
neighborDensities.z = getNormalizedDensity(passUv + texelSize.zy);
neighborDensities.w = getNormalizedDensity(passUv - texelSize.zy);

ivec4 stepId = min(ivec4(floor(neighborDensities * vec4(numSteps+1))), ivec4(numSteps));
isBoundary = (any(notEqual(stepId.xxx, stepId.yzw)));
Expand Down
71 changes: 41 additions & 30 deletions ManiVault/res/shaders/PointPlot.vert
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
#define EFFECT_COLOR_2D 4

// Point properties
uniform float pointSize; /** Point size */
uniform float pointSizeScale; /** Scale factor in absolute point size mode */
uniform float pointSize; /** Point size in x- and y direction to account for anisotropy of the render canvas */
uniform bool pointSizeAbsolute; /** Whether the point size is in world or screen coordinates */
uniform vec2 viewportSize; /** (width, height) of viewport */
uniform int scalarEffect;
uniform float pointOpacity; /** Point opacity */
uniform mat3 orthoM; /** Projection matrix from bounds space to clip space */
uniform mat4 mvp; /** Projection matrix from bounds space to clip space */
uniform bool hasHighlights; /** Whether a highlight buffer is used */
uniform bool hasFocusHighlights; /** Whether a focus highlight buffer is used */
uniform bool hasScalars; /** Whether a scalar buffer is used */
Expand All @@ -42,6 +43,9 @@ uniform float focusOutlineOpacity; /** Focus outline opacity */

uniform bool randomizedDepthEnabled; /** Whether to randomize the z-order */

// Miscellaneous
uniform float windowAspectRatio; /** Window aspect ratio (width / height) */

layout(location = 0) in vec2 vertex; /** Vertex input, always a [-1, 1] quad */
layout(location = 1) in vec2 position; /** 2-Dimensional positions of points */
layout(location = 2) in int highlight; /** Mask of highlights over the points */
Expand Down Expand Up @@ -103,8 +107,6 @@ float floatConstruct( uint m ) {
return f - 1.0; // Range [0:1]
}



// Pseudo-random value in half-open range [0:1].
float random( float x ) { return floatConstruct(hash(floatBitsToUint(x))); }
float random( vec2 v ) { return floatConstruct(hash(floatBitsToUint(v))); }
Expand All @@ -113,33 +115,42 @@ float random( vec4 v ) { return floatConstruct(hash(floatBitsToUint(v))); }

void main()
{
// The texture coordinates match vertex coordinates
vTexCoord = vertex;

// Selection and focus highlighting
vHighlight = hasHighlights ? highlight : 0;
// Use normalized quad vertices as texture coordinates
vTexCoord = vertex;

// Convert quad size from pixels to normalized device coordinates (NDC)
vec2 pixelSize = vec2(hasSizes ? size : pointSize) / viewportSize;

// if (!pointSizeAbsolute)
// pixelSize /= viewportSize;

// Apply projection only to the instance position, NOT to the quad size
vec4 worldPos = mvp * vec4(position, 0.0, 1.0);

// Compute the scaled vertex position
vec2 scaledVertex = vertex * pixelSize;

// Scale the vertex based on the selection display mode
scaledVertex *= ((selectionDisplayMode == 0) ? selectionOutlineScale : 1);

// Keep quad size in screen-space while maintaining correct aspect ratio
vec2 finalPos = worldPos.xy + scaledVertex;

// if (pointSizeAbsolute)
// finalPos = (mvp * vec4(position + scaledVertex, 0.0, 1.0)).xy;

// Compute random depth
float depth = randomizedDepthEnabled ? random(vec2(gl_InstanceID, 0)) : 0;

// Set the final position
gl_Position = vec4(finalPos, depth, 1.0); // Convert to NDC [-1,1]

vHighlight = hasHighlights ? highlight : 0;
vFocusHighlight = hasFocusHighlights ? focusHighlight : 0;

vScalar = hasScalars ? (scalar - colorMapRange.x) / colorMapRange.z : 0;

vColor = hasColors ? color : vec3(0.5);

vOpacity = pointOpacity;
vScalar = hasScalars ? (scalar - colorMapRange.x) / colorMapRange.z : 0;
vColor = hasColors ? color : vec3(0.5);
vOpacity = pointOpacity;

if (hasOpacities)
vOpacity = opacity;

vPosOrig = position;

// Transform position to clip space
vec2 pos = (orthoM * vec3(position, 1)).xy;

// Resize point quad according to properties
vec2 scaledVertex = vertex * pointSize * pointSizeScale * ((selectionDisplayMode == 0) ? selectionOutlineScale : 1);

if (hasSizes)
scaledVertex = vertex * size * pointSizeScale * ((selectionDisplayMode == 0) ? selectionOutlineScale : 1);

// Move quad by position and output
gl_Position = vec4(scaledVertex + pos, randomizedDepthEnabled ? random(pos) : 0, 1);
}
12 changes: 9 additions & 3 deletions ManiVault/res/shaders/Quad.vert
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@

#version 330 core

out vec2 pass_texCoord;
layout(location = 0) in vec2 vertex;
layout(location = 1) in vec2 uv;

uniform mat4 mvp;

out vec2 passUv;

void main() {
pass_texCoord = vec2((gl_VertexID << 1) & 2, gl_VertexID & 2);
gl_Position = vec4(pass_texCoord * 2 - 1, 0, 1);
gl_Position = mvp * vec4(vertex, 0, 1);

passUv = uv;
}
63 changes: 63 additions & 0 deletions ManiVault/src/actions/DecimalPointAction.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// A corresponding LICENSE file is located in the root directory of this source tree
// Copyright (C) 2023 BioVault (Biomedical Visual Analytics Unit LUMC - TU Delft)

#include "DecimalPointAction.h"

using namespace mv::util;

namespace mv::gui {

DecimalPointAction::DecimalPointAction(QObject* parent, const QString& title) :
NumericalPointAction<float, DecimalAction>(parent, title, std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max())
{
for (int axisIndex = 0; axisIndex < static_cast<int>(Axis::Count); ++axisIndex) {
getAction(static_cast<NumericalPointAction::Axis>(axisIndex)).setNumberOfDecimals(2);

connect(&getAction(static_cast<NumericalPointAction::Axis>(axisIndex)), &DecimalAction::valueChanged, this, [this](float value) -> void {
emit valueChanged(getX(), getY());
});
}
}

void DecimalPointAction::connectToPublicAction(WidgetAction* publicAction, bool recursive)
{
auto publicDecimalPointAction = dynamic_cast<DecimalPointAction*>(publicAction);

Q_ASSERT(publicDecimalPointAction);

if (!publicDecimalPointAction)
return;

connect(this, &DecimalPointAction::valueChanged, publicDecimalPointAction, [publicDecimalPointAction](float x, float y) -> void {
publicDecimalPointAction->set(x, y);
});

connect(publicDecimalPointAction, &DecimalPointAction::valueChanged, this, [this](float x, float y) -> void {
set(x, y);
});

set(publicDecimalPointAction->get());

NumericalPointAction<float, DecimalAction>::connectToPublicAction(publicAction, recursive);
}

void DecimalPointAction::disconnectFromPublicAction(bool recursive)
{
if (!isConnected())
return;

auto publicDecimalPointAction = dynamic_cast<DecimalPointAction*>(getPublicAction());

Q_ASSERT(publicDecimalPointAction);

if (!publicDecimalPointAction)
return;

disconnect(this, &DecimalPointAction::valueChanged, publicDecimalPointAction, nullptr);
disconnect(publicDecimalPointAction, &DecimalPointAction::valueChanged, this, nullptr);

NumericalPointAction<float, DecimalAction>::disconnectFromPublicAction(recursive);
}

}
Loading