Hi,
in the current state of my engine, I have an interface called "IRenderable" and a bunch of classes implementing this interface.
The interface (being a pure virtual class) let's every derived class define it's own rendering logic. However, I don't like the fact that those classes know how to render themselves. Just imagine porting to another backend.
I am thinking of an another approach with cache locality in mind. I've created structures like the following:
struct Light{
enum class LightType{
SPOT;
DIRECTIONAL;
POINT;
} lightType;
union{
// ...
} lightData;
};
struct Mesh{
glm::mat4 worldMatrix;
int vertexBuffer;
int indexBuffer;
};
I want to feed the renderer with this data (which is possibly stored as a chunk of continous memory).
But I have no idea how to feed the renderer with this data. My naiv approach is/was to have methods which add those classes into a vector and a render method which processes over the structs.
TL:DR, the question:
However, I have no idea how a modern renderer is designed in C++. I never touched a C++ engine (yet).
All my projects involving large scale rendering where done using Unity (Drag'n'Drop the Mesh, done.). My 3D-demos were all written in C# using the "IRenderable" approach.
Are there any papers, blogs, articles (and what so ever) that can give me an impression on how to design a renderer?
LG Julien
P.S.: Before the "Dont-Make-Engine-Make-Games"-People declare Jihad against me, I'd like to mention, that I am simultaneously working on a game RTS game (does anyone remember the "Jungle Troll Mod" for WC3?)