Chapter 42. Models variability (with GitHub)

Ok, time for a new GitHub repo.

The topic of this chapter is Models variability.

Of course, 1 single car model isn't enough for the Project. We'll need more. At least - in different colors. Creating a set of practically identical models with just different colors looks kind of wasteful. Instead, we can randomly customize models "on the fly", when loading.

So I added a new function in GameSubj class - onDeploy(), which will define for each deployed model it's own settings, such as colors, color schemas, options, such as open or closed roof, spare wheel placement (on the back or on sides), and so on, including optional fog lights, mirrors, signal lights. Like this:

Instructions on how to customize - in a separate file - ondeploy.txt.
Same XML format as in ModelLoader. Since it's a different set of tags for different purpose, I wrapped it in a separate class - ModelLoaderCmd.cpp/h. Works the same as ModelLoader.

2. Original model is 1:64 scale, but in this sample I rescaled it to 1:150 ("N scale"), which involved another new function in GameSubj - scaleMe(), which scales the subj itself, plus all it's "childs" and their attachment coordinates.

3. Also we have a bunch of changes from previous chapter.

So, here is a new repository (as promised earlier, now - leak-free):

https://github.com/bkantemir/_wg42

Again, instruction how to use it - in chapter 37.2.

Result:

Also, on each start it will be a different set.


Leave a Reply

Your email address will not be published. Required fields are marked *