Skip to content

Architecture

Eric Kerfoot edited this page Mar 1, 2017 · 17 revisions

This is an overview of the architecture of Eidolon, illustrated by the diagram below. Most of the code is implemented in Python with some data structures and binding code implemented in C++ and Cython. The overall objective of the architecture is to separate the compiled layers from the Python, implement a GUI-based system which maintains the Model-View-Controller (MVC) separation between the components, and provide a clean plugin interface permitting extension code to access and augment components of the system.

C++ Layer

Eidolon relies on only a few external compiled dependencies, namely Qt and Ogre3D. The first of these two is accessed through PyQt, which is found in the binding layer, and is not therefore represented by code in this layer.

Ogre3D (Open-source Graphics Rendering Engine) is a cross-platform rendering library using OpenGL or DirectX. It provides facilities for accessing these APIs, managing resources, and implementing a fast flexible rendering pipeline. Eidolon integrates with Ogre3D by subtyping Ogre classes in OgreRenderTypes to present simplified wrappers for renderer objects, as well as provide a simple scene manager interface. This module is the only component of Eidolon where third-party compiled code is directly interfaced at the C++ level.

The RenderTypes module implements the C++ data structures used throughout the C++ and Python system. These include the math types vec3, rotator, transform, and the {Vec3|Real|Color|Index}Matrix data structures collectively implemented by the template type Matrix. It also provides Figure and its subtypes, Material, Camera, RenderScene, and others which are abstract interface types implementing no behaviour themselves. These collectively define the abstract interface between the binding layer and the underlying renderer with the expectation that they will be implemented by another module to actually provide the concrete types.

This is done by OgreRenderTypes whose members inherit these interface types to wrap Ogre concepts and objects behind this abstraction layer. How this relates to the binding layer is explained below. Although only the Ogre bindings are present, if another rendering engine is to be used instead then types can be similarly defined for it to implement the interface types without having to change any other part of the code (other than getRenderAdapter() which has to return a concrete adapter object).

Binding Layer

C++ objects are accessed in Python through binding code compiled against the CPython API. PyQt, Numpy, Scipy, and other third-party libraries do this in their own ways which Eidolon only imports as Python packages. To interface with the renderer and associated C++ modules defined in the C++ layer, Cython is used to create wrapper types accessible in Python.

Python layer

Clone this wiki locally