Skip to content

Commit 5b283ef

Browse files
authored
Merge pull request #3 from DGerry83/feature-Rendering2
Adds new soft bloom type, fixed/adjusted fov-related math for the starfield, added planetary and sun-glare based dimming for the stars.
2 parents f50c10b + e130d3a commit 5b283ef

24 files changed

+4937
-564
lines changed

Core/StarfieldSettings.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ public static class StarfieldSettings
4343
// Color
4444
public static float ColorSaturation { get; set; } = 1.0f; // 0.5=realistic, 1.0=natural, 2.0=vivid
4545

46+
47+
// Bloom mode toggle: false = Classic (original 4-spike), true = Soft HDR (2-pass)
48+
public static bool UseSoftBloom { get; set; } = false;
49+
4650
// HYG Catalog Coordinate Rotation (degrees)
4751
// Allows aligning the real sky catalog with the game's coordinate system
4852
public static float RotationX { get; set; } = 0.0f; // Tilt forward/back
@@ -188,6 +192,7 @@ public static void Load()
188192
BloomThreshold = float.Parse(settingsNode.GetValue("BloomThreshold") ?? "0.08");
189193
BloomIntensity = float.Parse(settingsNode.GetValue("BloomIntensity") ?? "0.5");
190194
ColorSaturation = float.Parse(settingsNode.GetValue("ColorSaturation") ?? "1.0");
195+
UseSoftBloom = bool.Parse(settingsNode.GetValue("UseSoftBloom") ?? "false");
191196
RotationX = float.Parse(settingsNode.GetValue("RotationX") ?? "0.0");
192197
RotationY = float.Parse(settingsNode.GetValue("RotationY") ?? "0.0");
193198
RotationZ = float.Parse(settingsNode.GetValue("RotationZ") ?? "0.0");
@@ -262,6 +267,7 @@ public static void PushSettingsToNative()
262267
BloomThreshold = BloomThreshold,
263268
BloomIntensity = BloomIntensity,
264269
ColorSaturation = ColorSaturation,
270+
UseSoftBloom = UseSoftBloom ? 1 : 0,
265271
RotationX = RotationX,
266272
RotationY = RotationY,
267273
RotationZ = RotationZ
@@ -455,6 +461,7 @@ public static void Save()
455461
settingsNode.AddValue("BloomThreshold", BloomThreshold);
456462
settingsNode.AddValue("BloomIntensity", BloomIntensity);
457463
settingsNode.AddValue("ColorSaturation", ColorSaturation);
464+
settingsNode.AddValue("UseSoftBloom", UseSoftBloom);
458465
settingsNode.AddValue("RotationX", RotationX);
459466
settingsNode.AddValue("RotationY", RotationY);
460467
settingsNode.AddValue("RotationZ", RotationZ);
23.5 KB
Binary file not shown.
2.5 KB
Binary file not shown.

Native/StarfieldNative.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,24 @@ public struct StarfieldSettingsNative
4343
public float BloomThreshold;
4444
public float BloomIntensity;
4545
public float ColorSaturation; // 0.0-2.0: 0.5=realistic, 1.0=natural, 2.0=vivid
46-
46+
47+
// Rendering style transitions
48+
public int UseSoftBloom; // 0 = Classic, 1 = Soft HDR
49+
4750
// HYG Catalog Coordinate Rotation (degrees)
4851
public float RotationX;
4952
public float RotationY;
5053
public float RotationZ;
51-
54+
5255
// Galactic plane orientation
5356
public float GalacticPlaneNormalX;
5457
public float GalacticPlaneNormalY;
5558
public float GalacticPlaneNormalZ;
59+
60+
// Global scene dimming factors
61+
public float SunGlareDimming; // 1.0 = full brightness, 0.0 = fully dimmed
62+
public float PlanetaryDimming; // 1.0 = full brightness, 0.0 = fully dimmed
63+
public float GlobalDimming; // min(Sun, Planetary)
5664
}
5765

5866
[StructLayout(LayoutKind.Sequential, Pack = 4, Size = 48)]
@@ -138,6 +146,11 @@ Vector3 atmosphereUp // World-space up vector
138146
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
139147
public static extern int CR_StarfieldGetHeroCount();
140148

149+
150+
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
151+
public static extern void CR_StarfieldSetDimming(float sunGlareDimming, float planetaryDimming);
152+
153+
141154
[DllImport(DllName, CallingConvention = CallingConvention.Cdecl)]
142155
public static extern byte CR_StarfieldIsDeviceReady();
143156

0 commit comments

Comments
 (0)