int JRenderServer::AddDirLight( const Vec3& dir, DWORD diffuse, DWORD specular, bool bPerPixel ) { D3DLIGHT8 light; light.Type = D3DLIGHT_DIRECTIONAL ; light.Diffuse = ConvertColor( diffuse ); light.Specular = ConvertColor( specular ); light.Ambient = ConvertColor( 0xFF000000 ); Vec3 ldir( dir.x, dir.y, dir.z ); ldir.normalize(); light.Direction.x = ldir.x; light.Direction.y = ldir.y; light.Direction.z = ldir.z; light.Range = 100.0f; light.Position.x = 0.0f; light.Position.y = 0.0f; light.Position.z = 0.0f; light.Attenuation0 = 0.0f; light.Attenuation1 = 0.0f; light.Attenuation2 = 0.0f; light.Falloff = 0.0f; light.Theta = c_PI; light.Phi = c_PI; IDirect3DDevice8* pDevice = GetDirect3DDevice8(); pDevice->LightEnable( 0, TRUE ); pDevice->SetLight ( 0, &light ); return 0; } // JRenderServer::AddDirLight