本文整理汇总了C++中Transform::GetForward方法的典型用法代码示例。如果您正苦于以下问题:C++ Transform::GetForward方法的具体用法?C++ Transform::GetForward怎么用?C++ Transform::GetForward使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform::GetForward方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTouchUpHandlers
void DebugMenuTouchHandlers::OnTouchUpHandlers(UiObject* uiObject, Touch /* touch */) {
GameObject* debugCam = (GameObject*)ENGINE->GetSceneGraph3D()->GetMainCamera()->GetObject();
Transform* trans = debugCam->GetTransform();
if (uiObject->GetName() == "up") {
trans->Translate(this->cameraSpeed, trans->GetForward());
ASSERT(uiObject->GetClassType() & CLASS_TYPE_UIELEMENT, "UiObject is a ui element");
((UiElement*)uiObject)->SetSpriteTextureIndex(TEXTURE_INDEX_BUTTON_UP);
} else if (uiObject->GetName() == "down") {
trans->Translate(-this->cameraSpeed, trans->GetForward());
ASSERT(uiObject->GetClassType() & CLASS_TYPE_UIELEMENT, "UiObject is a ui element");
((UiElement*)uiObject)->SetSpriteTextureIndex(TEXTURE_INDEX_BUTTON_UP);
} else if (uiObject->GetName() == "left") {
trans->Translate(this->cameraSpeed, trans->GetLeft());
ASSERT(uiObject->GetClassType() & CLASS_TYPE_UIELEMENT, "UiObject is a ui element");
((UiElement*)uiObject)->SetSpriteTextureIndex(TEXTURE_INDEX_BUTTON_UP);
} else if (uiObject->GetName() == "right") {
trans->Translate(-this->cameraSpeed, trans->GetLeft());
ASSERT(uiObject->GetClassType() & CLASS_TYPE_UIELEMENT, "UiObject is a ui element");
((UiElement*)uiObject)->SetSpriteTextureIndex(TEXTURE_INDEX_BUTTON_UP);
} else if (uiObject->GetName() == "back") {
SINGLETONS->GetMenuManager()->LoadGameMenu();
GameObject* debugCam = (GameObject*)ENGINE->GetSceneGraph3D()->GetMainCamera()->GetObject();
ENGINE->GetSceneGraph3D()->SetMainCameraId(this->shadyCamId);
delete debugCam;
}
}
示例2: VUpdate
void VUpdate(double milliseconds) override
{
InitializeCamera();
mPixelSize = { 1.0f / mRenderer->GetWindowWidth(), 1.0f / mRenderer->GetWindowWidth() };
int offset = OFFSET_COUNT / 2;
for (int i = 0; i < OFFSET_COUNT; i++) {
mBlurH.uvOffsets[i] = { mPixelSize.x * (i - offset) , 0.0f, 0.0f, 0.0f };
mBlurV.uvOffsets[i] = { 0.0f, mPixelSize.y * (i - offset), 0.0f, 0.0f };
}
ScreenPoint mousePosition = Input::SharedInstance().mousePosition;
if (Input::SharedInstance().GetMouseButton(MOUSEBUTTON_LEFT)) {
mCamera.RotatePitch(-(mousePosition.y - mMouseY) * RADIAN * CAMERA_ROTATION_SPEED);
mCamera.RotateYaw(-(mousePosition.x - mMouseX) * RADIAN * CAMERA_ROTATION_SPEED);
}
mMouseX = mousePosition.x;
mMouseY = mousePosition.y;
vec3f position = mCamera.GetPosition();
if (Input::SharedInstance().GetKey(KEYCODE_W)) {
position += mCamera.GetForward() * CAMERA_SPEED;
mCamera.SetPosition(position);
}
if (Input::SharedInstance().GetKey(KEYCODE_A)) {
position += mCamera.GetRight() * -CAMERA_SPEED;
mCamera.SetPosition(position);
}
if (Input::SharedInstance().GetKey(KEYCODE_D)) {
position += mCamera.GetRight() * CAMERA_SPEED;
mCamera.SetPosition(position);
}
if (Input::SharedInstance().GetKey(KEYCODE_S)) {
position += mCamera.GetForward() * -CAMERA_SPEED;
mCamera.SetPosition(position);
}
if (Input::SharedInstance().GetKey(KEYCODE_1)) {
mBlurType = BLUR_TYPE_NONE;
}
if (Input::SharedInstance().GetKey(KEYCODE_2)) {
mBlurType = BLUR_TYPE_GAUSSIAN;
}
if (Input::SharedInstance().GetKey(KEYCODE_3)) {
mBlurType = BLUR_TYPE_MOTION;
}
}
示例3: HandleKeyboard
void FlyInput::HandleKeyboard(Transform& transform, GLFWwindow* pWindow, double deltaTime)
{
glm::vec3 moveDir(0.0f);
if (glfwGetKey(pWindow, GLFW_KEY_W) == GLFW_PRESS)
{
moveDir -= transform.GetForward();
}
if (glfwGetKey(pWindow, GLFW_KEY_S) == GLFW_PRESS)
{
moveDir += transform.GetForward();
}
if (glfwGetKey(pWindow, GLFW_KEY_A) == GLFW_PRESS)
{
moveDir -= transform.GetRight();
}
if (glfwGetKey(pWindow, GLFW_KEY_D) == GLFW_PRESS)
{
moveDir += transform.GetRight();
}
if (glfwGetKey(pWindow, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS)
{
//moveDir += glm::vec3(0.0f, 1.0f, 0.0f);
}
if (glfwGetKey(pWindow, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS)
{
//moveDir -= glm::vec3(0.0f, 1.0f, 0.0f);
}
float fLength = glm::length(moveDir);
if (fLength > 0.01f)
{
moveDir = ((float)deltaTime * m_flySpeed) * glm::normalize(moveDir);
transform.Translate(moveDir);
}
}
示例4: VSetTransform
void CameraNode::VSetTransform( const Transform& newTransform )
{
SceneNode::VSetTransform( newTransform );
m_View = Mat4x4::LookAt( newTransform.GetToWorldPosition(), newTransform.GetToWorldPosition() + newTransform.GetForward(), newTransform.GetUp() );
}