void InputCamera::wasdKeyboard(unsigned char key) { float vx, vy, vz; calcView(vx, vy, vz); float tmp; switch (key) { case 'w': translate(dp*vx, dp*vy, dp*vz); break; case 'a': // lol hax yaw -= 90; tmp = pitch; pitch = 0; wasdKeyboard('w'); yaw += 90; pitch = tmp; break; case 's': translate(-dp*vx, -dp*vy, -dp*vz); break; case 'd': // lol hax yaw += 90; tmp = pitch; pitch = 0; wasdKeyboard('w'); yaw -= 90; pitch = tmp; break; case ' ': y += dp; break; case 'z': y -= dp; break; } }
DirectX::XMFLOAT4X4 & Camera::getViewData( DirectX::XMFLOAT4X4 * value ) { calcView(); DirectX::XMStoreFloat4x4( value, DirectX::XMMatrixTranspose(mpd->mViewMatrix) ); return *value; }
DirectX::XMMATRIX Camera::getView() { calcView(); return mpd->mViewMatrix; }
void Camera::calcViewProj() { calcView(); mpd->mViewProjMatrixT = DirectX::XMMatrixMultiplyTranspose( mpd->mViewMatrix, mpd->mProjMatrix); }
void Camera::setRotation(const Vector3f &r) { rotation = r; calcView(); }
void Camera::setPosition(const Vector3f &p) { position = p; calcView(); }