This is an addition to excisting code that is already present in the Cycles Vector Math node. The same can be done with current nodes (separate/combine xyz + math nodes) but is not user friendly if you need many calculations. Hence I altered the vector math node. Power and square root could easily be added to this node but I have not found any use cases for it so I refrain from it. I tested it in Cycles by creating a blinn specular calculation behind an emitter node.
The only thing that I could not understand is this code:
\intern\cycles\test\render_graph_finalize_test.cpp
I presume this is for testing and not necessary.
\intern\cycles\render\constant_fold.cpp
In the "void ConstantFolder::fold_vector_math(NodeVectorMath type) const" I suspect that the multiply and divide should be contained but I do not quit understand the code before me because it feels like it is not coherent. Please imply if I have to change this.
Thanks in advance.