Confusion when reading shader source code

I encountered two questions while studying babylon source code(very beautiful I have to say :laughing:).

  1. What does {X} means?

2. Why is there “[0…maxSimultaneousLights]”(looks like array) in this “includes”?

Those two are related:

#include<lightFragment>[0..maxSimultaneousLights]

means the lightFragment.fx file should be included maxSimultaneousLights times and for the first inclusion the {X} string will be replaced by 0, for the 2nd inclusion {X} will be replaced by 1, …, for the last inclusion {X} will be replaced by maxSimultaneousLights-1.

3 Likes