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

Update vsgmultiviews.cpp #239

Merged
merged 1 commit into from
Aug 10, 2023
Merged
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
12 changes: 6 additions & 6 deletions examples/app/vsgmultiviews/vsgmultiviews.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

vsg::ref_ptr<vsg::Camera> createCameraForScene(vsg::Node* scenegraph, int32_t x, int32_t y, uint32_t width, uint32_t height)
{
// compute the bounds of the scene graph to help position camera
// compute the bounds of the scene graph to help position the camera
vsg::ComputeBounds computeBounds;
scenegraph->accept(computeBounds);
vsg::dvec3 centre = (computeBounds.bounds.min + computeBounds.bounds.max) * 0.5;
Expand Down Expand Up @@ -59,11 +59,11 @@ class ViewHandler : public vsg::Inherit<vsg::Visitor, ViewHandler>
auto viewport1 = view1->camera->getViewport();
VkExtent2D extent1{ static_cast<uint32_t>(viewport1.width), static_cast<uint32_t>(viewport1.height)};

// swap rendering order by swap the view entries in the renderGraph->children
// swap rendering order by swapping the view entries in the renderGraph->children
std::swap(renderGraph->children[views[0].first], renderGraph->children[views[1].first]);
std::swap(views[0].second->camera->viewportState, views[1].second->camera->viewportState);

// change the aspect ratios of the projection matrices to fit the new diemensions.
// change the aspect ratios of the projection matrices to fit the new dimensions.
view0->camera->projectionMatrix->changeExtent(extent0, extent1);
view1->camera->projectionMatrix->changeExtent(extent1, extent0);

Expand Down Expand Up @@ -140,14 +140,14 @@ int main(int argc, char** argv)
auto main_camera = createCameraForScene(scenegraph, 0, 0, width, height);
auto main_view = vsg::View::create(main_camera, scenegraph);

// create an RenderinGraph to add an secondary vsg::View on the top right part of the window.
// create another RenderGraph to add a secondary vsg::View on the top right part of the window.
auto secondary_camera = createCameraForScene(scenegraph2, (width * 3) / 4, 0, width / 4, height / 4);
auto secondary_view = vsg::View::create(secondary_camera, scenegraph2);

// add close handler to respond the close window button and pressing escape
// add close handler to respond to the close window button and pressing escape
viewer->addEventHandler(vsg::CloseHandler::create(viewer));

// add event handlers, in the order we wish event to be handled.
// add event handlers, in the order we wish events to be handled.
viewer->addEventHandler(vsg::Trackball::create(secondary_camera));
viewer->addEventHandler(vsg::Trackball::create(main_camera));

Expand Down