Etienne2005
If you have the SDK the StateManager in the C++ sample use a X file to read many other x file
The file is called scene.x
You can see that it's many Frame (Matrix) store with the name of a X file
To save this you probably need the other way to save X file, with Object that you create with template
This work by creating the Data Object of the small element and putting them into the container element
Then you save the final Container to disk...all this is not very easy stuff...for simple scene you should simply code
a simple file
ID3DXFileSaveObject
Applications use the methods of the ID3DXFileSaveObject interface to write a .x file to disk, and to add and save data objects and templates.
ID3DXFileSaveObject Members
Method |
Description |
AddDataObject |
Adds a data object as a child of the ID3DXFileSaveData object. |
GetFile |
Gets the ID3DXFile interface of the object that created this ID3DXFileSaveObject object. |
Save |
Saves a data object and its children to a .x file on disk. |
Remarks
Templates are not required in every file. For example, you could put all templates into a single .x file rather than duplicating them in every .x file.
The ID3DXFileSaveObject interface is obtained by calling the CreateSaveObject method.
The globally unique identifier (GUID) for the ID3DXFileSaveObject interface is IID_ID3DXFileSaveObject.
The LPD3DXFILESAVEOBJECT type is defined as a pointer to this interface.
typedef interface ID3DXFileSaveObject *LPD3DXFILESAVEOBJECT;
Requirements
Header: Declared in D3dx9xof.h.
Import Library: Use D3dx9.lib.