Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Simple Motion Blur Issues in C++

$
0
0
Hi, I'm currently messing around in C++ and have so far made a simple scene with a teapot but I'm trying to get a simple motion blur to appear as the scene rotates from my mouse & keyboard controls. However I'll have to admit I'm a little lost. Any pointers would be greatly appreciated

Initial values:

mCameraRadius    = 15.0f;
	mCameraRotationY = 1.4f * D3DX_PI;
	mCameraHeight    = 5.0f;


Keyboard & Mouse movement

void updateScene(float dt)
{
	mGfxStats->update(dt);

	// Get snapshot of input devices
	gDInput->poll();

	// Check input

	// KEYBOARD
	if (gDInput->keyDown(DIK_W))	 
	{
		mCameraHeight += 25.0f * dt;
	}
	if (gDInput->keyDown(DIK_S))	 
	{
		mCameraHeight -= 25.0f * dt;
	}

	if (gDInput->keyDown(DIK_A))	 
	{
		D3DXMatrixTranslation(&mTeapotWorld, 3.0, 0.0f, 0.0f);
	}
	if (gDInput->keyDown(DIK_D))	 
	{

		D3DXMatrixTranslation(&mTeapotWorld, -3.0f, 0.0f, 0.0f);
	}

	// MOUSE
	// (Scale to make mouse less sensitive) 
	mCameraRotationY += gDInput->mouseDX() / 100.0f;
	mCameraRadius    += gDInput->mouseDY() / 25.0f;

	// If we rotate over 360 degrees, just roll back to 0
	mCameraRotationY = fmodf(mCameraRotationY, 2.0f * D3DX_PI);

	// Don't let radius get too small.
	mCameraRadius = max(mCameraRadius, 3.0f);

	// The camera position/orientation relative to world space can 
	// change every frame based on input, so we need to rebuild the
	// view matrix every frame with the latest changes.
	buildViewMtx();
}

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>