Skip to content

Commit

Permalink
Fixed rotation for annotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Mar 9, 2024
1 parent 23d5d7d commit 60596d2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
4 changes: 4 additions & 0 deletions mrv2/lib/mrvGL/mrvGLViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,10 @@ namespace mrv
CHECK_GL;
}

if (p.environmentMapOptions.type ==
EnvironmentMapOptions::kNone)
mvp = _notRotatedMatrix();

if (p.showAnnotations && gl.annotation)
{
CHECK_GL;
Expand Down
2 changes: 2 additions & 0 deletions mrv2/lib/mrvGL/mrvGLViewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ namespace mrv
math::Matrix4x4f _createEnvironmentMap();

math::Matrix4x4f _createTexturedRectangle();

math::Matrix4x4f _notRotatedMatrix();

void _calculateColorArea(mrv::area::Info& info);

Expand Down
17 changes: 17 additions & 0 deletions mrv2/lib/mrvGL/mrvGLViewportPrims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,21 @@ namespace mrv
return pm * vm * to * rm * tm;
}

math::Matrix4x4f Viewport::_notRotatedMatrix()
{
TLRENDER_P();

const auto& viewportSize = getViewportSize();

const math::Matrix4x4f& vm =
math::translate(math::Vector3f(p.viewPos.x, p.viewPos.y, 0.F)) *
math::scale(math::Vector3f(p.viewZoom, p.viewZoom, 1.F));

const auto pm = math::ortho(
0.F, static_cast<float>(viewportSize.w), 0.F,
static_cast<float>(viewportSize.h), -1.F, 1.F);

return pm * vm;
}

} // namespace mrv
15 changes: 12 additions & 3 deletions mrv2/lib/mrvPy/USD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ Contains all classes and enums related to USD (Universal Scene Description).
.def(py::init<>())
.def(
py::init<
std::string, int, float, tl::usd::DrawMode, bool, bool, size_t,
size_t>(),
std::string, int, float, tl::usd::DrawMode, bool, bool, bool, bool,
size_t, size_t>(),
py::arg("rendererName") = 0, py::arg("renderWidth") = 1920,
py::arg("complexity") = 1.F,
py::arg("drawMode") = tl::usd::DrawMode::ShadedSmooth,
py::arg("enableLighting") = true, py::arg("sRGB") = true,
py::arg("enableLighting") = true,
py::arg("enableSceneLights") = false,
py::arg("enableSceneMaterials") = false,
py::arg("sRGB") = true,
py::arg("stageCache") = 10, py::arg("diskCache") = 0)
.def_readwrite(
"rendererName", &usd::RenderOptions::rendererName,
Expand All @@ -52,6 +55,12 @@ Contains all classes and enums related to USD (Universal Scene Description).
.def_readwrite(
"enableLighting", &usd::RenderOptions::enableLighting,
_("Enable Lighting"))
.def_readwrite(
"enableSceneLights", &usd::RenderOptions::enableLighting,
_("Enable Scene Lights"))
.def_readwrite(
"enableSceneMaterials", &usd::RenderOptions::enableLighting,
_("Enable Scene Materials"))
.def_readwrite("sRGB", &usd::RenderOptions::sRGB, _("Enable sRGB"))
.def_readwrite(
"stageCache", &usd::RenderOptions::stageCache,
Expand Down

0 comments on commit 60596d2

Please sign in to comment.