flutter3d_effects 1.0.0-rc.2
flutter3d_effects: ^1.0.0-rc.2 copied to clipboard
The elements' water and fire, drawn: a lit water surface, a waterfall with its spray, bubbles and froth, flames, smoke, embers and firelight, and a liquid in a vessel.
flutter3d_effects #
The physics core's water and fire, drawn.
final look = await LiquidLook.load(
device: device,
renderer: renderer,
bundle: await rootBundle.load(LiquidLook.asset),
);
final water = LiquidView(
world: world, liquid: pond, ground: heights,
device: device, scene: scene, look: look.material,
);
final fire = FireView(world: world, device: device, scene: scene, renderer: renderer);
// every frame, after world.step(dt):
water.update();
fire.update(dt);
look.update(seconds: clock, eye: camera.position);
flutter3d_physics_native simulates shallow water over ground, the sheet
a stream throws off a cliff with its spray and bubbles, and fires that heat
bodies, burn them and spread. This package draws what it simulates and
adds nothing to it: every number on screen is read off the core.
A LiquidView is one water: its surface, one vertex a cell, lit by the
LiquidLook material with ripples the flow carries, the sky mirrored as
strongly as Fresnel says, the colour a depth of water gives the bed and
froth where falling water drove air in or the flow runs fast enough to
break; the sheet off a lip drawn as one sheet, sewn row to row, clear
where it is thin and milky where it is thick and has fallen far, thinning
at its edges and into the drops it breaks into at its foot; the bubbles it
drags down. The surface runs level into its
banks and ends where it meets the ground, even over ground in steps a cell
high, and where it falls from one level to another the sheet draws the
fall, not a slanting wall of surface.
A FireView is every fire of a world: tongues rising through each
flame as fast as the gas in a real flame rises, along the axis the core
leans it by the wind; lit smoke over it at the plume's speed; embers;
firelight; and the bodies it was told to watch charring as their fuel
goes.
A PhysicsHearing says what the physics sounds like, without making
a sound itself: every fire as loud as its watts, falling water as loud as
the power it gives up falling, m·g·|v_y| summed over a few metres of
ground, and a splash where a watched body goes into a liquid, as loud as
the energy it goes in with. Loudness follows the logarithm of the power,
as hearing does. A game plays them through its own mixer; the three sounds
they were tuned on, a fire, falling water and a splash, are generated by
tool/make_sounds.py into assets/.
There is no Flutter in it, so it runs under dart test. An application
hands it one thing, the material's compiled bundle, from its asset bundle
as LiquidLook.asset. The package's build hook compiles that bundle from
assets_src/liquid.f3dmat on every build, with the compiler a game's own
hook runs, so nothing is run by hand after a checkout; the bundle is tied to
the Flutter SDK and is not committed. dart test, which runs no hook, wants
dart run tool/build_materials.dart first.
An Elements draws and sounds a whole ElementsSimulation of
flutter3d_elements, which steps the water, the fire and the bodies with
nothing of this package's under it. The looks kept on the bodies
(lookOf), and each water's view and look (viewOf, waterLookOf), are
held here, so the simulation names no scene node and a server steps it
without a renderer. ElementsViewPlugin draws it once a frame in a loop.
liquidMeshes draws a liquid in a vessel of flutter3d_physics, one
mesh a layer, its top the liquid's own waves and meniscus; jetMesh and
particleMesh draw what pours out.
LiquidDetail.light and FireDetail.light draw less for a phone.
Part of flutter3d, an independent 3D engine for Flutter.