Saturday, February 18, 2012

Progress Report

I have no fancy pictures of any moving textured objects yet, but there has been some progress.

I've realized that the way the code is structured in the DX11SDK tutorials simply won't do even as a starting point for a game engine, for a few different reasons..
First off, the triangles shown are defined and put into a vertex buffer in the InitDevice() function, and while we could change the triangles in some other function later, this would get rather messy, since the same kinds of things would be done at different places. Also, after Tutorial 5 we draw out two objects, but we actually only have one, we transform it and draw it at two places, but it's only one object. This is kind of a problem.

So we need to add something that manages different objects, where they're at, how large they are, what triangles they contain, how they are drawn, and so on. I *think* this is what's called a Scene Graph. We want to do these things in a separate file from the main .cpp, because in the main .cpp we will want to focus on handling events in the game.

So I'm restructuring all the code(not much code, but hey), making a class called TSceneGraph in a different .cpp file, that will do all of the above. This also means moving all the DX11 initialization to this TSceneGraph.
Inside this class I can create a variable that decides what API to use, making it possible to chose if I want it to initialize an OpenGL window or a DX11 window, while keeping track of all the objects separately from the API.
Making this new structure is kind of hard for me and requires some thought, and also, since I'm note really used to C++ anymore, lots and lots of compiling errors. To brush up I read about header file and source file standard practice here, and about class definition here. Hopefully, I'll have a rudimentary scene graph working soon.

I also found how to chose which pages to include or not in the menu, so from now on any tutorials will have their own pages, instead of posts, linked from the Tutorials page in the menu above, and from a list to the right.

No comments:

Post a Comment