Struct ModelPrimitive¶
Defined in File schemas.hpp
Struct Documentation¶
-
struct ModelPrimitive¶
A primitive representing a 3D model file loaded from an external URL or embedded data.
Public Functions
-
FoxgloveError encode(uint8_t *ptr, size_t len, size_t *encoded_len)¶
Encoded the ModelPrimitive as protobuf to the provided buffer.
On success, writes the serialized length to *encoded_len. If the provided buffer has insufficient capacity, writes the required capacity to *encoded_len and returns FoxgloveError::BufferTooShort. If the message cannot be encoded, writes the reason to stderr and returns FoxgloveError::EncodeError.
- Parameters:
ptr – the destination buffer. must point to at least len valid bytes.
len – the length of the destination buffer.
encoded_len – where the serialized length or required capacity will be written to.
Public Members
-
bool override_color = false¶
Whether to use the color specified in
color
instead of any materials embedded in the original model.
-
std::string url¶
URL pointing to model file. One of
url
ordata
should be provided.
-
std::string media_type¶
Media type of embedded model (e.g.
model/gltf-binary
). Required ifdata
is provided instead ofurl
. Overrides the inferred media type ifurl
is provided.
-
std::vector<std::byte> data¶
Embedded model. One of
url
ordata
should be provided. Ifdata
is provided,media_type
must be set to indicate the type of the data.
Public Static Functions
-
static Schema schema()¶
Get the ModelPrimitive schema.
The schema data returned is statically allocated.
-
FoxgloveError encode(uint8_t *ptr, size_t len, size_t *encoded_len)¶