Expand description
Geometry shared by the viewer and the thumbnail renderer: welding duplicate vertices, face and smooth normals, feature edges, the measurements Eagle’s viewer lists, and the lighting both draw with.
Structs§
- Stats
- What Eagle’s model viewer lists under Details.
Constants§
- AMBIENT
- Ambient and directional light strengths (0x88 / 255).
- DIFFUSE
- SHININESS
- SPECULAR
- The highlight’s strength and sharpness.
Functions§
- add_
light shade’s result with the surface’s own light added, in display values as in Eagle’s viewer.- back_
to_ front - The order to draw see-through parts in: the indices of
centers, farthest from the cameravp(projection times view) first. - bumped
- The normal
ntilted by a height field that changes bydh(per unit of u, per unit of v) in picture coordinates, on a surface as innormal_mapped: Mikkelsen’s surface gradient, heights in the model’s units. - center
- The middle of the box around the vertices of
meshthat triangles use. - face_
normal - The unit normal of the triangle (a, b, c), counter-clockwise front; zero for a degenerate triangle.
- feature_
edges - The edges to draw for Eagle’s “Show Edges”: the segments where the
faces on either side meet at more than
threshold_degdegrees, plus the open edges with a face on one side only. Edges inside a flat area (the diagonals of a triangulated quad) are left out. - is_
closed - Whether every edge of the mesh is shared by exactly two triangles that run along it in opposite directions: a closed, consistently wound surface, the only kind with a volume.
- normal_
mapped - The normal
nturned by a tangent-space normal map’s stored valuestexel(0..1, green up in the picture), on a surface where going alongq0moves the picture coordinates (u right, v down) byst0and going alongq1byst1. No tangents are stored: the frame comes from those differences, as in Schüler’s “Normal Mapping Without Precomputed Tangents”.ncomes back alone where the coordinates don’t change. The shader in the app computes the same from screen derivatives. - shade
- The lighting of Eagle’s viewer: a grey ambient light and a grey
directional light shining from the camera, each at 0x88 (0.533), with a
faint highlight. Both sides of a face are lit.
nis the unit normal,to_eyethe unit direction from the surface to the camera,basethe surface colour; the result is a display colour in 0..1. The WGSL shader in the app computes the same thing. - smooth_
normals - One normal per vertex for smooth shading: the file’s own normals when it has them, otherwise the area-weighted average of the faces meeting at the vertex’s place (welded, so a corner repeated per triangle still shades smoothly).
- stats
- weld
- For each vertex of
positions, the index of the first vertex at exactly the same place. Formats such as STL repeat a corner for every triangle that uses it; welding lets them share normals and edges.