/***************************************************************/
//
//
//		DirectX	[ materialdx9.cpp ]
//
//											Author	kazuki tanaka
//											Date	2017 6/5
/*---------------------------------------------------------------
■Update : 2017/6/5
			materialdx9.cppの作成

/*---------------------------------------------------------------
	Include File
---------------------------------------------------------------*/

#include "materialdx9.h"

#include "rendererdx9.h"

/*---------------------------------------------------------------
	Macro Difinition
---------------------------------------------------------------*/


/*---------------------------------------------------------------
	Const Number Difinition
---------------------------------------------------------------*/


/*----------------------------------------------------------------
	static member variable Initialize 
----------------------------------------------------------------*/





// MaterialDX9 Constructor
MaterialDX9::MaterialDX9( )
{

	// Menber Clear Process

}

// MaterialDX9 Destructor
MaterialDX9::~MaterialDX9( )
{

	// Do Nothing!!

}

// MaterialDX9 Create Instance 
MaterialDX9* MaterialDX9::Create( void )
{

	// Create Class Instance
	return  new MaterialDX9;

}
		
// Meterial SetMaterial
void MaterialDX9::SetMaterial( void )
{

	// デバイスにマテリアルを設定
	D3DMATERIAL9 mat;
	
	mat.Diffuse.r = diffuse.r;
	mat.Diffuse.g = diffuse.g;
	mat.Diffuse.b = diffuse.b;
	mat.Diffuse.a = diffuse.a;

	mat.Ambient.r  = ambient.r;
	mat.Ambient.g  = ambient.g;
	mat.Ambient.b  = ambient.b;
	mat.Ambient.a  = ambient.a;

	mat.Specular.r = specular.r;
	mat.Specular.g = specular.g;
	mat.Specular.b = specular.b;
	mat.Specular.a = specular.a;

	mat.Emissive.r = emissive.r;
	mat.Emissive.g = emissive.g;
	mat.Emissive.b = emissive.b;
	mat.Emissive.a = emissive.a;

	mat.Power      = power;
	
	GetDevice( ) -> SetMaterial( &mat );


}

// Meterial GetMaterial
void MaterialDX9::GetMaterial( void )
{

	D3DMATERIAL9 mat;

	GetDevice( )->GetMaterial( &mat );

	diffuse.r  = mat.Diffuse.r;		
	diffuse.g  = mat.Diffuse.g;		
	diffuse.b  = mat.Diffuse.b;		
	diffuse.a  = mat.Diffuse.a;		

	ambient.r  = mat.Ambient.r;		
	ambient.g  = mat.Ambient.g;		
	ambient.b  = mat.Ambient.b;		
	ambient.a  = mat.Ambient.a;		

	specular.r = mat.Specular.r;
	specular.g = mat.Specular.g;
	specular.b = mat.Specular.b;
	specular.a = mat.Specular.a;

	emissive.r = mat.Emissive.r;
	emissive.g = mat.Emissive.g;
	emissive.b = mat.Emissive.b;
	emissive.a = mat.Emissive.a;

	power      = mat.Power;


}






