| 855 | } |
| 856 | |
| 857 | Error LightmapperRD::_store_pfm(RenderingDevice *p_rd, RID p_atlas_tex, int p_index, const Size2i &p_atlas_size, const String &p_name, bool p_shadowmask) { |
| 858 | Vector<uint8_t> data = p_rd->texture_get_data(p_atlas_tex, p_index); |
| 859 | Ref<Image> img = Image::create_from_data(p_atlas_size.width, p_atlas_size.height, false, p_shadowmask ? Image::FORMAT_RGBA8 : Image::FORMAT_RGBAH, data); |
| 860 | img->convert(Image::FORMAT_RGBF); |
| 861 | Vector<uint8_t> data_float = img->get_data(); |
| 862 | |
| 863 | Error err = OK; |
| 864 | Ref<FileAccess> file = FileAccess::open(p_name, FileAccess::WRITE, &err); |
| 865 | ERR_FAIL_COND_V_MSG(err, err, vformat("Can't save PFN at path: '%s'.", p_name)); |
| 866 | file->store_line("PF"); |
| 867 | file->store_line(vformat("%d %d", img->get_width(), img->get_height())); |
| 868 | #ifdef BIG_ENDIAN_ENABLED |
| 869 | file->store_line("1.0"); |
| 870 | #else |
| 871 | file->store_line("-1.0"); |
| 872 | #endif |
| 873 | file->store_buffer(data_float); |
| 874 | file->close(); |
| 875 | |
| 876 | return OK; |
| 877 | } |
| 878 | |
| 879 | Ref<Image> LightmapperRD::_read_pfm(const String &p_name, bool p_shadowmask) { |
| 880 | Error err = OK; |
nothing calls this directly
no test coverage detected