The GlobalState contains parameters which describe the current state of the program as a whole. Since these common parameters need to be accessed by every other class within the program, with the exception of the VoxelData class, they need to be encapsulated in a single class with a global scope. These parameters, which include current drawing color, 2D slice brightness and contrast, and current toolbar mode, cannot be directly accessed or changed by other classes; instead, each parameter has its own Get and Set function that not only reads or changes the value of the given parameter, but also takes care of any other changes that might be necessary should that value be changed. In this way, other objects can be made aware of changes in the GlobalState.
GlobalState also now includes an instance of the MeshOptions class. The MO class instance is placed in the GlobalState class because we want the MO class information to be simultaneously active with GlobalState information. The GlobalState object is instantiated during the call to main(), in the primary source, Main.cpp, which also starts up the GUI.
By constructing a GlobalState object, we construct a MeshOptions object with the default parameters, which results in a valid set of rendering parameters, that can be changed at any time during program execution. This maintains the integrity of the object through runtime, by making usage valid from all levels of abstraction at all times, since the accessor functions will maintain the object's integrity.
For any information on the members/classes that MeshOptions entails, click on the MeshOptions link in the sidebar
or click here