|
scimesh 0.3.4
Headless CPU-only 3D software renderer for scientific mesh visualization
|
Internal helpers of the text renderer. More...
Functions | |
| void | render_text_layers (const std::vector< TextNodeRef > &layers, Image &output, const Mat4 &view_projection, float pixel_scale, const std::vector< float > &z_buffer, const Color &default_color) |
| Draw all text layers into an already rendered image. | |
| Vec3 | hermite_segment (const Vec3 &p0, const Vec3 &p1, const Vec3 &m0, const Vec3 &m1, double h, double s) |
| Cubic Hermite basis evaluation of a single curve segment. | |
| size_t | segment_count (size_t num_points, bool closed) |
| Number of segments a sampling function has to emit. | |
| size_t | next_index (size_t i, size_t num_points, bool closed) |
Index of the point after i, wrapping around for closed curves. | |
| int | sample_count (int samples_per_segment) |
| Clamp a requested sample count to at least one. | |
Variables | |
| constexpr size_t | kMinPathPoints = 2u |
| Minimum number of points that can describe a path. | |
| constexpr double | kMinKnotInterval = 1e-6 |
| Smallest knot interval, to keep a degenerate point pair from producing a zero-length interval (and a division by zero). | |
| constexpr double | kArcLengthEpsilon = 1e-9 |
| Tolerance used when deciding whether an arc-length sample coincides with the end of a path, relative to the total path length. | |
Internal helpers of the text renderer.
Everything in this namespace is an implementation detail: it is only public because the renderer lives in a different translation unit. Use TextLayer with a Scene (or draw_text()) instead.
|
inline |
Cubic Hermite basis evaluation of a single curve segment.
Evaluates P(s) for one segment of a cubic Hermite curve, given the two endpoint positions, the two endpoint derivatives m0/m1 with respect to the curve parameter t, and the length h of the parameter interval that the segment spans (h = t1 - t0, so that the derivative is rescaled to the local s in [0, 1]).
This is the single evaluation kernel behind hermite_path(), catmull_rom_path() and the endpoint handling of both: the other functions only differ in how they come up with m0/m1 and the knot sequence.
| p0,p1 | Segment endpoint positions. |
| m0,m1 | Segment endpoint derivatives (dP/dt). |
| h | Parameter interval length of the segment. |
| s | Local parameter in [0, 1]. |
s. | void scimesh::detail::render_text_layers | ( | const std::vector< TextNodeRef > & | layers, |
| Image & | output, | ||
| const Mat4 & | view_projection, | ||
| float | pixel_scale, | ||
| const std::vector< float > & | z_buffer, | ||
| const Color & | default_color | ||
| ) |
Draw all text layers into an already rendered image.
Called by the renderer at the end of the render pipeline, where the view projection matrix and the depth buffer of the current frame are known.
| layers | The text layers to draw, in order. | |
| [in,out] | output | The image to draw into (supersampled resolution). |
| view_projection | The combined projection * view matrix of the frame. | |
| pixel_scale | Supersampling factor the image was rendered with. | |
| z_buffer | Depth buffer of the frame (empty disables depth testing); must have width * height entries. | |
| default_color | Color for labels without an explicit color. |