示例#1
0
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;
	}
}
示例#2
0
DirectX::XMFLOAT4X4 & Camera::getViewData( DirectX::XMFLOAT4X4 * value )
{
	calcView();
	DirectX::XMStoreFloat4x4( value, DirectX::XMMatrixTranspose(mpd->mViewMatrix) );
	return *value;
}
示例#3
0
DirectX::XMMATRIX Camera::getView()
{
	calcView();
	return mpd->mViewMatrix;
}
示例#4
0
void Camera::calcViewProj()
{
	calcView();
	mpd->mViewProjMatrixT = DirectX::XMMatrixMultiplyTranspose( mpd->mViewMatrix, mpd->mProjMatrix);
}
示例#5
0
void Camera::setRotation(const Vector3f &r) {
  rotation = r;
  calcView();
}
示例#6
0
void Camera::setPosition(const Vector3f &p) {
  position = p;
  calcView();
}