aeronautic

Components

<Afterburner>, <AfterburnerBatch>, the handle and useAfterburnerBatch.

<Afterburner>

A group with a nozzle at its origin. The plume streams along the group's local +Z, aft of a model that flies along -Z, and follows the group every frame. It takes every <group> prop (position, rotation, scale, children…), plus:

proptypedefaultwhat it does
presetAfterburnerPresetName | AfterburnerPresetthe defaultsWhich look to start from. Outside an <AfterburnerBatch> it also picks the batch, and so the profile.
paramsAfterburnerParamsInput—How this plume looks, over the preset. See Params.
throttlenumber | (flight) => numbersee below0 to 1 is dry thrust, idle to military power; 1 to 1.1 is reheat. A function reads it from the flight, only when the flight changes.
sourceFlight | nullnearest providerThe flight its batch flies with, outside an <AfterburnerBatch>. null flies only the props.
batchAfterburnerBatchHandlenearestDraw with this batch rather than the nearest one.
targetObject3D | nullthe engine's exhaustSit on this mesh, group or bone from anywhere in the scene. position/rotation are then in its frame. Inside an <Engine>, its exhaust anchor; null sits where it is in the tree.
direction[x, y, z]—Which way the exhaust streams, in the frame it sits in. Wins over rotation.
refAfterburnerHandle—The imperative handle, below.

params is compared field by field, so an inline object is fine. A change rewrites only this nozzle's instance.

Left out, throttle is the nearest <Engine>'s, from @aeronautic/controls, else the flight's inside a <FlightProvider>, else 1.1, full reheat.

AfterburnerHandle

What ref gives you. It's stable for the component's life, and safe to use before the nozzle is in a batch.

type AfterburnerHandle = {
  throttle: number;
  setParams: (params: AfterburnerParamsInput) => void;
  updateParams: (params: AfterburnerParamsInput) => void;
  setOffset: (offset: AfterburnerOffset) => void;
  setDirection: (direction: [number, number, number]) => void;
  readonly params: Readonly<AfterburnerParams> | null;
  readonly object: Group | null;
  readonly nozzle: AfterburnerNozzle | null;
  readonly batch: AfterburnerBatchHandle | null;
};
memberwhat it does
throttleRead or write. Cheap to write every frame.
setParamsReplace the params over the preset.
updateParamsMerge into the current params. Rewrites this nozzle's instance.
setOffsetMove or turn the group: { position?, rotation?, direction? }.
setDirectionPoint the exhaust, in the frame it sits in.
paramsThe resolved params, or null before it is in a batch.
objectThe group.
nozzleThe core AfterburnerNozzle.
batchThe AfterburnerBatch it draws with.

A prop overrides what the handle wrote whenever that prop changes.

<AfterburnerBatch>

The batch its children draw with. Without one, nozzles share a batch per scene, preset and flight.

proptypedefaultwhat it does
presetAfterburnerPresetName | AfterburnerPreset—The profile to start from, and the look of nozzles that name none.
profilePartial<AfterburnerProfile>—The air and camera every nozzle shares, as uniforms. Applies live. See Profile.
quality"low" | "medium" | "high" | "ultra" | Partial<AfterburnerQuality>"high"Step counts are uniforms; only an octave change recompiles. See Quality.
hazebooleantrueHeat haze. Compiled in only when some nozzle has refractionM > 0.
hooksAfterburnerHooks—TSL to change the field or the pixel. A change recompiles. See Shader hooks.
timeScalenumber1Seconds of flame per second.
responseSnumber0.25Seconds a plume takes to follow its throttle, so a burner lights over a moment. 0 follows at once.
detailDistanceMnumber900Past this, eddies are dropped.
cheapDistanceMnumber3000Past this, a plume is a single sample.
minScreenFractionnumber0.001Plumes smaller than this share of the screen height are not drawn.
passAfterburnerPass—Draw the plumes in their own pass. A change rebuilds. See Half resolution.
sourceFlight | nullnearest providerA shared flight: its altitude, airspeed and day win over profile, and nozzles that follow the throttle run at its. null flies only the props.
refAfterburnerBatchHandle—The batch itself.

useAfterburnerBatch()

Returns the nearest <AfterburnerBatch>'s AfterburnerBatchHandle from inside one, or null outside.

const Overlay = () => {
  const batch = useAfterburnerBatch();
  useFrame(() => console.log(batch?.stats()));
  return null;
};

On this page