[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

suVrik/hooker.galore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hooker Galore

An experimental game engine in which everything works through ECS.

For example window is created and managed via WindowSingleComponent. WindowSystem observes changes to this component and makes corresponding system calls. Physics simulation is managed via PhysicsSingleComponent. PhysicsInitializationSystem, PhysicsSimulateSystem and PhysicsFetchSystem observe changes to this component and make corresponding physics engine calls.

Supported platforms (via SDL2):

  1. Windows;
  2. Linux;
  3. Mac OS.

Supported rendering backends (via bgfx):

  1. Direct3D 9;
  2. Direct3D 11;
  3. Direct3D 12;
  4. Metal;
  5. OpenGL 2.1;
  6. OpenGL 3.1+;
  7. Vulkan.

Systems

  1. AAPassSystem — implements an FXAA render pass;
  2. CameraSystem — updates camera matrices (view, projection, inverse view, inverse projection) in CameraSingleComponent which are later used by other render systems;
  3. DebugDrawPassSystem — draws debug primitives like points, lines, and glyphs;
  4. EditorCameraSystem — updates editor cameras;
  5. EditorFileSystem — manages "File" menu operations: new, open, save and save as;
  6. EditorGizmoSystem — shows gizmo that allows modifying transform of selected entity(s);
  7. EditorGridSystem — draws editor grid using debug draw;
  8. EditorHistorySystem — shows history overlay and performs undo-redo operations;
  9. EditorMenuSystem — shows editor menu (file, edit, and so on);
  10. EditorPresetSystem — shows preset overlay, which allows putting preset entities on the stage;
  11. EditorPropertyEditorSystem — shows property editor overlay, which allows to change existing components, add new components, and remove existing components;
  12. EditorSelectionSystem — shows entities overlay, processes LMB clicks to select entities using the picking pass texture;
  13. GeometryPassSystem — implements geometry pass for deferred rendering;
  14. HDRPassSystem — implements an HDR pass;
  15. ImguiFetchSystem — fetches input and window data to ImGui;
  16. ImguiPassSystem — draws ImGui on the screen;
  17. LightingPassSystem — implements lighting pass for deferred rendering;
  18. OutlinePassSystem — draws an outline around entities with OutlineComponent;
  19. PhysicsCharacterControllerSystem — synchronizes character controller components and PhysX character controllers;
  20. PhysicsFetchSystem — waits until the end of asynchronous PhysX simulation and fetches data from it;
  21. PhysicsInitializationSystem — initializes PhysX;
  22. PhysicsRigidBodySystem — synchronizes rigid body components and PhysX rigid bodies;
  23. PhysicsShapeSystem — synchronizes shape components and PhysX shapes;
  24. PhysicsSimulateSystem — starts asynchronous physics simulation;
  25. PickingPassSystem — draws all entities with entity indices encoded in color. Asynchronously reads back the resulting texture (used for selection in the editor);
  26. QuadSystem — creates quad geometry and stores it in QuadSingleComponent. This quad is used in all screen space render passes;
  27. RenderFetchSystem — prepares rendering backend for rendering;
  28. RenderSystem — presents image on the screen;
  29. ResourceSystem — asynchronously loads all resources (models, textures, and presents);
  30. SkyboxPassSystem — draws skybox;
  31. WindowSystem — fetches window events, synchronizes WindowSingleComponent with an actual window.

Components

  1. AAPassSingleComponent — stores AAPassSystem state (such as frame buffer handle, shader program handle, and more);
  2. BlockoutComponent — makes entity's UV coordinates scale-dependent without changing vertex buffers;
  3. CameraSingleComponent — contains a pointer to an active camera and view, projection, inverse view, and inverse projection matrices of that camera;
  4. DebugDrawPassSingleComponent — stores DebugDrawPassSystem state (such as frame buffer handle, shader program handle, and more);
  5. EditorCameraComponent — makes an entity a first-person flying camera managed by EditorCameraSystem;
  6. EditorFileSingleComponent — stores which file menu's dialog window is currently open;
  7. EditorGizmoSingleComponent — stores which gizmo operation is currently active, whether it's in local space or in global space;
  8. EditorGridSingleComponent — stores whether editor grid is visible or not;
  9. EditorHistorySingleComponent — stores ring buffers of undo-redo actions;
  10. EditorMenuSingleComponent — stores menu items;
  11. EditorPresetSingleComponent — stores all loaded presets;
  12. EditorSelectionSingleComponent — stores which entities are selected;
  13. GeometryPassSingleComponent — stores GeometryPassSystem state (such as frame buffer handle, shader program handle, and more);
  14. HDRPassSingleComponent — stores HDRPassSystem state (such as frame buffer handle, shader program handle, and more);
  15. ImguiSingleComponent — stores ImGui render pass shader programs, textures, and more;
  16. LevelSingleComponent — stores which level to load;
  17. LightComponent — makes an entity a point light;
  18. LightingPassSingleComponent — stores LightingPassSystem state (such as frame buffer handle, shader program handle, and more);
  19. MaterialComponent — defines entity's material;
  20. ModelComponent — defines entity's geometry;
  21. ModelSingleComponent — stores all loaded models;
  22. NameComponent — specifies the name of an entity;
  23. NameSingleComponent — stores mapping from name to an entity;
  24. NormalInputSingleComponent — stores input state;
  25. OutlineComponent — adds an outline to an entity;
  26. OutlinePassSingleComponent — stores OutlinePassSystem state (such as frame buffer handle, shader program handle, and more);
  27. PhysicsBoxShapeComponent — adds a physical box shape to a rigid body;
  28. PhysicsBoxShapePrivateComponent — automatically added and removed by PhysicsShapeSystem, stores PhysX shape handle;
  29. PhysicsCharacterControllerComponent — makes an entity a character controller;
  30. PhysicsCharacterControllerPrivateComponent — automatically added and removed by PhysicsCharacterControllerSystem, stores PhysX character controller handle;
  31. PhysicsCharacterControllerSingleComponent — stores PhysX character controller manager;
  32. PhysicsSingleComponent — stores PhysX handles;
  33. PhysicsStaticRigidBodyComponent — makes an entity a rigid body;
  34. PhysicsStaticRigidBodyPrivateComponent — automatically added and removed by PhysicsRigidBodySystem, stores PhysX rigid body handle;
  35. PickingPassSingleComponent — stores PickingPassSystem state (such as frame buffer handle, shader program handle, and more);
  36. QuadSingleComponent — stores quad vertex and index buffers;
  37. RenderSingleComponent — stores current frame and whether to show debug info;
  38. SkyboxPassSingleComponent — stores SkyboxPassSystem state (such as frame buffer handle, shader program handle, and more);
  39. TextureSingleComponent — stores all loaded textures;
  40. TransformComponent — stores linear transformation of an entity;
  41. WindowSingleComponent — stores window title, width, height, and more.

System execution order

System execution order is an important topic in every ECS game engine. Initially, this engine had a manual system order, but after a couple of dozen systems, it has become difficult to add new systems to that list.

Now each system has a small descriptor that defines before/after which systems a certain system must execute. System manager uses this information to order systems automatically.

SYSTEM_DESCRIPTOR(
    SYSTEM(LightingPassSystem),
    TAGS(render),
    BEFORE("RenderSystem"),
    AFTER("WindowSystem", "RenderFetchSystem", "CameraSystem", "GeometryPassSystem")
)

Tags are used to enable/disable certain systems (like physics or debug).

Fixed system execution order:

  1. PhysicsInitializationSystem;
  2. PhysicsCharacterControllerSystem;
  3. PhysicsRigidBodySystem;
  4. PhysicsShapeSystem;
  5. PhysicsSimulateSystem;
  6. PhysicsFetchSystem.

Normal system execution order:

  1. WindowSystem;
  2. RenderFetchSystem;
  3. ImguiFetchSystem;
  4. EditorMenuSystem;
  5. EditorSelectionSystem;
  6. EditorCameraSystem;
  7. CameraSystem;
  8. EditorPresetSystem;
  9. ResourceSystem;
  10. EditorFileSystem;
  11. EditorGizmoSystem;
  12. EditorPropertyEditorSystem;
  13. GeometryPassSystem;
  14. LightingPassSystem;
  15. SkyboxPassSystem;
  16. AAPassSystem;
  17. EditorGridSystem;
  18. DebugDrawPassSystem;
  19. EditorHistorySystem;
  20. HDRPassSystem;
  21. ImguiPassSystem;
  22. OutlinePassSystem;
  23. PickingPassSystem;
  24. QuadSystem;
  25. RenderSystem.

Screenshots

Overview of the editor.

PBR flight helmet.

PBR damaged helmet.

Add components dialog window.