|
| 1 | += Simple Engine — Course Modules |
| 2 | +:toc: left |
| 3 | +:toclevels: 3 |
| 4 | +:sectnums: |
| 5 | + |
| 6 | +Course modules are self-contained feature extensions that live entirely inside this `Courses/` directory. |
| 7 | +Each module is compiled as a static library (`SimpleEngineCourses`) that is linked into the main `SimpleEngine` target — no existing engine source files are modified. |
| 8 | + |
| 9 | +== Available Courses |
| 10 | + |
| 11 | +[cols="2,5",options="header"] |
| 12 | +|=== |
| 13 | +| Module | Description |
| 14 | + |
| 15 | +| xref:../en/Building_a_Simple_Engine/Courses/Opacity_Micromaps/00_introduction.adoc[Opacity Micromaps] |
| 16 | +| Hardware-accelerated shadow rays through alpha-masked geometry using |
| 17 | +`VK_KHR_opacity_micromap`. Reduces any-hit shader invocations to only the |
| 18 | +micro-triangles at the exact alpha boundary. |
| 19 | +|=== |
| 20 | + |
| 21 | +== Building with Course Modules |
| 22 | + |
| 23 | +=== Prerequisites |
| 24 | + |
| 25 | +* CMake 3.29 or newer |
| 26 | +* Vulkan SDK 1.3.283 or newer (the `VK_KHR_opacity_micromap` extension headers must be present — SDK 1.3.296+ recommended) |
| 27 | +* A GPU and driver that advertise `VK_KHR_opacity_micromap` |
| 28 | + |
| 29 | +=== Quick Start |
| 30 | + |
| 31 | +[source,shell] |
| 32 | +---- |
| 33 | +# Configure — enable the course modules umbrella option plus the |
| 34 | +# Opacity Micromaps module specifically |
| 35 | +cmake -B build \ |
| 36 | + -DENABLE_COURSES=ON \ |
| 37 | + -DENABLE_COURSE_OPACITY_MICROMAPS=ON \ |
| 38 | + .. |
| 39 | +
|
| 40 | +# Build |
| 41 | +cmake --build build --parallel |
| 42 | +---- |
| 43 | + |
| 44 | +=== CMake Options |
| 45 | + |
| 46 | +[cols="3,1,4",options="header"] |
| 47 | +|=== |
| 48 | +| Option | Default | Effect |
| 49 | + |
| 50 | +| `ENABLE_COURSES` |
| 51 | +| `OFF` |
| 52 | +| Master switch. Must be `ON` for any course module to be compiled. |
| 53 | +When `OFF`, the `Courses/` subdirectory is skipped entirely and the |
| 54 | +build is identical to the base engine. |
| 55 | + |
| 56 | +| `ENABLE_COURSE_OPACITY_MICROMAPS` |
| 57 | +| `ON` |
| 58 | +| Build the Opacity Micromaps module. Has no effect unless |
| 59 | +`ENABLE_COURSES=ON`. When enabled, adds the |
| 60 | +`ENABLE_COURSE_OPACITY_MICROMAPS` compile definition so the engine |
| 61 | +startup code activates `OmmIntegration`. |
| 62 | +|=== |
| 63 | + |
| 64 | +=== Enabling Only Courses, Disabling OMM |
| 65 | + |
| 66 | +[source,shell] |
| 67 | +---- |
| 68 | +# Build courses infrastructure but skip the OMM module |
| 69 | +cmake -B build \ |
| 70 | + -DENABLE_COURSES=ON \ |
| 71 | + -DENABLE_COURSE_OPACITY_MICROMAPS=OFF \ |
| 72 | + .. |
| 73 | +---- |
| 74 | + |
| 75 | +When all per-course options are disabled, no `SimpleEngineCourses` library is produced and the linker step is a no-op. |
| 76 | + |
| 77 | +=== Disabling Everything (Base Engine Only) |
| 78 | + |
| 79 | +[source,shell] |
| 80 | +---- |
| 81 | +cmake -B build -DENABLE_COURSES=OFF .. |
| 82 | +---- |
| 83 | + |
| 84 | +=== Reconfiguring an Existing Build Directory |
| 85 | + |
| 86 | +Pass the same flags to the existing build tree — CMake will re-run the configure step and update only the affected targets: |
| 87 | + |
| 88 | +[source,shell] |
| 89 | +---- |
| 90 | +cmake -B build -DENABLE_COURSES=ON -DENABLE_COURSE_OPACITY_MICROMAPS=ON |
| 91 | +cmake --build build --parallel |
| 92 | +---- |
| 93 | + |
| 94 | +=== IDE / GUI Configuration (cmake-gui / ccmake) |
| 95 | + |
| 96 | +1. Open `cmake-gui` (or run `ccmake build/`). |
| 97 | +2. Set `ENABLE_COURSES` to `ON` and click **Configure**. |
| 98 | +3. Set `ENABLE_COURSE_OPACITY_MICROMAPS` to `ON` (it appears after the first configure pass). |
| 99 | +4. Click **Configure** again, then **Generate**. |
| 100 | +5. Build the generated project as normal. |
| 101 | + |
| 102 | +== Verifying the Build |
| 103 | + |
| 104 | +A successful configure with OMM enabled prints: |
| 105 | + |
| 106 | +---- |
| 107 | +[Courses] Opacity Micromaps module ENABLED |
| 108 | +---- |
| 109 | + |
| 110 | +A successful build will produce `libSimpleEngineCourses.a` (Linux/macOS) or |
| 111 | +`SimpleEngineCourses.lib` (Windows) in the build tree, linked automatically into `SimpleEngine`. |
| 112 | + |
| 113 | +At runtime the ImGui panel shows an **Opacity Micromaps** section with live statistics (micromap count, build time, any-hit invocations saved). |
| 114 | + |
| 115 | +== Adding a New Course Module |
| 116 | + |
| 117 | +1. Create a subdirectory under `Courses/` (e.g. `Courses/My_Feature/`). |
| 118 | +2. Add its `.cpp` files to the `COURSE_SOURCES` list in `Courses/CMakeLists.txt`. |
| 119 | +3. Add a corresponding `option(ENABLE_COURSE_MY_FEATURE ...)` entry. |
| 120 | +4. Document the course in `en/Building_a_Simple_Engine/Courses/`. |
0 commit comments