|
coastline 0.0.4
|
Editable console body materials or numbered image layers for an imported car. More...
#include <decalcar.h>
Public Member Functions | |
| DecalTexture | Texture (int material) const |
| bool | HasMaterial (int material) const |
| std::string | DecalNote () const |
| bool | ImagePanels () const |
| int | PanelCount () const |
| std::vector< u8 > | PanelPixels (int panel) const |
| Composite a numbered panel over its imported RGBA pixels. | |
| std::vector< u8 > | NoteHeader () const |
| bool | ValidNote (std::span< const u8 > note) const |
| Validate the save header, complete panel payloads, and palette before loading. | |
| std::size_t | PixelOffset (int x, int y, int width) const |
| Locate a packed pixel in linear image layers or console body-panel rows. | |
| u8 * | Texels (int material) |
| const u8 * | End () const |
| std::vector< u8 > | CopyEditableData () const |
| bool | RestoreEditableData (std::span< const u8 > data) |
| Restore editable texels and palettes without invalidating texture pointers. | |
| const u8 * | Mask (int slot) const |
| u16 | PaletteColor (int material, int entry) const |
| void | SetPaletteColor (int material, int entry, u16 color) |
| Replace one material palette entry without changing its indexed texels. | |
| std::optional< std::filesystem::path > | WriteImages (const std::filesystem::path &directory) const |
| Write painted images and an image-override glTF document in imported image order. | |
| std::optional< GltfDocument > | ImageDocument () const |
| Build the image-override document of WriteImages() in memory, with each image in a buffer view. | |
| const std::filesystem::path & | Directory () const |
Static Public Member Functions | |
| static std::optional< DecalCar > | Load (const std::filesystem::path &directory) |
| Reconstruct editable textures from an imported car document and its images. | |
Editable console body materials or numbered image layers for an imported car.
|
static |
Reconstruct editable textures from an imported car document and its images.
| directory | The directory of the car, with model.gltf or model.glb. |
| nlohmann::json::exception | If editable image metadata has invalid fields or types. |
| DecalTexture coastline::DecalCar::Texture | ( | int | material | ) | const |
| material | The console material or zero-based numbered image-panel index. |
| bool coastline::DecalCar::HasMaterial | ( | int | material | ) | const |
| material | The body material or numbered image-panel index. |
| std::string coastline::DecalCar::DecalNote | ( | ) | const |
| bool coastline::DecalCar::ImagePanels | ( | ) | const |
| int coastline::DecalCar::PanelCount | ( | ) | const |
| std::vector< u8 > coastline::DecalCar::PanelPixels | ( | int | panel | ) | const |
Composite a numbered panel over its imported RGBA pixels.
| panel | The zero-based numbered image-panel index. |
| std::vector< u8 > coastline::DecalCar::NoteHeader | ( | ) | const |
Validate the save header, complete panel payloads, and palette before loading.
| note | The saved note bytes. |
| std::size_t coastline::DecalCar::PixelOffset | ( | int | x, |
| int | y, | ||
| int | width ) const |
Locate a packed pixel in linear image layers or console body-panel rows.
| x | The pixel column within the texture. |
| y | The pixel row within the texture. |
| width | The texture width, in pixels. |
| u8 * coastline::DecalCar::Texels | ( | int | material | ) |
| material | The console material or zero-based numbered image-panel index. |
| const u8 * coastline::DecalCar::End | ( | ) | const |
| std::vector< u8 > coastline::DecalCar::CopyEditableData | ( | ) | const |
Restore editable texels and palettes without invalidating texture pointers.
| data | A snapshot from CopyEditableData() for this car. |
| const u8 * coastline::DecalCar::Mask | ( | int | slot | ) | const |
| slot | The console decal, from 0 to DECAL_SLOTS - 1. |
| u16 coastline::DecalCar::PaletteColor | ( | int | material, |
| int | entry ) const |
| material | The console material or zero-based numbered image-panel index. |
| entry | The colour, from 0 to 15. |
| void coastline::DecalCar::SetPaletteColor | ( | int | material, |
| int | entry, | ||
| u16 | color ) |
Replace one material palette entry without changing its indexed texels.
Absent materials and invalid entries are ignored. Numbered panels share one palette.
| material | The console material or zero-based numbered image-panel index. |
| entry | The colour, from 0 to 15. |
| color | The RGBA5551 colour. |
| std::optional< std::filesystem::path > coastline::DecalCar::WriteImages | ( | const std::filesystem::path & | directory | ) | const |
Write painted images and an image-override glTF document in imported image order.
Unpainted console images retain their original encoded bytes. Errors from the final document write are not checked.
| directory | The directory to write the document and the images to. |
| std::optional< GltfDocument > coastline::DecalCar::ImageDocument | ( | ) | const |
Build the image-override document of WriteImages() in memory, with each image in a buffer view.
| const std::filesystem::path & coastline::DecalCar::Directory | ( | ) | const |