pach

hello everyone,
I'm a newbie here.

I want to open several X files with DirectX 9.0(C#),
and save them to one X file.

I loaded X with
Mesh mesh1 = Mesh.FromFile(strXPath1, MeshFlags.Managed, meshDevice, out mtrl);
Mesh mesh2 = Mesh.FromFile(strXPath2, MeshFlags.Managed, meshDevice, out mtrl);
¡­¡­
and wanted to save with following :
Mesh meshSave = new Mesh(iAdjNum,iVerticNum,MeshFlags.Managed,
CustomVertex.PositionNormal.Format, frm.device);
Mesh meshsave = Mesh.Save();


but I failed , Could someone give some tips. Thanks!!!!


Re: Game Technologies: General How to save several x files to one x file

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.







Re: Game Technologies: General How to save several x files to one x file

pach

Thanks !!!Etienne2005

But is there any .Net Documents/Help
For I'm not so familiar with c/c++.

I've searched over the internet, it seems I have to learn  DirectX /C++ to solve the problem.

Anyway , thank you. Merry Christmas!




Re: Game Technologies: General How to save several x files to one x file

Inaki Ayucar

Look in Managed DirectX docs.

Im pretty sure the Mesh class have some methods for saving to x files. (may be those methods are static. not sure right now).

You can merge the meshes into a single one and then save them.