coastline 0.0.4
Loading...
Searching...
No Matches
n64model.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstddef>
5#include <cstdint>
6#include <expected>
7#include <span>
8#include <string>
9#include <string_view>
10#include <vector>
11
12#include <nlohmann/json.hpp>
13
14namespace coastline {
15
33
40
54std::expected<GltfModel, std::string> CarModelToGltf(std::span<const std::uint8_t> bytes,
55 std::size_t imageOffset,
56 std::string_view bufferUri);
57
69std::expected<GltfModel, std::string> TrackToGltf(std::span<const std::uint8_t> bytes,
70 std::string_view bufferUri);
71
83std::expected<GltfModel, std::string> FrontEndModelToGltf(std::span<const std::uint8_t> bytes,
84 std::string_view bufferUri);
85
94std::expected<std::vector<std::uint8_t>, std::string>
95ModelFromGltf(const nlohmann::ordered_json &json, std::span<const std::uint8_t> buffer);
96
97} // namespace coastline
Definition assetimport.h:11
std::expected< GltfModel, std::string > CarModelToGltf(std::span< const std::uint8_t > bytes, std::size_t imageOffset, std::string_view bufferUri)
Describe the model of a car as glTF.
std::expected< GltfModel, std::string > FrontEndModelToGltf(std::span< const std::uint8_t > bytes, std::string_view bufferUri)
Describe a model of the front end, such as a logo of the splash screens, as glTF.
std::expected< std::vector< std::uint8_t >, std::string > ModelFromGltf(const nlohmann::ordered_json &json, std::span< const std::uint8_t > buffer)
Build the file of a model or a track from its glTF, the inverse of CarModelToGltf(),...
std::expected< GltfModel, std::string > TrackToGltf(std::span< const std::uint8_t > bytes, std::string_view bufferUri)
Describe a track as glTF.
A texture of a glTF document, as the RDP samples it.
Definition n64model.h:17
std::vector< std::uint8_t > rgba
Definition n64model.h:21
std::vector< std::uint8_t > indices
The 4-bit texels of an image the colour of a car paints, two to a byte with the first in the high fou...
Definition n64model.h:24
std::string uri
Definition n64model.h:18
std::size_t address
The offset of the texels in the image of the model.
Definition n64model.h:31
int width
Definition n64model.h:19
int paintMaterial
The material of the car, a VEHICLE_MATERIAL_ value, whose entry of the palette gives the alpha of the...
Definition n64model.h:29
int height
Definition n64model.h:20
std::vector< std::uint8_t > palette
The 16 colours of the texels of indices, each a big-endian RGBA5551 half.
Definition n64model.h:26
A glTF document, the bytes of its one buffer, and its images.
Definition n64model.h:35
std::vector< std::uint8_t > buffer
Definition n64model.h:37
nlohmann::ordered_json json
Definition n64model.h:36
std::vector< GltfImage > images
Definition n64model.h:38