generalcam
asked on
DirectXFramework
I need help with the errors below this code that is attached. I have included the header file and the cpp file. Can anyone please assist me with these errors.
//////////////////////////////////////////////////////////////////////////
// Name:	DirectXFramework.h
// Date:	April 2nd, 2010
// Author:	Kyle Lauing [klauing@devry.edu] or [kylelauing@gmail.com]
// Purpose: This file is used to create a very simple framework for using
//			DirectX 9 for the GSP 381 course for DeVry University.
// Disclaimer:	
//			Copyright © 2010 by DeVry Educational Development Corporation.
//			All rights reserved. No part of this work may be reproduced
//			or used in any form or by any means – graphic, electronic, or
//			mechanical, including photocopying, recording, Web distribution
//			or information storage and retrieval systems – without the
//			prior consent of DeVry Educational Development Corporation.
//////////////////////////////////////////////////////////////////////////
#pragma once
#include <stdio.h>
#include <vector>
#pragma comment(lib, "winmm.lib")
//////////////////////////////////////////////////////////////////////////
// Direct3D 9 headers and libraries required
//////////////////////////////////////////////////////////////////////////
#include <d3d9.h>
#include <d3dx9.h>
#include <DxErr.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "dxerr.lib")
//////////////////////////////////////////////////////////////////////////
// DirectInput headers and libraries
//////////////////////////////////////////////////////////////////////////
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
//////////////////////////////////////////////////////////////////////////
// To DEBUG D3D correctly:
//	Go to the Start Menu, Find Microsoft DirectX SDK (June 2010).
// Go to the DirectX Control Panel.
// In Direct3D 9 settings, Increase the Debug Output Level to the Max
// Turn on debugging flags for Maximum validation, Break on Memory Leaks, etc.
//////////////////////////////////////////////////////////////////////////
// If in DEBUG mode, turn on D3D_DEBUG_INFO flag enable DXTrace, and d3dx9d.lib (debug version)
#if defined(DEBUG) | defined(_DEBUG)
	#ifndef D3D_DEBUG_INFO
		#define D3D_DEBUG_INFO
	#endif
	#pragma comment(lib, "d3dx9d.lib")
#else
	#pragma comment(lib, "d3dx9.lib")
#endif
// Macro to release COM objects fast and safely
#define SAFE_RELEASE(x) if(x){x->Release(); x = 0;}
// HRESULT macro that prints an error window
#ifndef HR
#define HR(x)												\
		{ \
		HRESULT hr = x;									 \
		if(FAILED(hr))									 \
			{ \
				MessageBox(m_hWnd, DXGetErrorDescription(hr), DXGetErrorString(hr), MB_OK);	/*DXTraceA(__FILE__, __LINE__, hr, DXGetErrorStringA(hr), TRUE);*/	 \
			} \
		}
#endif
class CDirectXFramework
{
	//////////////////////////////////////////////////////////////////////////
	// Application Variables
	//////////////////////////////////////////////////////////////////////////
	HWND				m_hWnd;			// Handle to the window
	bool				m_bVsync;		// Boolean for vertical syncing
	int					m_width;		// Window width
	int					m_height;		// Window height
	RECT				screenRect;		// RECT for the entire size of window
	float				m_currTime;		// Time to render current frame
	float				m_prevTime;		// Time to render previous frame
	int					m_FPS;			// Frames per second
	float				m_elapsedTime;	// ms per frame
	float m_fRotation; // Rotation variable for Cube 2
	
	//////////////////////////////////////////////////////////////////////////
	// Direct3D Variables
	//////////////////////////////////////////////////////////////////////////
	IDirect3D9*			 m_pD3DObject;	// Direct3D 9 Object
	IDirect3DDevice9*	 m_pD3DDevice;	// Direct3D 9 Device
	D3DPRESENT_PARAMETERS m_D3Dpp;		// Device Presentation Parameters
	D3DCAPS9			 m_D3DCaps;	// Device Capabilities
	D3DXCOLOR			 m_clearColor; // Back-buffer Clear Color
	//////////////////////////////////////////////////////////////////////////
	// View and Projection Matrices
	//////////////////////////////////////////////////////////////////////////
	// Set these 3 component to initialize the view matrix (camera)
	D3DXVECTOR3 m_eyePos;
	D3DXVECTOR3 m_lookAt;
	D3DXVECTOR3 m_upVec;
	D3DXVECTOR3 m_pyramidTranslation;
	D3DXVECTOR3 m_pyramidRotation;
	
	// View matrix
	D3DXMATRIX m_viewMat;
	D3DXMATRIX WITMat;
	// Projection matrix
	D3DXMATRIX m_projMat;
	//////////////////////////////////////////////////////////////////////////
	// Vertex Declaration and Vertex and Index Buffers
	//////////////////////////////////////////////////////////////////////////
	struct Vertex
	{
		D3DXVECTOR3 position;
		D3DXVECTOR3 normal;
		D3DXVECTOR2 uv;
	};
	
	// Cube data (Vertex and Index array)
	// Could use 8, but cannot texture or define valid normals correctly
	Vertex m_cubeVerts[24];	
	WORD m_cubeIndices[36];
	// Pyramid data
	Vertex m_pyramidVerts[16];	
	WORD m_pyramidIndices[18];
	
	IDirect3DVertexDeclaration9*	m_pD3DVertexDecl;
	// Tri Grcube
	IDirect3DIndexBuffer9* m_pD3DIndexBuffer;
	IDirect3DVertexBuffer9* m_pD3DVertexBuffer;
	IDirect3DVertexBuffer9* m_pD3DVertexBufferPyramid;
	IDirect3DVertexBuffer9* m_pD3DIndexBufferPyramid;
	std::vector<Vertex>				m_triGridVerts;
	std::vector<DWORD>				m_triGridIndices;
	int 							m_numVerts;
	int 							m_numTris;
	/////////////////////////////////////////////////////////////////////////
// D3DXMesh - Used for D3DXCreate functions and .x files
/////////////////////////////////////////////////////////////////////////
ID3DXBuffer* m_pXMaterials;
ID3DXBuffer* m_pXEffects;
//////////////////////////////////////////////////////////////////////////
// Lighting, Material, Textures
//////////////////////////////////////////////////////////////////////////
D3DLIGHT9 m_Light;
D3DMATERIAL9					m_Material;
D3DMATERIAL9					m_Material[2];
//////////////////////////////////////////////////////////////////////////
// Effects
//////////////////////////////////////////////////////////////////////////
ID3DXEffect*					m_pEffect;
ID3DXBuffer* m_pEffectError;
D3DXHANDLE m_hTech;
//////////////////////////////////////////////////////////////////////////
	// Font Variables
	//////////////////////////////////////////////////////////////////////////
	ID3DXFont*			m_pD3DFont;		// Font Object
	//////////////////////////////////////////////////////////////////////////
	// Sprite Variables
	//////////////////////////////////////////////////////////////////////////
	ID3DXSprite*		m_pD3DSprite;	// Sprite Object
	IDirect3DTexture9*	m_pTexture;		// Texture Object for a sprite
	//D3DXIMAGE_INFO		m_imageInfo;	// File details of a texture
	IDirect3DTexture9*	m_pTexture2;	// Second sprite image
	//D3DXIMAGE_INFO		m_imageInfo2;	// File details of 2nd texture
	// A structure of sprite information to use for sprites, so we can initialize
	// values for each sprite in the init, and use them in the render() function
	struct SpriteObject
	{
		D3DXVECTOR3 position;	// Translation
		float rotation;			// Z rotation
		float scale;			// Uniform scaling (x and y value the same)
		D3DCOLOR color;			// Color modulation
	};
	SpriteObject spriteObj[6];	// Array of sprite values to be used
	//////////////////////////////////////////////////////////////////////////
	// DirectInput
	//////////////////////////////////////////////////////////////////////////
	IDirectInput8*		 m_pDIObject;	// DirectInput Object
	IDirectInputDevice8* m_pDIKeyboard;	// Keyboard Device
	IDirectInputDevice8* m_pDIMouse;	// Mouse Device
public:
	//////////////////////////////////////////////////////////////////////////
	// Init and Shutdown are preferred to constructors and destructor,
	// due to having more control when to explicitly call them when global.
	//////////////////////////////////////////////////////////////////////////
	CDirectXFramework(void);
	~CDirectXFramework(void);
	//////////////////////////////////////////////////////////////////////////
	// Name:		Init
	// Parameters:	HWND hWnd - Handle to the window for the application
	//				HINSTANCE hInst - Handle to the application instance
	//				bool bWindowed - Boolean to control windowed or full-screen
	// Return:		void
	// Description:	Ran once at the start. Initialize DirectX components and
	//				variables to control the application.
	//////////////////////////////////////////////////////////////////////////
	void Init(HWND& hWnd, HINSTANCE& hInst, bool bWindowed);
	//////////////////////////////////////////////////////////////////////////
	// Name:		Update
	// Parameters:	float elapsedTime - Time that has elapsed since the last
	//					update call.
	// Return:		void
	// Description: Runs every frame, use dt to limit functionality called to
	//				a certain amount of elapsed time that has passed. Used
	//				for updating variables and processing input commands prior
	//				to calling render.
	//////////////////////////////////////////////////////////////////////////
	void Update(float dt);
	//////////////////////////////////////////////////////////////////////////
	// Name:		Render
	// Parameters:	float elapsedTime - Time that has elapsed since the last
	//					render call.
	// Return:		void
	// Description: Runs every frame, use dt to limit functionality called to
	//				a certain amount of elapsed time that has passed. Render
	//				calls all draw call to render objects to the screen.
	//////////////////////////////////////////////////////////////////////////
	void Render(float dt);
	//////////////////////////////////////////////////////////////////////////
	// Name:		Shutdown
	// Parameters:	void
	// Return:		void
	// Description:	Runs once at the end of an application. Destroy COM
	//				objects and deallocate dynamic memory.
	//////////////////////////////////////////////////////////////////////////
	void Shutdown();
	//////////////////////////////////////////////////////////////////////////
	// Skinned Animation Functions
	//////////////////////////////////////////////////////////////////////////
	void DrawBoundingBoxes();
	void CDirectXFramework::GenTriGrid(int numVertRows, int numVertCols, float dx, float dz, const D3DXVECTOR3& center,
								 std::vector<Vertex>& verts, std::vector<DWORD>& indices);
	void CDirectXFramework::soundsInit();
	void CDirectXFramework::videosInit();
	void CDirectXFramework::initWindow(HWND& hWnd, bool bWindowed);
	void CDirectXFramework::initViewProjAndMatrices();
	void CDirectXFramework::initVertexDecl();
	void CDirectXFramework::initTriGrid();
	void CDirectXFramework::initBasicMeshes();
	void CDirectXFramework::initStaticXMeshes();
	void CDirectXFramework::initLights();
	void CDirectXFramework::initMaterials();
	void CDirectXFramework::initTextures();
	void CDirectXFramework::initShaderEffects();
	void CDirectXFramework::initFonts();
	void CDirectXFramework::initDirectInput(HWND& hWnd, HINSTANCE& hInst);
	
	//////////////////////////////////////////////////////////////////////////
	// Name:		isDeviceLost
	// Parameters:	void
	// Return:		bool
	// Description:	If the device is lost due to various reasons (Alt+Tab in
	//				full-screen mode, etc.) this function will return true,
	//				so that it can be restored.
	//////////////////////////////////////////////////////////////////////////
	bool isDeviceLost();
	//////////////////////////////////////////////////////////////////////////
	// Name:		onLostDevice
	// Parameters:	void
	// Return:		bool
	// Description:	If a device has been lost, clean up COM objects that must
	//				be reallocated during the onResetDevice()
	//////////////////////////////////////////////////////////////////////////
	void onLostDevice();
	//////////////////////////////////////////////////////////////////////////
	// Name:		onResetDevice
	// Parameters:	void
	// Return:		bool
	// Description:	If a device has been restored, reinitialize COM objects
	//				that were lost.
	//////////////////////////////////////////////////////////////////////////
	void onResetDevice();
	//////////////////////////////////////////////////////////////////////////
	// Accessors
	//////////////////////////////////////////////////////////////////////////
	int getResolutionWidth() {return m_width;}
	int getResolutionHeight() {return m_height;}
	//////////////////////////////////////////////////////////////////////////
	// Modifiers
	//////////////////////////////////////////////////////////////////////////
	void setResolution(int w, int h)
	{
		m_width = w;
		m_height = h;
		if(m_pD3DDevice)
		{
			m_D3Dpp.BackBufferWidth = m_width;
			onLostDevice();
			HR(m_pD3DDevice->Reset(&m_D3Dpp));
			onResetDevice();
		
		}
	}
};
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Name:	DirectXFramework.cpp
// Date:	April 2nd, 2010
// Author:	Kyle Lauing [klauing@devry.edu] or [kylelauing@gmail.com]
// Purpose: This file is used to create a very simple framework for using
//			DirectX 9 for the GSP 381 course for DeVry University.
// Disclaimer:	
//			Copyright © 2010 by DeVry Educational Development Corporation.
//			All rights reserved. No part of this work may be reproduced
//			or used in any form or by any means – graphic, electronic, or
//			mechanical, including photocopying, recording, Web distribution
//			or information storage and retrieval systems – without the
//			prior consent of DeVry Educational Development Corporation.
//////////////////////////////////////////////////////////////////////////
#include "DirectXFramework.h"
#include <math.h>
CDirectXFramework::CDirectXFramework(void)
{
	// Init or NULL objects before use to avoid any undefined behavior
	m_bVsync				= false;
	m_pD3DObject			= 0;
	m_pD3DDevice			= 0;
	m_pD3DFont				= 0;		
	m_pDIObject				= 0;	
	m_pDIKeyboard			= 0;	
	m_pDIMouse				= 0;	
	m_currTime				= 0;
	m_prevTime				= 0;
	m_fRotation				= 0.0f;
	m_pyramidTranslation	= D3DXVECTOR3(0.0f, 0.0f, 0.0f);
	m_pyramidRotation		= D3DXVECTOR3(0.0f, 0.0f, 0.0f);
	m_pyramidScaling		= 1.0f;
	
}
CDirectXFramework::~CDirectXFramework(void)
{
	// If Shutdown is not explicitly called correctly, call it when
	// this class is destroyed or falls out of scope as an error check.
	Shutdown();
}
void CDirectXFramework::Init(HWND& hWnd, HINSTANCE& hInst, bool bWindowed)
{
	m_hWnd = hWnd;
	//////////////////////////////////////////////////////////////////////////
	// Direct3D Foundations - D3D Object, Present Parameters, and D3D Device
	//////////////////////////////////////////////////////////////////////////
	// Create the D3D Object
	m_pD3DObject = Direct3DCreate9(D3D_SDK_VERSION);
	// Find the width and height of window using hWnd and GetWindowRect()
	RECT rect;
	GetWindowRect(hWnd, &rect);
	int width = rect.right - rect.left;
	int height = rect.bottom - rect.top;
	// Set D3D Device presentation parameters before creating the device
	D3DPRESENT_PARAMETERS D3Dpp;
	ZeroMemory(&D3Dpp, sizeof(D3Dpp)); // NULL the structure's memory
	D3Dpp.hDeviceWindow					= hWnd;										// Handle to the focus window
	D3Dpp.Windowed						= bWindowed;								// Windowed or Full-screen boolean
	D3Dpp.AutoDepthStencilFormat		= D3DFMT_D24S8;								// Format of depth/stencil buffer, 24 bit depth, 8 bit stencil
	D3Dpp.EnableAutoDepthStencil		= TRUE;										// Enables Z-Buffer (Depth Buffer)
	D3Dpp.BackBufferCount				= 1;										// Change if need of > 1 is required at a later date
	D3Dpp.BackBufferFormat				= D3DFMT_X8R8G8B8;							// Back-buffer format, 8 bits for each pixel
	D3Dpp.BackBufferHeight				= height;									// Make sure resolution is supported, use adapter modes
	D3Dpp.BackBufferWidth				= width;									// (Same as above)
	D3Dpp.SwapEffect					= D3DSWAPEFFECT_DISCARD;					// Discard back-buffer, must stay discard to support multi-sample
	D3Dpp.PresentationInterval			= m_bVsync ? D3DPRESENT_INTERVAL_DEFAULT : D3DPRESENT_INTERVAL_IMMEDIATE; // Present back-buffer immediately, unless V-Sync is on								
	D3Dpp.Flags							= D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL;		// This flag should improve performance, if not set to NULL.
	D3Dpp.FullScreen_RefreshRateInHz	= bWindowed ? 0 : D3DPRESENT_RATE_DEFAULT;	// Full-screen refresh rate, use adapter modes or default
	DWORD quality;
	m_pD3DObject->CheckDeviceMultiSampleType(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
		D3DFMT_X8R8G8B8, bWindowed, D3DMULTISAMPLE_4_SAMPLES, &quality);
	//D3Dpp.MultiSampleQuality			= quality - 1;								// Must use quality, returned from CheckDeviceMultiSampleType(), minus one.
	//D3Dpp.MultiSampleType				= D3DMULTISAMPLE_4_SAMPLES;					// 4x Multisampling. Device caps can let you know which MSAA is supported.
	D3Dpp.MultiSampleQuality			= 0;								// MSAA currently off, check documentation for support.
	D3Dpp.MultiSampleType				= D3DMULTISAMPLE_NONE;					// MSAA currently off, check documentation for support.
	// Check device capabilities
	DWORD deviceBehaviorFlags = 0;
	m_pD3DObject->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &m_D3DCaps);
	// Determine vertex processing mode
	if(m_D3DCaps.DevCaps & D3DCREATE_HARDWARE_VERTEXPROCESSING)
	{
		// Hardware vertex processing supported? (Video Card)
		deviceBehaviorFlags |= D3DCREATE_HARDWARE_VERTEXPROCESSING;	
	}
	else
	{
		// If not, use software (CPU)
		deviceBehaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING;
	}
	// If hardware vertex processing is on, check pure device support
	if(m_D3DCaps.DevCaps & D3DDEVCAPS_PUREDEVICE && deviceBehaviorFlags & D3DCREATE_HARDWARE_VERTEXPROCESSING)
	{
		deviceBehaviorFlags |= D3DCREATE_PUREDEVICE;	
	}
	// Create the D3D Device with the present parameters and device flags above
	m_pD3DObject->CreateDevice(
		D3DADAPTER_DEFAULT,		// which adapter to use, set to primary
		D3DDEVTYPE_HAL,			// device type to use, set to hardware rasterization
		hWnd,					// handle to the focus window
		deviceBehaviorFlags,	// behavior flags
		&D3Dpp,					// presentation parameters
		&m_pD3DDevice);			// returned device pointer
	//////////////////////////////////////////////////////////////////////////	
	// View and Projection Matrices
	//////////////////////////////////////////////////////////////////////////
	// Initialize View Matrix
	m_eyePos	= D3DXVECTOR3(0.0f, 2.0f, -10.0f);	// Camera position
	m_lookAt	= D3DXVECTOR3(0.0f, 0.0f, 0.0f);	// Position camera is viewing
	m_upVec		= D3DXVECTOR3(0.0f, 1.0f, 0.0f);	// Rotational orientation
	// Easily calculate the view matrix with 3 intuitive vectors
	D3DXMatrixLookAtLH(
		&m_viewMat,	// Returned viewMat
		&m_eyePos,	// Eye Position
		&m_lookAt,	// LookAt Position
		&m_upVec);	// Up Vector
	// Apply the view matrix in the scene
	m_pD3DDevice->SetTransform(D3DTS_VIEW, &m_viewMat);
	// Initialize perspective projection matrix, this creates view frustum
	D3DXMatrixPerspectiveFovLH(
		&m_projMat,						// Returned ProjMat
		D3DXToRadian(65.0f),			// Field of View
		(float)width / (float)height,	// Aspect Ratio
		1.0f,							// Near Plane
		1000.0f);						// Far Plane
	//// Apply the projection matrix in the scene
	//m_pD3DDevice->SetTransform(D3DTS_PROJECTION, &m_projMat);
	//////////////////////////////////////////////////////////////////////////
	// Vertex Declaration and Vertex and Index Buffers
	//////////////////////////////////////////////////////////////////////////
	// Vertex declaration
	D3DVERTEXELEMENT9 decl[] =
	{
		{0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
		{0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0},
		{0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
		D3DDECL_END()
	};
	// Create vertex declaration
	m_pD3DDevice->CreateVertexDeclaration(decl, &m_pD3DVertexDecl);
	//////////////////////////////////////////////////////////////////////////
	// Load cube data (verts and indices) into respective arrays
	//////////////////////////////////////////////////////////////////////////
	// Load vertex info
	//////////////////////////////////////////////////////////////////////////
	// Cube
	//////////////////////////////////////////////////////////////////////////
	// Front
	m_cubeVerts[0].position = D3DXVECTOR3(-1.0f, -1.0f, -1.0f);
	m_cubeVerts[1].position = D3DXVECTOR3(-1.0f, 1.0f, -1.0f);
	m_cubeVerts[2].position = D3DXVECTOR3(1.0f, 1.0f, -1.0f);
	m_cubeVerts[3].position = D3DXVECTOR3(1.0f, -1.0f, -1.0f);
	D3DXVec3Normalize(&m_cubeVerts[0].normal, &D3DXVECTOR3(0.0f, 0.0f, -1.0f));
	D3DXVec3Normalize(&m_cubeVerts[1].normal, &D3DXVECTOR3(0.0f, 0.0f, -1.0f));
	D3DXVec3Normalize(&m_cubeVerts[2].normal, &D3DXVECTOR3(0.0f, 0.0f, -1.0f));
	D3DXVec3Normalize(&m_cubeVerts[3].normal, &D3DXVECTOR3(0.0f, 0.0f, -1.0f));
	m_cubeVerts[0].uv = D3DXVECTOR2(0.0f, 1.0f);
	m_cubeVerts[1].uv = D3DXVECTOR2(0.0f, 0.0f);
	m_cubeVerts[2].uv = D3DXVECTOR2(1.0f, 0.0f);
	m_cubeVerts[3].uv = D3DXVECTOR2(1.0f, 1.0f);
	// Back
	m_cubeVerts[4].position = D3DXVECTOR3(-1.0f, -1.0f, 1.0f);
	m_cubeVerts[5].position = D3DXVECTOR3(1.0f, -1.0f, 1.0f);
	m_cubeVerts[6].position = D3DXVECTOR3(1.0f, 1.0f, 1.0f);
	m_cubeVerts[7].position = D3DXVECTOR3(-1.0f, 1.0f, 1.0f);
	D3DXVec3Normalize(&m_cubeVerts[4].normal, &D3DXVECTOR3(0.0f, 0.0f, 1.0f));
	D3DXVec3Normalize(&m_cubeVerts[5].normal, &D3DXVECTOR3(0.0f, 0.0f, 1.0f));
	D3DXVec3Normalize(&m_cubeVerts[6].normal, &D3DXVECTOR3(0.0f, 0.0f, 1.0f));
	D3DXVec3Normalize(&m_cubeVerts[7].normal, &D3DXVECTOR3(0.0f, 0.0f, 1.0f));
	m_cubeVerts[4].uv = D3DXVECTOR2(1.0f, 1.0f);
	m_cubeVerts[5].uv = D3DXVECTOR2(0.0f, 1.0f);
	m_cubeVerts[6].uv = D3DXVECTOR2(0.0f, 0.0f);
	m_cubeVerts[7].uv = D3DXVECTOR2(1.0f, 0.0f);
	// Top
	m_cubeVerts[8].position = D3DXVECTOR3(-1.0f, 1.0f, -1.0f);
	m_cubeVerts[9].position = D3DXVECTOR3(-1.0f, 1.0f, 1.0f);
	m_cubeVerts[10].position = D3DXVECTOR3(1.0f, 1.0f, 1.0f);
	m_cubeVerts[11].position = D3DXVECTOR3(1.0f, 1.0f, -1.0f);
	D3DXVec3Normalize(&m_cubeVerts[8].normal, &D3DXVECTOR3(0.0f, 1.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[9].normal, &D3DXVECTOR3(0.0f, 1.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[10].normal, &D3DXVECTOR3(0.0f, 1.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[11].normal, &D3DXVECTOR3(0.0f, 1.0f, 0.0f));
	m_cubeVerts[8].uv = D3DXVECTOR2(0.0f, 1.0f);
	m_cubeVerts[9].uv = D3DXVECTOR2(0.0f, 0.0f);
	m_cubeVerts[10].uv = D3DXVECTOR2(1.0f, 0.0f);
	m_cubeVerts[11].uv = D3DXVECTOR2(1.0f, 1.0f);
	// Bottom
	m_cubeVerts[12].position = D3DXVECTOR3(-1.0f, -1.0f, -1.0f);
	m_cubeVerts[13].position = D3DXVECTOR3(1.0f, -1.0f, -1.0f);
	m_cubeVerts[14].position = D3DXVECTOR3(1.0f, -1.0f, 1.0f);
	m_cubeVerts[15].position = D3DXVECTOR3(-1.0f, -1.0f, 1.0f);
	D3DXVec3Normalize(&m_cubeVerts[12].normal, &D3DXVECTOR3(0.0f, -1.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[13].normal, &D3DXVECTOR3(0.0f, -1.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[14].normal, &D3DXVECTOR3(0.0f, -1.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[15].normal, &D3DXVECTOR3(0.0f, -1.0f, 0.0f));
	m_cubeVerts[12].uv = D3DXVECTOR2(1.0f, 1.0f);
	m_cubeVerts[13].uv = D3DXVECTOR2(0.0f, 1.0f);
	m_cubeVerts[14].uv = D3DXVECTOR2(0.0f, 0.0f);
	m_cubeVerts[15].uv = D3DXVECTOR2(1.0f, 0.0f);
	// Left
	m_cubeVerts[16].position = D3DXVECTOR3(-1.0f, -1.0f, 1.0f);
	m_cubeVerts[17].position = D3DXVECTOR3(-1.0f, 1.0f, 1.0f);
	m_cubeVerts[18].position = D3DXVECTOR3(-1.0f, 1.0f, -1.0f);
	m_cubeVerts[19].position = D3DXVECTOR3(-1.0f, -1.0f, -1.0f);
	D3DXVec3Normalize(&m_cubeVerts[16].normal, &D3DXVECTOR3(-1.0f, 0.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[17].normal, &D3DXVECTOR3(-1.0f, 0.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[18].normal, &D3DXVECTOR3(-1.0f, 0.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[19].normal, &D3DXVECTOR3(-1.0f, 0.0f, 0.0f));
	m_cubeVerts[16].uv = D3DXVECTOR2(0.0f, 1.0f);
	m_cubeVerts[17].uv = D3DXVECTOR2(0.0f, 0.0f);
	m_cubeVerts[18].uv = D3DXVECTOR2(1.0f, 0.0f);
	m_cubeVerts[19].uv = D3DXVECTOR2(1.0f, 1.0f);
	// Right
	m_cubeVerts[20].position = D3DXVECTOR3(1.0f, -1.0f, -1.0f);
	m_cubeVerts[21].position = D3DXVECTOR3(1.0f, 1.0f, -1.0f);
	m_cubeVerts[22].position = D3DXVECTOR3(1.0f, 1.0f, 1.0f);
	m_cubeVerts[23].position = D3DXVECTOR3(1.0f, -1.0f, 1.0f);
	D3DXVec3Normalize(&m_cubeVerts[20].normal, &D3DXVECTOR3(1.0f, 0.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[21].normal, &D3DXVECTOR3(1.0f, 0.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[22].normal, &D3DXVECTOR3(1.0f, 0.0f, 0.0f));
	D3DXVec3Normalize(&m_cubeVerts[23].normal, &D3DXVECTOR3(1.0f, 0.0f, 0.0f));
	m_cubeVerts[20].uv = D3DXVECTOR2(0.0f, 1.0f);
	m_cubeVerts[21].uv = D3DXVECTOR2(0.0f, 0.0f);
	m_cubeVerts[22].uv = D3DXVECTOR2(1.0f, 0.0f);
	m_cubeVerts[23].uv = D3DXVECTOR2(1.0f, 1.0f);
	//////////////////////////////////////////////////////////////////////////
	// Pyramid
	//////////////////////////////////////////////////////////////////////////
	// Bottom
	m_pyramidVerts[0].position = D3DXVECTOR3(-1.0f, -1.0f, -1.0f);
	m_pyramidVerts[1].position = D3DXVECTOR3(1.0f, -1.0f, -1.0f);
	m_pyramidVerts[2].position = D3DXVECTOR3(1.0f, -1.0f, 1.0f);
	m_pyramidVerts[3].position = D3DXVECTOR3(-1.0f, -1.0f, 1.0f);
	D3DXVec3Normalize(&m_pyramidVerts[0].normal, &D3DXVECTOR3(0.0f, -1.0f, 0.0f));
	D3DXVec3Normalize(&m_pyramidVerts[1].normal, &D3DXVECTOR3(0.0f, -1.0f, 0.0f));
	D3DXVec3Normalize(&m_pyramidVerts[2].normal, &D3DXVECTOR3(0.0f, -1.0f, 0.0f));
	D3DXVec3Normalize(&m_pyramidVerts[3].normal, &D3DXVECTOR3(0.0f, -1.0f, 0.0f));
	m_pyramidVerts[0].uv = D3DXVECTOR2(1.0f, 1.0f);
	m_pyramidVerts[1].uv = D3DXVECTOR2(0.0f, 1.0f);
	m_pyramidVerts[2].uv = D3DXVECTOR2(0.0f, 0.0f);
	m_pyramidVerts[3].uv = D3DXVECTOR2(1.0f, 0.0f);
	// Front
	m_pyramidVerts[4].position = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
	m_pyramidVerts[5].position = D3DXVECTOR3(1.0f, -1.0f, -1.0f);
	m_pyramidVerts[6].position = D3DXVECTOR3(-1.0f, -1.0f, -1.0f);
	D3DXVec3Normalize(&m_pyramidVerts[4].normal, &D3DXVECTOR3(0.0f, 0.0f, -1.0f ));
	D3DXVec3Normalize(&m_pyramidVerts[5].normal, &D3DXVECTOR3(0.0f, 0.0f, -1.0f ));
	D3DXVec3Normalize(&m_pyramidVerts[6].normal, &D3DXVECTOR3(0.0f, 0.0f, -1.0f ));
	m_pyramidVerts[4].uv = D3DXVECTOR2(0.5f, 0.0f);
	m_pyramidVerts[5].uv = D3DXVECTOR2(1.0f, 1.0f);
	m_pyramidVerts[6].uv = D3DXVECTOR2(0.0f, 1.0f);
	// Back
	m_pyramidVerts[7].position = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
	m_pyramidVerts[8].position = D3DXVECTOR3(-1.0f, -1.0f, 1.0f);
	m_pyramidVerts[9].position = D3DXVECTOR3(1.0f, -1.0f, 1.0f);
	D3DXVec3Normalize(&m_pyramidVerts[7].normal, &D3DXVECTOR3(0.0f, 0.0f, 1.0f ));
	D3DXVec3Normalize(&m_pyramidVerts[8].normal, &D3DXVECTOR3(0.0f, 0.0f, 1.0f ));
	D3DXVec3Normalize(&m_pyramidVerts[9].normal, &D3DXVECTOR3(0.0f, 0.0f, 1.0f ));
	m_pyramidVerts[7].uv = D3DXVECTOR2(0.5f, 0.0f);
	m_pyramidVerts[8].uv = D3DXVECTOR2(1.0f, 1.0f);
	m_pyramidVerts[9].uv = D3DXVECTOR2(0.0f, 1.0f);
	// Left
	m_pyramidVerts[10].position = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
	m_pyramidVerts[11].position = D3DXVECTOR3(-1.0f, -1.0f, -1.0f);
	m_pyramidVerts[12].position = D3DXVECTOR3(-1.0f, -1.0f, 1.0f);
	D3DXVec3Normalize(&m_pyramidVerts[10].normal, &D3DXVECTOR3(-1.0f, 0.0f, 0.0f ));
	D3DXVec3Normalize(&m_pyramidVerts[11].normal, &D3DXVECTOR3(-1.0f, 0.0f, 0.0f ));
	D3DXVec3Normalize(&m_pyramidVerts[12].normal, &D3DXVECTOR3(-1.0f, 0.0f, 0.0f ));
	m_pyramidVerts[10].uv = D3DXVECTOR2(0.5f, 0.0f);
	m_pyramidVerts[11].uv = D3DXVECTOR2(1.0f, 1.0f);
	m_pyramidVerts[12].uv = D3DXVECTOR2(0.0f, 1.0f);
	// Right
	m_pyramidVerts[13].position = D3DXVECTOR3(0.0f, 1.0f, 0.0f);
	m_pyramidVerts[14].position = D3DXVECTOR3(1.0f, -1.0f, 1.0f);
	m_pyramidVerts[15].position = D3DXVECTOR3(1.0f, -1.0f, -1.0f);
	D3DXVec3Normalize(&m_pyramidVerts[13].normal, &D3DXVECTOR3(1.0f, 0.0f, 0.0f ));
	D3DXVec3Normalize(&m_pyramidVerts[14].normal, &D3DXVECTOR3(1.0f, 0.0f, 0.0f ));
	D3DXVec3Normalize(&m_pyramidVerts[15].normal, &D3DXVECTOR3(1.0f, 0.0f, 0.0f ));
	m_pyramidVerts[13].uv = D3DXVECTOR2(0.5f, 0.0f);
	m_pyramidVerts[14].uv = D3DXVECTOR2(1.0f, 1.0f);
	m_pyramidVerts[15].uv = D3DXVECTOR2(0.0f, 1.0f);
	// Load index info, refers into index into verts array to compose triangles
	// Note: A clockwise winding order of verts will show the front face.
	//////////////////////////////////////////////////////////////////////////
	// Cube
	//////////////////////////////////////////////////////////////////////////
	// Front
	m_cubeIndices[0] = 0; m_cubeIndices[1] = 1; m_cubeIndices[2] = 2;		// Triangle 0
	m_cubeIndices[3] = 0; m_cubeIndices[4] = 2; m_cubeIndices[5] = 3;		// Triangle 1
	// Back
	m_cubeIndices[6] = 4; m_cubeIndices[7] = 5; m_cubeIndices[8] = 6;		// Triangle 2
	m_cubeIndices[9] = 4; m_cubeIndices[10] = 6; m_cubeIndices[11] = 7;	// Triangle 3
	// Top
	m_cubeIndices[12] = 8; m_cubeIndices[13] = 9; m_cubeIndices[14] = 10;	// Triangle 4
	m_cubeIndices[15] = 8; m_cubeIndices[16] = 10; m_cubeIndices[17] = 11;	// Triangle 5
	// Bottom
	m_cubeIndices[18] = 12; m_cubeIndices[19] = 13; m_cubeIndices[20] = 14;	// Triangle 6
	m_cubeIndices[21] = 12; m_cubeIndices[22] = 14; m_cubeIndices[23] = 15;	// Triangle 7
	// Left
	m_cubeIndices[24] = 16; m_cubeIndices[25] = 17; m_cubeIndices[26] = 18;	// Triangle 8
	m_cubeIndices[27] = 16; m_cubeIndices[28] = 18; m_cubeIndices[29] = 19;	// Triangle 9
	// Right
	m_cubeIndices[30] = 20; m_cubeIndices[31] = 21; m_cubeIndices[32] = 22;	// Triangle 10
	m_cubeIndices[33] = 20; m_cubeIndices[34] = 22; m_cubeIndices[35] = 23;	// Triangle 11
	
	//////////////////////////////////////////////////////////////////////////
	// Pyramid
	//////////////////////////////////////////////////////////////////////////
	// Bottom
	m_pyramidIndices[0] = 0; m_pyramidIndices[1] = 1; m_pyramidIndices[2] = 2;		// Triangle 0
	m_pyramidIndices[3] = 0; m_pyramidIndices[4] = 2; m_pyramidIndices[5] = 3;		// Triangle 1
	// Front
	m_pyramidIndices[6] = 4; m_pyramidIndices[7] = 5; m_pyramidIndices[8] = 6;		// Triangle 2
	// Back
	m_pyramidIndices[9] = 7; m_pyramidIndices[10] = 8; m_pyramidIndices[11] = 9;	// Triangle 3
	// Left
	m_pyramidIndices[12] = 10; m_pyramidIndices[13] = 11; m_pyramidIndices[14] = 12;// Triangle 4
	// Right
	m_pyramidIndices[15] = 13; m_pyramidIndices[16] = 14; m_pyramidIndices[17] = 15;// Triangle 5
	//////////////////////////////////////////////////////////////////////////
	// Cube
	// Create Vertex Buffer
	m_pD3DDevice->CreateVertexBuffer(
		4 * 6 * sizeof(Vertex),	// Length in bytes to allocate buffer (num quads * num sides * sizeof(Vertex))
		D3DUSAGE_WRITEONLY,		// Usage
		0,						// Used only with FVF, we are not using
		D3DPOOL_MANAGED,		// Memory Pool
		&m_pD3DVertexBuffer,	// Vertex Buffer
		0);						// No longer used, set to 0
	// Create Index Buffer
	m_pD3DDevice->CreateIndexBuffer(
		3 * 12 * sizeof(WORD),	// Length in bytes to allocate buffer (3 verts * num triangles * sizeof(WORD))
		D3DUSAGE_WRITEONLY,		// Usage
		D3DFMT_INDEX16,			// Index Format
		D3DPOOL_MANAGED,		// Memory Pool
		&m_pD3DIndexBuffer,		// Index Buffer
		0);						// No longer used
	// Pyramid
	// Create Vertex Buffer
	m_pD3DDevice->CreateVertexBuffer(
		16 * sizeof(Vertex),		// Length in bytes to allocate buffer (num quads * num sides * sizeof(Vertex))
		D3DUSAGE_WRITEONLY,			// Usage
		0,							// Used only with FVF, we are not using
		D3DPOOL_MANAGED,			// Memory Pool
		&m_pD3DVertexBufferPyramid,	// Vertex Buffer
		0);							// No longer used, set to 0
	// Create Index Buffer
	m_pD3DDevice->CreateIndexBuffer(
		18 * sizeof(WORD),			// Length in bytes to allocate buffer (3 verts * num triangles * sizeof(WORD))
		D3DUSAGE_WRITEONLY,			// Usage
		D3DFMT_INDEX16,				// Index Format
		D3DPOOL_MANAGED,			// Memory Pool
		&m_pD3DIndexBufferPyramid,	// Index Buffer
		0);							// No longer used
	
	//////////////////////////////////////////////////////////////////////////
	// Accessing vertex buffer memory
	//////////////////////////////////////////////////////////////////////////
	void* pVerts;
	// Cube
	// Lock vertex buffer
	m_pD3DVertexBuffer->Lock(
		0,			// Offset to Lock (0 locks entire buffer)
		0,			// Size to Lock (0 locks entire buffer)
		&pVerts,	// Double pointer to data
		0);			// Flags
	// Modify data
	memcpy(pVerts, m_cubeVerts, 4 * 6 * sizeof(Vertex));
	// Unlock vertex buffer
	m_pD3DVertexBuffer->Unlock();
	// Pyramid
	// Lock vertex buffer
	m_pD3DVertexBufferPyramid->Lock(
		0,			// Offset to Lock (0 locks entire buffer)
		0,			// Size to Lock (0 locks entire buffer)
		&pVerts,	// Double pointer to data
		0);			// Flags
	// Modify data
	memcpy(pVerts, m_pyramidVerts, 16 * sizeof(Vertex));
	// Unlock vertex buffer
	m_pD3DVertexBufferPyramid->Unlock();
	
	//////////////////////////////////////////////////////////////////////////
	// Accessing index buffer memory
	//////////////////////////////////////////////////////////////////////////
	void* pIndices;
	// Cube
	// Lock index buffer
	m_pD3DIndexBuffer->Lock(
		0,			// Offset to Lock (0 locks entire buffer)
		0,			// Size to Lock (0 locks entire buffer)
		&pIndices,	// Double pointer to data
		0);			// Flags
	// Modify data
	memcpy(pIndices, m_cubeIndices, 3 * 12 * sizeof(WORD));
	// Unlock index buffer
	m_pD3DIndexBuffer->Unlock();
	// Pyramid
	// Lock index buffer
	m_pD3DIndexBufferPyramid->Lock(
		0,			// Offset to Lock (0 locks entire buffer)
		0,			// Size to Lock (0 locks entire buffer)
		&pIndices,	// Double pointer to data
		0);			// Flags
	// Modify data
	memcpy(pIndices, m_pyramidIndices, 18 * sizeof(WORD));
	// Unlock index buffer
	m_pD3DIndexBufferPyramid->Unlock();
	
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//Create effect
	D3DXCreateEffectFromFile(m_pD3DDevice, L"Lab5.fx", 0, 0,D3DXSHADER_DEBUG | D3DXSHADER_SKIPOPTIMIZATION, 0, &m_pEffect, &m_pEffectError);
	// find the best techniq
	m_hTech = m_pEffect->GetTechniqueByName("tech0");
	// Print errors, if any
	m_pEffectError = 0; // defined locally
	if(m_pEffectError)
	{
		MessageBoxA(0, (char*)m_pEffectError->GetBufferPointer(), "Lab5.fx - Load Error", MB_OK);
	}
	// Enable Z-Buffer (Depth Buffer), Make sure you have:
	// The two presentation parameters set
	//// The flag in the Clear function
	m_pD3DDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);
	m_pD3DDevice->SetRenderState(D3DRS_SPECULARENABLE, TRUE);
	m_pD3DDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(60, 60, 60));
	//////////////////////////////////////////////////////////////////////////
	// Lighting, Material, and Texture
	//////////////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////////////
	// Light
	//////////////////////////////////////////////////////////////////////////
	ZeroMemory(&m_Light, sizeof(m_Light));
	// Ambient light color emitted from this light
	m_Light.Ambient = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
	// Diffuse light color emitted from this light
	m_Light.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
	// Specular light color emitted from this light
	m_Light.Specular = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
	// Light Type (Point) Requires: Position, Range, Attenuation
	m_Light.Type = D3DLIGHT_POINT;	// Point, alternatively D3DLIGHT_DIRECTIONAL or D3DLIGHT_SPOT
	// Light Position
	m_Light.Position = D3DXVECTOR3(30.0f, 10.0f, -10.0f);
	// Range of Light
	m_Light.Range = 100.0f;
	// Light Attenuation
	m_Light.Attenuation0 = 0.0f;	// Constant
	m_Light.Attenuation1 = 0.05f;	// Linear
	m_Light.Attenuation2 = 0.0f;	// Quadratic
	// Set Light
	m_pD3DDevice->SetLight(0, &m_Light);	// 0 is the index for this light
	// Enable Light
	m_pD3DDevice->LightEnable(0, true);
	//////////////////////////////////////////////////////////////////////////
	//// Material (How light is reflected off of an object)
	//////////////////////////////////////////////////////////////////////////
	ZeroMemory(&m_Material[0], sizeof(m_Material));
	m_Material[0].Ambient = D3DXCOLOR(0.2f, 0.2f, 0.2f, 1.0f);		// Ambient color reflected
	m_Material[0].Diffuse = D3DXCOLOR(1.0f, 0.3f, 0.3f, 1.0f);		// Diffuse color reflected
	m_Material[0].Emissive = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);		// Emissive color reflected
	m_Material[0].Specular = D3DXCOLOR(0.8f, 0.8f, 0.8f, 1.0f);		// Specular
	m_Material[0].Power = 30.0f;									// Specular highlight intensity
	ZeroMemory(&m_Material[1], sizeof(m_Material[1]));
	m_Material[1].Ambient = D3DXCOLOR(0.2f, 0.2f, 0.2f, 1.0f);		// Ambient color reflected
	m_Material[1].Diffuse = D3DXCOLOR(0.3f, 0.3f, 1.0f, 1.0f);		// Diffuse color reflected
	m_Material[1].Emissive = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);		// Emissive color reflected
	m_Material[1].Specular = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);		// Specular
	m_Material[1].Power = 30.0f;									// Specular highlight intensity
	
	ZeroMemory(&m_Material[2], sizeof(m_Material[2]));
	m_Material[2].Ambient = D3DXCOLOR(0.2f, 0.2f, 0.2f, 1.0f);		// Ambient color reflected
	m_Material[2].Diffuse = D3DXCOLOR(0.3f, 1.0f, 0.3f, 1.0f);		// Diffuse color reflected
	m_Material[2].Emissive = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);		// Emissive color reflected
	m_Material[2].Specular = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);		// Specular
	m_Material[2].Power = 30.0f;									// Specular highlight intensity
	//////////////////////////////////////////////////////////////////////////
	// Texture
	//////////////////////////////////////////////////////////////////////////
	// Load Texture
	D3DXCreateTextureFromFile(m_pD3DDevice, L"ground2.bmp", &m_pTexture[0]);
	// Set Sampler States
	m_pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
	m_pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
	m_pD3DDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
	D3DXCreateTextureFromFile(m_pD3DDevice, L"seafloor.bmp", &m_pTexture[1]);
	// Set Sampler States
	m_pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
	m_pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
	m_pD3DDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
	D3DXCreateTextureFromFile(m_pD3DDevice, L"floor.bmp", &m_pTexture[2]);
	// Set Sampler States
	m_pD3DDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
	m_pD3DDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
	m_pD3DDevice->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
	
	//////////////////////////////////////////////////////////////////////////
	// Create a Font Object
	//////////////////////////////////////////////////////////////////////////
	// Load a font for private use for this process
	AddFontResourceEx(L"Delicious-Roman.otf", FR_PRIVATE, 0);
	// Load D3DXFont, each font style you want to support will need an ID3DXFont
	D3DXCreateFont(m_pD3DDevice, 30, 0, FW_BOLD, 0, false, DEFAULT_CHARSET,
		OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Delicious-Roman"), &m_pD3DFont);
	//////////////////////////////////////////////////////////////////////////
	// Initialize DirectInput
	//////////////////////////////////////////////////////////////////////////
	// Create the DI Object
	DirectInput8Create(hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&m_pDIObject, NULL);
	// Initialize Keyboard
	m_pDIObject->CreateDevice(GUID_SysKeyboard, &m_pDIKeyboard, NULL);
	// Initialize Mouse
	m_pDIObject->CreateDevice(GUID_SysMouse, &m_pDIMouse, NULL);
	// Set up Keyboard
	m_pDIKeyboard->SetCooperativeLevel(hWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
	m_pDIKeyboard->SetDataFormat(&c_dfDIKeyboard);
	// Set up Mouse (c_dfDIMouse2 = 8 button mouse)
	m_pDIMouse->SetCooperativeLevel(hWnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
	m_pDIMouse->SetDataFormat(&c_dfDIMouse2);
}
void CDirectXFramework::Update(float dt)
{
	////////////////////////////////////////////////////////////////////////
	// Get and Acquire Keyboard Input
	//////////////////////////////////////////////////////////////////////////
	// buffer - Stores our keyboard device state
	char buffer[256];
	ZeroMemory(buffer, sizeof(buffer));
	// Get the input device state
	HRESULT hr;
	hr = m_pDIKeyboard->GetDeviceState( sizeof(buffer), (LPVOID)&buffer );
	if(FAILED(hr))
	{
		hr = m_pDIKeyboard->Acquire();
		// Device has probably been lost if failed, if so keep trying to get it until it’s found.
		while( hr == DIERR_INPUTLOST)
		{
			hr = m_pDIKeyboard->Acquire();
		}
		// If we failed for some other reason
		if(FAILED(hr))
			return;
		// Read the device state again
		m_pDIKeyboard->GetDeviceState(sizeof(buffer), buffer);
	}
	
	//////////////////////////////////////////////////////////////////////////
	// Get and Acquire Mouse Input
	//////////////////////////////////////////////////////////////////////////
	// Stores our mouse state for an 8 button mouse.
	DIMOUSESTATE2 mouseState;
	ZeroMemory(&mouseState, sizeof(mouseState));
	// Get the input device state
	hr = m_pDIMouse->GetDeviceState( sizeof(DIMOUSESTATE2), &mouseState );
	if(FAILED(hr))
	{
		hr = m_pDIMouse->Acquire();
		// Device has probably been lost if failed, if so keep trying to get it until it’s found.
		while( hr == DIERR_INPUTLOST)
		{
			hr = m_pDIMouse->Acquire();
		}
		// If we failed for some other reason
		if(FAILED(hr))
			return;
		// Read the device state again
		m_pDIMouse->GetDeviceState(sizeof(DIMOUSESTATE2), &mouseState);
	}
	//////////////////////////////////////////////////////////////////////////
	//	Keyboard Code Examples: [DIK (DirectInput Key) codes we translate]
	//	DIK_0 – DIK_9
	//	DIK_NUMPAD0 – DIK_NUMPAD9
	//	DIK_A – DIK_Z
	//	DIK_F1 – DIK_F12
	//	DIK_UP, DIK_DOWN, DIK_LEFT, DIK_RIGHT	// Arrow Keys
	//	DIK_SPACE, DIK_TAB, DIK_CAPITAL, DIK_LCONTROL (Left Ctrl Key),
	// DIK_RCONTROL (Right Ctrl Key), DIK_RETURN, DIK_LMENU (Left Alt Key),
	// DIK_LWIN (Left Windows Key), DIK_LSHIFT (Left Shift Key), etc.
	//	Complete list under Keyboard Device in the documentation.
	//////////////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////////////
	//	Mouse variables: [MouseState2 structure supports 8 button mice]
	//	lX				-	X-axis mouse relative coordinates
	//	lY				-	Y-axis mouse relative coordinates
	//	lZ				-	Mouse wheel relative coordinates
	//	rgbButtons[8]	-	Array of 8 mouse buttons
	//
	//	Usually mouse hardware maps the button layout in a standard way for
	//	the first 4 buttons, after that it depends on the mouse hardware layout
	//	rgbButtons[0]	-	Left Mouse Button
	//	rgbButtons[1]	-	Right Mouse Button
	//	rgbButtons[2]	-	Middle Mouse Button (click scroll wheel)
	//	rgbButtons[3]	-	Side Mouse Button 1
	//	rgbButtons[4]	-	Side Mouse Button 2
	//	rgbButtons[5]	-	Side Mouse Button 3
	//	rgbButtons[6]	-	Side Mouse Button 4
	//	rgbButtons[7]	-	Side Mouse Button 5
	//////////////////////////////////////////////////////////////////////////
	//////////////////////////////////////////////////////////////////////////
	//	Act on Input
	//////////////////////////////////////////////////////////////////////////
	// If either CTRL key is held on the keyboard, activate transformation
	// input gathering for the pyramid.
	// Keyboard
	if(buffer[DIK_LCONTROL] & 0x80 || buffer[DIK_RCONTROL] &0x80);
	
		
		// Mouse
		// Left Mouse Button - Translation
		if(mouseState.rgbButtons[0] & 0x80)
		{
			m_pyramidTranslation.x += mouseState.lX * 0.01f; // X Axis
			m_pyramidTranslation.y -= mouseState.lY * 0.01f; // Y Axis
			m_pyramidTranslation.z += mouseState.lZ * 0.01f; // Mouse Wheel
		}
		// Right Mouse Button - Rotation
		if(mouseState.rgbButtons[1] & 0x80)
		{
			m_pyramidRotation.y -= mouseState.lX * 0.01f; // X Axis
			m_pyramidRotation.x -= mouseState.lY * 0.01f; // Y Axis
			m_pyramidRotation.z += mouseState.lZ * 0.1f; // Mouse Wheel
		}
		// Middle Mouse Button - Scaling
		if(mouseState.rgbButtons[2] & 0x80)
		{
			m_pyramidScaling += mouseState.lX * 0.01f; // X Axis
			m_pyramidScaling += mouseState.lY * 0.01f; // Y Axis
			m_pD3DDevice->SetRenderState(D3DRS_NORMALIZENORMALS, true);
		}
}
	
void CDirectXFramework::Render(float dt)
{
	// If the device was not created successfully, return
	if(!m_pD3DDevice)
		return;
	//////////////////////////////////////////////////////////////////////////
	// All draw calls between swap chain's functions, and pre-render and post-
	// render functions (Clear and Present, BeginScene and EndScene)
	//////////////////////////////////////////////////////////////////////////
	// Clear the back buffer, call BeginScene()
	if(SUCCEEDED(m_pD3DDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DXCOLOR(0.0f, 0.4f, 0.8f, 1.0f), 1.0f, 0)))
	{
		if(SUCCEEDED(m_pD3DDevice->BeginScene()))
		{
			//////////////////////////////////////////////////////////////////////////
			// Draw 3D Objects
			//////////////////////////////////////////////////////////////////////////
			UINT pass =0;
			m_pEffect->SetTechnique(m_hTech);
			m_pEffect->Begin(&pass, 0);
			//// Set global shader parameters
			m_pEffect->SetFloatArray("eyePos", (float*)m_eyePos, 3);
			m_pEffect->SetFloatArray("lightPos", (float*)&m_Light.Position, 3);
			m_pEffect->SetFloatArray("ambientLight", (float*)&m_Light.Ambient, 3);
			m_pEffect->SetFloatArray("specularLight", (float*)&m_Light.Specular, 3);
			m_pEffect->SetFloatArray("diffuseLight", (float*)&m_Light.Diffuse, 3);
			m_pEffect->SetFloatArray("lightAttenuation", (float*)&D3DXVECTOR3(m_Light.Attenuation0,m_Light.Attenuation1, m_Light.Attenuation2), 3);
			//////////////////////////////////////////////////////////////////////////
			// Matrix Transformations to control each objects position, scale, and
			// rotation. Set these matrices for each object you want to render.
			//////////////////////////////////////////////////////////////////////////
			D3DXMATRIX transMat, rotMat, scaleMat, worldMat;
			D3DXMatrixIdentity(&transMat);
			D3DXMatrixIdentity(&scaleMat);
			D3DXMatrixIdentity(&rotMat);
			D3DXMatrixIdentity(&worldMat);
			m_pD3DDevice->SetStreamSource(0, m_pD3DVertexBuffer, 0, sizeof(Vertex));
			m_pD3DDevice->SetIndices(m_pD3DIndexBuffer);
			m_pD3DDevice->SetVertexDeclaration(m_pD3DVertexDecl);
			////////////////////////////////////////////////////////////////////////
			//Cube 1
			////////////////////////////////////////////////////////////////////////
			// Calculate Matrix Transform
			D3DXMatrixScaling(&scaleMat, 1.0f, 1.0f, 1.0f);			// Scaling
			D3DXMatrixRotationYawPitchRoll(&rotMat, timeGetTime() * 0.001f, 0.0f, 0.0f); // Rotation on Yaw, Pitch, and Roll
			D3DXMatrixTranslation(&transMat, -4.0f, 0.0f, 0.0f);		// Translation
			D3DXMatrixMultiply(&scaleMat, &scaleMat, &rotMat);		// Multiply scale and rotation, store in scale
			D3DXMatrixMultiply(&worldMat, &scaleMat, &transMat);	// Multiply scale and translation, store in world
			for(int i=0; i < pass; i++)
			{
				// Begin the pass
				m_pEffect->BeginPass(i);
				m_pEffect->SetMatrix("worldViewProjMat", &(worldMat * m_viewMat * m_projMat));
				D3DXMatrixInverse(&WITMat,0,&worldMat);
				D3DXMatrixTranspose(&WITMat,&WITMat);
				m_pEffect->SetMatrix("worldInverseTransposeMat",&(WITMat));
				m_pEffect->SetMatrix("worldMat", &worldMat);
				m_pEffect->SetFloatArray("ambientMaterial",(float*)&m_Material[2].Ambient, 3);
				m_pEffect->SetFloatArray("diffuseMaterial",(float*)&m_Material[2].Diffuse, 3);
				m_pEffect->SetFloatArray("specularMaterial",(float*)&m_Material[2].Specular, 3);
				m_pEffect->SetFloat("specularPower",m_Material[2].Power);
				m_pEffect->SetTexture("tex",m_pTexture);
				m_pEffect->CommitChanges();
				m_pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 4 * 6, 0, 12);
				// End the pass
				m_pEffect->EndPass();
			}
			m_pEffect->End(); // end the effect
			//// Set global shader parameters
			m_pEffect->SetFloatArray("eyePos", (float*)m_eyePos, 3);
			m_pEffect->SetFloatArray("lightPos", (float*)&m_Light.Position, 3);
			m_pEffect->SetFloatArray("ambientLight", (float*)&m_Light.Ambient, 3);
			m_pEffect->SetFloatArray("specularLight", (float*)&m_Light.Specular, 3);
			m_pEffect->SetFloatArray("diffuseLight", (float*)&m_Light.Diffuse, 3);
			m_pEffect->SetFloatArray("lightAttenuation", (float*)&D3DXVECTOR3(m_Light.Attenuation0,m_Light.Attenuation1, m_Light.Attenuation2), 3);
			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			//////////////////////////////////////////////////////////////////////////
			// Cube 2
			//////////////////////////////////////////////////////////////////////////
			D3DXMatrixScaling(&scaleMat, 1.0f, 1.0f, 1.0f);			// Scaling
			D3DXMatrixRotationYawPitchRoll(&rotMat, timeGetTime() * -0.001f, 0.0f, 0.0f); // Rotation on Yaw, Pitch, and Roll
			D3DXMatrixTranslation(&transMat, 4.0f, 0.0f, 0.0f);		// Translation
			D3DXMatrixMultiply(&scaleMat, &scaleMat, &rotMat);		// Multiply scale and rotation, store in scale
			D3DXMatrixMultiply(&worldMat, &scaleMat, &transMat);	// Multiply scale and translation, store in world
			m_pEffect->SetMatrix("worldViewProjMat", &(worldMat * m_viewMat * m_projMat));
			D3DXMatrixInverse(&WITMat,0,&worldMat);
			D3DXMatrixTranspose(&WITMat,&WITMat);
			m_pEffect->SetMatrix("worldInverseTransposeMat",&(WITMat));
			m_pEffect->SetMatrix("worldMat", &worldMat);
			m_pEffect->SetFloatArray("ambientMaterial",(float*)&m_Material[1].Ambient, 3);
			m_pEffect->SetFloatArray("diffuseMaterial",(float*)&m_Material[1].Diffuse, 3);
			m_pEffect->SetFloatArray("specularMaterial",(float*)&m_Material[1].Specular, 3);
			m_pEffect->SetFloat("specularPower",m_Material[1].Power);
			m_pEffect->SetTexture("tex",m_pTexture);
			for(int i=0; i < pass; i++)
			{	
				// Begin the pass
				m_pEffect->BeginPass(i);
				m_pEffect->CommitChanges();
				// Draw cube
				m_pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 4 * 6, 0, 12);;
				m_pEffect->EndPass();
			}// Loop Ends
			m_pEffect->End(); // end the effect
			//////////////////////////////////////////////////////////////////////////
			// Pyramid
			//////////////////////////////////////////////////////////////////////////
			
			//////////////////////////////////////////////////////////////////////////
			// Draw 2D sprites
			//////////////////////////////////////////////////////////////////////////
			//////////////////////////////////////////////////////////////////////////
			// Draw Text
			//////////////////////////////////////////////////////////////////////////
			// Calculate RECT structure for text drawing placement, using whole screen
			RECT rect;
			GetWindowRect(m_hWnd, &rect);
			rect.right = rect.right - rect.left;
			rect.bottom = rect.bottom - rect.top;
			rect.left = 0;
			rect.top = 0;
			// Draw Text, using DT_TOP, DT_RIGHT for placement in the top right of the
			// screen. DT_NOCLIP can improve speed of text rendering, but allows text
			// to be drawn outside of the rect specified to draw text in.
			m_pD3DFont->DrawText(0, L"<Orlando Camacho>", -1, &rect, DT_TOP | DT_RIGHT | DT_NOCLIP, D3DCOLOR_ARGB(255, 255, 255, 255));
			// Draw Controls
			m_pD3DFont->DrawText(0, L"Pyramid Controls:\nHold either CTRL key then:\nTranslation - Left Mouse Button\nRotation - Right Mouse Button\nScaling - Middle Mouse Button", -1, &rect, DT_BOTTOM | DT_LEFT | DT_NOCLIP, D3DCOLOR_ARGB(255, 255, 255, 255));
			// Draw FPS & ms
			wchar_t buffer[64];
			swprintf_s(buffer, 64, L"FPS: %d\nMs: %0.2f", m_FPS, m_elapsedTime);
			m_pD3DFont->DrawText(0, buffer, -1, &screenRect, DT_TOP | DT_NOCLIP, D3DCOLOR_ARGB(255, 255, 255, 255));
			// EndScene, and Present the back buffer to the display buffer
			m_pD3DDevice->EndScene();
		}
		m_pD3DDevice->Present(0, 0, 0, 0);
	}
	// Calculate Frames per Second
	m_currTime = (float)timeGetTime();
	static int fpsCounter = 0;
	if(m_currTime - m_prevTime >= 1000.0f)
	{
		m_prevTime = m_currTime;
		m_FPS = fpsCounter;
		fpsCounter = 0;		
	}
	else
	{
		++fpsCounter;
	}
}
void CDirectXFramework::Shutdown()
{
	// Release COM objects in the opposite order they were created in
	// close and release the effect
	SAFE_RELEASE(m_pDIMouse);
	SAFE_RELEASE(m_pDIKeyboard);
	SAFE_RELEASE(m_pDIObject);
	SAFE_RELEASE(m_pD3DFont);
	RemoveFontResourceEx(L"Delicious-Roman.otf", FR_PRIVATE, 0);
	SAFE_RELEASE(m_pTexture);
	SAFE_RELEASE(m_pEffect);
	SAFE_RELEASE(m_pD3DVertexBufferPyramid);
	SAFE_RELEASE(m_pD3DIndexBufferPyramid);
	SAFE_RELEASE(m_pD3DIndexBuffer);
	SAFE_RELEASE(m_pD3DVertexBuffer);
	SAFE_RELEASE(m_pD3DVertexDecl);
	SAFE_RELEASE(m_pD3DDevice);
	SAFE_RELEASE(m_pD3DObject);
}
I received these Errors can anyone assist me please:
c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.h(162): error C2040: 'CDirectXFramework::m_Material' : 'D3DMATERIAL9 [2]' differs in levels of indirection from 'D3DMATERIAL9'
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(33): error C2065: 'm_pyramidScaling' : undeclared identifier
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(400): error C2664: 'IDirect3DDevice9::CreateIndexBuffer' : cannot convert parameter 5 from 'IDirect3DVertexBuffer9 **' to 'IDirect3DIndexBuffer9 **'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(526): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(528): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(528): error C2228: left of '.Ambient' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(529): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(529): error C2228: left of '.Diffuse' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(530): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(530): error C2228: left of '.Emissive' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(531): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(531): error C2228: left of '.Specular' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(532): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(532): error C2228: left of '.Power' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(534): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(534): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(536): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(536): error C2228: left of '.Ambient' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(537): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(537): error C2228: left of '.Diffuse' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(538): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(538): error C2228: left of '.Emissive' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(539): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(539): error C2228: left of '.Specular' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(540): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(540): error C2228: left of '.Power' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(543): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(543): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(545): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(545): error C2228: left of '.Ambient' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(546): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(546): error C2228: left of '.Diffuse' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(547): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(547): error C2228: left of '.Emissive' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(548): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(548): error C2228: left of '.Specular' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(549): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(549): error C2228: left of '.Power' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(555): error C2664: 'D3DXCreateTextureFromFileW' : cannot convert parameter 3 from 'IDirect3DTexture9 *' to 'LPDIRECT3DTEXTURE9 *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(561): error C2664: 'D3DXCreateTextureFromFileW' : cannot convert parameter 3 from 'IDirect3DTexture9 *' to 'LPDIRECT3DTEXTURE9 *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(567): error C2664: 'D3DXCreateTextureFromFileW' : cannot convert parameter 3 from 'IDirect3DTexture9 *' to 'LPDIRECT3DTEXTURE9 *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(718): warning C4390: ';' : empty controlled statement found; is this the intent?
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(737): error C2065: 'm_pyramidScaling' : undeclared identifier
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(738): error C2065: 'm_pyramidScaling' : undeclared identifier
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(802): warning C4018: '<' : signed/unsigned mismatch
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(811): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(811): error C2228: left of '.Ambient' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(812): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(812): error C2228: left of '.Diffuse' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(813): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(813): error C2228: left of '.Specular' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(814): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(814): error C2228: left of '.Power' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(854): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(854): error C2228: left of '.Ambient' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(855): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(855): error C2228: left of '.Diffuse' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(856): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(856): error C2228: left of '.Specular' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(857): error C2088: '[' : illegal for struct
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(857): error C2228: left of '.Power' must have class/struct/union
1>c:\users\generalcamacho\documents\visual studio 2010\projects\gspweek4assignment\gspweek4assigment\directxframework.cpp(860): warning C4018: '<' : signed/unsigned mismatch
This isn't really a Game Programming problem, this is language syntax. Specifically you're mixing structs, classes and arrays. I suggest you add this to one of the more active programming topics, I have asked a moderator to help with this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.