Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert meshconvert tool to use GNU-style long options #173

Merged
merged 5 commits into from
Oct 28, 2024
Merged

Conversation

walbourn
Copy link
Member

Embraces the -so vs. --long-option GNU-like pattern for the command-line tool.

This also adds -o=value which is the GNU standard and the tool already supported -o:value or -o value.

This is a hybrid of the Windows style and GNU-like pattern. For example, you can't combine single-characters together such as -yl with this tool like you can with GNU-style argument syntax. Not all multi-character options use -- which would be the GNU standard.

The tool already supports the -- escape so you can start filenames with / or -

@walbourn walbourn self-assigned this Oct 26, 2024
@walbourn walbourn added the tools Applies to meshconvert label Oct 26, 2024
@walbourn
Copy link
Member Author

walbourn commented Oct 26, 2024

The help output for meshconvert now reads:

Microsoft (R) MeshConvert Command-line Tool [DirectXMesh] Version 166 (library)
Copyright (C) Microsoft Corp.
*** Debug build ***

Usage: meshconvert <options> [--] <files>

   Input file type must be Wavefront Object (.obj)

   -ft <filetype>, --file-type <filetype>  output file type
       sdkmesh:  DirectX SDK .sdkmesh format (default)
       sdkmesh2: sdkmesh format version 2 (PBR materials)
       cmo:      Visual Studio Content Pipeline .cmo format
       vbo:      Vertex Buffer Object (.vbo) format
       obj:      WaveFront Object (.obj) format

   -r                  wildcard filename search is recursive
   -flist <filename>, --file-list <filename>
                       use text file with a list of input files (one per line)

   -n, --normal-by-angle   -na, --normal-by-area   -ne, --normal-by-equal
                                  generate normals weighted by angle/area/equal
   -t, --tangents                 generate tangents
   -tb, --tangent-frame           generate tangents & bi-tangents
   -cw, --clockwise               faces are clockwise (defaults to counter-clockwise)

   -op, --optimize   -oplru, --optimize-lru
                                  vertex cache optimize the mesh (implies -c)
   -c, --clean                    mesh cleaning including vertex dups for attribute sets
   -ta, --topological-adjacency -or- -ga, --geometric-adjacency
                                  generate topological vs. geometric adjacency (def: ta)

   -nodds                         prevents extension renaming in exported materials
   -flip, --flip-face-winding     reverse winding of faces
   --flip-u                       inverts the u texcoords
   --flip-v                       inverts the v texcoords
   --flip-z                       flips the handedness of the positions/normals
   -o <filename>                  output filename
   -l, --to-lowercase             force output filename to lower case
   -y, --overwrite                overwrite existing output file (if any)
   -nologo                        suppress copyright message

       (sdkmesh/sdkmesh2 only)
   -ib32, --index-buffer-32-bit   use 32-bit index buffer
   -fn <normal-format>, --normal-format <normal-format>
                                  format to use for writing normals/tangents/binormals
   -fuv <uv-format>, --uv-format <uv-format>
                                  format to use for texture coordinates
   -fc <color-format>, --color-format <color-format>
                                  format to use for writing colors

   '-- ' is needed if any input filepath starts with the '-' or '/' character

   <normal-format>: float3 float16_4 r11g11b10 

   <uv-format>: float2 float16_2 

   <color-format>: bgra rgba float4 float16_4 rgba_10 r11g11b10 

All the existing older switches are still accepted, but are deprecated per this table:

Old switch New switch
-sdkmesh -ft sdkmesh
--file-type sdkmesh
-sdkmesh2 -ft sdkmesh2
--file-type sdkmesh2
-cmo -ft cmo
--file-type cmo
-vbo -ft vbo
--file-type vbo
-wf -ft obj
--file-type obj
-flipu --flip-u
-flipv --flip-v
-flipz --flip-z

@walbourn
Copy link
Member Author

@walbourn walbourn merged commit bfd0961 into main Oct 28, 2024
77 checks passed
@walbourn walbourn deleted the gnucommandline branch October 28, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Applies to meshconvert
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants