3DXI Initialization

Before you can begin using 3DXI, it must be initialized by obtaining a pointer to the main IGameScene. The following code snippet is an example:

IGameScene * pIgame = GetIGameInterface();

You can also specify the coordinate space during initialization.

3DXI uses a system where the developer can define such coordinate system standards such as 3ds Max, OpenGL and DirectX. By default, the conversion manager defaults to the 3ds Max system which is a right-Handed system with Z-up and Y into the screen.

The developer can also define a custom system with the ability to set the handedness and principle axis orientation. The conversion manager ensures that all matrix and coordinate data is returned in the correct format without the need for further processing. The following code sets-up the conversion manager with the internal database ready to be used with data being converted to a DirectX format. It is now a simple case of enumerating the IGameNodes and extracting the data you need:

// pIGame is an IGameScene pointer

GameConversionManager * cm = GetConversionManager();
cm->SetCoordSystem(IGameConversionManager::IGAME_D3D);
Igame->InitialiseIGame(true); // true- we want selected only
Igame->SetStaticFrame(0);

The following code snippet show how to setup a user defined coordinate system:

UserCoord WhackySystem = {
    1, //Right Handed
    1, //X axis goes right
    4, //Y Axis goes in
    3, //Z Axis goes down.
    0, //U Tex axis is left
    1, //V Tex axis is Down
};

IGameConversionManager * cm = GetConversionManager();
cm->SetUserCoordSystem(WhackySystem);

You can also initialize 3DXI based on a set of INodes. If you do not wish to gather data from every node in the 3ds Max scene, you can initialize 3DXI based on a single node or a list of nodes by supplying the relevant INode(s). This provides you with an IGameScene, maintaining pointers only to the specified nodes. The following is an example:

Tab < INode *> interestingNodes;
Interface * ip = GetCOREInterface();

//use the 3ds Max SDL to provide access to the selected nodes.
INode* node;
for(int i=0;i<ip->GetSelNodeCount();i++)
{
    node = ip->GetSelNode(i);
    interestingNodes.Append(1,&node);
}

//pIGame is an IGameScene pointer
IGameScene * scene = pIgame->InitialiseIGame(interestingNodes,false);