| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
#pragma once |
| 16 |
#include "../transcoder/basisu_file_headers.h" |
| 17 |
#include "basisu_backend.h" |
| 18 |
|
| 19 |
namespace basisu |
| 20 |
{ |
| 21 |
class basisu_file |
| 22 |
{ |
| 23 |
BASISU_NO_EQUALS_OR_COPY_CONSTRUCT(basisu_file); |
| 24 |
|
| 25 |
public: |
| 26 |
basisu_file() |
| 27 |
{ |
| 28 |
} |
| 29 |
|
| 30 |
void clear() |
| 31 |
{ |
| 32 |
m_comp_data.clear(); |
| 33 |
|
| 34 |
clear_obj(m_header); |
| 35 |
m_images_descs.clear(); |
| 36 |
|
| 37 |
m_header_file_ofs = 0; |
| 38 |
m_slice_descs_file_ofs = 0; |
| 39 |
m_endpoint_cb_file_ofs = 0; |
| 40 |
m_selector_cb_file_ofs = 0; |
| 41 |
m_tables_file_ofs = 0; |
| 42 |
m_first_image_file_ofs = 0; |
| 43 |
m_total_file_size = 0; |
| 44 |
} |
| 45 |
|
| 46 |
bool init(const basisu_backend_output& encoder_output, basist::basis_texture_type tex_type, uint32_t userdata0, uint32_t userdata1, bool y_flipped, uint32_t us_per_frame); |
| 47 |
|
| 48 |
const uint8_vec &get_compressed_data() const { return m_comp_data; } |
| 49 |
|
| 50 |
private: |
| 51 |
basist::basis_file_header m_header; |
| 52 |
basisu::vector<basist::basis_slice_desc> m_images_descs; |
| 53 |
|
| 54 |
uint8_vec m_comp_data; |
| 55 |
|
| 56 |
uint32_t m_header_file_ofs; |
| 57 |
uint32_t m_slice_descs_file_ofs; |
| 58 |
uint32_t m_endpoint_cb_file_ofs; |
| 59 |
uint32_t m_selector_cb_file_ofs; |
| 60 |
uint32_t m_tables_file_ofs; |
| 61 |
uint32_t m_first_image_file_ofs; |
| 62 |
uint32_t m_total_file_size; |
| 63 |
|
| 64 |
void create_header(const basisu_backend_output& encoder_output, basist::basis_texture_type tex_type, uint32_t userdata0, uint32_t userdata1, bool y_flipped, uint32_t us_per_frame); |
| 65 |
bool create_image_descs(const basisu_backend_output& encoder_output); |
| 66 |
void create_comp_data(const basisu_backend_output& encoder_output); |
| 67 |
void fixup_crcs(); |
| 68 |
}; |
| 69 |
|
| 70 |
} |