diff options
| author | vimene <vincent.menegaux@gmail.com> | 2026-02-03 20:26:01 +0100 |
|---|---|---|
| committer | vimene <vincent.menegaux@gmail.com> | 2026-02-03 20:26:01 +0100 |
| commit | cbf7d23623b5bb2d2092cb6c86bc965138b4ea75 (patch) | |
| tree | 7234b255b871cecca24aadc03c8d0857202f48e4 /src/renderer.cpp | |
| parent | 0d10b77f77459333c5549711334f417623ab1f3e (diff) | |
| download | engine-cbf7d23623b5bb2d2092cb6c86bc965138b4ea75.tar.gz | |
This commit add mipmaps, but for now, mipmaps are generated on the gpu
at runtime. We should generate them in advance.
- added mipmaps for the hardware renderer
- renamed stb_image.c to stb_image.cpp
- add compiler flag to stb_image.cpp to prevent warning
- added pipe notation for various objects to have all clipping functions
be left to right. We need this for the time being because dot notation
would considerably complicate the current implementation
- small improvements
Diffstat (limited to 'src/renderer.cpp')
| -rw-r--r-- | src/renderer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/renderer.cpp b/src/renderer.cpp index 9447119..3cd721d 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -51,8 +51,8 @@ enum class TriangleSide { top, bottom }; template<FrameBufferConcept FrameBuffer, ShadersConcept Shaders> void Renderer<FrameBuffer, Shaders>::draw_triangle(const Triangle& triangle) { - const auto& polygon = engine::o3d::polygon::div_by_w(engine::o3d::polygon::from_triangle_derived(triangle.to_derived()).clip_z(0.f, 1.f)); - if (engine::o3d::polygon::signed_area_xy(polygon) >= 0) return; + const auto& polygon = (triangle.to_derived() | engine::o3d::polygon::ToPolygon()).clip_z(0.f, 1.f) | engine::o3d::polygon::DivByW(); + if ((polygon | engine::o3d::polygon::SignedAreaXY()) >= 0) return; const auto& [final_triangles_count, final_triangles] = polygon.clip_xy(-1.f, -1.f, 1.f, 1.f) .map_xy({ -1.f, -1.f }, { 1.f, 1.f }, { -.5f, -.5f }, { static_cast<float>(fb.width()) - .5f, static_cast<float>(fb.height()) - .5f }) |
