Colossal.Atmosphere.MoonIllumination
Assembly:
(assembly not specified in source; part of Colossal.Atmosphere namespace)
Namespace: Colossal.Atmosphere
Type: public struct
Base: System.ValueType
Summary: Represents basic lunar illumination parameters used by the atmosphere/lighting system. Holds the fraction of the lunar disk that is illuminated, a phase value describing the lunar phase, and an orientation angle for the illuminated portion. Exact semantics (units for phase/angle) are not present in the source; typical usage is: - fraction: illuminated fraction [0.0 — 1.0] - phase: phase indicator (implementation-dependent; often relates to phase angle or phase position) - angle: orientation of the illuminated terminator (usually in radians)
Fields
-
public double fraction
Represents the illuminated fraction of the Moon's visible disk. Expect values in the range 0.0 (new moon) to 1.0 (full moon). Used to modulate moon brightness in rendering. -
public double phase
Numeric phase value describing the moon's phase. The exact meaning depends on the calling code (could be a phase angle, a normalized phase [0..1], or another phase parameter). Check surrounding atmospheric/astronomical code to interpret this correctly. -
public double angle
Orientation angle for the illuminated portion of the Moon (terminator angle). Typically used to rotate the lit region when rendering; units are likely radians (verify in consumer code).
Properties
- None. This type is a simple POD struct with public fields; it exposes no properties.
Constructors
- public MoonIllumination() Structs in C# always have a default parameterless constructor that zero-initializes fields (fraction = 0.0, phase = 0.0, angle = 0.0). The source file does not declare any custom constructors.
You can initialize instances using an object initializer or by assigning fields directly: var m = new MoonIllumination { fraction = 0.5, phase = 0.25, angle = 1.57 };
Methods
- None. The struct declares no methods. Any computation (e.g., converting fraction to brightness or converting angle units) must be performed by external code.
Usage Example
// Create and initialize a MoonIllumination instance
var moon = new Colossal.Atmosphere.MoonIllumination
{
fraction = 0.78, // ~78% illuminated
phase = 0.39, // implementation-specific phase value
angle = Math.PI/4 // 45 degrees in radians
};
// Example: convert fraction to a simple brightness multiplier
double brightness = 0.2 + 0.8 * moon.fraction; // keep some ambient moonlight when new moon
// Example: convert angle to degrees for UI/debug
double angleDegrees = moon.angle * (180.0 / Math.PI);
Console.WriteLine($"Moon: fraction={moon.fraction}, phase={moon.phase}, angle={angleDegrees:F1}°");
Notes: - Verify how consumer code interprets phase and angle (units and ranges) before using values for physically-based calculations or rendering.