One property of a PLY element.
A property is either a scalar (property float x) or a
variable-length list (property list uchar int vertex_indices),
where the count is stored inline before the values.
Property names are kept as strings. They come from the file and are arbitrary, so converting them to atoms would let an untrusted file exhaust the VM's atom table.
Summary
Types
Either a scalar type, or {:list, count_type, value_type} for a
variable-length list.
Functions
Builds a list property.
Whether this property is a variable-length list.
Builds a scalar property.
Renders the property as a PLY header line (without a trailing newline).
Byte width of a scalar property, or :variable for a list.
Types
@type kind() :: Ply.Types.t() | {:list, Ply.Types.t(), Ply.Types.t()}
Either a scalar type, or {:list, count_type, value_type} for a
variable-length list.
Functions
@spec list(String.t(), Ply.Types.t(), Ply.Types.t()) :: t()
Builds a list property.
iex> Ply.Property.list("vertex_indices", :uint8, :int32)
%Ply.Property{name: "vertex_indices", type: {:list, :uint8, :int32}}
Whether this property is a variable-length list.
iex> Ply.Property.list?(Ply.Property.scalar("x", :float32))
false
@spec scalar(String.t(), Ply.Types.t()) :: t()
Builds a scalar property.
iex> Ply.Property.scalar("x", :float32)
%Ply.Property{name: "x", type: :float32}
Renders the property as a PLY header line (without a trailing newline).
@spec width(t()) :: pos_integer() | :variable
Byte width of a scalar property, or :variable for a list.
iex> Ply.Property.width(Ply.Property.scalar("x", :float32))
4