# MxEngine
**Repository Path**: simbazhang/MxEngine
## Basic Information
- **Project Name**: MxEngine
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: BSD-3-Clause
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-10-16
- **Last Updated**: 2022-12-06
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# MxEngine

[](https://travis-ci.org/asc-community/MxEngine)
[](https://ci.appveyor.com/project/MomoDeve/mxengine/branch/master)

[](https://trello.com/b/lfPsihUY/mxengine)
[](https://discord.gg/YWJEX7a)
MxEngine is an educational modern-C++ general-purpose 3D game engine.
Right now MxEngine is developed only by me, [#Momo](https://github.com/MomoDeve), but any contributions are welcome and will be reviewed.
Fow now MxEngine supports OpenGL as graphic API and targets x64 only. I develop the project in my free time, so updates may be not so frequent!
***Note:** MxEngine is currently being ported to new Vulkan rendering backend. Development progress of the rendering library can be found here: [VulkanAbstractionLayer](https://github.com/asc-community/VulkanAbstractionLayer)*
## Versions & Releases
MxEngine releases come with versions in format X.Y.Z where X stands for major release, Y for minor release and Z for bug fixes or non-significant changes.
Major releases are prone to breakage of already existing API and functional but bring a lot new features to the engine. Usually it is possible to rewrite all code using new API and retain former behaviour.
Minor releases may change API or add new features but usually user code can be easily adapted to them. With this releases also come some new MxEngine user libraries (for example new bindings or non-required components)
Bug fixes & improvements are just fixes to already existing code to reestablish initially planned behaviour. This fixes may also be merged into major or minor releases if they come in the same time.
For full version list see [versions.md](versions.md) file
## Installing and running MxEngine
#### As a developer (if you want to contribute or check samples)
Right now MxEngine is distributed in source code with configurable CMake files. Here are the steps you need to do to compile and run MxEngine sample projects:
1. clone this repo to your system using `git clone --recurse-submodules https://github.com/asc-community/MxEngine`
2. build project by running `CMakeLists.txt` located in root directory (set up the environment if needed)
3. select one of executables from samples folder and run it to check if everything was built successfully
4. to create your own project, consider taking ProjectTemplate sample as starting point, it has everything already configured for build
#### As a user (if you want to develop your own application)
To develop your own applications using MxEngine you can use template project with already setup dependencies:
[MxEngineTemplate](https://github.com/MomoDeve/MxEngineTemplate) (make sure it contains up-to-date version of the engine)
## Feature list
Rendering features
- Deferred Physically Based Rendering (Cook-Torrance GGX)
- Screen Space Reflection, Screen Space Ambient Occlusion, Screen Space Global Illumination
- Cascade shadow maps, omnidirectional shadow maps, spot projection maps
- directional, point and spot dynamic lights
- Adaptive tone mapping, FXAA, fog, bloom effect
- Particle System based on compute shaders
- 2D debug utilities: light, sound, object bounds, lines, rectangles and etc.
Physics features
- Rigid body dynamics: static, dynamic and kinematic bodies
- Collision detection with triggers and callbacks
- Raycasting with object type filtering
Audio features
- 3D sounds with distance attenuation
- Support of popular audio formats: .mp3, .ogg, .wav, .flac
Programmable API
- Entity Component System (20+ different components)
- Safe to use handle system (RAII or by managable object pools)
- 50+ supported objects formats via Assimp library (with automatic normal & tangent generation)
- Event system with ability to add your own event types
- Logging, image & cubemap loading, json reading, UUID, random generators and more
Scripting & runtime editing
- Runtime C++ code compilation via dynamically load libraries
- Runtime GLSL shader editing (both engines and your own)
- ImGui editor with multiple draggable windows (docking)
- Load/save file dialog, texture viewer, mesh, material & component editors
- One-click scene loading/saving, generic serializer for all components and resources
## Code snippets
### Primitive creation
You can easily create spheres, planes, cylinders and etc. Custom number of vertecies for displacement maps are supported out of box
```cs
auto cube = MxObject::Create();
cube->AddComponent(Primitives::CreateCube());
cube->AddComponent();
```
### Loading object from file
MxEngine is using Assimp library which can load any popular object format. To load materials simply pass same path to object file
```cs
auto object = MxObject::Create();
object->AddComponent(AssetManager::LoadMesh("objects/your_object.obj"));
object->AddComponent(AssetManager::LoadMaterials("objects/your_object.obj"));
```
### Creating lights
Dynamic directional lights, spot lights and point lights are supported. Each has a similar interface and is created in a uniform way
```cs
auto object = MxObject::Create();
auto light = object->AddComponent();
light->SetColor(Vector3(1.0f, 0.7f, 0.0f));
light->SetIntensity(100.0f);
light->SetAmbientIntensity(0.3f);
light->SetOuterAngle(45.0f);
```
### Using scripts for runtime code compilation
by creating a seperate file with special macro definition you are able to add scripts to objects and
then edit them in runtime - the scripts will be recompiled automatically:
```cs
#include
using namespace MxEngine
class YourScript : public Scriptable
{
public:
virtual void OnCreate(MxObject& self) override { }
virtual void OnReload(MxObject& self) override { }
virtual void OnUpdate(MxObject& self) override { }
};
MXENGINE_RUNTIME_EDITOR(YourScript);
```
```cs
// you can add it as a component by name:
auto object = MxObject::Create();
object->AddComponent