1 #include "mof/DirectionalLight.hpp"
3 #include "mof/GraphicsDevice.hpp"
4 #include "mof/private/GraphicsDeviceImpl.hpp"
7 mof::DirectionalLight::DirectionalLight(mof::Color diffuse , mof::Color ambient , mof::Vector3D& direction)
10 setDiffuseColor(diffuse);
11 setAmbientColor(ambient);
12 setDirection(direction);
17 void mof::DirectionalLight::update(){
18 //mof::Animation* pAnimation = getAnimation();
19 //if(pAnimation == NULL)return;
20 //pAnimation->update();
21 //mof::Color color = pAnimation->get();
22 //set(pAnimation->getColor());
25 void mof::DirectionalLight::reflect(){
26 LPDIRECT3DDEVICE9 pDevice = mof::GraphicsDevice::getRawDevice();
28 ZeroMemory(&light , sizeof(light));
29 light.Type = D3DLIGHT_DIRECTIONAL;
30 light.Diffuse.a = (float)mof::getAlpha(m_diffuse) / 255.0f;
31 light.Diffuse.r = (float)mof::getRed(m_diffuse) / 255.0f;
32 light.Diffuse.g = (float)mof::getGreen(m_diffuse) / 255.0f;
33 light.Diffuse.b = (float)mof::getBlue(m_diffuse) / 255.0f;
35 light.Ambient.a = (float)mof::getAlpha(m_ambient) / 255.0f;
36 light.Ambient.r = (float)mof::getRed(m_ambient) / 255.0f;
37 light.Ambient.g = (float)mof::getGreen(m_ambient) / 255.0f;
38 light.Ambient.b = (float)mof::getBlue(m_ambient) / 255.0f;
40 light.Direction = D3DXVECTOR3(m_direction.x , m_direction.y , m_direction.z);
43 pDevice->SetLight(0 , &light);
44 pDevice->LightEnable(0 , TRUE);