void ForwardPositonalLightShader::update_properties( const Mat4& trans, const RenderEngine& engine) const { //TODO remove global camera. // auto mvp = set_uniform_matrix4("transformation_mat", trans); // set_uniform_matrix4("camera_mat", engine.get_global_camera()->get_camera_mat()); // set_uniform_matrix4("projection_mat", engine.get_global_camera()->get_projection_mat()); set_uniform_matrix4("camera_mat", Locator::get_game().get_camera()->get_camera_mat()); set_uniform_matrix4("projection_mat", Locator::get_game().get_camera()->get_projection_mat()); set_uniform_matrix3("normal_mat", trans.get_mat3().inverse().transpose()); set_light("positional_light.light", engine.get_active_light()); set_pos_light("positional_light",static_cast<const PositionalLight*>(engine.get_active_light()),trans); // //TODO set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos()); set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos()); set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos()); set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos()); // //use the new texture // material.get_texture("diffuse").bind_texture(m_program_id, m_uniform_map["texture_sampler"]); }
void ForwardDirectionalShader::update_properties( const Mat4& trans, const RenderEngine& engine) const { //TOOD use dir //TODO remove global camera. // auto mvp = set_uniform_matrix4("transformation_mat", trans); // set_uniform_matrix4("camera_mat", engine.get_global_camera()->get_camera_mat()); // set_uniform_matrix4("projection_mat", engine.get_global_camera()->get_projection_mat()); set_uniform_matrix4("camera_mat", Locator::get_game().get_camera()->get_camera_mat()); set_uniform_matrix4("projection_mat", Locator::get_game().get_camera()->get_projection_mat()); set_uniform_matrix3("normal_mat", trans.get_mat3().inverse().transpose()); auto dir_light = static_cast<const DirectionalLight*>(engine.get_active_light()); set_light("directional_light.light", engine.get_active_light()); set_uniform3f("directional_light.direction", dir_light->get_dir()); auto& rim_light = dir_light->get_rim_light(); if (rim_light) { set_uniformi("directional_light.rim_light.enable", rim_light->get_status()); set_uniform3f("directional_light.rim_light.color", rim_light->get_rim_color()); set_uniformf("directional_light.rim_light.power", rim_light->get_rim_power()); }else{ set_uniformi("directional_light.rim_light.enable", false); } //TODO // set_uniform3f("camera_pos", engine.get_global_camera()->get_world_pos() ); set_uniform3f("camera_pos", Locator::get_game().get_camera()->get_world_pos() ); // //use the new texture // material.get_texture("diffuse").bind_texture(m_program_id, m_uniform_map["texture_sampler"]); }