pub struct Config {Show 17 fields
pub pattern: String,
pub output: PathBuf,
pub quiet: bool,
pub fps: u32,
pub time_step: Option<f32>,
pub reverse: bool,
pub invert_tets: bool,
pub step: u32,
pub colors: AttributeInfo,
pub attributes: AttributeInfo,
pub texcoords: TextureAttributeInfo,
pub textures: Vec<TextureInfo>,
pub materials: Vec<MaterialInfo>,
pub material_attribute: String,
pub insert_vanishing_frames: bool,
pub no_animated_normals: bool,
pub no_animated_tangents: bool,
}
Expand description
Output configuration for the generated glTF.
Fields§
§pattern: String
A glob pattern matching input mesh files.
Use # to match a frame number. If more than one ‘#’ is used, the first match will correspond to the frame number. Note that the glob pattern should generally by provided as a quoted string to prevent the terminal from evaluating it.
Strings within between braces (i.e. ‘{’ and ‘}’) will be used as names for unique animations. This means that a single output can contain multiple animations. If more than one group is specified, the matched strings within will be concatenated to produce a unique name. Note that for the time being, ‘{’ ‘}’ are ignored when the glob pattern is matched.
output: PathBuf
Output glTF file.
quiet: bool
Silence all output.
fps: u32
Frames per second.
1/fps gives the time step between discrete frames. If ‘time_step’ is also provided, this parameter is ignored.
time_step: Option<f32>
Time step in seconds between discrete frames.
Specifying this option overrides the time step that would be computed from ‘fps’, which is set to 24 by default. This means that the default ‘time_step’ is equivalently 1/24.
reverse: bool
Reverse polygon orientations on output meshes.
invert_tets: bool
Invert tetrahedra orientations on input meshes.
step: u32
Step by the given number of frames.
In other words, read frames in increments of ‘step’. Note that this does not affect the value for ‘fps’ or ‘time_step’ options. This number must be at least 1.
For example for frames 1 to 10, a ‘step’ value of 3 will read frames 1, 4, 7, and 10.
colors: AttributeInfo
A dictionary of color attributes and their types.
The dictionary string should have the following pattern:
‘{“color0”:type0(component_type0), “color1”:type1(component_type1), ..}’
The color attribute names should appear exactly how they are named in the input mesh files. On the output, these names will be converted to COLOR_# where # corresponds to the index (starting from 0) in the order they are provided on the command line.
The associated types must have the format ‘type(component)’ where ‘type’ is one of [Vec3, Vec4].
The component type can be one of [U8, U16, F32].
which correspond to ‘GL_UNSIGNED_BYTE’, ‘GL_UNSIGNED_SHORT’, and ‘GL_FLOAT’ respectively.
Note that component type names may be specified in lower case as well.
LIMITATIONS:
See LIMITATIONS section for the ‘–attributes’ flag.
EXAMPLES:
The following is a valid texture coordinate attribute list:
‘{“diffuse”: Vec3(f32), “bump”: Vec3(F32)}’
attributes: AttributeInfo
A dictionary of vertex attributes and their types.
The dictionary string should have the following pattern:
‘{“attribute1”:type1(component1), “attribute2”:type2(component2), ..}’
Use this to specify custom attributes as well as special attributes like normals and tangents, which are expected to be named “N” and “T” respectively. If an input file does not have a specific way to specify these attributes, make sure that they are appropriately named on the input and have single precision floating point component type (f32).
For custom attributes, the attribute names should appear exactly how the attribute is named in the input mesh files. On the output, the attribute names will be converted to SCREAMING_SNAKE case prefixed with an underscore as required by the glTF 2.0 specifications.
For example an attribute named “temperatureKelvin” will be stored as “_TEMPERATURE_KELVIN” in the output. There are no guarantees for collision resolution resulting from this conversion.
The associated types must have the format ‘type(component)’ where ‘type’ is one of [Scalar, Vec2, Vec3, Vec4, Mat2, Mat3, or Mat4].
and ‘component’ is one of [I8, U8, I16, U16, U32, F32].
which correspond to ‘GL_BYTE’, ‘GL_UNSIGNED_BYTE’, ‘GL_SHORT’, ‘GL_UNSIGNED_SHORT’, ‘GL_UNSIGNED_INT’ and ‘GL_FLOAT’ respectively.
Scalar types may be specified without the ‘Scalar(..)’, but with the component type directly as ‘attribute: F32’ instead of ‘attribute: Scalar(F32)’.
If this flag is omitted, then gltfgen looks for normal vertex attributes named “N” by default. This will pick up dedicated normal attributes in formats like ‘vn’ in ‘.obj’ files and NORMALS in ‘.vtk’ files.
Note that type and component names may be specified in all lower case as well.
LIMITATIONS:
Component types are not converted from the input to the output, so it’s important that they are stored in the input files exactly in the types supported by glTF 2.0. This means that double precision float attribute will not be transferred to a single precision float attribute in glTF, but will simply be ignored.
EXAMPLES:
The following is a valid attribute list demonstrating different ways to specify types and component types:
‘{“temperature”:F32, “force”:Vec3(F32), “material”:Scalar(u32)}’
texcoords: TextureAttributeInfo
A dictionary of texture coordinate attributes and their types.
The dictionary string should have the following pattern:
‘{“texcoord0”:component_type1, “texcoord1”:component_type2, ..}’
The texture coordinate attribute names should appear exactly how they are named in the input mesh files. On the output, these names will be converted to TEXCOORD_# where # corresponds to the index (starting from 0) in the order they are provided on the command line.
The component type can be one of [U8, U16, F32].
which correspond to ‘GL_UNSIGNED_BYTE’, ‘GL_UNSIGNED_SHORT’, and ‘GL_FLOAT’ respectively.
If this flag is omitted, then gltfgen looks for texture attributes named “uv” by default. This will pick up dedicated texture attributes in formats like ‘vt’ in ‘.obj’ files and TEXTURE_COORDINATES in ‘.vtk’ files.
Note that component type names may be specified in lower case as well.
LIMITATIONS:
See LIMITATIONS section for the ‘–attributes’ flag.
EXAMPLES:
The following is a valid texture coordinate attribute list:
‘{“uv”: f32, “bump”: F32}’
textures: Vec<TextureInfo>
A tuple of texture parameters.
Each struct should have the following pattern:
“( image: Image, [wrap_s: WrappingMode,] [wrap_t: WrappingMode,] [mag_filter: MagFilter,] [min_filter: MinFilter,] ) ..”
where the fields in brackets ‘[]’ are optional. ‘Image’, ‘WrappingMode’, ‘MagFilter’ and ‘MinFilter’ are enums (variants) that take on the following values:
‘Image’ is one of{n} * Auto(path_to_image){n} * Uri(path_to_image){n} * Embed(path_to_image){n}
where ‘path_to_image’ is the path to a ‘png’ or a ‘jpeg’ image which
will be either referenced (‘Uri’) or embedded (‘Embed’) into the gltf
file itself. Images specified ‘Auto’ will be referenced for .gltf
outputs and embedded for .glb
outputs.
The remaining optional fields describe the sampler and can take on the following values:
‘WrappingMode’ is one of [ClampedToEdge, MirroredRepeat, Repeat (default)].
‘MagFilter’ is one of [Nearest, Linear].
‘MinFilter’ is one of [Nearest, Linear, NearestMipmapNearest, LinearMipmapNearest, NearestMipmapLinear, or LinearMipmapLinear].
See the glTF 2.0 specifications for more details https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#texture-data
Note that all options may be specified in snake_case as well.
EXAMPLES:
The following is a valid texture list:
‘(image: Uri(“./texture.png”)) (image: Embed(“./texture2.png”), wrap_s: Repeat wrap_t: mirrored_repeat)’
materials: Vec<MaterialInfo>
A tuple of material properties.
Each struct should have the following pattern:
“(name:String, base_color:[f32; 4], base_texture:(index:u32,texcoord:u32), metallic:f32, roughness:f32) ..”
where ‘f32’ indicates a single precision floating point value, and ‘u32’ a 32 bit unsigned integer. All fields are optional. The type ‘[f32; 4]’ is an array of 4 floats corresponding to red, green, blue and alpha values between 0.0 and 1.0. ‘metallic’ and ‘roughness’ factors are expected to be between 0.0 and 1.0.
‘base_texture’ specifies the texture to be used by the material. ‘index’ specifies the 0-based index of the texture provided by the ‘–textures’ (or ‘-x’) flag. ‘texcoord’ specifies the index of the texture attribute specified by the ‘–texcoords’ (or ‘-u’) flag. ‘base_texture’ is not set by default.
Default values are 0.0 for ‘metallic’, 0.5 for ‘roughness’, and [0.5, 0.5, 0.5, 1.0] for ‘base_color’.
If a texture is specified with the -x or –textures flag in ‘Auto’ mode (default), then gltfgen will create a default binding to each ‘Auto’ image found. Note that the ‘index’ specified in ‘base_texture’ will be in the order the ‘Auto’ images are found, which is unspecified. This means that it is best to place the ‘Auto’ image reference at the end of the list if used.
EXAMPLES:
The following are examples of valid material specifications:
“()”
produces a default material.
‘(name:“material0”, base_color:[0.1, 0.2, 0.3, 1.0], metallic:0.0)’
produces a material named “material0” with the specified base_color and metallic factor.
material_attribute: String
Name of the material attribute on mesh faces or cells.
This is used for determining which materials should be assigned to which meshes.
This attribute must be an integer (at most 64 bit) and must index materials specified by the ‘-m’ or ‘–materials’ flag.
insert_vanishing_frames: bool
Inserts additional frames before and after an animation sequence with all vertex positions at the origin.
This effectively hides meshes before and after each animation sequence, giving the illusion of continuous animation to sequences with varying topology. This depends heavily on glTF viewers implementing framed animation correctly (e.g. this will work in Blender but not in most web viewers).
CAVEATS: When viewing the animation at a higher frame rate than what was originally specified (to gltfgen) the meshes will blend in and out of the origin between frames which have different topologies, which breaks the illusion.
no_animated_normals: bool
Skip animated normals to reduce file size.
Normals are still transferred for the base mesh for each output node if ‘“N”: Vec3(f32)’ is specified in the ‘–attributes’ option.
no_animated_tangents: bool
Skip animated tangents to reduce file size.
Tangents are still transferred for the base mesh for each output node if ‘“T”: Vec3(f32)’ is specified in the ‘–attributes’ option.
Implementations§
Trait Implementations§
source§impl Args for Config
impl Args for Config
source§fn group_id() -> Option<Id>
fn group_id() -> Option<Id>
ArgGroup::id
][crate::ArgGroup::id] for this set of argumentssource§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl FromArgMatches for Config
impl FromArgMatches for Config
source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>
source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches
) -> Result<Self, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches ) -> Result<Self, Error>
source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches ) -> Result<(), Error>
ArgMatches
to self
.source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches ) -> Result<(), Error>
ArgMatches
to self
.source§impl Parser for Config
impl Parser for Config
§fn parse_from<I, T>(itr: I) -> Selfwhere
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn parse_from<I, T>(itr: I) -> Selfwhere I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
§fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
§fn update_from<I, T>(&mut self, itr: I)where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn update_from<I, T>(&mut self, itr: I)where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
§fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>where
I: IntoIterator<Item = T>,
T: Into<OsString> + Clone,
fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Auto Trait Implementations§
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DropBytes for Twhere
T: 'static,
impl<T> DropBytes for Twhere T: 'static,
unsafe fn drop_bytes(bytes: &mut [MaybeUninit<u8>])
§impl<'a, S, I> Get<'a, I> for Swhere
I: GetIndex<'a, S>,
impl<'a, S, I> Get<'a, I> for Swhere I: GetIndex<'a, S>,
type Output = <I as GetIndex<'a, S>>::Output
fn get(&self, idx: I) -> Option<<I as GetIndex<'a, S>>::Output>
§fn at(&self, idx: I) -> Self::Output
fn at(&self, idx: I) -> Self::Output
get
that will panic if the equivalent get
call is None
,
which typically means that the given index is out of bounds. Read more§unsafe fn at_unchecked(&self, idx: I) -> Self::Output
unsafe fn at_unchecked(&self, idx: I) -> Self::Output
§impl<S, I> Isolate<I> for Swhere
I: IsolateIndex<S>,
impl<S, I> Isolate<I> for Swhere I: IsolateIndex<S>,
type Output = <I as IsolateIndex<S>>::Output
§unsafe fn isolate_unchecked(self, idx: I) -> <S as Isolate<I>>::Output
unsafe fn isolate_unchecked(self, idx: I) -> <S as Isolate<I>>::Output
isolate
. Read morefn try_isolate(self, idx: I) -> Option<<S as Isolate<I>>::Output>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.