-
Notifications
You must be signed in to change notification settings - Fork 91
docs: add new feature development template guide #1529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # New Feature Development Reference | ||
|
|
||
| Quick reference for creating new graphics features in Community Shaders. | ||
|
|
||
| ## File Structure | ||
|
|
||
| Template files to copy and customize: | ||
|
|
||
| - `template/NewFeature.h` → Copy to `src/Features/YourFeature.h` | ||
| - `template/NewFeature.cpp` → Copy to `src/Features/YourFeature.cpp` | ||
| - `template/New Feature/` → Copy to `features/Your Feature Name/` | ||
|
|
||
| ## Core System Registration | ||
|
|
||
| These are the **required** files that must be modified for your feature to appear in settings: | ||
|
|
||
| ### 1. `src/Globals.h` | ||
|
|
||
| **Forward Declaration** - Add at top with other feature declarations (~lines 1-30): | ||
|
|
||
| struct YourFeature; | ||
|
|
||
| **Feature Instance Declaration** - Add in `globals::features` namespace (~lines 51-80): | ||
|
|
||
| extern YourFeature yourFeature; | ||
|
|
||
| ### 2. `src/Globals.cpp` | ||
|
|
||
| **Feature Instance Definition** - Add in `globals::features` namespace (~lines 48-75): | ||
|
|
||
| YourFeature yourFeature{}; | ||
|
|
||
| ### 3. `src/Feature.cpp` | ||
|
|
||
| **Feature Registration** - Add to features vector in `GetFeatureList()` (~lines 200-225): | ||
|
|
||
| &globals::features::yourFeature, | ||
|
|
||
| ## Template Customization | ||
|
|
||
| ### Class Names | ||
|
|
||
| - Replace all `NewFeature` → `YourFeature` | ||
| - Replace all `"New Feature"` → `"Your Feature Name"` | ||
| - Replace all `"NewFeature"` → `"YourFeature"` | ||
|
|
||
| ### Metadata | ||
|
|
||
| - `GetCategory()` → Choose: "Lighting", "Effects", "Rendering", "Performance", "Terrain", "Water", "Atmosphere" | ||
| - `GetFeatureModLink()` → Update Nexus mod ID | ||
| - `GetFeatureSummary()` → Update description and features list | ||
| - `GetShaderDefineName()` → Your preprocessor define name | ||
| - `HasShaderDefine()` → Which shader types use your define | ||
|
|
||
| ### Settings | ||
|
|
||
| - Update `Settings` struct with your parameters | ||
| - Update `CbData` struct for shader constant buffer (must be 16-byte aligned) | ||
| - Update NLOHMANN serialization macro | ||
| - Customize `DrawSettings()` UI controls | ||
| - Update shader compilation paths in `CompileShaders()` | ||
|
|
||
| ### VR Support | ||
|
|
||
| Set `SupportsVR()` return value: | ||
|
|
||
| - `return true;` - Feature works in VR | ||
| - `return false;` - Feature disabled in VR builds | ||
|
|
||
| ## Naming Conventions | ||
|
|
||
| | Component | Convention | Example | | ||
| | ------------------ | ---------- | ----------------------------- | | ||
| | C++ Class | PascalCase | `YourFeature` | | ||
| | Instance Variable | camelCase | `yourFeature` | | ||
| | Display Name | Spaces | `"Your Feature Name"` | | ||
| | Short Name | PascalCase | `"YourFeature"` | | ||
| | Features Directory | Spaces | `features/Your Feature Name/` | | ||
| | Shader Directory | PascalCase | `YourFeature/` | | ||
|
|
||
| ## Automatic Build Integration | ||
|
|
||
| The build system automatically handles: | ||
|
|
||
| - Shader compilation and validation | ||
| - Settings persistence (JSON serialization) | ||
| - UI menu integration | ||
| - Feature lifecycle management | ||
| - Cross-platform builds (SE/AE/VR) | ||
|
|
||
| Build with: `./BuildRelease.bat ALL` | ||
|
|
||
| ## Testing Checklist | ||
|
|
||
| - [ ] Feature appears in settings menu | ||
| - [ ] Settings save/load correctly | ||
| - [ ] Shaders compile without errors | ||
| - [ ] Feature works in-game | ||
| - [ ] VR compatibility (if enabled) | ||
| - [ ] No build errors | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.