Expand description
Part thumbnails: a small CPU rasterizer over the RenderScene’s display
meshes, the one picture producer that runs the same on native, in the
browser and in the headless bake worker (which has no GPU device at all).
The picture is the ViewCube’s ISO view (from +X+Y+Z, +Y up), orthographic,
fit to what is drawn, square, on a transparent background: Lambert shading
under a fixed light, a depth buffer, each body’s viewport colour (a face’s
colour, else its solid’s, else the name-hashed colour), and the display
edges drawn over it. It is supersampled SUPERSAMPLE× per axis and
averaged down, so silhouettes are anti-aliased.
capture copies what the picture needs out of the scene (cheap, on the
caller’s thread); render_png does the rest and is Send-safe, so a
native host can run it on a thread of its own. The PNG carries no text or
time chunks: the same scene gives the same bytes.
Modules§
- line_
art - The Line art step picture: a flat technical illustration, as assembly instructions draw a step (the instructions documents’ default style).
Structs§
- Body
- One body’s triangles, ready to draw.
- Capture
- What
render_pngdraws: an owned copy of the visible scene.
Constants§
- RENDERER
- The renderer’s version, stored beside each thumbnail on the server. Bump it whenever the picture for the same document would change, so a server can tell a thumbnail made by an older renderer.
- SIZE
- The default thumbnail edge, in pixels.
Functions§
- body_of
- One display’s body as
capturecopies it, whatever its visibility: hidden faces left out, in the viewport’s colours.Nonewhen no face is left to draw. - capture
- Copy the visible bodies out of
scene: every visible solid and committed sketch sheet, hidden faces left out, in the viewport’s colours. - embedded_
png - Portable preview carried by native CAD JSON. The image has no external URL.
- empty_
embedded - Empty documents and edits still rebuilding have an honest empty preview.
- render_
png - Render
captureas asize×sizeRGBA PNG.Nonewhen nothing is drawn (an empty document gets no thumbnail; consumers show their placeholder). - render_
png_ from render_pngfrom another direction:basis(right, up, toward the eye) in place of the ISO view’s, fit and lit the same way.- render_
rgba render_png’s pixels, before encoding:size² RGBA, row-major.- render_
rgba_ from render_png_from’s pixels, before encoding.
Type Aliases§
- Basis
- A view’s orthonormal basis: right, up, and the direction from the model toward the eye.