A lib provides easy simulation backboned by DirectX
This project provides a simple backbone of simulation. Some concepts are introduced as follows.
- App:
SimApphandles some basic function of the application, incl. managing window, initializing DirectX basic COMs, updating and rendereing in frame, signal handling, etc. - Case:
SimCaseprovides the basic structure of a simulation case. A case holds UI (backboned by ImGUI) and entities. Basicly, if one wants to implement a specific simulation case, define a new case that inherits from SimCase, likeFadingTriangleCase. - Entity:
Entityrepresents a simulation object. A simulation object holds simulation properties, like position, rotation, speed, etc. To be displayed in window, it should owns a model. - Model:
Modelis consist of meshes. Model is loaded in an asynchronized way frommodel/xxx.xmlwhich refers vertex data fromvertex/xxx.xmland defines mesh list with index data, primitive type, vertex shader and index shader. - Mesh:
Meshrefers vertex buffer, index buffer, vertex material, index material, vertex material buffer, index material buffer. - Material:
VertexMaterialencasulates vertex layout and vertex shader.PixelMaterialencapsulates pixel shader. BothVertexMaterialBufferandPixelMaterialBufferencapsulate constant buffers for each. Vertex layout in defined inTypeUtil, if one introduces a new vertex layout, one should implementparsemethod and modifyloadVertexFromFile. If one introduces a new shader, one should implement new Material buffer type likeVMBPosColorRawandPMBPosColorRaw. - Vertex Buffer:
VertexBufferencapsulates vertex buffer (immutable) and its data. - Index Buffer:
IndexBufferencapsulated index buffer (immutable) and its data.
This project has the following singletons.
- Thread pool:
Dispatcheris a thread pool. Main thread can submit functions to it. - Main thread callback:
MainthreadCallbackHubis a hub collecting callbacks from sub therads. Normally, only sub thread can sumbit functions to it. - Logger:
Loggeris a multithread log recorder. Main thread submit log task and sub thread append log to file stream. Dynamic count and type of arguments are supported. - Bunch of resource pools:
VertexBufferPoolmanagesVertexBufferhashed by same vertex filename.IndexBufferPoolmanagesIndexBufferhashed by same mesh name.VertexMaterialPoolmanagesVertexMaterialhashed by same vertex shader filename.IndexMaterialPoolmanagesIndexMaterialhashed by same pixel shader filename.