VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
3.8 - The Object Parameter Database API

DtVrfParameterDb (vrfParamDb.h) is the base object parameter database class.

It holds a collection of DtVrfObjectParameters (vrfObjParams.h) entries, keyed on DtObjectType. It has member functions for adding, removing, and looking up DtVrfObjectParameters entries. It also includes an interface for load() and save(), but with an empty implementation. You can create derived types of object parameter database classes that know how to load and save themselves from file in whatever format you choose.

VR-Forces has one kind of derived DtVrfParameterDb type, DtMtlParameterDb (mtlParamDb.h). DtMtlParameterDb extends the base class by adding the ability to load from and save to DtReaderWriter (MTL) format. The DtMtlParameterDb class knows how to read and write object parameter database files in this format and in the (pre-VR-Forces 3.7) single file format.

The DtCgf class is responsible for creating the object parameter database object. By default, it creates an instance of type DtMtlParameterDb. You can override this behavior and have VR-Forces create some other kind of derived DtVrfObjectParametersDb. To do this, register a static creator function for the new kind of DtVrfObjectParametersDb with the DtDefaultVrfCreator (defVrfCreator.h) class before initializing the DtCgf, for example:

DtCgf cgf;
. . .
DtDefaultVrfCreator creator;
// Specify the base parameter database type, DtVrfParameterDb. This
// is the simplest kind of parameter database. It does not serialize
// itself to file in MTL format.
// Initialize the CGF, passing in our altered creator.
cgf->init(exerciseConn, &creator);

The example createParamDbDynamically demonstrates how to use a different type of object parameter database with VR-Forces.

[<< Control Objects] [Home] [Top of Page]


Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)