本文整理汇总了C++中View::GetViewMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ View::GetViewMatrix方法的具体用法?C++ View::GetViewMatrix怎么用?C++ View::GetViewMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类View
的用法示例。
在下文中一共展示了View::GetViewMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testSelect
void RotateManipulator::testSelect (const View& view, const Matrix4& pivot2world)
{
m_pivot.update(pivot2world, view.GetModelview(), view.GetProjection(), view.GetViewport());
updateCircleTransforms();
SelectionPool selector;
{
{
Matrix4 local2view(matrix4_multiplied_by_matrix4(view.GetViewMatrix(), m_local2world_x));
SelectionIntersection best;
LineStrip_BestPoint(local2view, m_circle_x.m_vertices.data(), m_circle_x.m_vertices.size(), best);
selector.addSelectable(best, &m_selectable_x);
}
{
Matrix4 local2view(matrix4_multiplied_by_matrix4(view.GetViewMatrix(), m_local2world_y));
SelectionIntersection best;
LineStrip_BestPoint(local2view, m_circle_y.m_vertices.data(), m_circle_y.m_vertices.size(), best);
selector.addSelectable(best, &m_selectable_y);
}
{
Matrix4 local2view(matrix4_multiplied_by_matrix4(view.GetViewMatrix(), m_local2world_z));
SelectionIntersection best;
LineStrip_BestPoint(local2view, m_circle_z.m_vertices.data(), m_circle_z.m_vertices.size(), best);
selector.addSelectable(best, &m_selectable_z);
}
}
{
Matrix4 local2view(matrix4_multiplied_by_matrix4(view.GetViewMatrix(), m_pivot.m_viewpointSpace));
{
SelectionIntersection best;
LineLoop_BestPoint(local2view, m_circle_screen.m_vertices.data(), m_circle_screen.m_vertices.size(), best);
selector.addSelectable(best, &m_selectable_screen);
}
{
SelectionIntersection best;
Circle_BestPoint(local2view, eClipCullCW, m_circle_sphere.m_vertices.data(),
m_circle_sphere.m_vertices.size(), best);
selector.addSelectable(best, &m_selectable_sphere);
}
}
m_axis_screen = m_pivot.m_axis_screen;
if (!selector.failed()) {
(*selector.begin()).second->setSelected(true);
}
}
示例2: testSelect
void TranslateManipulator::testSelect(const View& view, const Matrix4& pivot2world) {
_pivot.update(pivot2world, view.GetModelview(), view.GetProjection(), view.GetViewport());
SelectionPool selector;
Vector3 x = _pivot._worldSpace.x().getVector3().getNormalised();
bool show_x = manipulator_show_axis(_pivot, x);
Vector3 y = _pivot._worldSpace.y().getVector3().getNormalised();
bool show_y = manipulator_show_axis(_pivot, y);
Vector3 z = _pivot._worldSpace.z().getVector3().getNormalised();
bool show_z = manipulator_show_axis(_pivot, z);
{
Matrix4 local2view(view.GetViewMatrix().getMultipliedBy(_pivot._viewpointSpace));
{
SelectionIntersection best;
Quad_BestPoint(local2view, eClipCullCW, &_quadScreen.front(), best);
if(best.valid())
{
best = SelectionIntersection(0, 0);
selector.addSelectable(best, &_selectableScreen);
}
}
}
{
Matrix4 local2view(view.GetViewMatrix().getMultipliedBy(_pivot._worldSpace));
if(show_x)
{
SelectionIntersection best;
Line_BestPoint(local2view, &_arrowX.front(), best);
Triangles_BestPoint(local2view, eClipCullCW, &_arrowHeadX._vertices.front(), &*(_arrowHeadX._vertices.end()-1)+1, best);
selector.addSelectable(best, &_selectableX);
}
if(show_y)
{
SelectionIntersection best;
Line_BestPoint(local2view, &_arrowY.front(), best);
Triangles_BestPoint(local2view, eClipCullCW, &_arrowHeadY._vertices.front(), &*(_arrowHeadY._vertices.end()-1)+1, best);
selector.addSelectable(best, &_selectableY);
}
if(show_z)
{
SelectionIntersection best;
Line_BestPoint(local2view, &_arrowZ.front(), best);
Triangles_BestPoint(local2view, eClipCullCW, &_arrowHeadZ._vertices.front(), &*(_arrowHeadZ._vertices.end()-1)+1, best);
selector.addSelectable(best, &_selectableZ);
}
}
// greebo: If any of the above arrows could be selected, select the first in the SelectionPool
if(!selector.failed()) {
(*selector.begin()).second->setSelected(true);
} else {
Selectable* selectable = NULL;
if (registry::getValue<bool>(RKEY_TRANSLATE_CONSTRAINED)) {
// None of the shown arrows (or quad) has been selected, select an axis based on the precedence
Matrix4 local2view(view.GetViewMatrix().getMultipliedBy(_pivot._worldSpace));
// Get the (relative?) distance from the mouse pointer to the manipulator
Vector3 delta = local2view.t().getProjected();
// Get the precedence (which axis has the absolute largest value in it)
bool xGreaterY = (fabs(delta.x()) > fabs(delta.y()));
// The precedence has to be interpreted according to which axes are visible
if (show_z) {
// Either XZ or YZ
if (show_y) {
// YZ
selectable = (xGreaterY) ? &_selectableY : &_selectableZ;
}
else {
// XZ
selectable = (xGreaterY) ? &_selectableX : &_selectableZ;
}
}
else {
// XY
selectable = (xGreaterY) ? &_selectableX : &_selectableY;
}
}
else {
// Don't constrain to axis, choose the freemove translator
selectable = &_selectableScreen;
}
// If everything went ok, there is a selectable available, add it
if (selectable != NULL) {
selector.addSelectable(SelectionIntersection(0,0), selectable);
selectable->setSelected(true);
}
}
//.........这里部分代码省略.........