本文整理汇总了C++中InputState::modifierKeys方法的典型用法代码示例。如果您正苦于以下问题:C++ InputState::modifierKeys方法的具体用法?C++ InputState::modifierKeys怎么用?C++ InputState::modifierKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputState
的用法示例。
在下文中一共展示了InputState::modifierKeys方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleScroll
void CameraTool::handleScroll(InputState& inputState) {
if (inputState.modifierKeys() != ModifierKeys::MKNone &&
inputState.modifierKeys() != ModifierKeys::MKAlt)
return;
if (m_orbit) {
const Renderer::Camera& camera = inputState.camera();
Planef orbitPlane(camera.direction(), m_orbitCenter);
float maxForward = orbitPlane.intersectWithRay(Rayf(camera.position(), camera.direction())) - 32.0f;
float forward = inputState.scrollY() * moveSpeed(false);
if (maxForward < 0.0f)
maxForward = 0.0f;
if (forward > maxForward)
forward = maxForward;
CameraMoveEvent cameraEvent;
cameraEvent.setForward(forward);
postEvent(cameraEvent);
} else {
Preferences::PreferenceManager& prefs = Preferences::PreferenceManager::preferences();
const Renderer::Camera& camera = inputState.camera();
const Vec3f moveDirection = prefs.getBool(Preferences::CameraMoveInCursorDir) ? inputState.pickRay().direction : camera.direction();
const float distance = inputState.scrollY() * moveSpeed(false);
const Vec3f moveVector = distance * moveDirection;
CameraMoveEvent cameraEvent;
cameraEvent.setForward(moveVector.dot(camera.direction()));
cameraEvent.setRight(moveVector.dot(camera.right()));
cameraEvent.setUp(moveVector.dot(camera.up()));
postEvent(cameraEvent);
}
}
示例2: handleScroll
void CameraTool::handleScroll(InputState& inputState) {
if (inputState.modifierKeys() != ModifierKeys::MKNone &&
inputState.modifierKeys() != ModifierKeys::MKAlt)
return;
if (m_orbit) {
const Renderer::Camera& camera = inputState.camera();
Plane orbitPlane(camera.direction(), m_orbitCenter);
float maxForward = orbitPlane.intersectWithRay(Ray(camera.position(), camera.direction())) - 32.0f;
float forward = inputState.scrollY() * moveSpeed();
if (maxForward < 0.0f)
maxForward = 0.0f;
if (forward > maxForward)
forward = maxForward;
CameraMoveEvent cameraEvent;
cameraEvent.setForward(forward);
postEvent(cameraEvent);
} else {
CameraMoveEvent cameraEvent;
cameraEvent.setForward(inputState.scrollY() * moveSpeed());
cameraEvent.setRight(inputState.scrollX() * moveSpeed());
postEvent(cameraEvent);
}
}
示例3: handleDrag
bool CameraTool::handleDrag(InputState& inputState) {
if (inputState.mouseButtons() == MouseButtons::MBRight) {
if (m_orbit) {
CameraOrbitEvent cameraEvent;
cameraEvent.setHAngle(inputState.deltaX() * lookSpeed(false));
cameraEvent.setVAngle(inputState.deltaY() * lookSpeed(true));
cameraEvent.setCenter(m_orbitCenter);
postEvent(cameraEvent);
} else {
CameraLookEvent cameraEvent;
cameraEvent.setHAngle(inputState.deltaX() * lookSpeed(false));
cameraEvent.setVAngle(inputState.deltaY() * lookSpeed(true));
postEvent(cameraEvent);
}
} else if (inputState.mouseButtons() == MouseButtons::MBMiddle) {
Preferences::PreferenceManager& prefs = Preferences::PreferenceManager::preferences();
bool enableAltMove = prefs.getBool(Preferences::CameraEnableAltMove);
CameraMoveEvent cameraEvent;
if (enableAltMove && inputState.modifierKeys() == ModifierKeys::MKAlt) {
cameraEvent.setRight(inputState.deltaX() * panSpeed(false));
cameraEvent.setForward(inputState.deltaY() * -moveSpeed(true));
} else {
cameraEvent.setRight(inputState.deltaX() * panSpeed(false));
cameraEvent.setUp(inputState.deltaY() * panSpeed(true));
}
postEvent(cameraEvent);
}
return true;
}
示例4: handleStartPlaneDrag
bool CreateBrushTool::handleStartPlaneDrag(InputState& inputState, Planef& plane, Vec3f& initialPoint) {
assert(m_brush == NULL);
Model::EditStateManager& editStateManager = document().editStateManager();
if (inputState.mouseButtons() != MouseButtons::MBLeft ||
inputState.modifierKeys() != ModifierKeys::MKNone ||
editStateManager.selectionMode() != Model::EditStateManager::SMNone)
return false;
Model::FaceHit* hit = static_cast<Model::FaceHit*>(inputState.pickResult().first(Model::HitType::FaceHit, true, m_filter));
if (hit != NULL) {
initialPoint = hit->hitPoint();
} else {
Renderer::Camera& camera = view().camera();
initialPoint = camera.defaultPoint(inputState.pickRay().direction);
}
plane = Planef(Vec3f::PosZ, initialPoint);
m_initialPoint = initialPoint;
updateBounds(m_initialPoint);
Preferences::PreferenceManager& prefs = Preferences::PreferenceManager::preferences();
Renderer::TextureRendererManager& textureRendererManager = document().sharedResources().textureRendererManager();
m_brushFigure = new Renderer::BrushFigure(textureRendererManager);
m_brushFigure->setFaceColor(prefs.getColor(Preferences::FaceColor));
m_brushFigure->setEdgeColor(prefs.getColor(Preferences::SelectedEdgeColor));
m_brushFigure->setOccludedEdgeColor(prefs.getColor(Preferences::OccludedSelectedEdgeColor));
m_brushFigure->setEdgeMode(Renderer::BrushFigure::EMRenderOccluded);
m_brush = new Model::Brush(document().map().worldBounds(), document().map().forceIntegerFacePoints(), m_bounds, document().mruTexture());
m_brushFigure->setBrush(*m_brush);
return true;
}
示例5: handleStartDrag
bool CameraTool::handleStartDrag(InputState& inputState) {
if (inputState.mouseButtons() == MouseButtons::MBRight) {
if (inputState.modifierKeys() == ModifierKeys::MKAlt) {
Model::Hit* hit = inputState.pickResult().first(Model::HitType::ObjectHit, true, m_filter);
if (hit != NULL)
m_orbitCenter = hit->hitPoint();
else
m_orbitCenter = inputState.camera().defaultPoint();
m_orbit = true;
return true;
} else if (inputState.modifierKeys() == ModifierKeys::MKNone) {
return true;
}
} else if (inputState.mouseButtons() == MouseButtons::MBMiddle &&
(inputState.modifierKeys() == ModifierKeys::MKNone || inputState.modifierKeys() == ModifierKeys::MKAlt)) {
return true;
}
return false;
}
示例6: DragInfo
RestrictedDragPolicy::DragInfo ClipToolController::MoveClipPointPart::doStartDrag(const InputState& inputState) {
if (inputState.mouseButtons() != MouseButtons::MBLeft ||
inputState.modifierKeys() != ModifierKeys::MKNone)
return DragInfo();
Vec3 initialPoint;
if (!m_callback->tool()->beginDragPoint(inputState.pickResult(), initialPoint))
return DragInfo();
DragRestricter* restricter = m_callback->createDragRestricter(inputState, initialPoint);
DragSnapper* snapper = m_callback->createDragSnapper(inputState);
return DragInfo(restricter, snapper, initialPoint);
}
示例7: handleResetPlane
void CreateBrushTool::handleResetPlane(InputState& inputState, Planef& plane, Vec3f& initialPoint) {
float distance = plane.intersectWithRay(inputState.pickRay());
if (Math<float>::isnan(distance))
return;
initialPoint = inputState.pickRay().pointAtDistance(distance);
if (inputState.modifierKeys() == ModifierKeys::MKAlt) {
Vec3f planeNorm = inputState.pickRay().direction;
planeNorm[2] = 0.0f;
planeNorm.normalize();
plane = Planef(planeNorm, initialPoint);
} else {
plane = Planef::horizontalDragPlane(initialPoint);
}
}
示例8: handleStartDrag
bool RotateObjectsTool::handleStartDrag(InputState& inputState) {
if (inputState.mouseButtons() != MouseButtons::MBLeft ||
inputState.modifierKeys() != ModifierKeys::MKNone)
return false;
Model::EditStateManager& editStateManager = document().editStateManager();
const Model::EntityList& entities = editStateManager.selectedEntities();
const Model::BrushList& brushes = editStateManager.selectedBrushes();
if (entities.empty() && brushes.empty())
return false;
Model::RotateHandleHit* hit = static_cast<Model::RotateHandleHit*>(inputState.pickResult().first(Model::HitType::RotateHandleHit, true, view().filter()));
if (hit == NULL)
return false;
Vec3f test = hit->hitPoint() - m_rotateHandle.position();
switch (hit->hitArea()) {
case Model::RotateHandleHit::HAXAxis:
m_axis = Vec3f::PosX;
m_invert = ((test.dot(Vec3f::PosX) > 0.0f) == (test.dot(Vec3f::PosY) > 0.0f));
break;
case Model::RotateHandleHit::HAYAxis:
m_axis = Vec3f::PosY;
m_invert = ((test.dot(Vec3f::PosX) > 0.0f) != (test.dot(Vec3f::PosY) > 0.0f));
break;
case Model::RotateHandleHit::HAZAxis:
m_axis = Vec3f::PosZ;
m_invert = false;
break;
}
m_startX = inputState.x();
m_startY = inputState.y();
m_angle = 0.0f;
m_center = m_rotateHandle.position();
m_rotateHandle.lock();
beginCommandGroup(Controller::Command::makeObjectActionName(wxT("Rotate"), entities, brushes));
return true;
}