Original Post
I am new to DirectX and have been reading quite a few books and online tutorials. Most start by describing how to create a simple, one window application to render a simple object such as a box. Generally, the code is contained in a single file and often in a single C++ class. For more complex software with lots of windows and objects, I was looking for some guidance on how to organize one's C++ code.
For example, consider input layouts. In the tutorials there is usually only one (or maybe two) globally defined input layout to describe corresponding vertex layouts. Would it be more common for vertex layouts to vary by object? A simple box might use one vertex layout while a more complex object might be rendered using several vertex layouts. I suppose the same could be said for the type of topology being employed as well as lighting or other elements.
If a C++ class is used to represent a type of object, would it be good practice to include vertex layouts, topology, etc. with the object? Or is it the case that these elements usually are set during application initialization and don't vary from object to object? I'm not looking for a hard rule to follow. I was just curious to learn what others do when writing software that is more complex than introductory tutorials.
For example, consider input layouts. In the tutorials there is usually only one (or maybe two) globally defined input layout to describe corresponding vertex layouts. Would it be more common for vertex layouts to vary by object? A simple box might use one vertex layout while a more complex object might be rendered using several vertex layouts. I suppose the same could be said for the type of topology being employed as well as lighting or other elements.
If a C++ class is used to represent a type of object, would it be good practice to include vertex layouts, topology, etc. with the object? Or is it the case that these elements usually are set during application initialization and don't vary from object to object? I'm not looking for a hard rule to follow. I was just curious to learn what others do when writing software that is more complex than introductory tutorials.