|
| | WireFrame3D () |
| | Creates an empty wireframe renderer.
|
| |
| | WireFrame3D (size_t viewportWidth, size_t viewportHeight) |
| | Creates a wireframe renderer with the specified viewport size.
|
| |
| | WireFrame3D (ISurface< RGB_T > &surface) |
| | Creates a wireframe renderer with the dimensions of the given surface.
|
| |
| void | setViewport (size_t viewportWidth, size_t viewportHeight) |
| | Sets the viewport size used for projection and depth buffering.
|
| |
| bool | begin () |
| |
| size_t | viewportWidth () const |
| | Returns the current viewport width.
|
| |
| size_t | viewportHeight () const |
| | Returns the current viewport height.
|
| |
| void | setCamera (const Camera &camera) |
| | Sets the active camera.
|
| |
| const Camera & | camera () const |
| | Returns the active camera.
|
| |
| void | setPerspective (float fovYDegrees, float nearPlane=0.1f, float farPlane=100.0f) |
| | Sets a perspective projection using the current viewport aspect ratio.
|
| |
| void | setOrthographic (float left, float right, float bottom, float top, float nearPlane=0.1f, float farPlane=100.0f) |
| | Sets an orthographic projection volume.
|
| |
| const Mat4 & | viewMatrix () const |
| | Returns the current view matrix.
|
| |
| const Mat4 & | projectionMatrix () const |
| | Returns the current projection matrix.
|
| |
| void | clearDepthBuffer () |
| | Clears the internal depth buffer.
|
| |
| bool | projectPoint (const Vec3 &point, int16_t &screenX, int16_t &screenY, float &depth, const Mat4 &model=Mat4::identity()) const |
| | Projects a world-space point into screen space.
|
| |
| void | renderWireframe (ISurface< RGB_T > &target, const Mesh &mesh, const Mat4 &model=Mat4::identity(), RGB_T color=RGB_T(255, 255, 255), bool clearDepth=true) |
| | Renders a wireframe mesh with minimal depth buffering.
|
| |
|
| static Vec3 | transformPoint (const Mat4 &matrix, const Vec3 &point) |
| | Transforms a point by a matrix and divides by w when possible.
|
| |
| static Mat4 | translation (float x, float y, float z) |
| | Creates a translation matrix.
|
| |
| static Mat4 | scaling (float x, float y, float z) |
| | Creates a scale matrix.
|
| |
| static Mat4 | rotationX (float radians) |
| | Creates a rotation matrix around the X axis.
|
| |
| static Mat4 | rotationY (float radians) |
| | Creates a rotation matrix around the Y axis.
|
| |
| static Mat4 | rotationZ (float radians) |
| | Creates a rotation matrix around the Z axis.
|
| |
| static Mesh | cube (float size=1.0f) |
| | Creates a wireframe cube centered at the origin.
|
| |
| static Mesh | axis (float length=1.0f) |
| | Creates RGB-style axis lines centered at the origin.
|
| |
| static Mesh | grid (size_t subdivisions=10, float spacing=1.0f) |
| | Creates a wireframe grid on the XZ plane.
|
| |
| static Mesh | sphere (float radius=1.0f, size_t latitudeSteps=8, size_t longitudeSteps=12) |
| | Creates a wireframe sphere centered at the origin.
|
| |
| static Mat4 | lookAt (const Vec3 &eye, const Vec3 &target, const Vec3 &up) |
| | Creates a view matrix from camera parameters.
|
| |
|
| static float | dot (const Vec3 &first, const Vec3 &second) |
| |
| static Vec3 | cross (const Vec3 &first, const Vec3 &second) |
| |
| static float | length (const Vec3 &vector) |
| |
| static Vec3 | normalize (const Vec3 &vector) |
| |
| static Vec3 | transformAffine (const Mat4 &matrix, const Vec3 &point) |
| |
| static Mat4 | createPerspectiveMatrix (float fovYDegrees, float aspect, float nearPlane, float farPlane) |
| |
| static Mat4 | createOrthographicMatrix (float left, float right, float bottom, float top, float nearPlane, float farPlane) |
| |
| static bool | clipLineToPlane (Vec3 &start, Vec3 &end, float planeZ, bool keepLessEqual) |
| |
template<typename RGB_T = RGB565>
class tinygpu::WireFrame3D< RGB_T >
Lightweight 3D wireframe renderer for TinyGPU drawing targets.
WireFrame3D implements a compact CPU-side 3D pipeline intended for embedded and Arduino-style environments where a full 3D engine would be excessive. It stores no scene graph of its own; instead, it provides the math and rendering steps needed to transform user-supplied mesh data into 2D line output on any ISurface-compatible surface.
The class covers the main stages of a simple wireframe renderer:
- 3D vector and 4x4 matrix operations
- model transforms such as translation, scaling, and rotation
- camera setup via a look-at style view transform
- perspective or orthographic projection into screen space
- minimal per-pixel depth handling for overlapping wireframe edges
Meshes are represented as vertices plus edge lists, which keeps memory usage predictable and makes the class suitable for simple geometry such as cubes, spheres, axes, grids, and custom debug or UI visualizations.