if you steal code then try to understand it too...
looks like this comes from irrlicht project,
https://searchcode.com/codesearch/view/22672766/