28. Strstr()

KMP Algorithm, Pre-compute and create the suffix equal to prefix table Next. Then if mismatch, run back the pointer of needle string according to the prefix table on the mismatch place. (e.g. misma...

PBR Based Specular Reflection

Demo: When a light hit on the surface of an object, it could be separate into three parts: a. Specular reflection; b. Diffuse reflection; c. Absorbed by the surface.  Specular and diffuse refl...