本文整理汇总了C++中Mtx44::SetToRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ Mtx44::SetToRotation方法的具体用法?C++ Mtx44::SetToRotation怎么用?C++ Mtx44::SetToRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mtx44
的用法示例。
在下文中一共展示了Mtx44::SetToRotation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void CustomCam1::rotateCamVertical(float degrees)
{
if (degrees + f_currentPitch > f_pitchLimit && degrees > 0)
{
degrees = f_pitchLimit - f_currentPitch;
if (f_currentPitch >= f_pitchLimit)
{
degrees = 0.f;
}
}
else if (degrees + f_currentPitch < -f_pitchLimit && degrees < 0)
{
degrees = -f_pitchLimit - f_currentPitch;
if (f_currentPitch <= -f_pitchLimit)
{
degrees = 0.f;
}
}
Vector3 view = (target - position).Normalized();
Vector3 right = view.Cross(up);
right.y = 0;
right.Normalize();
up = right.Cross(view).Normalized();
Mtx44 rotation;
target -= position;
f_currentPitch += degrees;
rotation.SetToRotation(static_cast<float>(degrees), right.x, right.y, right.z);
target = rotation * target;
target += position;
}
示例2: SetRotate
void CTransform::SetRotate( const float angle, const float rx, const float ry, const float rz, bool self)
{
Mtx44 MtxBackToPosition;
if (self)
{
Mtx44 MtxBackToOrigin;
MtxBackToOrigin.a[12] = -Mtx.a[12];
MtxBackToOrigin.a[13] = -Mtx.a[13];
MtxBackToOrigin.a[14] = -Mtx.a[14];
MtxBackToPosition.a[12] = Mtx.a[12];
MtxBackToPosition.a[13] = Mtx.a[13];
MtxBackToPosition.a[14] = Mtx.a[14];
Mtx = Mtx + MtxBackToOrigin;
}
Mtx44 TempMtx;
TempMtx.SetToRotation(angle, rx, ry, rz);
Mtx = Mtx * TempMtx ;
if (self)
{
Mtx = Mtx + MtxBackToPosition;
}
}
示例3: movementFB
void AI::movementFB(double &dt, bool forward)
{
Mtx44 rotation;
if (forward)
{
if (e_State == ATTACK)
{
f_movementSpeed = f_move_run;
}
else
{
f_movementSpeed = f_move_walk;
}
vel += (getDirection(true).Normalize() * (f_movementSpeed)) * static_cast<float>(dt);
}
else
{
Lookat = Lookat - pos;
rotation.SetToRotation(720 * static_cast<float>(dt), 0, 1, 0);
Lookat = rotation * Lookat;
Lookat = Lookat + pos;
//Velocity += (getDirection(true).Normalize() * f_movementSpeed) * static_cast<float>(dt);
}
}
示例4: SpinCounterClockwise
void FPcamera::SpinCounterClockwise(const double dt)
{
float angle = (float)(-TURN_SPEED * (float)dt);
view = (target - position).Normalized();
Mtx44 rotation;
rotation.SetToRotation(angle, 0, 0, 1);
view = rotation * view;
target = position + view;
}
示例5: LookAround
void CameraComponent::LookAround(double dt)
{
auto infoC = this->getParent()->getComponent<InformationComponent>();
if (infoC)
{
Mtx44 rotation;
rotation.SetToRotation(m_Camera->getCameraYaw(),0, 1, 0);
Vector3 curDirection = infoC->getDirection().Normalized();
curDirection = rotation * curDirection;
infoC->setDirection(curDirection);
}
}
示例6:
void CPlayInfo3PV::UpdateDir(float yaw, float pitch)
{
// Yaw
Mtx44 rotation;
rotation.SetToRotation(yaw, 0, 1, 0);
curDirection = rotation * curDirection;
Vector3 right = curDirection.Cross(curUp);
right.y = 0;
right.Normalize();
curUp = right.Cross(curDirection).Normalized();
// Pitch
//rotation.SetToRotation(pitch, 1, 0, 0);
right = curDirection.Cross(curUp);
right.y = 0;
right.Normalize();
curUp = right.Cross(curDirection).Normalized();
rotation.SetToRotation(pitch, right.x, right.y, right.z);
curDirection = rotation * curDirection;
}
示例7: movementLR
void AI::movementLR(double &dt, bool left, float rotation_speed)
{
Mtx44 rotation;
if (left == true)
{
Lookat = Lookat - pos;
rotation.SetToRotation(-rotation_speed * static_cast<float>(dt), 0, 1, 0);
Lookat = rotation * Lookat;
Lookat = Lookat + pos;
//Velocity += (getDirection(true).Normalize() * f_movementSpeed) * static_cast<float>(dt);
}
else
{
Lookat = Lookat - pos;
rotation.SetToRotation(rotation_speed * static_cast<float>(dt), 0, 1, 0);
Lookat = rotation * Lookat;
Lookat = Lookat + pos;
//Velocity += (getDirection(true).Normalize() * f_movementSpeed) * static_cast<float>(dt);
}
}
示例8: LookDown
/********************************************************************************
LookDown
********************************************************************************/
void TPCamera::LookDown(const double dt)
{
//float pitch = (float)(-CAMERA_SPEED * Application::camera_pitch * (float)dt);
float pitch = (float)(CAMERA_SPEED * (float)dt);
Vector3 view = (target - position).Normalized();
Vector3 right = view.Cross(up);
right.y = 0;
right.Normalize();
up = right.Cross(view).Normalized();
Mtx44 rotation;
rotation.SetToRotation(pitch, right.x, right.y, right.z);
view = rotation * view;
target = position + view;
}
示例9: lookUp
void FPcamera::lookUp(const double dt)
{
float pitch = (float)(-TURN_SPEED * Application::camera_pitch * (float)dt);
rotationX -= pitch;
view = (target - position).Normalized();
Vector3 right = view.Cross(up);
right.y = 0;
right.Normalize();
up = right.Cross(view).Normalized();
Mtx44 rotation;
rotation.SetToRotation(pitch, right.x, right.y, right.z);
view = rotation * view;
target = position + view;
}
示例10: lookRight
void FPcamera::lookRight(const double dt)
{
view = (target - position).Normalized();
float yaw = (float)(-TURN_SPEED * Application::camera_yaw * (float)dt);
rotationY += yaw;
Mtx44 rotation;
rotation.SetToRotation(yaw, 0, 1, 0);
view = rotation * view;
target = position + view;
Vector3 right = view.Cross(up);
right.y = 0;
right.Normalize();
up = right.Cross(view).Normalized();
}
示例11: TurnRight
/********************************************************************************
Turn right
********************************************************************************/
void TPCamera::TurnRight(const double dt)
{
Vector3 view = (target - position).Normalized();
// float yaw = (float)(-CAMERA_SPEED * Application::camera_yaw * (float)dt);
float yaw = (float)(-CAMERA_SPEED * (float)dt);
Mtx44 rotation;
rotation.SetToRotation(yaw, 0, 1, 0);
view = rotation * view;
target = position + view;
Vector3 right = view.Cross(up);
right.y = 0;
right.Normalize();
up = right.Cross(view).Normalized();
}
示例12:
/********************************************************************************
LookRight
********************************************************************************/
void Camera3::LookRight(const double dt)
{
float yaw = yawVelocity;
Vector3 view = (target - position).Normalized();
Vector3 right = view.Cross(up);
right.y = 0;
right.Normalize();
up = right.Cross(view).Normalized();
Mtx44 rotation;
rotation.SetToRotation(yaw, 0, 1, 0);
view = rotation * view;
target = position + view;
up = rotation * up;
}
示例13: lookDown
void FPcamera::lookDown(const double dt, float downValue)
{
float pitch = (float)(-WALK_SPEED * Application::camera_pitch * (float)dt - downValue * (float)dt);
recoil -= 5.f * (float)dt;;
rotationX -= pitch;
view = (target - position).Normalized();
Vector3 right = view.Cross(up);
right.y = 0;
right.Normalize();
up = right.Cross(view).Normalized();
Mtx44 rotation;
rotation.SetToRotation(pitch, right.x, right.y, right.z);
view = rotation * view;
target = position + view;
}
示例14: LookPitch
void FPS_Cam::LookPitch(float pitchValue, double dt)
{
float mspeed = mouse_speed * pitchValue * dt;
FaceDirection = (target - position).Normalized();
Vector3 right = FaceDirection.Cross(up);
right.y = 0;
right.Normalize();
up = right.Cross(FaceDirection).Normalized();
rotation22.SetToRotation(mspeed, right.x, right.y, right.z);
FaceDirection = rotation22 * FaceDirection;
target = position + FaceDirection;
up = rotation22 * up;
}
示例15: LookYaw
void FPS_Cam::LookYaw(float yawValue, double dt)
{
float mspeed = mouse_speed * yawValue;
FaceDirection = (target - position).Normalized();
Vector3 right = FaceDirection.Cross(up);
right.y = 0;
right.Normalize();
up = right.Cross(FaceDirection).Normalized();
rotation22.SetToRotation(mspeed * dt, 0, 1, 0);
FaceDirection = rotation22 * FaceDirection;
target = position + FaceDirection;
up = rotation22 * up;
}