Skip to content
Snippets Groups Projects
Commit f79926d1 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

adds pzr to vegaexample. switched pan and rotate!

parent 53c59380
No related branches found
No related tags found
No related merge requests found
......@@ -91,16 +91,16 @@ void pzrMouseCameraController::handleEvent(std::shared_ptr<smtk::Event::smEvent>
if(lmbPressed && rmbPressed)
{
//rotate
this->camera->rotateFocusX(SM_DEGREES2RADIANS(moveDistance * diff(1)));
this->camera->rotateFocusY(SM_DEGREES2RADIANS(moveDistance * diff(0)));
//pan x and y
this->camera->pan(smVec3f(diff(0), diff(1), 0) * moveDistance);
//reset coords for next mouse move event
coords = newCoords;
}
else if(lmbPressed)
{
//pan x and y
this->camera->pan(smVec3f(diff(0), diff(1), 0) * moveDistance);
{
//rotate
this->camera->rotateFocusX(SM_DEGREES2RADIANS(moveDistance * diff(1)));
this->camera->rotateFocusY(SM_DEGREES2RADIANS(moveDistance * diff(0)));
//reset coords for next mouse move event
coords = newCoords;
}
......
......@@ -46,6 +46,7 @@
#include "../common/wasdCameraController.h"
#include "../common/KeyPressSDKShutdown.h"
#include "../common/pzrMouseCameraController.h"
//#include "../common/hapticController.h"
int main()
......@@ -62,6 +63,7 @@ int main()
std::shared_ptr<smCamera> sceneCamera;
std::shared_ptr<smtk::Examples::Common::wasdCameraController> camCtl;
std::shared_ptr<smtk::Examples::Common::KeyPressSDKShutdown> keyShutdown;
std::shared_ptr<smtk::Examples::Common::pzrMouseCameraController> pzrCamCtl;
//std::shared_ptr<smtk::Examples::Common::hapticController> hapticCtl;
smMatrix33d mat;
......@@ -182,9 +184,14 @@ int main()
keyShutdown = std::make_shared<smtk::Examples::Common::KeyPressSDKShutdown>();
pzrCamCtl = std::make_shared<smtk::Examples::Common::pzrMouseCameraController>();
pzrCamCtl->setCamera(sceneCamera);
// Link up the event system between this the camera controller and the viewer
viewer->attachEvent(smtk::Event::EventType::Keyboard, camCtl);
viewer->attachEvent(smtk::Event::EventType::Keyboard, keyShutdown);
viewer->attachEvent(smtk::Event::EventType::MouseMove, pzrCamCtl);
viewer->attachEvent(smtk::Event::EventType::MouseButton, pzrCamCtl);
//-------------------------------------------------------
// Run the SDK
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment