Skip to content

Commit

Permalink
Updated README file.
Browse files Browse the repository at this point in the history
  • Loading branch information
seigtm committed Jun 7, 2022
1 parent 01e50e6 commit cef445b
Show file tree
Hide file tree
Showing 14 changed files with 185 additions and 146 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"regex": "cpp",
"shared_mutex": "cpp",
"stack": "cpp",
"unordered_set": "cpp"
"unordered_set": "cpp",
"string_view": "cpp"
}
}
292 changes: 147 additions & 145 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,135 @@

**‼️ Note**: this project is currently under development.

**Minimalistic Easy Object Viewer**: lightweight and easy-to-use 3D object viewer.
**Minimalistic Easy Object Viewer**: fast, lightweight, powerful and easy-to-use 3D object viewer.

## Reason

Most of the services and programs for viewing 3D objects occupy a lot of space on the drive, piled with a lot of functionality, not required for a simple model viewer, are inconvenient or even paid.

The main goal of this project is to design, create and release a universal application for viewing 3D models, which does not take up a lot of disk space and supports a large number of model formats.

## Requirements

At this stage of development, the software product has been tested on the operating systems of the `Microsoft Windows` family and functions correctly.
There was no testing on `Linux`, but it is a goal for the foreseeable future.

The application will require the latest version of the `Microsoft Visual C++ Redistributable` to be installed on the computer.

## Usage

To change the direction of view you need to `hold the computer mouse wheel`.

Movement on the scene is done using the `WASDQE` keys.

To open your own model files you need to put them in the «`assets`» directory. Change the `model component` of the «`Test object`» and it will be ready to go!

![Kurumi :3](./pics/kurumi.png)

## Scope

Any spheres connected with the use of 3D models:

- modeling and design;
- computer graphics;
- development of game applications;
- research and development;
- biological and scientific modeling;
- architectural/construction modeling;
- education;
- cinematography;
- animation;
- advertising agencies and many others.

## Languages

- The main program code of the application is implemented with `C++`;
- shaders - `GLSL`;
- automated build - `CMake Language`.

## Logs

The program generates logs containing records in chronological order about all important status changes, certain user and application actions, in the embedded widget, in the file and in the terminal window.

## Dependencies

External dependencies are connected to the project using the `Git submodules`.

The project is stand-alone application that does not need any dependencies to install and use it (except `Microsoft Visual C++ Redistributable`).

All necessary libraries are linked `statically`.

## Components

- `transform component` sets object on stage and their scale;
- `move component` adds ability to change position of object by pressing keyboard key;
- `camera component` creates an observer on the stage. You can configure its:
- `sensitivity`;
- `zoom`;
- `near` and `far`;
- `pitch`;
- `view matrix`;
- `projection matrix`.
- `skybox component` sets the object photorealistic textures of the sky, informs about the name and status of the texture, and allows you to reboot the mesh of the object;
- `model component` adds model to object, informs about the name and path to model file, displays all its meshes and their textures, and allows you to replace the model using the file selection dialog box;
- `shader component` adds the ability of the object to have its own vertex and geometric shaders, allows them to be turned on and off if necessary, and informs about the status of their functioning;
- `directional light`, `spot light` and `point light` components make the object an appropriate source of lighting on the stage and allows you to adjust all the necessary parameters depending on its type.

## Classes

`Core` is the fundamental class within the project. This class is used for the main cycle (the "Game Loop" design pattern). This entity is responsible for updating all objects and their components by using the the "Update Method" design pattern. On each frame, the application updates all objects from this collection. Together with the update of individual blocks, the main loop monitors input data from the user and operating system.

The basic components of the application are initialized and de-initialized using the class `Initializer`.

![Core and Initializer classes](./pics/core.png)

The entity of the `scene` in the application source code is represented as configurable object `components`. For the design and creation of `components` the «Component» pattern is used. Configuration is possible by inheritance between the `Holder` and `Object` classes. `Holder` provides a mechanism for creating, removing, and accessing `components` that determine the behavior of an object.

![Objects container in the Scene class](./pics/objects_on_scene.png)

Each component implements the methods it needs and adds new features.

![Components](./pics/component.png)

To obtain resources, the `Loader` class and its specific implementation for Assimp (`AssimpLoader`) are used. The `Loader` object provides methods for loading resources to the program by the given path.

![Resources](./pics/resource.png)

The `Manager` class is a resource manager that is implemented using the singleton application design pattern.

![Resource manager](./pics/manager.png)

The project also has an event manager, divided into two static classes - a mouse manager (`MouseManager`) and a keyboard manager (`KeyboardManager`).

![KeyboardManager](./pics/keyboard_manager.png)

![MouseManager](./pics/mouse_manager.png)

The `FrameBuffer` class is a set of buffers used as a destination for rendering.

![FrameBuffer](./pics/framebuffer.png)

The `Graphics` class encapsulates and implements graphical content, providing unified access to GPU resources.

![Graphics](./pics/graphics.png)

The `Base` class is a basic window interface from which classes that implement a specific interface are inherited.

## Widgets

- `Scene` on which the objects of the model, light sources and skybox are located;
- `Scene tree` is a widget that displays all objects on the stage and allows you to click on the objects to open their properties in a separate widget;
- `Properties` contains the components of the objects selected in the tree;
- `Git information` provides information about the current version of Git commit (hash, message, and commit date);
- `Logger` displays real-time records about important changes in the state of the application, successful or unsuccessful loading of models, textures, shaders, critical application errors and others.

All widgets use `docking` technology, allowing them to attach to each other and to the main graphical window of the application in any order and location.

![](./pics/windows.png)

## **Diagrams:**

### `Named`, `Virtual` and `Component` classes diagram:
### Object components system:

```mermaid
classDiagram
Expand All @@ -20,6 +144,9 @@ Component "1" o..> "1" Holder : contains
Component <|-- TransformComponent
Component <|-- ModelComponent
Component <|-- LightingComponent
Component <|-- MoveComponent
Component <|-- ShaderComponent
Component <|-- SkyboxComponent
class Named {
-string mName
Expand All @@ -34,15 +161,22 @@ class Component {
# weak_ptr~Holder~ mHolder
+Component(string&& name) ctor
+Draw()* void
+Update(double)* void
+PreDraw(Graphics& g)* void
+Draw(Graphics& g)* void
+PostDraw(Graphics& g)* void
+PreUpdate(double delta)* void
+Update(double delta)* void
+PostUpdate(double delta)* void
+Serialize()* void
+SetHolder(weak_ptr~Holder~&& holder) void
}
class TransformComponent
class ModelComponent
class LightingComponent
class MoveComponent
class ShaderComponent
class SkyboxComponent
class Holder {
-GetTypeName()$ string
Expand All @@ -56,151 +190,19 @@ class Holder {
class Object {
<<virtual>>
-bool mEnabled
+Object(string&& name) ctor
+PreDraw(Graphics& g)* void
+Draw(Graphics& g)* void
+PostDraw(Graphics& g)* void
+PreUpdate(double delta)* void
+Update(double delta)* void
+PostUpdate(double delta)* void
+Serialize()* void
+Enabled() bool
+Enable() void
+Disable() void
}
```

### (OLD) Main scene things diagram:

```mermaid
classDiagram
direction LR
class Core {
+run() int
}
class SceneManager {
+make(Window*, string path)
}
class Scene {
+draw(Graphics *) void
+update(float delta) void
}
class Node {
+draw(Graphics *)* void
+update(float delta)* void
+getName() string
+getProperty(string) Property
+getChildren() vector~Node~
+getChild(string name) Node
}
class Property
class Window
class Graphics {
-mGlobalTransform matrix
-mTransformQueue queue~matrix~
-mColorQueue queue~color~
+pushTransform(const matrix &transform) void
+popTransform() void
+pushColor(const Color &clr) void
+popColor()
+draw(const Model &model) void
+draw(const Mesh &model) void
+draw(const Texture &model) void
}
class Vertex {
+position vec4
+color vec4
+texturePosition vec2
+tangent vec3
+bitAgent vec3
}
class Shader {
}
class Texture
class Mesh
class Model
class Sprite
class Camera
class ResourceManager
Model o--> Mesh
Model o--> Texture
Model o--> Shader
Mesh o--> "0..*" Vertex
Property <|-- Model
Property <|-- Transform
Property <|-- Color
Node o--> "2..*" Property
Camera --|> Node
Scene --|> Node
SceneManager o--> "1..*" Scene
Core o--> SceneManager
Core o--> Window
Core o--> Graphics
```

## (Not implemented) JSON configuration file example:

```json
[
{
"name": "MainCamera",
"type": "camera",
"properties": {
"transform": {
"position": {
"x": 0,
"y": 0,
"z": 0
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0,
"y": 0,
"z": 0
}
}
}
},
{
"name": "Model",
"type": "node",
"properties": {
"transform": {
"position": {
"x": 0,
"y": 0,
"z": -10
},
"rotation": {
"x": 0,
"y": 0,
"z": 0
},
"scale": {
"x": 0,
"y": 0,
"z": 0
}
},
"model": {
"path": "path/to/object.obj"
}
}
}
]
```
3 changes: 3 additions & 0 deletions pics/component.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/core.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/framebuffer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/graphics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/keyboard_manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/kurumi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/loaders.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/mouse_manager.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/objects_on_scene.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/resource.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions pics/windows.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cef445b

Please sign in to comment.