Table of Contents
The goal of this project is to implement a program for viewing 3D models in wireframe form (3D Viewer) in the C++ programming language. The models themselves are loaded from .obj files, which makes it possible to view them on the screen with the ability to rotate, scale and move.
- The program is developed in the
C++
standard language using thegcc
compiler. Additional libraries andQt
modules are used; - The program code is located in the
src
folder; - The program and test build is configured using
CMake
, which is launched usingMakefile
with a standard set of targets for a GNU program:all
,install
,uninstall
,clean
,dvi
,dist
,tests
. Installation is carried out in thebin
folder in the repository root; - The program is developed in accordance with the principles of object-oriented programming. The following development patterns are used:
Facade
,Singleton
,Strategy
,MVC
; - The code is written in accordance with
Google Style
; - The modules related to model loading and affine transformations are covered by
unit
tests; - The program displays only one model on the screen at a time;
- The program allows you to:
- Load a wireframe model from an
obj
file (supports only a list of vertices and surfaces); - Move the model a given distance relative to the
X
,Y
,Z
axes; - Rotate the model a given angle relative to its
X
,Y
,Z
axes; - Scale the model by a given value;
- Perform affine transformations using the processor/video memory;
- Set up the projection type (parallel and central);
- Set up the edge type (none, solid, dotted), color and thickness;
- Set up the vertex type (none, circle, square), color and size;
- Choose a background color;
- Save the resulting ("rendered") images to a file in the
bmp
andjpeg
formats; - Record small "screencasts" - current user affine transformations of the loaded object into
gif
-animation (640x480, 10fps
, 5s);
- Load a wireframe model from an
- The program has a graphical user interface based on the GUI libraries
Qt
withAPI
forC++
. - The graphical user interface contains:
- A button for selecting a file with a model and a field for entering/outputting its name;
- A button for switching the affine transformation method (processor/video card);
- A button for switching the projection;
- Buttons for selecting the type, color and thickness of edges;
- Buttons for selecting the type, color and size of vertices;
- A button for selecting a background;
- Buttons for saving an image and a screencast;
- A wireframe model visualization area;
- Sliders and input fields for moving the model;
- Sliders and input fields for rotating the model;
- Slider and input field for scaling the model;
- Information about the loaded model - file name, number of vertices and edges.
- Settings are saved between program restarts;
- Implementation class inside the
s21
namespace;
To get a local copy and run it, follow these steps.
-
CMake
sudo apt install cmake
-
Qt
sudo apt install qt6-base-dev
-
OpenGL
sudo apt-get install build-essential libgl1-mesa-dev
- Install the required software (if missing)
- Clone the repository
git clone [email protected]:emmonbear/3DViewer.git
- Run the installation program
make install
- Run the program manually (
3DViewer/bin/viewer
) or enter the commandmake run
Distributed under the MIT License. See LICENSE.txt
for more information.
Pervin Gabilov - Telegram / e-mail