On today’s hardware you can’t render anything but solid-colored screens without a shader, so yes, technically the shader is doing all the rendering.
But not the shader
class. That’s absurd.
However by having a PointLight structure as part of your mesh class you aren’t doing much better. Lights might be part of a model file, but they’re only there to hand off that light data to the scene manager upon loading. The scene graph will keep your headlights attached to your bones and the scene manager will make sure the light’s shadows get generated and that objects not affected by it are culled from its rendering influence—you don’t need any part of the mesh class dedicated to managing the light at all.
It’s a common mistake to assume that meshes are
the source of all renderings in a game. They aren’t. Procedural skies, terrain, foliage, water, volumetric fog, etc., are not “meshes”. So to say that a light has any special relationship to meshes is also to somehow imply that they don’t have relationships with terrain or water or grass.
It should become clear that anything your mesh class is doing with lights would have to be duplicated for your ocean class and your terrain class, and that kind of duplication is always a clue that something is wrong with your design.
How does handling mutple light sources get managed inside a game is the bottom question,
After the scene files have been loaded and all the lights (from the terrain files, the model files, the scene files, etc.) are registered with the scene manager, the scene manager can then decide during the rendering process which lights to activate (which works the same way as in Direct3D or OpenGL—your graphics module has light settings that you can activate to enable a light, change its color, etc., which will be sent to the shader during the actual render) based on closeness to the player, influence on objects (don’t draw an object with a light activated if that light does not affect that object (this applies to forward rendering; deferred rendering has a different set of culling optimizations to be performed)), etc.
L. Spiro