I wrote everything from scratch in javascript and webgl. You can check the entire source code of the article here: https://imadr.me/pbr/main.js
Beaware though, it's a 8000+ lines of code js file that is very badly organized, it's by no mean a reference for good quality code.
However I find writing everything by hand easier in the long term than using already existing libraries for example.
The code includes all the math functions, mesh primitive generation, shaders and even a sketchy text renderer using sdf fonts.
If I had to make it again I would use typescript, type errors were the biggest source of bugs.
Beaware though, it's a 8000+ lines of code js file that is very badly organized, it's by no mean a reference for good quality code. However I find writing everything by hand easier in the long term than using already existing libraries for example.
The code includes all the math functions, mesh primitive generation, shaders and even a sketchy text renderer using sdf fonts.
If I had to make it again I would use typescript, type errors were the biggest source of bugs.