Getting Started

Engine Structure

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:
    • 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 basic graphics utilities
    • 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
    • Common (Common) implements some common functionality such as file wrapper, debug utilities etc.
  • 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:
    • SampleBase provides base functionality for all samples
    • AntTweakBarSample demonstrates the usage of AntTweakBar library to create simple user interface
    • AtmosphereSample renders atmospheric scattering effects
    • AsteroidsDemo a performance benchmark that is based on this demo developed by Intel and renders 50,000 unique textured asteroids

The modules also contain the following 3rd party libraries and components (located in the External subdirectory):

Downloading the Engine

The engine source code is hosted on GitHub (https://github.com/diligentgraphics). Every module is kept in its own repository:

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

Diligent Engine uses CMake as a cross-platform build tool. To start using CMake, download the latest release (3.10 or later is required for Windows build).

Win32

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_NAME=WindowsStore
  • 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”

Android

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.

Linux

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

cmake

  • 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

MacOS

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”