Skip to content

Comments

ui_color_thermal#258

Merged
GooberRF merged 7 commits intoGooberRF:masterfrom
nickalreadyinuse:railscanner-color
Feb 24, 2026
Merged

ui_color_thermal#258
GooberRF merged 7 commits intoGooberRF:masterfrom
nickalreadyinuse:railscanner-color

Conversation

@nickalreadyinuse
Copy link

Change rail scanner thermal color re: #251

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses issue #251 by adding a customizable color option for thermal/IR entity rendering in the Rail Driver scanner. Previously, entities were always displayed using a red color derived from distance and body temperature, which was difficult for some users to see. This change allows users to customize the thermal entity color via a console command and settings file.

Changes:

  • Added thermal_entity_color_override configuration field and supporting infrastructure
  • Implemented console command ui_color_thermal to allow runtime color customization
  • Modified IR scanner rendering logic to use custom color when specified

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
game_patch/misc/alpine_settings.h Added thermal_entity_color_override field to AlpineGameSettings structure
game_patch/misc/alpine_settings.cpp Added loading and saving logic for ThermalEntityColor setting
game_patch/hud/hud_colors.cpp Added ui_color_thermal console command registration
game_patch/graphics/d3d11/gr_d3d11_mesh.cpp Implemented thermal entity color override in IR scanner rendering path

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +778 to +779
color.alpha = static_cast<ubyte>(params.alpha);
}
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the IR-scanner path, when thermal_entity_color_override is set for character meshes, color.alpha is taken from the override and params.alpha is no longer applied (previously alpha was always forced to params.alpha). This can change scanner fade/blending behavior and makes the override behave differently than the non-override path. Consider always applying params.alpha after choosing the RGB (or modulating override alpha with params.alpha, e.g., multiply and renormalize).

Suggested change
color.alpha = static_cast<ubyte>(params.alpha);
}
}
// Always apply scanner alpha after determining RGB to keep fade/blending behavior consistent.
color.alpha = static_cast<ubyte>(params.alpha);

Copilot uses AI. Check for mistakes.
color = is_character_mesh ? params.self_illum : rf::Color{255, 255, 255, 255};
if (is_character_mesh && g_alpine_game_config.thermal_entity_color_override) {
auto [r, g, b, a] = extract_color_components(*g_alpine_game_config.thermal_entity_color_override);
color = rf::Color{static_cast<ubyte>(r), static_cast<ubyte>(g), static_cast<ubyte>(b), static_cast<ubyte>(a)};
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the thermal override is set, the code fully replaces params.self_illum (noted as derived from distance/body-temp) with a constant color. If self_illum encodes per-entity intensity, this will remove the heat/intensity effect and make characters render at a flat brightness. Consider treating the override as a tint (preserve self_illum intensity and apply it to the override RGB) instead of a full replacement.

Suggested change
color = rf::Color{static_cast<ubyte>(r), static_cast<ubyte>(g), static_cast<ubyte>(b), static_cast<ubyte>(a)};
// Treat thermal override as a tint: preserve per-entity intensity from self_illum
// and apply it to the override RGB. Assume self_illum is grayscale (same in all channels)
// and use the red channel as the intensity source.
const float intensity = static_cast<float>(params.self_illum.red) / 255.0f;
const auto scaled_r = static_cast<int>(static_cast<float>(r) * intensity);
const auto scaled_g = static_cast<int>(static_cast<float>(g) * intensity);
const auto scaled_b = static_cast<int>(static_cast<float>(b) * intensity);
color.red = static_cast<ubyte>(std::clamp(scaled_r, 0, 255));
color.green = static_cast<ubyte>(std::clamp(scaled_g, 0, 255));
color.blue = static_cast<ubyte>(std::clamp(scaled_b, 0, 255));
color.alpha = static_cast<ubyte>(params.alpha);

Copilot uses AI. Check for mistakes.
"Thermal entity color override",
g_alpine_game_config.thermal_entity_color_override);
},
"Set thermal/IR entity color override for the Rail Driver scanner.",
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui_color_thermal is presented as a general Rail Driver scanner setting, but thermal_entity_color_override is only referenced in the Direct3D 11 mesh renderer code. With the legacy renderer selected, this command/setting appears to have no effect. Either implement the override for the legacy renderer as well, or clarify the help text to indicate it only applies to the D3D11 renderer.

Suggested change
"Set thermal/IR entity color override for the Rail Driver scanner.",
"Set thermal/IR entity color override for the Rail Driver scanner (D3D11 renderer only).",

Copilot uses AI. Check for mistakes.
@GooberRF GooberRF merged commit c2fe5d0 into GooberRF:master Feb 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants