本文整理汇总了C++中Mat4::rotateY方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4::rotateY方法的具体用法?C++ Mat4::rotateY怎么用?C++ Mat4::rotateY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4
的用法示例。
在下文中一共展示了Mat4::rotateY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: normalisedYaw
//----------------------------------------------------------------------------------------------------------------------
void Camera::normalisedYaw( Real _angle ) noexcept
{
// build a rotation matrix around the y axis
Mat4 mat;
mat.identity();
mat.rotateY(_angle);
//multiply all three local coord vectors by the matrix
m_u = m_u * mat;
m_v = m_v * mat;
m_n = m_n * mat;
// reset the modelview matrix
setViewMatrix();
}
示例2: setHandleEvent
void HelloWorld::setHandleEvent()
{
auto listener = EventListenerTouchOneByOne::create();
listener->setSwallowTouches(true);
listener->onTouchBegan = [&](Touch *touch, Event *event){
return !isTouchElement(touch);
};
listener->onTouchMoved = [&](Touch *touch, Event *event){
Vec2 location = touch->getLocationInView();
Vec2 preLocation = touch->getPreviousLocationInView();
float delta = (location - preLocation).dot(Vec2(-1.0f, 0.0f));
Mat4 mat;
mat.rotateY(delta * 0.01f);
mat.translate(_camera->getPosition3D());
Vec3 currentPos;
mat.getTranslation(¤tPos);
_camera->setPosition3D(currentPos);
_camera->lookAt(Vec3(0.0f, 0.0f, 0.0f), Vec3(0.0f, 1.0f, 0.0f));
};
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
}