@v12-engine/render
Interfaces
| Name | What |
|---|---|
| Batch beta | One geometry with one material at many places |
| BatchOptions beta | How a batch is drawn beside its geometry, material and copies (Renderer.batch) |
| CameraState beta | A view's camera, written in place by the game and read each frame |
| Capture beta | A picture read back from the card: its pixels and its size |
| CaptureOptions beta | How the main view is captured (Renderer.capture) |
| Card beta | The renderer's things as the card has them (Renderer.card) |
| Caster beta | A thing that would cast the sun's shadow into a cascade, as the game's code is asked of it (Renderer.casters.casts, the client's WorldShadows.casts): once a frame for each cascade it is in, so what decides should be quick |
| CasterTag beta | What a batch says of its casters, for the game's code (BatchOptions.caster) |
| Cull beta | What one pass culls by |
| DataRegion beta | A rectangle of a level of a layer: the whole of level 0 of layer 0 where left out |
| DataTexture beta | A texture of data the game writes, whole or a rectangle at a time, for a kind's bindings |
| DataTextureOptions beta | How a data texture is made (Renderer.texture): its size, its texels, its layers or depth, its mips |
| FrameStats beta | What a frame drew |
| Geometry beta | A mesh's points on the card, shared by every batch that draws it |
| GeometryData beta | A mesh's points as they are sent to the card (Renderer.geometry) |
| GeometryParts beta | The parts of a merged geometry: where each starts in the indices (one more: the end), and its box (min, max) |
| GlowSettings beta | The glow, as a game sets it (the client's WorldGlow.frame works these out from its looks and the hour) |
| KindMaterialOptions beta | What a kind's own material is made of |
| Lamp beta | A lamp: every field written in place by who owns it, read each frame |
| LampOptions beta | A lamp as it is added: where it stands, and what is left out taken as said beside each |
| Lamps beta | The renderer's lamps: lights at a place with a reach, none throwing a shadow, as many at once as max |
| Material beta | What a batch is drawn with: a kind of material, its variant and what its bindings are bound to |
| MaterialKind beta | A kind of material: the WGSL its draws run, what of a geometry's vertices and of a copy they read, and what its group of bindings holds. The renderer gives every kind the frame's group (0: Frame, the three cascades and their sampler in the view's pass; Cascade alone in a cascade's) and asks the kind for group 1. flags is a material's variant of the kind, a string the kind reads (cutout, tinted): a shader is made once for each that is used. |
| MaterialOptions beta | A standard material (Renderer.material): a colour, a picture, how its alpha is taken, the sun and the sky |
| MistArea beta | An area of mist standing over a circle or a box of the map, thick at its base and thinning to its top |
| MistGround beta | The layer of mist on the ground: thick at its base, thinning to nothing at its top |
| MistState beta | The mist of the world: its layer on the ground and its areas, either left out for none |
| Outline beta | A way of drawing an outline: written in place by who owns it, read each frame |
| OutlineLook beta | How an outline is drawn (the client's OutlineLook, less its pulse, which is its width written each frame) |
| Outlines beta | The renderer's outlines: the ways of drawing them, and what the last frame drew |
| Picture beta | A picture on the card, with its mips |
| PictureHas beta | What of a frame's stages is there beside the settings: each stage's targets made yet, and what the view drew |
| PictureLens beta | What a cinematic asks of the lens (the client's WorldPicture.lens) |
| PictureSampling beta | How a picture is sampled (a glTF file's sampler, Babylon's texture's wrapU, wrapV, samplingMode, anisotropicFilteringLevel): what is left out is the renderer's own, repeating, linear between texels and mips, 4 times anisotropic |
| PictureSettings beta | What the picture's passes do, each read every frame: the client's MapPictureLook and its quality's knobs |
| PictureStages beta | Which of the picture's passes a frame draws, and into what: what pictureStages decides of the settings |
| PostPass beta | A game's own pass, once added (Renderer.post.addPass) |
| PostPassOptions beta | How a game's own pass is added (Renderer.post.addPass), beside its place and its WGSL |
| ReadView beta | The view as what reads the shadows is measured against it |
| Renderer beta | The renderer: a canvas, the world's geometries, pictures, materials and batches of copies, a camera, the sun and the sky, and a frame drawn from them |
| RendererOptions beta | How a renderer is made (createRenderer): what is left out taken as said beside each |
| ScreenFrame beta | What the frame draws over the picture, as numbers (the client's ScreenState, its bars already shares by side) |
| ScreenPicture beta | A picture another pass binds: a side view's (SideView.picture), one made of an image (Renderer.picture) |
| ScreenStages beta | What the stages draw, written by the client and read every frame |
| ScreenTransition beta | A transition being played. A new object is a new cut: the old shot is taken as the object is first seen, and for as long as it is the one given, its values are read every frame |
| ScreenVideo beta | A video drawn into the picture: its element, and what to draw of it each frame (null: nothing this frame) |
| ScreenVideoBox beta | What is drawn of a video in a frame: the client's VideoPlaneFrame, pixels of the page from its top left |
| SideView beta | Another view of things than the main one: its own camera, lights, batches and target, drawn when asked or with every frame |
| SkyState beta | The sky's light, from above and from below, written in place by the game and read each frame |
| Stream beta | Many copies of a few vertices with no geometry, each a record of the caller's own, drawn by one instanced draw |
| StreamOptions beta | How a stream is made (Renderer.stream): its WGSL, its bindings, its record's layout, how many and how it blends |
| SunState beta | The sun: its light and its shadows, written in place by the game and read each frame |
| Sweep beta | How far shadows fall: the sun's way, the floor they fall to, and the farthest one is taken to reach |
| TextureBindingOptions beta | How a texture of group 1 is declared: one or an array of layers, and the kind of numbers it is sampled as |
| Uniforms beta | A block of uniforms of a kind's own: its floats, kept and written in place by who owns it; write sends them |
| VertexStream beta | A stream of a geometry's vertices beside their positions: its name in the geometry and its format. Four bytes or four shorts a vertex for what needs no more (uint8x4: a skin's joints, vec4u in a shader; unorm8x4: its weights, vec4f from 0 to 1; uint16x4: joints past 255): the geometry is then given a Uint8Array or a Uint16Array for the stream |
| ViewOptions beta | How a side view is made (Renderer.view): what it shows, its size, its camera, its shadows and passes |
| WorldState beta | The world's terms every material of the view applies after its own light |
Functions
| Name | What |
|---|---|
| addPlane beta | Adds a plane to a pass's; with a sweep, a shadow counts towards it as far as the sun's way goes into it |
| blendState beta | The card's state for a way of blending, as Babylon's engine had them: alpha (ALPHA_COMBINE), add (ALPHA_ADD: the source times its alpha, added), multiply (ALPHA_MULTIPLY), and premultiplied, which serves the first two from one shader: a fragment that writes rgb * a with a is laid over, with 0 it is added. untoned: laid over as premultiplied is, and the main view's alpha left the share of the pixel that is not its (a times less): the finish tone maps that share alone and leaves the rest as drawn (the words in the world: post/shaders.ts finish). For the main view alone, whose alpha is otherwise 1 throughout |
| boxOf beta | The box of a geometry's own points: least x, y, z, then greatest (none: zeros) |
| boxOut beta | Whether a box is out of a pass, its shadow with it |
| captureSize beta | How big a picture at a scale is: the canvas's pixels times it, no wider or taller than most (the client's viewCaptureSize) |
| cascadeBias beta | A cascade's matrix as the receivers read it (frame.cascades[c], at at in data), moved toward the sun by its bias: its rows are the light's axes scaled by the box's half width (x, y) and by its depth (z), so a world distance along the sun is that times the third row's length, and a texel is the box's width over the map's |
| copyOut beta | Whether copy i of a batch is left out of a pass: its sphere (spheres, four floats a copy) out of the pass with margin more, or, where small things stop casting (castsTo, a cascade's), farther from the eye than its own distance, or, cast into most cascades at most (a cascade's: BatchOptions.cascadesMost), in as many nearer ones already (fallsBefore). What the renderer's keep asks of each copy; the test renderer (testing.ts) asks the same |
| copySpheres beta | A sphere around each copy of a geometry (x, y, z, radius), from the copies' matrices and the geometry's own sphere |
| createCull beta | A pass's planes with none in use, room for the most a pass has |
| createReadView beta | A view to measure against, its planes, corners and axis zeros until setReadView sets them |
| createRenderer beta | A renderer on a canvas: WebGPU's device asked for, the view's, the cascades' and the picture's targets made; not drawing until start |
| createScreenStages beta | The stages with nothing asked of them |
| cross beta | The way across both a and b, as long as the area between them (a × b) |
| debugDrawOf beta | What Renderer.debug draws the view's batches as |
| debugPipeline beta | What a debug draw changes of a kind's view pipeline: the wireframe its topology, the overdraw its blend and depth |
| dot beta | a · b: how far one goes along the other, times the other's length |
| lookTo beta | A view from eye looking along forward |
| multiply beta | a then b |
| nearestRead beta | The nearest along the view any point of a box (its least and greatest corner) can be inside the view: Infinity where none of it is. Where the box cannot be nearer than below, something not less than below (its nearest corner), without working it out |
| normalized beta | a made of length 1, a new array (one of length 0 stays 0) |
| orthographic beta | A projection without perspective into out: the box from left, bottom, near to right, top, far onto the screen, depth 0 at near and 1 at far |
| paddedRow beta | The bytes a row takes in a buffer a texture is copied into: a multiple of 256 |
| partRuns beta | The runs of a geometry's parts a pass sees, into out as pairs (the first index, how many): parts side by side are one run. castsTo: parts farther than this from the eye are left out (small things in the shadows), each by its own distance over the last fade. Returns how many runs |
| patternTurn beta | How far the ordered patterns are turned in frame frames (the frame's frameTurn() in WGSL): an eighth a frame while the frames are blended (blended: the temporal blend on), so a pixel a fade leaves out is on its share of eight frames; 0 where they are not, the pattern standing still (it would flicker). The client's levelFadeTurn |
| perspective beta | A projection with perspective into out: fov the angle up and down in radians, aspect the width over the height, depth 0 at near and 1 at far |
| pictureStages beta | Which of the picture's passes run for settings, and into what, with what is there (PictureHas: a stage whose targets are not made yet is off that frame; the glow the layers drew is added by the finish). No card in it: what a chain's frame does each frame, and what a test asks of a look. A stage off draws nothing; the last that is on draws onto the screen (or the screen's stages); with none, the plain showing does |
| placeStale beta | Whether the place slot of a pass's kept copies (data, stride floats a place, the matrix first) must be written with the copy whose matrix is at from in matrices: a copy that stands where the one kept there stood is taken as the same (what moved is written, what did not is not sent again), but a place past the kept of the last frame holds nothing to go by: never written, its zeros pass for a copy at the origin (a mesh made in the world's own places, the water's, culled its first frame and never drawn after), or written before a touch it did not see. What the renderer's keep asks of each copy it keeps, unless the batch was touched (then every one is written) |
| processesPicture beta | Whether a look processes the picture: materials then give linear colours and the finish turns them to gamma |
| samplerBinding beta | A sampler at a place of group 1 |
| samplingKey beta | A sampling's key: the same sampling, the same sampler; what is left out the renderer's own |
| screenTakes beta | Whether the screen's stages take the picture this frame: something asked of them (a picture kept for a cut, a transition, a video, a blur, the frame). Where nothing is, there is no pass of theirs and the picture's last pass draws onto the screen (PictureHas.screen) |
| setReadView beta | The view of a camera with perspective at position, looking along z (of length 1), its right and up right, up (of length 1), half as wide as tanX and as high as tanY at a depth of 1, from near to far |
| sidePlanes beta | The four side planes of a view-projection (left, right, bottom, top; each a, b, c, d of length 1): what a pass culls by. Near and far are left out: nothing stands behind an RTS camera, and the far plane is past the map |
| sidesOf beta | The sides of a triangle list on the processor, as LINES_WGSL makes them on the card: for tests |
| smallCastsTo beta | The distance from the eye a small thing stops casting at: its own, between near - fade and near, the same every frame, so small things leave the shadows one by one and not along a line (the client's smallCastsTo) |
| sphereOf beta | The sphere around a geometry's own points |
| sphereOut beta | Whether a sphere is out of a pass: behind one of its planes, its shadow with it |
| sweepLength beta | How far along the sun's way the shadow of what reaches up to top falls: to the floor, longest at most |
| textureBinding beta | A texture at a place of group 1 |
| uniformBinding beta | A block of uniforms at a place of group 1 (var<uniform>) |
| unpackRows beta | The rows of a copy (row bytes each, the pixels first) as pixels one after the other, red first (swap: the copy's are blue first) |
Values
| Name | What |
|---|---|
| CASCADES beta | How many parts the sun's shadows are in |
| DEBUG_OVERDRAW beta | Renderer.debug: the overdraw |
| DEBUG_WIREFRAME beta | Renderer.debug: the wireframe |
| FRAME beta | What every kind's shader of the view's pass begins with: the frame's group (0) and what is read from it. The sun through its cascades (sunlit), the lamps (lamps), and the world's terms a kind applies in this order after its own light: worldHazeShare and the scene's fog, worldSpace, worldCloud, worldMist, worldFogOfWar. The light of a kind, as Babylon's standard material had it: the sky's and the sun's clamped to 1, the lamps' added after the clamp, all of it times the base colour: (clamp(hemi + sun) + lamps(at, normal)) * base. Colour spaces (the client's, spec-post-lights.md A.4). A kind lights with its colours as they are stored (gamma) and applies the scene's fog so. Then worldSpace turns the colour into the space the picture's passes work in: linear (pow 2.2) where the look processes the picture (tone mapping, exposure, contrast, a vignette: the finish turns it back), unchanged where it does not, as Babylon's materials did with and without its image processing. The clouds' shadows, the mist, the fog of war and whatever else a kind lays over (the ground's rings, the sky in the water) come after worldSpace, in the picture's space, their colours taken as that space's. worldOver(colour, at) is all of it in order for a kind with nothing of its own between. |
| FRAME_PARTS beta | The parts of the renderer's frame on the processor, in their order (FrameStats.cpu): the game's own frame (the callbacks of onFrame), the side views drawn with every frame, the main view's copies culled and kept, the picture's passes set up and the layers', the sun's cascades culled and kept, the frame's uniforms (the lamps binned with them), the copies sent to the card, and the frame graph encoded and submitted (Lite's) |
| LAYER beta | What every kind's shader of a layer begins with: the layers' group (0). A kind's own group (1) is its material's, as in the view's pass. A layer's vertex stage places a vertex as the view's does, by layer.viewProjection. |
| LAYER_GLOW beta | The glow's: the batch's colour (Batch.glow), which the fragment returns, times whatever of its own says where it shines |
| LAYER_OUTLINE beta | The outline's: after a copy's own record its mark comes in one more location (a vec4f), which the fragment returns through outlineOut |
| LAYER_VELOCITY beta | The velocity's: after a copy's own record its matrix of the frame before comes in four more locations. The vertex stage gives the place now and the place then, both without the jitter (layer.plain * now, layer.last * then), and the fragment returns velocityOut(position, now, was). |
| OUTLINE_STYLES beta | How many ways of drawing an outline there are at once |
| PLAIN_PICTURE beta | The picture as drawn, nothing done to it but the two smoothings: what a map with no look of its own has (the client's PLAIN_PICTURE) |
| POST_PASS_VALUES beta | How many floats a pass's own values are: four vec4f |
| POST_PASSES_AT beta | How many of a game's passes one place draws in a frame: the rest are not drawn (said by PostPass.drawn) |
| POST_PLACES beta | The places, in their order in the chain |
| SCREEN_VIDEOS beta | How many videos are drawn into the picture at once |
| SHADOW_BIAS_TEXELS beta | How far in front of what it sees a cascade's depth is read, in its texels along the sun's way: about Babylon's bias for the client's sun (0.001 of a cascade's depth, which its depthClamp fits round the cascade: two texels of a map of 2048, with a normal bias of 0.005 besides; three here, which has none, for no acne on a pine's needles). A share of the cascade's depth as it was (0.0008, times the cascade's number) was six times that and more: the cascades reach CASCADE_BEHIND behind their sphere, so a share of their depth is a long way, and what lies near what shades it (the needles of a pine under the ones above them) was not shaded: a pine lighter and flatter |
| STANDARD beta | The kind most things are: a colour, a picture, the sun and the sky. Flags: cutout, tinted |
| TRANSITION_KINDS beta | The transitions the stages draw themselves, by the number their shader takes |
Types
| Name | What |
|---|---|
| Binding beta | A declaration of one binding of a kind's group |
| BlendMode beta | How a blended draw is laid over what is behind it |
| CastsHook beta | Whether a thing casts its shadow, in code, over what the culling says (Caster.kept): nothing as it says |
| DataFormat beta | What a texel of a data texture is: a byte, four bytes, a float or four floats |
| DebugDraw beta | How a debug view draws the view's batches: as its sides (lines), each draw added (count), or as they are ('') |
| LayerName beta | The WGSL of the layers (layers.ts): what a kind's shader of each begins with, and the standard kind's own. |
| Mat4 beta | The renderer's matrices: 16 floats, the translation at 12..14, a point a row vector times the matrix. The layout the engine's world and the game's files use, and the one WGSL reads unchanged (mat4x4f of the four rows as its columns, m * v). Left-handed, depth 0 at the near plane and 1 at the far. |
| PictureStage beta | A pass after the view's, by its task's name, in their order |
| PostPlace beta | Where a game's pass goes among the picture's own: before which of them |
| StreamData beta | A stream's values: floats, or bytes or shorts for a stream of that format (VertexStream.format) |
| Vec3 beta | A point or a way: x, y and z, the first three of any array of numbers |