Struct ModelPrimitive

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

std::optional<Pose> pose

Origin of model relative to reference frame.

std::optional<Vector3> scale

Scale factor to apply to the model along each axis.

std::optional<Color> color

Solid color to use for the whole model if override_color is true.

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 or data should be provided.

std::string media_type

Media type of embedded model (e.g. model/gltf-binary). Required if data is provided instead of url. Overrides the inferred media type if url is provided.

std::vector<std::byte> data

Embedded model. One of url or data should be provided. If data 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.