// // CalcLightPosition // void CalcLightPosition(POINT_LIGHT_SOURCE *pLight) { if (pLight->bMoveable) { float Angle = (g_ElapsedTime / 100.0f * pLight->Velocity); if (pLight->bClockwiseOrbit) pLight->OrbitAngle -= Angle; else pLight->OrbitAngle += Angle; float Rad = XMConvertToRadians(pLight->OrbitAngle); // Position on orbit //pLight->Position = pLight->Center; pLight->Position.x = sinf(Rad) * pLight->OrbitRadius; pLight->Position.y = 0.0f; pLight->Position.z = cosf(Rad) * pLight->OrbitRadius; XMMATRIX Roll = XMMatrixRotationZ(XMConvertToRadians(pLight->OrbitRoll)); XMVECTOR V = XMLoadFloat3(&pLight->Position); // Orbit roll angle V = XMVector3Transform(V, Roll); XMStoreFloat3(&pLight->Position, V); pLight->Position.x += pLight->Center.x; pLight->Position.y += pLight->Center.y; pLight->Position.z += pLight->Center.z; } else { pLight->Position = pLight->Center; } }
void SceneNode::execute(XMMATRIX *world, XMMATRIX* view, XMMATRIX* projection) { // the local_world matrix will be used to calc the local transformations for this node XMMATRIX local_world = XMMatrixIdentity(); local_world = XMMatrixRotationX(XMConvertToRadians(m_xangle)); local_world *= XMMatrixRotationY(XMConvertToRadians(m_yangle)); local_world *= XMMatrixRotationZ(XMConvertToRadians(m_zangle)); local_world *= XMMatrixScaling(m_scale, m_scale, m_scale); local_world *= XMMatrixTranslation(m_x, m_y, m_z); // the local matrix is multiplied by the passed in world matrix that contains the concatenated // transformations of all parent nodes so that this nodes transformations are relative to those local_world *= *world; // only draw if there is a model attached if (m_p_model) m_p_model->draw(world, view, projection); // traverse all child nodes, passing in the concatenated world matrix for (int i = 0; i< m_children.size(); i++) { m_children[i]->execute(&local_world, view, projection); } }
void CameraClass::LookAround(int x, int y) { float dy = XMConvertToRadians(floor(static_cast<float>(x - mLastMousePosition.x) / 45)); float dx = XMConvertToRadians(floor(static_cast<float>(y - mLastMousePosition.y) / 45)); mRotation.x += dx*mFrameTime * 1000; mRotation.y += dy*mFrameTime * 1000; if (mRotation.x > 90.0f) { mRotation.x = 90.0f; } if (mRotation.x < -90.0f) { mRotation.x = -90.0f; } if (mRotation.y > 0.0f) { mRotation.y -= 360.0f; } if (mRotation.y < 0.0f) { mRotation.y += 360.0f; } }
void CameraClass::Render() { XMVECTOR up, position, lookAt; float yaw, pitch, roll; XMMATRIX rotationMatrix; up = XMLoadFloat3(&mUp); position = XMLoadFloat3(&mPosition); lookAt = XMLoadFloat3(&mLookAt); pitch = XMConvertToRadians(mRotation.x); yaw = XMConvertToRadians(mRotation.y); roll = XMConvertToRadians(mRotation.z); rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll); up = XMVector3TransformNormal(up, rotationMatrix); lookAt = XMVector3TransformNormal(lookAt, rotationMatrix); mLookZ = XMVectorGetByIndex(lookAt, 2); lookAt = position + lookAt; XMStoreFloat4x4(&mViewMatrix, XMMatrixLookAtLH(position, lookAt, up)); }
void TestTriangleStripsDX::Update() { if (processInput) { float rotAmount = 0.0f; XMMATRIX rotMatrix = XMMatrixIdentity(); if (input.right || input.left) { if (input.right) rotAmount = rotDelta; if (input.left) rotAmount = -rotDelta; rotMatrix = XMMatrixRotationAxis(XMLoadFloat4(&up), XMConvertToRadians(rotAmount)); } else if (input.up || input.down) { if (input.up) rotAmount = rotDelta; if (input.down) rotAmount = -rotDelta; rotMatrix = XMMatrixRotationAxis(XMLoadFloat4(&right), XMConvertToRadians(rotAmount)); } XMStoreFloat4(&eye, XMVector3Transform(XMLoadFloat4(&eye), rotMatrix)); XMStoreFloat4(&right, XMVector3Normalize(XMVector3Cross(XMLoadFloat4(&up), (XMLoadFloat4(¢er) - XMLoadFloat4(&eye))))); XMMATRIX viewMatrix = XMMatrixLookAtRH(XMLoadFloat4(&eye), XMLoadFloat4(¢er), XMLoadFloat4(&up)); mDeviceContext->UpdateSubresource(viewMatrixBuffer, 0, NULL, &viewMatrix, 0, 0); } }
void TextureWave::OnMouseMove(WPARAM btnState, int x, int y) { if ((btnState & MK_LBUTTON) != 0) { float deltaX = XMConvertToRadians(0.25f * static_cast<float>(x - m_mousePose.x)); float deltaY = XMConvertToRadians(0.25f * static_cast<float>(y - m_mousePose.y)); m_theta -= deltaX; m_phi -= deltaY; m_phi = MathHelper::Clamp(m_phi, 0.1f, XM_PI - 0.1f); } if ((btnState & MK_RBUTTON) != 0) { float deltaX = 0.05f * static_cast<float>(x - m_mousePose.x); float deltaY = 0.05f * static_cast<float>(y - m_mousePose.y); m_radius -= (deltaX - deltaY); m_radius = MathHelper::Clamp(m_radius, 50.0f, 500.0f); } m_mousePose.x = x; m_mousePose.y = y; }
void BoxApp::OnMouseMove(WPARAM btnState, int x, int y) { if( (btnState & MK_LBUTTON) != 0 ) { // Make each pixel correspond to a quarter of a degree. float dx = XMConvertToRadians(0.25f*static_cast<float>(x - mLastMousePos.x)); float dy = XMConvertToRadians(0.25f*static_cast<float>(y - mLastMousePos.y)); // Update angles based on input to orbit camera around box. mTheta += dx; mPhi += dy; // Restrict the angle mPhi. mPhi = MathHelper::Clamp(mPhi, 0.1f, MathHelper::Pi-0.1f); } else if( (btnState & MK_RBUTTON) != 0 ) { // Make each pixel correspond to 0.005 unit in the scene. float dx = 0.005f*static_cast<float>(x - mLastMousePos.x); float dy = 0.005f*static_cast<float>(y - mLastMousePos.y); // Update the camera radius based on input. mRadius += dx - dy; // Restrict the radius. mRadius = MathHelper::Clamp(mRadius, 3.0f, 15.0f); } mLastMousePos.x = x; mLastMousePos.y = y; }
void WavesApp::OnMouseMove(WPARAM btnState, int x, int y) { //我并不关心这些鼠标换算公式 if ((btnState & MK_LBUTTON) != 0) { //Make each pixel correspond to a quarter of a degree. float dx = XMConvertToRadians(0.25f*static_cast<float>(x - m_lastMousePos.x)); float dy = XMConvertToRadians(0.25f*static_cast<float>(y - m_lastMousePos.y)); m_fTheta += dx; m_fPhi += dy; m_fPhi = MathHelper::Clamp(m_fPhi, 0.1f, MathHelper::PI - 0.1f); } else if ((btnState & MK_RBUTTON) != 0) { // Make each pixel correspond to 0.005 unit in the scene. float dx = 0.005f*static_cast<float>(x - m_lastMousePos.x); float dy = 0.005f*static_cast<float>(y - m_lastMousePos.y); // Update the camera radius based on input. m_fRadius += dx - dy; // Restrict the radius. m_fRadius = MathHelper::Clamp(m_fRadius, 3.0f, 15.0f); } m_lastMousePos.x = x; m_lastMousePos.y = y; }
XMVECTOR GameObject::GetForwardVector() { XMMATRIX rotmat = XMMatrixRotationRollPitchYaw(XMConvertToRadians(rotation.x), XMConvertToRadians(rotation.y), XMConvertToRadians(rotation.z)); XMFLOAT4X4 rotationMatrixF; XMStoreFloat4x4(&rotationMatrixF, rotmat); forwardVector = -XMVectorSet(rotationMatrixF._11, rotationMatrixF._12, rotationMatrixF._13, rotationMatrixF._14); return XMVector3Normalize ( forwardVector ); }
void InClassProj::OnMouseMove(WPARAM btnState, int x, int y) { // Make each pixel correspond to a quarter of a degree. float dx = XMConvertToRadians(0.25f*static_cast<float>(x - mLastMousePos.x)); float dy = XMConvertToRadians(0.25f*static_cast<float>(y - mLastMousePos.y)); mLastMousePos.x = x; mLastMousePos.y = y; }
void D3DAnimation::OnMouseMove(WPARAM btnState, int x, int y) { if ((btnState & MK_LBUTTON) != 0) { float dx = XMConvertToRadians(0.25f * static_cast<float>(x - mLastMousePos.x)); float dy = XMConvertToRadians(0.25f * static_cast<float>(y - mLastMousePos.y)); Cam.Pitch(dy); Cam.RotateY(dx); } mLastMousePos.x = x; mLastMousePos.y = y; }
void App::MouseMove( WPARAM btn, int x, int y ) { if ((btn & MK_RBUTTON) != 0) { float dx = XMConvertToRadians(0.25f*static_cast<float>(x-mouseX)); float dy = XMConvertToRadians(0.25f*static_cast<float>(y-mouseY)); viewports[0].Pitch(dy); viewports[0].RotateY(dx); } mouseX = x; mouseY = y; }
void CubeMap::OnMouseMove(WPARAM btnState, int x, int y){ if((btnState & MK_LBUTTON) != 0){ float dx = XMConvertToRadians(0.25f * static_cast<float>(x - m_lastMousePos.x)); float dy = XMConvertToRadians(0.25f * static_cast<float>(y - m_lastMousePos.y)); m_camera.RotateRightVec(dy); m_camera.RotateY(dx); } m_lastMousePos.x = x; m_lastMousePos.y = y; }
// // UpdateBunnyConstantsVS // void UpdateBunnyConstantsVS() { XMMATRIX SpinX = XMMatrixRotationX(XMConvertToRadians(g_SpinY)); XMMATRIX SpinY = XMMatrixRotationY(XMConvertToRadians(g_SpinX)); XMMATRIX Pivot = XMMatrixMultiply(SpinY, SpinX); XMMATRIX Trans = XMMatrixTranslation(0.0f, 0.1f, 0.0f); // Lift slightly up XMMATRIX World = XMMatrixMultiply(Pivot, Trans); XMMATRIX WorldView = XMMatrixMultiply(World, g_View); XMMATRIX WorldViewProj = XMMatrixMultiply(WorldView, g_Proj); glUniformMatrix4fv(g_PhongUniforms.Mpivot, 1, GL_FALSE, (const GLfloat *)&Pivot); glUniformMatrix4fv(g_PhongUniforms.Mworld, 1, GL_FALSE, (const GLfloat *)&World); glUniformMatrix4fv(g_PhongUniforms.Mwvp, 1, GL_FALSE, (const GLfloat *)&WorldViewProj); }
void D3DPBRApp::OnMouseMove(WPARAM btnState, int x, int y) { if( (btnState & MK_LBUTTON) != 0 ) { // Make each pixel correspond to a quarter of a degree. float dx = XMConvertToRadians(0.25f*static_cast<float>(x - mLastMousePos.x)); float dy = XMConvertToRadians(0.25f*static_cast<float>(y - mLastMousePos.y)); mCam.Pitch(dy); mCam.RotateY(dx); } mLastMousePos.x = x; mLastMousePos.y = y; }
XMFLOAT4 quat_from_axis_angle(XMFLOAT3 axis, float angle) { auto qr = XMQuaternionRotationAxis(XMLoadFloat3(&axis), XMConvertToRadians(angle)); XMFLOAT4 quat; XMStoreFloat4(&quat, qr); return quat; }
void BoidManager::updateWorldMatrix(birds &bird) { XMMATRIX mRotX, mRotY, mRotZ, mTrans, WorldMatrix; XMFLOAT4 iPos = bird.getPosition(); XMFLOAT4 iRot = bird.getRotation(); mRotX = XMMatrixRotationX(XMConvertToRadians(iRot.x)); mRotY = XMMatrixRotationY(XMConvertToRadians(iRot.y)); mRotZ = XMMatrixRotationZ(XMConvertToRadians(iRot.z)); mTrans = XMMatrixTranslation(iPos.x, iPos.y, iPos.z); WorldMatrix = mRotZ * mRotX * mRotY * mTrans; bird.setWorldMatrix(WorldMatrix); }
// // Render // void Render(unsigned Width, unsigned Height) { g_ElapsedTime = GetElapsedMilliseconds(); BeginFrame(); glViewport(0, 0, Width, Height); glClear(GL_DEPTH_BUFFER_BIT); // No need to clear color buffer, because we draw background image g_View = XMMatrixTranslation(0.0f, 0.0f, g_Distance); g_Proj = XMMatrixPerspectiveFovRH(XMConvertToRadians(45.0f), Width / (float)Height, 0.1f, 100.0f); // Bunny rotation g_SpinX += g_ElapsedTime / 50.0f; // Setup light positions for (int i = 0; i < MAX_POINT_LIGHTS; ++i) { POINT_LIGHT_SOURCE *pLight = &g_PointLights[i]; CalcLightPosition(pLight); } g_pBackground->SetScreenSize(Width, Height); g_pBackground->Draw(); DrawBunny(); DrawLights(); DrawHUD(Width, Height); EndFrame(); g_pFraps->OnPresent(); }
void CameraClass::MoveForward(bool keyDown) { //Update the forward speed. If we move (keyDown) we "charge up" to a certain speed. //If the key is not down, we slowly slow down to 0. if (keyDown) { mForwardSpeed += mFrameTime * 15.0f; if (mForwardSpeed > (mFrameTime * 40.0f)) { mForwardSpeed = mFrameTime*40.0f; } } else { mForwardSpeed -= mFrameTime * 10.0f; if (mForwardSpeed < 0.0f) { mForwardSpeed = 0.0f; } } float radians = XMConvertToRadians(mRotation.y); //Update position. mPosition.z += cosf(radians)*mForwardSpeed; mPosition.x += sinf(radians)*mForwardSpeed; }
void CSphere::update(float delta) { // 카메라 좌표계 기준으로 이동시켜야 하므로 좌표계를 변환 auto camera = CGameManager::GetInstance()->GetRenderer()->GetCamera(); auto cameraAngle = XMConvertToRadians((*camera->getRotate()).m128_f32[1]); translation( XMVector3Transform(mSpeed, XMMatrixRotationY(cameraAngle)) ); // 네 모서리와 부딪혔는지 체크 auto width = camera->getWidth(); auto height = camera->getHeight(); auto pos = ConvertCenterToViewingCoord(); // 위쪽 벽에 공이 닿음 if (pos.m128_f32[1] + mScale.m128_f32[0] >= (height / 2)) mulSpeed({ 1.f, -1.f, 1.f }); // 아래쪽 벽에 공이 닿음 - 게임 오버 if (pos.m128_f32[1] - mScale.m128_f32[0] <= -(height / 2)) CGameManager::GetInstance()->GetEventManager()->triggerEvent("Gameover"); // 왼쪽 벽에 공이 닿음 if (pos.m128_f32[0] - mScale.m128_f32[0] < -(width / 2)) CGameManager::GetInstance()->GetEventManager()->triggerEvent("RotateLeft"); // 오른쪽 벽에 공이 닿음 if (pos.m128_f32[0] + mScale.m128_f32[0] > (width / 2)) CGameManager::GetInstance()->GetEventManager()->triggerEvent("RotateRight"); CPrimitive::update(delta); }
void TopicApp::OnMouseMove(WPARAM btnState, int x, int y) { //Rotate if left mouse button is pressed if( (btnState & MK_LBUTTON) != 0 ) { // Make each pixel correspond to a quarter of a degree. float dx = XMConvertToRadians(0.25f*static_cast<float>(x - m_lastMousePos.x)); float dy = XMConvertToRadians(0.25f*static_cast<float>(y - m_lastMousePos.y)); m_cam.pitch(dy); //Rotate on right vector (x axis) m_cam.rotateY(dx); } m_lastMousePos.x = x; m_lastMousePos.y = y; }
void SpotlightSample::InitializeCamera() { mCamera.mTransform = new Transform(); mCamera.mTransform->mPosition = { 0, 50, -50 }; mCamera.mTransform->RotatePitch(XMConvertToRadians(45.f)); mCamera.Update(); mCamera.UpdateProjection(0.25f * 3.1415926535f, AspectRatio(), 0.1f, 100.0f); }
void Game::UpdateScene() { floorWorld = XMMatrixIdentity(); scale = XMMatrixScaling(250.0f, 1.0f, 250.0f); translation = XMMatrixTranslation(0.0f, 0.0f, 0.0f); floorWorld = scale*translation; //Keep the cubes rotating rotSpeed += .0005f; if (rotSpeed > 6.26f) rotSpeed = 0.0f; //When used, these matrices will rotate objects rotateAboutX = XMMatrixRotationAxis(rotXAxis, -rotSpeed); rotateAboutY = XMMatrixRotationAxis(rotYAxis, -rotSpeed); rotateAboutZ = XMMatrixRotationAxis(rotZAxis, -rotSpeed); scale = XMMatrixScaling(2, scaleY, 2); //Reset cubes locations cube1World = XMMatrixIdentity(); cube2World = XMMatrixIdentity(); //When used, these matrices will set an objects position translation = XMMatrixTranslation(-5.0f, 2.0f, 0.0f); //Set cube1's world space using the transformations cube1World = rotateAboutX * translation * scale; //When used, these matrices will set an objects position translation = XMMatrixTranslation(5.0f, 2.0f, 0.0f); //Set cube2's world space matrix cube2World = rotateAboutY * translation * scale; meshWorld = XMMatrixIdentity(); travelSpeed += 0.0003f; //Setting meshes scale, translation and rotation scale = XMMatrixScaling(0.2f,0.2f,0.2f); translation = XMMatrixTranslation(-travelSpeed, 0.0f, 0.0f); rotation = XMMatrixRotationRollPitchYaw(0, XMConvertToRadians(180), 0); meshWorld = translation * rotation * scale; //Reset sphereWorld sphereWorld = XMMatrixIdentity(); //Define sphereWorld's world space matrix scale = XMMatrixScaling(5.0f, 5.0f, 5.0f); //Make sure the sphere is always centered around camera translation = XMMatrixTranslation(XMVectorGetX(camPosition), XMVectorGetY(camPosition), XMVectorGetZ(camPosition)); //Set sphereWorld's world space using the transformations sphereWorld = scale * translation; }
void CubeModel::Update(float time) { mAngle += 90.0f * time; XMVECTOR rotationAxis = XMVectorSet(1, 0, 1, 0); mWorldPos.world = XMMatrixRotationAxis(rotationAxis, XMConvertToRadians(mAngle)); mVertexShader->UpdateWorldMatrix(mWorldPos); }
void Framework::OnMouseMove(WPARAM mouseButton, int x, int y) { // // Camera Rotate // if ((mouseButton & MK_LBUTTON) != 0) { mouse->dx = XMConvertToRadians(0.25f*static_cast<float>(x - mouse->lastMousePos.x)); mouse->dy = XMConvertToRadians(0.25f*static_cast<float>(y - mouse->lastMousePos.y)); camera->mTheta += mouse->dx; camera->mPhi += mouse->dy; camera->mPhi = Clamp(camera->mPhi, 0.1f, XM_PI - 0.1f); } // // Camera Zoom // else if ((mouseButton & MK_RBUTTON) != 0) { // Make each pixel correspond to 0.005 unit in the scene. mouse->dx = 0.05f*static_cast<float>(x - mouse->lastMousePos.x); mouse->dy = 0.05f*static_cast<float>(y - mouse->lastMousePos.y); // Update the camera radius based on input. camera->raio += (mouse->dx - mouse->dy) * 2; // Restrict the radius. camera->raio = Clamp(camera->raio, 3.0f, 150.0f); } // // Camera Pan // else if ((mouseButton & MK_MBUTTON) != 0) { mouse->dx = 0.75f*static_cast<float>(mouse->lastMousePos.x - x); mouse->dy = 0.75f*static_cast<float>(y - mouse->lastMousePos.y); camera->IncPosition(mouse->dx, mouse->dy, 0); } mouse->lastMousePos.x = x; mouse->lastMousePos.y = y; }
void Camera::Update() { XMMATRIX rotationMatrix; XMVECTOR up = XMVectorSet(0, 1, 0, 1); XMVECTOR pos = XMVectorSet(position.x, position.y, position.z, 1); XMVECTOR lookAt = camLookAt; rotationMatrix = XMMatrixRotationRollPitchYaw(XMConvertToRadians(rotation.x), XMConvertToRadians(rotation.y), 0); lookAt = XMVector3TransformCoord(lookAt, rotationMatrix); up = XMVector3TransformCoord(up, rotationMatrix); lookAt = pos + lookAt; viewMatrix = XMMatrixLookAtLH(pos, lookAt, up); }
void Camera::SetFOV(float fov) { if (fov > 0.0f) { _fov = XMConvertToRadians(fov); } _projection = XMMatrixPerspectiveFovLH(_fov, _viewport.Width / _viewport.Height, _farClip, _nearClip); Transform.Moved = true; }
void SceneNode::update_collision_tree(XMMATRIX* world, float scale) { // the m_local_world_matrix matrix will be used to calculate the local transformations for this node XMMATRIX m_local_world_matrix = XMMatrixIdentity(); m_local_world_matrix = XMMatrixRotationX(XMConvertToRadians(m_xangle)); m_local_world_matrix *= XMMatrixRotationY(XMConvertToRadians(m_yangle)); m_local_world_matrix *= XMMatrixRotationZ(XMConvertToRadians(m_zangle)); m_local_world_matrix *= XMMatrixScaling(m_scale, m_scale, m_scale); m_local_world_matrix *= XMMatrixTranslation(m_x, m_y, m_z); // the local matrix is multiplied by the passed in world matrix that contains the concatenated // transformations of all parent nodes so that this nodes transformations are relative to those m_local_world_matrix *= *world; // calc the world space scale of this object, is needed to calculate the // correct bounding sphere radius of an object in a scaled hierarchy m_world_scale = scale * m_scale; XMVECTOR v; if (m_p_model) { v = XMVectorSet(m_p_model->GetBoundingSphere_x(), m_p_model->GetBoundingSphere_y(), m_p_model->GetBoundingSphere_z(), 0.0); } else v = XMVectorSet(0, 0, 0, 0); // no model, default to 0 // find and store world space bounding sphere centre v = XMVector3Transform(v, m_local_world_matrix); m_world_centre_x = XMVectorGetX(v); m_world_centre_y = XMVectorGetY(v); m_world_centre_z = XMVectorGetZ(v); // traverse all child nodes, passing in the concatenated world matrix and scale for (int i = 0; i< m_children.size(); i++) { m_children[i]->update_collision_tree(&m_local_world_matrix, m_world_scale); } }
void BoidManager::initialisePositions() { for (int i = 0; i < maxBirds; ++i) { XMMATRIX mRotX, mRotY, mRotZ, mTrans, WorldMatrix; XMFLOAT4 iPos = m_birds.at(i)->getPosition(); XMFLOAT4 iRot = m_birds.at(i)->getRotation(); mRotX = XMMatrixRotationX(XMConvertToRadians(iRot.x)); mRotY = XMMatrixRotationY(XMConvertToRadians(iRot.y)); mRotZ = XMMatrixRotationZ(XMConvertToRadians(iRot.z)); mTrans = XMMatrixTranslation(iPos.x, iPos.y, iPos.z); WorldMatrix = mRotZ * mRotX * mRotY * mTrans; m_birds.at(i)->setWorldMatrix(WorldMatrix); m_birds.at(i)->setVector(XMVector4Normalize(WorldMatrix.r[2])); } }
void GCamera::Rotate(XMFLOAT3 axis, float degrees) { if (XMVector3Equal(GMathFV(axis), XMVectorZero()) || degrees == 0.0f) return; // rotate vectors XMFLOAT3 look_at_target = GMathVF(GMathFV(mTarget) - GMathFV(mPosition)); XMFLOAT3 look_at_up = GMathVF(GMathFV(mUp) - GMathFV(mPosition)); look_at_target = GMathVF(XMVector3Transform(GMathFV(look_at_target), XMMatrixRotationAxis(GMathFV(axis), XMConvertToRadians(degrees)))); look_at_up = GMathVF(XMVector3Transform(GMathFV(look_at_up), XMMatrixRotationAxis(GMathFV(axis), XMConvertToRadians(degrees)))); // restore vectors's end points mTarget and mUp from new rotated vectors mTarget = GMathVF(GMathFV(mPosition) + GMathFV(look_at_target)); mUp = GMathVF(GMathFV(mPosition) + GMathFV(look_at_up)); this->lookatViewMatrix(); }