Skip to content

Commit f57825e

Browse files
committed
Refactored projection matrix to be public.
1 parent e950aea commit f57825e

File tree

8 files changed

+15
-11
lines changed

8 files changed

+15
-11
lines changed

src/docs/HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ ChangeLog
6464
- Added support for Pixar's Renderman .z or .zfile shadow map files.
6565
- Fixed the OpenGL bug in macOS mrv2. There's no longer any need to change your System Settings.
6666
- Switch to A Compare Mode if only a single file is left open.
67+
- Python command to getVoiceAnnotationsJSON now returns the projection matrix.
6768

6869

6970
v1.5.2

src/lib/mrvGL/mrvGLViewportDraw.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ namespace mrv
860860
const auto& viewportSize = getViewportSize();
861861
const auto& renderSize = getRenderSize();
862862

863-
math::Matrix4x4f mvp = _projectionMatrix();
863+
math::Matrix4x4f mvp = projectionMatrix();
864864
mvp = mvp * math::scale(math::Vector3f(1.F, -1.F, 1.F));
865865
gl.render->setTransform(mvp);
866866

@@ -1216,7 +1216,7 @@ namespace mrv
12161216
box.min.y = -(renderSize.h - box.min.y);
12171217
box.max.y = -(renderSize.h - box.max.y);
12181218

1219-
math::Matrix4x4f mvp = _projectionMatrix();
1219+
math::Matrix4x4f mvp = projectionMatrix();
12201220
mvp = mvp * math::scale(math::Vector3f(1.F, -1.F, 1.F));
12211221
gl.render->setTransform(mvp);
12221222

src/lib/mrvGL/mrvGLViewportPrims.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ namespace mrv
196196
CHECK_GL;
197197
}
198198

199-
return _projectionMatrix();
199+
return projectionMatrix();
200200
}
201201

202202
} // namespace opengl

src/lib/mrvPy/Annotations.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ namespace mrv2
120120
const auto& viewportSize = App::ui->uiView->getViewportSize();
121121
const auto& renderSize = App::ui->uiView->getRenderSize();
122122
const float viewZoom = App::ui->uiView->viewZoom();
123+
const math::Matrix4x4f& mvp = App::ui->uiView->projectionMatrix();
123124

124125
// Calculate resolution multiplier.
125126
float resolutionMultiplier = renderSize.w * 6 / 4096.0 / viewZoom;
@@ -129,6 +130,7 @@ namespace mrv2
129130
j["viewportSize"] = viewportSize;
130131
j["renderSize"] = renderSize;
131132
j["viewZoom"] = viewZoom;
133+
j["mvp"] = mvp;
132134

133135
auto annotations = player->getVoiceAnnotations();
134136
std::vector<nlohmann::json > voiceAnnotations;

src/lib/mrvViewport/mrvTimelineViewport.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3872,7 +3872,8 @@ namespace mrv
38723872
}
38733873

38743874

3875-
math::Matrix4x4f TimelineViewport::_projectionMatrix() const noexcept
3875+
const math::Matrix4x4f
3876+
TimelineViewport::projectionMatrix() const noexcept
38763877
{
38773878
TLRENDER_P();
38783879

src/lib/mrvViewport/mrvTimelineViewport.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ namespace mrv
424424

425425
//! Append audio and mouse movements to current voice over.
426426
void voiceOverAppend();
427+
428+
//! Get the full projection matrix.
429+
const math::Matrix4x4f projectionMatrix() const noexcept;
427430

428431
protected:
429432
void _init();
@@ -452,9 +455,6 @@ namespace mrv
452455
//! Get the render projection matrix.
453456
math::Matrix4x4f _renderProjectionMatrix() const noexcept;
454457

455-
//! Get the full projection matrix.
456-
math::Matrix4x4f _projectionMatrix() const noexcept;
457-
458458
//! Get the matrix to pixel (raster) coordinates of image.
459459
math::Matrix4x4f _pixelMatrix() const noexcept;
460460

src/lib/mrvVk/mrvVkViewportDraw.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ namespace mrv
548548
selection.max.x++;
549549
selection.max.y++;
550550
}
551-
const math::Matrix4x4f mvp = _projectionMatrix();
551+
const math::Matrix4x4f& mvp = projectionMatrix();
552552
_drawRectangleOutline("selection", mvp, selection, color);
553553
}
554554

@@ -622,7 +622,7 @@ namespace mrv
622622
const auto& viewportSize = getViewportSize();
623623
const auto& renderSize = getRenderSize();
624624

625-
const math::Matrix4x4f mvp = _projectionMatrix();
625+
const math::Matrix4x4f& mvp = projectionMatrix();
626626
const VkRenderPass oldRenderPass = vk.render->getRenderPass();
627627
const math::Matrix4x4f oldTransform = vk.render->getTransform();
628628

@@ -993,7 +993,7 @@ namespace mrv
993993
std::stringstream ss(dw);
994994
ss >> box;
995995

996-
const math::Matrix4x4f mvp = _projectionMatrix();
996+
const math::Matrix4x4f& mvp = projectionMatrix();
997997
const VkRenderPass oldRenderPass = vk.render->getRenderPass();
998998
const math::Matrix4x4f oldTransform = vk.render->getTransform();
999999

src/lib/mrvVk/mrvVkViewportPrims.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ namespace mrv
195195
prepare_pipeline();
196196
}
197197

198-
return _projectionMatrix();
198+
return projectionMatrix();
199199
}
200200

201201
} // namespace vulkan

0 commit comments

Comments
 (0)