The engine consists of the following logical modules:
- Core module is the collection of libraries and platform utilities that provide all the key functionality. The module contains the following projects:
- Primitives (Graphics/Primitives) contains definitions of basic types (Int32, Int16, Uint32, etc.) and interfaces (IObject, IReferenceCounters, etc.)
- Common (Graphics/Common) implements common functionality such as file wrapper, logging, debug utilities, etc.
- GraphicsAccessories (Graphics/GraphicsAccessories) contains basic graphics accessories used by all implementations
- GraphicsEngine (Graphics/GraphicsEngine) provides platform-independent base functionality
- GraphicsEngineD3DBase (Graphics/GraphicsEngineD3DBase) provides base functionality for D3D11/D3D12 implementations
- GraphicsEngineD3D11 (Graphics/GraphicsEngineD3D11) is the engine implementation with Direct3D11
- GraphicsEngineD3D12 (Graphics/GraphicsEngineD3D12) is the engine implementation with Direct3D12
- GraphicsEngineOpenGL (Graphics/GraphicsEngineOpenGL) is the engine implementation with OpenGL/OpenGLES
- GraphicsTools (Graphics/GraphicsTools) provides graphics utilities build on top of core interfaces (definitions of commonly used states, texture uploaders, etc.)
- BasicPlatform (Platforms/BasicPlatform) defines interface for platform-specific routines and implements some common functionality
- AndroidPlatform (Platforms/Android) implements platform-specific routines on Android
- Win32Platform (Platforms/Win32) implements platform-specific routines on Win32 desktop
- UniversalWindowsPlatform (Platforms/UWP) implements platform-specific routines on Universal Windows Platform
- LinuxPlatform (Platforms/Linux) implementation of platform-specific routines on Linux platform
- ApplePlatform (Platforms/Apple) implementation of platform-specific routines on Apple platforms (MacOS, iOS)
- Tools module implements additional utilities on top of the core library:
- RenderScript is the simple Lua-based script that facilitates graphics object creation and management.
- TextureLoader provides texture and image loading routines.
- Samples module contains simple applications that demonstrate the usage of the engine:
- Master repository also contains the following projects:
The modules also contain the following 3rd party libraries and components (located in the External subdirectory):
- Core module:
- Tools module:
- libjpeg is a library for loading and writing jpeg files (project homepage)
- LibPng is a library for loading and writing png files (project homepage)
- LibTiff is a library for loading and writing tiff files (project homepage)
- zlib is a free losless data compression library (project homepage)
- Lua is an embedded scripting language (project homepage)
- Samples module:
Downloading the Engine
The engine source code is hosted on GitHub (https://github.com/diligentgraphics). Every module is kept in its own repository:
- Core: https://github.com/DiligentGraphics/DiligentCore
- Tools: https://github.com/DiligentGraphics/DiligentTools
- Samples: https://github.com/DiligentGraphics/DiligentSamples
Every module can be downloaded independently. Alternatively, there is a master repository that includes all three as submodules: https://github.com/DiligentGraphics/DiligentEngine.
Building the Engine
To generate build files for Windows desktop platform, use either CMake GUI or command line tool. For example, to generate Visual Studio 2017 64-bit solution and project files in cmk_build/Win64 folder, navigate to the engine’s root folder and run the following command:
cmake -H. -B./cmk_build/Win64 -G “Visual Studio 15 2017 Win64”
WARNING! In current implementation, full path to cmake build folder must not contain white spaces.
Open DiligentEngine.sln file in cmk_build folder, select the desired configuration and build the engine. By default, Asteroids demo will be set up as startup project.
Universal Windows Platform
To generate build files for Universal Windows platform, you need to define the following two cmake variables:
- CMAKE_SYSTEM_VERSION=<Windows SDK Version>
For example, to generate Visual Studio 2017 64-bit solution and project files in cmk_build/UWP64 folder, run the following command from the engine’s root folder:
cmake -D CMAKE_SYSTEM_NAME=WindowsStore -D CMAKE_SYSTEM_VERSION=10.0.15063.0 -H. -B./cmk_build/UWP64 -G “Visual Studio 15 2017 Win64”
Please make sure that your machine is set up for Android development. Download Android Studio, Android NDK and other required tools. To verify that your environment is properly set up, try building teapots sample.
Open DiligentSamples/Android or UnityPlugin/Android folders with Android Studio to build and run the engine samples and Unity emulator on Android.
Your Linux environment needs to be set up for c++ development. To configure my fresh Ubuntu 17.10, I installed the following packages:
gcc, make and other essential c/c++ tools:
- sudo apt-get update
- sudo apt-get upgrade
- sudo apt-get install build-essential
- sudo apt-get install cmake
Other required packages:
- sudo apt-get install libx11-dev
- sudo apt-get install mesa-common-dev
- sudo apt-get install mesa-utils
- sudo apt-get install libgl-dev
To generate make files for debug configuration, run the following CMake command from the engine’s root folder:
cmake -H. -B./cmk_build/Linux64 -G “Unix Makefiles” -DCMAKE_BUILD_TYPE=”Debug”
To build the engine, run the following command:
cmake –build ./cmk_build/Linux64
After you clone the repo, run the following command from the engine’s root folder to generate XCode project (you need to have CMake installed on the system):
cmake -H. -B./cmk_build/MacOS -G “Xcode”
Run the command below from the engine’s root folder to generate Xcode project configured for iOS build (you need to have CMake installed on your Mac):
cmake -DCMAKE_TOOLCHAIN_FILE=DiligentCore/ios.toolchain.cmake -H. -Bcmk_build/IOS -GXcode
Open Xcode project file in cmk_build/IOS folder and build the engine. To run the applications on an iOS device, you will need to set the appropriate development team in the project settings.