![]() |
Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
|
Draws a bounded, radial light effect as a scene-layer direct drawing. More...
Public Member Functions | |||
| DirectRadialLight (Color lightColor, RenderSurfaceHostBase renderSurfaceHost, SceneLayer sceneLayer, PointF centerWorldPx, float radiusWorldPx, string? nickname=null) | |||
| Initializes a new scene-layer radial light. | |||
| DirectRadialLight | MoveTo (PointF centerWorldPx) | ||
| Moves the light center and returns this instance for chaining. | |||
| DirectRadialLight | SetRadius (float radiusWorldPx) | ||
| Sets the light radius and returns this instance for chaining. | |||
| DirectRadialLight | SetIntensity (float intensity) | ||
| Sets the light intensity and returns this instance for chaining. | |||
| override void | Update (long tick) | ||
Performs per-frame update logic for this direct drawing, including fade and reveal animations.
| |||
| Public Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |||
| RectangleF | GetDrawLocationScreen (View view) | ||
| Gets the screen-space drawing location for this direct drawing as seen from the specified view. | |||
| void | Draw (BackbufferBase backbuffer, RectangleF destRectScreen) | ||
| Renders this direct drawing to the backbuffer at the specified screen location. | |||
| DirectDrawingBase | SetOpacity (float opacity) | ||
| Instantly sets the opacity to the specified value without animation. | |||
| DirectDrawingBase | FadeTo (float targetOpacity, float durationSec) | ||
| Initiates a smooth fade transition to the specified target opacity over the given duration. | |||
| DirectDrawingBase | FadeIn (float durationSec) | ||
| Fades this direct drawing from its current opacity to fully opaque over the specified duration. | |||
| DirectDrawingBase | FadeOut (float durationSec) | ||
| Fades this direct drawing from its current opacity to fully transparent over the specified duration. | |||
| DirectDrawingBase | CancelFade () | ||
| Cancels any active fade transition, leaving the opacity at its current value. | |||
| DirectDrawingBase | SetReveal (float t01) | ||
| Instantly sets the reveal progress to the specified value without animation. | |||
| DirectDrawingBase | SetRevealDirection (RevealDirection dir) | ||
| Sets the direction from which the reveal animation progresses. | |||
| DirectDrawingBase | RevealTo (float t01, float durationSec, Func< float, float >? easing=null) | ||
| Initiates a smooth reveal animation to the specified target progress over the given duration, optionally using a custom easing function. | |||
| DirectDrawingBase | CancelReveal () | ||
| Stops an active reveal animation at its current progress. | |||
| int | CompareTo (DirectDrawingBase? other) | ||
| Compares this direct drawing to another for sorting by ZOrder. | |||
| void | Dispose () | ||
| Releases all resources used by this DirectDrawingBase instance. | |||
| override bool | Equals (object? obj) | ||
| Determines whether the specified object is equal to the current direct drawing. | |||
| override int | GetHashCode () | ||
| Returns a hash code for this direct drawing. | |||
Protected Member Functions | |
| override void | OnDraw (BackbufferBase backbuffer, RectangleF destRectScreen) |
| Protected Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| void | OnDraw (BackbufferBase backbuffer, RectangleF destRectScreen) |
| Performs the concrete drawing for this direct drawing to the backbuffer. | |
| DirectDrawingBase (RenderSurfaceHostBase renderSurfaceHost, DirectDrawingMode mode, SceneLayer? sceneLayer, View? view, Rectangle? screenBounds, Rectangle? worldBounds, string? nickname=null) | |
| Initializes a new instance of the DirectDrawingBase class. | |
| virtual void | Dispose (bool disposing) |
| Releases resources used by this DirectDrawingBase instance. | |
Properties | |
| PointF | CenterWorldPx [get, set] |
| Gets the light center in world pixels. | |
| float | RadiusWorldPx [get, set] |
| Gets the light radius in world pixels. | |
| Color | LightColor [get, set] |
| Gets or sets the color and base alpha of the light. | |
| float | Intensity [get, set] |
| Gets or sets the overall intensity multiplier from 0 to 1. | |
| float | EffectiveIntensity [get] |
| Gets the current intensity after flicker has been applied. | |
| SKBlendMode | BlendMode [get, set] |
| Gets or sets the blend mode used when compositing the light over scene content. | |
| float | HotspotRadiusRatio [get, set] |
| Gets or sets the radius ratio for the hottest inner portion of the gradient. | |
| float | MidpointRadiusRatio [get, set] |
| Gets or sets the radius ratio for the middle gradient stop. | |
| float | MidpointIntensityRatio [get, set] |
| Gets or sets the middle stop intensity multiplier from 0 to 1. | |
| bool | IsAntialias [get, set] |
| Gets or sets whether Skia antialiasing is enabled for the light draw. | |
| bool | FlickerEnabled [get, set] |
| Gets or sets whether the light should periodically vary its intensity. | |
| float | FlickerAmount [get, set] |
| Gets or sets how much flicker may alter the base intensity. Recommended range: 0 to 0.25. | |
| int | FlickerRefreshHz [get, set] |
| Gets or sets how often flicker is recomputed and dirtied. | |
| Properties inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| bool | HideWhenFullyTransparent = true [get, set] |
| Gets or sets a value indicating whether this direct drawing should be automatically hidden when its opacity reaches zero during fade transitions. | |
| RenderSurfaceHostBase | RenderSurfaceHost [get] |
| Gets the render surface host that manages this direct drawing's rendering pipeline. | |
| DirectDrawingMode | Mode [get] |
| Gets the drawing mode that determines how this direct drawing is positioned and transformed. | |
| SceneLayer? | SceneLayer [get] |
Gets the scene layer to which this direct drawing is attached, or null if the drawing is in view mode. | |
| View? | View [get] |
Gets the view to which this direct drawing is attached, or null if the drawing is in scene-layer mode. | |
| Rectangle | ScreenBounds [get, set] |
| Gets or sets the screen-space bounds of this direct drawing in pixels. | |
| Rectangle | WorldBounds [get, set] |
| Gets or sets the world-space bounds of this direct drawing in pixels. | |
| TypedValueBag | ValueBag = new() [get] |
| Gets the extensible value bag for storing arbitrary key-value data associated with this direct drawing. | |
| Guid | Id = Guid.NewGuid() [get] |
| Gets the unique identifier for this direct drawing. | |
| string? | Nickname [get] |
| Gets the optional human-readable name for this direct drawing. | |
| int | ZOrder [get, set] |
| Gets or sets the Z-order (depth) used for sorting this direct drawing relative to other drawables. | |
| bool | Visible [get, set] |
| Gets or sets a value indicating whether this direct drawing is visible and should be rendered. | |
| float | Opacity [get, set] |
| Gets or sets the current opacity of this direct drawing. | |
Events | |
| Action< DirectRadialLight >? | Changed |
| Occurs when this light changes in a way tracked darkness overlays care about. | |
| Events inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| EventHandler< IDirectDrawable >? | Disposing |
| Occurs when this direct drawing is being disposed. | |
| EventHandler< DirectDrawingBase >? | FadeToCompleted |
| Occurs when a fade transition initiated by FadeTo, FadeIn, or FadeOut completes. | |
| Events inherited from Gondwana.Drawing.Direct.IDirectDrawable | |
| EventHandler< IDirectDrawable >? | Disposing |
| Occurs when the object is being disposed. | |
Additional Inherited Members | |
| Public Types inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| enum | RevealDirection { LeftToRight , RightToLeft , TopToBottom , BottomToTop } |
| Defines the direction from which a reveal animation progressively displays the direct drawing. More... | |
| Static Public Member Functions inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| static bool | operator== (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether two direct drawing instances are equal using reference equality. | |
| static bool | operator!= (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether two direct drawing instances are not equal using reference equality. | |
| static bool | operator< (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether the Z-order of the left direct drawing is less than the right. | |
| static bool | operator<= (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether the Z-order of the left direct drawing is less than or equal to the right. | |
| static bool | operator> (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether the Z-order of the left direct drawing is greater than the right. | |
| static bool | operator>= (DirectDrawingBase? left, DirectDrawingBase? right) |
| Determines whether the Z-order of the left direct drawing is greater than or equal to the right. | |
| Protected Attributes inherited from Gondwana.Drawing.Direct.DirectDrawingBase | |
| readonly RenderSurfaceHostBase | _renderSurfaceHost |
| The render surface host that manages this direct drawing's rendering pipeline. | |
| Rectangle | _screenBounds |
| The current screen-space bounds for view-mode direct drawings, in pixels. | |
| Rectangle | _worldBounds |
| The current world-space bounds for scene-layer-mode direct drawings, in pixels. | |
| int | _zOrder |
| The Z-order used for draw sorting. Higher values draw later (on top). | |
| bool | _visible |
| Indicates whether this direct drawing is currently visible and should be rendered. | |
| long | _lastTick = HighResTimer.GetCurrentTick() |
| The last engine tick value used for delta-time calculations in Update. | |
Draws a bounded, radial light effect as a scene-layer direct drawing.
DirectRadialLight is intended for localized draw-time lighting effects such as torches, lamps, spell glows, and other finite-radius light sources. It is deliberately modeled as a normal DirectDrawingBase instead of a post-process effect so it participates in Gondwana's existing dirty-rectangle selection path.
The important contract is its bounds: DirectDrawingBase.WorldBounds is the full world-space area that may be affected by the light. When a light moves or changes radius, both the old and new bounds are marked dirty by the inherited DirectDrawingBase.WorldBounds setter.
Rendering uses a Skia radial-gradient SKShader on an SKPaint. This keeps the first lighting primitive compatible with both bitmap and GPU-backed backbuffers while still exercising the same "shader during draw" idea that a later SkSL-backed implementation would use.
Definition at line 31 of file DirectRadialLight.cs.
| Gondwana.Drawing.Direct.DirectRadialLight.DirectRadialLight | ( | Color | lightColor, |
| RenderSurfaceHostBase | renderSurfaceHost, | ||
| SceneLayer | sceneLayer, | ||
| PointF | centerWorldPx, | ||
| float | radiusWorldPx, | ||
| string? | nickname = null ) |
Initializes a new scene-layer radial light.
| lightColor | The color and base alpha of the light. |
| renderSurfaceHost | The render surface host that owns the drawing. |
| sceneLayer | The scene layer where the light is positioned. |
| centerWorldPx | The center of the light in world pixels. |
| radiusWorldPx | The light radius in world pixels. |
| nickname | Optional name used by DirectDrawingManager. |
Definition at line 70 of file DirectRadialLight.cs.
| DirectRadialLight Gondwana.Drawing.Direct.DirectRadialLight.MoveTo | ( | PointF | centerWorldPx | ) |
Moves the light center and returns this instance for chaining.
| centerWorldPx | The center in world pixels. |
Definition at line 306 of file DirectRadialLight.cs.
|
protected |
Definition at line 342 of file DirectRadialLight.cs.
| DirectRadialLight Gondwana.Drawing.Direct.DirectRadialLight.SetIntensity | ( | float | intensity | ) |
Sets the light intensity and returns this instance for chaining.
| intensity | The intensity. |
Definition at line 328 of file DirectRadialLight.cs.
| DirectRadialLight Gondwana.Drawing.Direct.DirectRadialLight.SetRadius | ( | float | radiusWorldPx | ) |
Sets the light radius and returns this instance for chaining.
| radiusWorldPx | The radius in world pixels. |
Definition at line 317 of file DirectRadialLight.cs.
|
virtual |
Performs per-frame update logic for this direct drawing, including fade and reveal animations.
| tick | The current engine tick value from HighResTimer. |
Reimplemented from Gondwana.Drawing.Direct.DirectDrawingBase.
Definition at line 335 of file DirectRadialLight.cs.
|
getset |
Gets or sets the blend mode used when compositing the light over scene content.
Definition at line 170 of file DirectRadialLight.cs.
|
getset |
Gets the light center in world pixels.
Definition at line 94 of file DirectRadialLight.cs.
|
get |
Gets the current intensity after flicker has been applied.
Definition at line 165 of file DirectRadialLight.cs.
|
getset |
Gets or sets how much flicker may alter the base intensity. Recommended range: 0 to 0.25.
Definition at line 277 of file DirectRadialLight.cs.
|
getset |
Gets or sets whether the light should periodically vary its intensity.
Flicker marks the light's full bounds dirty at FlickerRefreshHz. If a DirectDarknessOverlay reveal source is tracking this light with intensity tracking enabled, the overlay will also refresh at this cadence.
Definition at line 258 of file DirectRadialLight.cs.
|
getset |
Gets or sets how often flicker is recomputed and dirtied.
Definition at line 295 of file DirectRadialLight.cs.
|
getset |
Gets or sets the radius ratio for the hottest inner portion of the gradient.
Definition at line 186 of file DirectRadialLight.cs.
|
getset |
Gets or sets the overall intensity multiplier from 0 to 1.
Definition at line 147 of file DirectRadialLight.cs.
|
getset |
Gets or sets whether Skia antialiasing is enabled for the light draw.
Definition at line 237 of file DirectRadialLight.cs.
|
getset |
Gets or sets the color and base alpha of the light.
Definition at line 130 of file DirectRadialLight.cs.
|
getset |
Gets or sets the middle stop intensity multiplier from 0 to 1.
Definition at line 220 of file DirectRadialLight.cs.
|
getset |
Gets or sets the radius ratio for the middle gradient stop.
Definition at line 203 of file DirectRadialLight.cs.
|
getset |
Gets the light radius in world pixels.
Changing the radius changes DirectDrawingBase.WorldBounds, which dirties the old and new light areas.
Definition at line 113 of file DirectRadialLight.cs.
| Action<DirectRadialLight>? Gondwana.Drawing.Direct.DirectRadialLight.Changed |
Occurs when this light changes in a way tracked darkness overlays care about.
This event is primarily a synchronization hook for DirectDarknessOverlay and DirectSceneLayerDarknessOverlay. It is raised when the light's center, radius, base intensity, or effective flicker intensity changes. It is not intended to be a complete "any paint setting changed" notification for every cosmetic property.
Definition at line 59 of file DirectRadialLight.cs.