Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
00c66c6
fix(examples): build dashbook on the decoupled material
SERDUN Sep 30, 2026
e42a609
feat(flame_water): mirror the world in water surfaces
SERDUN Sep 30, 2026
81eecc1
feat(examples): add the wet world samples
SERDUN Sep 30, 2026
35f7939
feat(examples): show where each rain drop lands
SERDUN Sep 30, 2026
94dd337
feat(flame_water): bend reflections around the rings
SERDUN Sep 30, 2026
ab1fad3
feat(examples): ripple the wet world through the water shader
SERDUN Sep 30, 2026
138af03
feat(flame_lighting): cut lights out of the night
SERDUN Sep 30, 2026
14969d9
feat(flame_water): show the lights in the water
SERDUN Sep 30, 2026
13ee070
feat(examples): add the rainy night sample
SERDUN Sep 30, 2026
96396a1
feat(flame_lighting): break reflections into slivers
SERDUN Sep 30, 2026
57dcca4
feat(examples): haze over the rainy night
SERDUN Sep 30, 2026
6694204
fix(flame_lighting): let the rain break the reflected lights
SERDUN Sep 30, 2026
7dd3116
feat(flame_water): move the mirrored lights with the ripples
SERDUN Sep 30, 2026
22823ff
refactor(flame_lighting): hand the glow to the mirrors
SERDUN Sep 30, 2026
f693915
feat(flame_water): mirror the glow through the water shader
SERDUN Sep 30, 2026
47965d3
feat(examples): wet road streaks in the rainy night
SERDUN Sep 30, 2026
832d642
fix(flame_water): smear reflections with a blur, not taps
SERDUN Sep 30, 2026
c34af72
feat(examples): a narrower, brighter road streak
SERDUN Sep 30, 2026
e772512
feat(flame_water): keep water astir in the rain
SERDUN Sep 30, 2026
6d6d7bc
feat(examples): one water for the road and the puddles
SERDUN Sep 30, 2026
40ada49
feat(flame_water): size rings by depth and soften puddle rims
SERDUN Sep 30, 2026
b80cdf0
feat(examples): depth for the road and the puddles
SERDUN Sep 30, 2026
c3c541f
fix(flame_water): make the rings glint with the light round them
SERDUN Sep 30, 2026
4a79d5c
feat(examples): plainer rings on the wet road
SERDUN Sep 30, 2026
5dc404b
feat(flame_lighting): glint off wet walls
SERDUN Sep 30, 2026
1af6cd3
feat(examples): rain on the houses of the rainy night
SERDUN Sep 30, 2026
aa3d635
fix(flame_lighting): soften water on walls into damp trails
SERDUN Sep 30, 2026
1477643
fix(flame_lighting): draw sheen and glow where their surfaces are
SERDUN Sep 30, 2026
8884b78
feat(examples): wet house fronts under the walker
SERDUN Sep 30, 2026
3329b37
feat(examples): give the walker a torch
SERDUN Sep 30, 2026
47b2ee7
feat(flame_lighting): mirror the light in the wet air
SERDUN Sep 30, 2026
0f48de4
feat(flame_lighting): lay pools of light on the ground
SERDUN Sep 30, 2026
64dd2ee
feat(examples): torch and lamp pools on the rainy road
SERDUN Sep 30, 2026
d1446d3
feat(flame_lighting): give elements the roles lighting needs
SERDUN Sep 30, 2026
e438a61
feat(flame_water): make rain a system elements take part in
SERDUN Sep 30, 2026
83e0b2a
refactor(examples): compose the wet world of elements
SERDUN Sep 30, 2026
1ac8b40
feat(flame_water): cap wetness and shrink drying pools
SERDUN Sep 30, 2026
c359745
feat(examples): add a ground wetness slider to the wet world
SERDUN Sep 30, 2026
655a9be
fix(flame_lighting): brighten only the source in a mirror
SERDUN Sep 30, 2026
7cf025a
fix(flame_water): let a puddle dry up to nothing
SERDUN Sep 30, 2026
6c7cd70
feat(flame_water): let wetness gather and drain with the weather
SERDUN Sep 30, 2026
d7d65ed
feat(examples): let the rainy night dry in time
SERDUN Sep 30, 2026
d687004
feat(flame_water): dry water as long as it is deep
SERDUN Sep 30, 2026
49212d9
fix(flame_lighting): soften damp trails without a blur
SERDUN Sep 30, 2026
c58c315
feat(flame_lighting): light the ground and the rain as they are seen
SERDUN Sep 30, 2026
cbe7bde
feat(flame_water): mirror and wet by the physics of the view
SERDUN Sep 30, 2026
896c52f
feat(examples): the wet world by the new physics
SERDUN Sep 30, 2026
8dc0e8e
perf(flame_lighting): find the world's lighting, ground and rain once
SERDUN Sep 30, 2026
85c186d
perf(flame_lighting): draw a light's cone in one pass
SERDUN Sep 30, 2026
8db24c7
perf(flame_water): draw water and rain without layers or per-drop draws
SERDUN Sep 30, 2026
317d973
fix(flame_lighting): keep the pool shader's uniforms to scalars
SERDUN Oct 1, 2026
b4dcbad
feat(flame_water): take the water line, wet sheen and roof rule from …
SERDUN Oct 1, 2026
c68613b
feat(examples): let the wet world mirror as water does
SERDUN Oct 1, 2026
880daed
Merge pull request #2 from SERDUN/feat/lighting
SERDUN Oct 1, 2026
0a88815
feat(flame_lighting): one depth projection on the ground
SERDUN Oct 1, 2026
36b1261
feat(flame_water): land, scale and mirror by the ground's projection
SERDUN Oct 1, 2026
2db1748
Merge pull request #3 from SERDUN/feat/street-depth
SERDUN Oct 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions examples/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ import 'package:examples/stories/svg/svg.dart';
import 'package:examples/stories/system/system.dart';
import 'package:examples/stories/tiled/tiled.dart';
import 'package:examples/stories/utils/utils.dart';
import 'package:examples/stories/wet_world/wet_world.dart';
import 'package:examples/stories/widgets/widgets.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';
import 'package:material_ui/material_ui.dart';

void main() {
final page = PageProviderImpl().getPage();
Expand Down Expand Up @@ -69,9 +70,11 @@ void main() {
void runAsDashbook() {
final dashbook = Dashbook(
title: 'Flame Examples',
theme: ThemeData.dark(),
);

// The SERDUN fork's own samples: water that mirrors the world.
addWetWorldStories(dashbook);

// Some small sample games
addGameStories(dashbook);

Expand Down
46 changes: 46 additions & 0 deletions examples/lib/stories/wet_world/mirror_puddle_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'package:examples/stories/wet_world/street.dart';
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame_water/flame_water.dart';

class MirrorPuddleExample extends FlameGame {
MirrorPuddleExample({
this.reflectivity = 0.75,
this.squash = 1,
this.fade = 0.7,
this.wetRoadOn = true,
}) : super(
camera: CameraComponent.withFixedResolution(width: 800, height: 450),
);

static const String description = '''
A puddle mirrors the street above it: the sky, the houses, the lamps and
the walker, clipped to its shape, squeezed as water seen at a low angle
and faded with depth. The road itself is a thin film of water with a
faint mirror of its own. Nothing is rendered off screen: each reflected
component is drawn a second time, upside down.
''';

final double reflectivity;
final double squash;
final double fade;
final bool wetRoadOn;

@override
Future<void> onLoad() async {
await WaterShader.load();
camera.viewfinder.anchor = Anchor.topLeft;
await world.addAll([
...street(),
if (wetRoadOn) wetRoad(),
puddle(
left: 260,
width: 320,
reflectivity: reflectivity,
fade: fade,
)..squash = squash,
puddle(left: 500, width: 130, top: 398, height: 44),
Rain(),
]);
}
}
82 changes: 82 additions & 0 deletions examples/lib/stories/wet_world/rainy_night_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'package:examples/stories/wet_world/street.dart';
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame_lighting/flame_lighting.dart';
import 'package:flame_water/flame_water.dart';

class RainyNightExample extends FlameGame {
RainyNightExample({
this.darkness = 0.7,
this.glow = 0.35,
this.haze = 0.5,
this.rain = 1,
this.drying = 1,
this.wetness = 1,
}) : super(
camera: CameraComponent.withFixedResolution(width: 800, height: 450),
);

static const String description = '''
A street at night in the rain, made only of elements - the road, its
film of water, puddles, houses, lamps, a walker with a torch, the rain,
the night. Everything that happens between them is their own: the rain
falls on whatever catches it, the water ripples and bends what it
mirrors, the houses get wet and glint, the lights cut the night, lay
pools on the road and show in the water. Stop the rain and the street
dries as fast as the weather dries it: the walls first, then the
asphalt, the puddles last.
''';

final double darkness;
final double glow;
final double haze;
final double rain;
final double drying;

/// How wet the street is when the scene opens, from dry to soaked; from
/// then on the rain and the drying move it.
final double wetness;

Lighting? _lighting;
Rain? _rain;

/// Changes the weather on the running street, keeping how wet it has got.
void setWeather({
required double darkness,
required double glow,
required double haze,
required double rain,
required double drying,
}) {
_lighting
?..darkness = darkness
..glow = glow
..haze = haze;
_rain
?..intensity = rain
..drying = drying;
}

/// Makes everything that gets wet [wetness] wet now.
void setWetness(double wetness) {
for (final wet in world.descendants().whereType<Wettable>()) {
wet.wetness = wetness;
}
}

@override
Future<void> onLoad() async {
await WaterShader.load();
await LightingShader.load();
camera.viewfinder.anchor = Anchor.topLeft;
await world.addAll([
...street(lit: true),
wetRoad(),
puddle(left: 260, width: 320),
puddle(left: 500, width: 130, top: 398, height: 44),
_lighting = Lighting(darkness: darkness, glow: glow, haze: haze),
_rain = Rain(intensity: rain, drying: drying),
]);
setWetness(wetness);
}
}
48 changes: 48 additions & 0 deletions examples/lib/stories/wet_world/ripples_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import 'package:examples/stories/wet_world/street.dart';
import 'package:flame/components.dart';
import 'package:flame/events.dart';
import 'package:flame/game.dart';
import 'package:flame_water/flame_water.dart';

class RipplesExample extends FlameGame with TapCallbacks {
RipplesExample({this.rain = 1})
: super(
camera: CameraComponent.withFixedResolution(width: 800, height: 450),
);

static const String description = '''
Rain on the street by day: every drop lands on whatever catches it - a
ring in a puddle, a small quick one in the film on the road, a splash on
a roof - and the ring bends the reflection around it, through the water
shader. Tap a puddle to splash it yourself.
''';

final double rain;
final List<WaterSurface> _puddles = [];

@override
Future<void> onLoad() async {
await WaterShader.load();
camera.viewfinder.anchor = Anchor.topLeft;
_puddles.addAll([
puddle(left: 260, width: 320),
puddle(left: 500, width: 130, top: 398, height: 44),
]);
await world.addAll([
...street(),
wetRoad(),
..._puddles,
Rain(intensity: rain),
]);
}

@override
void onTapDown(TapDownEvent event) {
final at = camera.globalToLocal(event.canvasPosition);
for (final puddle in _puddles) {
if (puddle.covers(at)) {
puddle.splash(at);
}
}
}
}
Loading