// Author: Juan Carlos De Abreu (jcabreur@gmail.com)
//
//

#ifndef RENDERER_D3D_RENDERER_H__
#define RENDERER_D3D_RENDERER_H__
/*
#include "Renderer.h"
#include "../Util/LogManagement.h"

// include the basic windows header files and the Direct3D header file
#include "C:/Archivos de programa/Aplicaciones/DXSDK/Include/d3d9.h"

// include the Direct3D Library file
//#pragma comment (lib, "C:/Archivos de programa/Aplicaciones/DXSDK/Lib/d3d9.lib")

BEGIN_TEG_NAMESPACE();

// Add to draw a triangle
	static LPDIRECT3DVERTEXBUFFER9 t_buffer;    // the pointer to the vertex buffer
	struct CUSTOMVERTEX {FLOAT X, Y, Z, RHW; DWORD COLOR;};
	#define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)
///

class D3DRenderer : public IRenderer {
	// Attributes
protected:

	// global declarations
	LPDIRECT3D9 d3d;    // the pointer to our Direct3D interface
	LPDIRECT3DDEVICE9 d3ddev;    // the pointer to the device class

	// Constructor
public:

	D3DRenderer(HWND hWnd, bool _bFullscreen = true) {
		
		d3d = Direct3DCreate9(D3D_SDK_VERSION);    // create the Direct3D interface

		D3DPRESENT_PARAMETERS d3dpp;    // create a struct to hold various device information

		ZeroMemory(&d3dpp, sizeof(d3dpp));    // clear out the struct for use
		d3dpp.Windowed = FALSE; //TRUE;    // program windowed, not fullscreen
		d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;    // discard old frames
		d3dpp.hDeviceWindow = hWnd;    // set the window to be used by Direct3D

		// Added to fullscreen functionality
		d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;    // set the back buffer format to 32-bit
		d3dpp.BackBufferWidth = WIDTH_SCREEN;	   // set the width of the buffer
		d3dpp.BackBufferHeight = HEIGHT_SCREEN;    // set the height of the buffer

		// create a device class using this information and the info from the d3dpp stuct
		d3d->CreateDevice(D3DADAPTER_DEFAULT,
						  D3DDEVTYPE_HAL,
						  hWnd,
						  D3DCREATE_SOFTWARE_VERTEXPROCESSING,
						  &d3dpp,
						  &d3ddev);

	// Addded to draw the triangle
		init_graphics();    // call the function to initialize the triangle
	////
	
		return;
	}

	// Destructor
	~D3DRenderer() {
	
	// added to draw the triangle
		t_buffer->Release();    // close and release the vertex buffer
	////
		d3ddev->Release();    // close and release the 3D device
		d3d->Release();    // close and release Direct3D
	}


	// Add to draw a triangle
	// this is the function that puts the 3D models into video RAM
	void init_graphics(void)
	{
		// create the vertices using the CUSTOMVERTEX struct
		CUSTOMVERTEX t_vert[] =
		{
			{ 320.0f, 50.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), },
			{ 520.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), },
			{ 120.0f, 400.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), },
		};

		// create a vertex buffer interface called t_buffer
		d3ddev->CreateVertexBuffer(3*sizeof(CUSTOMVERTEX),
								   0,
								   CUSTOMFVF,
								   D3DPOOL_MANAGED,
								   &t_buffer,
								   NULL);

		VOID* pVoid;    // a void pointer

		// lock t_buffer and load the vertices into it
		t_buffer->Lock(0, 0, (void**)&pVoid, 0);
		memcpy(pVoid, t_vert, sizeof(t_vert));
		t_buffer->Unlock();

		return;
	}


	// Methods
	void render() {
		
		// clear the window to a deep blue
		d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 40, 100), 1.0f, 0);

		d3ddev->BeginScene();    // begins the 3D scene

		// do 3D rendering on the back buffer here
	/// added to draw the triangle
		// select which vertex format we are using
        d3ddev->SetFVF(CUSTOMFVF);

        // select the vertex buffer to display
        d3ddev->SetStreamSource(0, t_buffer, 0, sizeof(CUSTOMVERTEX));

        // copy the vertex buffer to the back buffer
        d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
	//

		d3ddev->EndScene();    // ends the 3D scene

		d3ddev->Present(NULL, NULL, NULL, NULL);   // displays the created frame on the screen
	}

	void resize(int _width, int _height) {
	
	}

	// 
	unsigned long size() {return 0;}

};

//LPDIRECT3DVERTEXBUFFER9 D3DRenderer::t_buffer;

END_TEG_NAMESPACE();
*/
#endif  // RENDERER_D3D_RENDERER_H__
