Decided to roll my own PWM adjustable SMPS BCCC (Buck Converter Constant Current mode) for an LED project I've been having troubles getting to work trying to hack CV mode SMPS modules. This is about as basic as it can get without losing regulation.
You may get better results and maybe cheaper if using a comparator and one NPN transistor to drive the MOSFET gate.
A few caveats if trying to build a physical version:
It's likely to be less than 80% efficient. (I don't mind).
Proper design techniques and component selection should be used with a >= 2x safety factor to ensure longevity. Keep all high current traces short and wide as possible.
There is an effective "soft-start" function to limit inrush current. This soft start feature is a function of your PWM filter network. (upper right quadrant). It provides a fairly steady Vref to the comparator.
I've modified the MOSFET to act more like a real high power MOSFET with 3x more width. The logic AND gate is required to regulate the width of the pulse to the MOSFET.