17#include <nlohmann/json.hpp>
168 DecalCar() =
default;
169 bool LoadImagePanels();
172 nlohmann::ordered_json m_images;
177 bool m_imagePanels =
false;
192 return (((y & 1) << 3 ^ x) >> 1) + y * (width >> 1);
u8 * Texels(int material)
DecalTexture Texture(int material) const
std::size_t PixelOffset(int x, int y, int width) const
Locate a packed pixel in linear image layers or console body-panel rows.
const u8 * Mask(int slot) const
bool RestoreEditableData(std::span< const u8 > data)
Restore editable texels and palettes without invalidating texture pointers.
u16 PaletteColor(int material, int entry) const
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::vector< u8 > NoteHeader() const
bool HasMaterial(int material) const
bool ValidNote(std::span< const u8 > note) const
Validate the save header, complete panel payloads, and palette before loading.
std::vector< u8 > PanelPixels(int panel) const
Composite a numbered panel over its imported RGBA pixels.
std::string DecalNote() const
std::optional< GltfDocument > ImageDocument() const
Build the image-override document of WriteImages() in memory, with each image in a buffer view.
static std::optional< DecalCar > Load(const std::filesystem::path &directory)
Reconstruct editable textures from an imported car document and its images.
void SetPaletteColor(int material, int entry, u16 color)
Replace one material palette entry without changing its indexed texels.
std::vector< u8 > CopyEditableData() const
const std::filesystem::path & Directory() const
Definition assetimport.h:11
constexpr int DECAL_SLOTS
The decals of a car, each the texture of the material of the same number.
Definition decalcar.h:25
int TexelOffset(int x, int y, int width)
The byte of a texel of a 4-bit texture as the console loads it in one block, the 64-bit words of each...
Definition decalcar.h:191
constexpr int CAR_MATERIAL_HEADLIGHTS
The material whose palette is the headlights.
Definition decalcar.h:34
constexpr int CAR_MATERIAL_PAINT
The material whose palette is the paint, saved with the decals.
Definition decalcar.h:31
constexpr int CAR_MATERIALS
The materials of a car whose palettes the colour of the car paints.
Definition decalcar.h:28
constexpr int CAR_MATERIAL_REAR_LIGHTS
The material whose palette is the rear lights.
Definition decalcar.h:37
The byte offsets and dimensions of an indexed model texture or numbered paint layer.
Definition decalcar.h:40
std::size_t palette
Definition decalcar.h:42
std::size_t texels
Definition decalcar.h:41
int width
Definition decalcar.h:43
int height
Definition decalcar.h:44
The integer and floating-point types of the console, for headers shared with Windows.
unsigned short u16
Definition ultratypes.h:19
unsigned char u8
Definition ultratypes.h:18