From cbf7d23623b5bb2d2092cb6c86bc965138b4ea75 Mon Sep 17 00:00:00 2001 From: vimene Date: Tue, 3 Feb 2026 20:26:01 +0100 Subject: added mipmaps for the hw renderer, improvements 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 --- src/shaders/simple_shaders.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/shaders/simple_shaders.cpp') diff --git a/src/shaders/simple_shaders.cpp b/src/shaders/simple_shaders.cpp index ebbec31..af7bb79 100644 --- a/src/shaders/simple_shaders.cpp +++ b/src/shaders/simple_shaders.cpp @@ -1,10 +1,22 @@ #include "shaders/simple_shaders.hpp" +#include +#include +#include +#include "math/vector.hpp" #include "math/mat4.hpp" using namespace engine::shaders; -using engine::math::Matrix4; +using + engine::math::Vector4, + engine::math::Matrix4; -SimpleShaders::SimpleShaders(int w, int h, unsigned char* pixels) : w { w }, h { h }, pixels { pixels } { +SimpleShaders::SimpleShaders(int w, int h, unsigned char* pixels) : w { w }, h { h }, pixels {} { + this->pixels.reserve(w * h); + for (size_t i = 0; i < static_cast(w * h); i++) { + [&](std::index_sequence) { + this->pixels.emplace_back(static_cast(pixels[i * 4 + j]) / 255.f ...); + }(std::make_index_sequence<4> {}); + } } void SimpleShaders::set_view(const Matrix4& view_mat, const Matrix4& proj_mat) { -- cgit v1.2.3