This project is a console-based (CLI and TUI) 3D shape generator written in C++. It allows users to create and save a variety of 3D shapes such as:
β Plane | π§ Cube | πΌ Tetrahedron | πΊ Pyramid | π’ Cylinder | π¦ Cone | π΄ Sphere | π· IcoSphere | π© Torus | β¬’ Hexagon
The program dynamically generates the shape based on user input and exports the shape data to a file.
π§ Note: All shapes use the counterclockwise order for listing vertices, which ensures consistency and simplifies rendering in most 3D engines.
πΊ Note: Each shape is constructed using triangles.
π Technologies used:
- GLM (OpenGL Mathematics) for vector operations
- FMT for formatted output
- JSON for exporting in json format
- Catch2 for unit tests
- FTXUI for terminal user interface
- Clip for copying path to clipboard
- β¨ Features
- π¦ Dependencies
- βοΈ How to Build
βΆοΈ Usage- π§Ύ Configuration
- π Troubleshooting
- π¨βπ» Authors
- π License
β Interactive User Input
- Configure shapes through console input.
- Choose from ten different shapes:
- β Plane
- π§ Cube
- πΌ Tetrahedron
- πΊ Pyramid
- π’ Cylinder
- π¦ Cone
- π΄ Sphere
- π· IcoSphere
- π© Torus
- β¬’ Hexagon
β
ESC Key Support: Press ESC anytime to exit the program.
β
File Output: Generated shapes are saved in shape.txt, shape.obj or shape.json for later use.
β
Error Handling: Provides feedback for invalid inputs and applies sensible defaults.
- C++20 or later
- CMake 3.30 or later
- GLM Library (OpenGL Mathematics)
- FMT Library (Formatted console output)
- JSON Library (Exporting in JSON format)
- Catch2 Library (Unit tests)
- FTXUI Library (Terminal user interface)
- Clip Library (Copying to clipboard)
-
Clone the repository:
> git clone https://github.com/Muppetsg2/Shapes-Generator.git > cd Shapes-Generator
-
Open the folder in Visual Studio (supports CMake natively).
-
CMake will configure the project and download dependencies automatically via
CPM.cmake. -
Press
βΆοΈ to build and run the app.
-
Clone the repository:
> git clone https://github.com/Muppetsg2/Shapes-Generator.git > cd Shapes-Generator
-
Install CMake, compiler and libx11 dependency (if not installed):
> sudo apt install cmake g++ ninja-build libx11-dev -
Build the project:
> cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release > cmake --build build
-
Run the app:
> ./build/bin/Shapes-Generator
-
Clone the repository:
> git clone https://github.com/Muppetsg2/Shapes-Generator.git > cd Shapes-Generator
-
Install dependencies (CMake, Ninja, compiler) (if not installed):
> brew install cmake ninja -
Build the project with app bundle:
> cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release > cmake --build build
-
Run the app:
> open build/bin/Shapes-Generator.app
The application supports two modes:
- TUI (Terminal User Interface) β default mode
- CLI (Command Line Interface) β text-based sequential mode
π₯οΈ Note: By default, the program starts in TUI mode.
When launched without any flags, the program starts in TUI mode powered by FTXUI.
How to use:
- Launch the program β A banner and an interactive menu with available shapes will appear.
- (Optional) Edit the configuration file before generating a shape.
- Select a shape by clicking on it or navigating with the keyboard.
- Enter the required shape parameters, if applicable.
- Press the Generate button to start the generation process.
- The shape will be generated.
- Select the file format for saving the shape.
- The file path will be displayed in the console and copied to the clipboard.
- (Optional) The file explorer may open at the saved file location.
- Exit at any time by pressing the ESC key or generate another shape.
Features of TUI mode:
- Interactive navigation
- Structured menu layout
- Keyboard and mouse support
- Ability to change the selected object at any time
To launch the application in CLI mode, use one of the following flags:
-cor
--cliCLI mode provides a classic step-by-step console interaction.
How to use:
- Launch the program with
-cor--cli- ASCII art and a menu will appear. - Select a shape by entering a number (1-10).
- Enter the required shape parameters, if applicable.
- The shape is generated.
- Select the file format for saving.
- The file path will be displayed in the console.
- (Optional) File explorer will pop up with file location.
- Exit anytime by pressing the ESC key.
Features of CLI mode:
- Lightweight sequential input
- Clear text prompts
The application allows you to configure the default output path and filename using the shapes.config file.
Example contents of shapes.config:
generateTangents: true
calculateBitangents: true
tangentHandednessPositive: true
saveDir: C:\my\custom\output\
fileName: my_${TYPE}-%H-%M-%S
openDirOnSave: true- generateTangents: Tells the generator whether to compute and include tangent vectors for each vertex (useful for normal mapping and advanced shading).
If
calculateBitangentsis enabled, bitangent vectors will also be generated for each vertex. - calculateBitangents: Determines whether bitangent vectors should be calculated and included in the saved file.
- tangentHandednessPositive: Defines which handedness convention should be used when calculating bitangents or when saving tangents to the file.
- saveDir: Sets the directory where shape files will be saved. Can be absolute or relative to application directory.
- fileName: Defines the pattern for the output file name. You can use standard time format markers
compatible with the C++ function strftime, as well as a custom placeholder
${TYPE}, which will be replaced with the name of the generated 3D object (e.g.,"Cube","Cone","Sphere"). - openDirOnSave: If enabled, instructs the application to open the system file explorer at the location of the saved file after generation.
| Marker | Description | Example |
|---|---|---|
${TYPE} |
Name of the 3D object being generated | Sphere |
π‘ If the config file is missing or malformed, defaults will be used.
βΉοΈ The path will be different depending on your operating system. Here is an example of the path for Windows
β±οΈ List of all supported time marks you can find here
β Issues? Try this:
- Ensure all dependencies are installed.
- Check console messages for errors.
- Verify you're using C++20 or later.
βΉοΈ If you cannot see or understand the error, open an issue.
π Marceli Antosik (Muppetsg2)
This project is open-source under the MIT License.
π MIT License Overview:
- β Free to use, modify, and distribute.
- β Can be used in commercial and non-commercial projects.
- β Must include original license and copyright.
See the LICENSE file for details.

