本文整理汇总了C++中InputState::camera方法的典型用法代码示例。如果您正苦于以下问题:C++ InputState::camera方法的具体用法?C++ InputState::camera怎么用?C++ InputState::camera使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputState
的用法示例。
在下文中一共展示了InputState::camera方法的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: doGetNewClipPointPosition
bool doGetNewClipPointPosition(const InputState& inputState, Vec3& position) const {
const Renderer::Camera& camera = inputState.camera();
const Vec3 viewDir = camera.direction().firstAxis();
const Ray3& pickRay = inputState.pickRay();
const Vec3 defaultPos = m_tool->defaultClipPointPos();
const FloatType distance = pickRay.intersectWithPlane(viewDir, defaultPos);
if (Math::isnan(distance))
return false;
position = pickRay.pointAtDistance(distance);
const Grid& grid = m_tool->grid();
position = grid.snap(position);
return true;
}
示例4: 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;
}
示例5: updateEntityPosition
void CreateEntityTool::updateEntityPosition(InputState& inputState) {
assert(m_entity != NULL);
Utility::Grid& grid = document().grid();
Model::FaceHit* hit = static_cast<Model::FaceHit*>(inputState.pickResult().first(Model::HitType::FaceHit, true, view().filter()));
Vec3f delta;
if (hit == NULL) {
Vec3f newPosition = inputState.camera().defaultPoint(inputState.pickRay().direction);
const Vec3f& center = m_entity->bounds().center();
delta = grid.moveDeltaForEntity(center, document().map().worldBounds(), newPosition - center);
} else {
Model::Face& face = hit->face();
delta = grid.moveDeltaForEntity(face, m_entity->bounds(), document().map().worldBounds(), inputState.pickRay(), hit->hitPoint());
}
if (delta.null())
return;
m_entity->setProperty(Model::Entity::OriginKey, m_entity->origin() + delta, true);
m_entityFigure->invalidate();
}
示例6: doMouseDrag
bool ResizeBrushesToolController::doMouseDrag(const InputState& inputState) {
return m_tool->resize(inputState.pickRay(), inputState.camera());
}
示例7: getHelpVectors
Vec3::List getHelpVectors(const InputState& inputState) const {
return Vec3::List(1, inputState.camera().direction());
}
示例8: doPick
void ClipToolController::doPick(const InputState& inputState, Model::PickResult& pickResult) {
m_tool->pick(inputState.pickRay(), inputState.camera(), pickResult);
}