4 registered members (dBc, clonman, TipmyPip, 1 invisible),
18,936
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: export all entities to obj
[Re: Dooley]
#459896
06/10/16 11:21
06/10/16 11:21
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
OP
Serious User
|
OP
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
The big limitation in my script is that it can only export the specific model. It actually exports a few different models, but they are all based on the same mesh, so they have the same triangle arrangements and number of vertices...
But it does do the thing you are looking for, it combines them all into one large mesh. , that is indeed a big limitation. But perhaps I can learn from your posted code so I can fine tune the obj export code. So tnx for uploading, it will take some time to let it all sink though. 
|
|
|
Re: export all entities to obj
[Re: Dooley]
#459948
06/12/16 22:51
06/12/16 22:51
|
Malice
Unregistered
|
Malice
Unregistered
|
Hi, I know I'm just jumping in here a bit under-informed. However, D3D 9 haves it's own ability to take a 3d entity running in it's dx framework and save it as a X(file). Why not save the entity as a X and convert it off-side to obj? DX9 D3d link https://msdn.microsoft.com/en-us/library/windows/desktop/bb205428(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/bb205428(v=vs.85).aspx
Last edited by Malice; 06/12/16 22:52.
|
|
|
Re: export all entities to obj
[Re: Dooley]
#459953
06/13/16 01:45
06/13/16 01:45
|
Malice
Unregistered
|
Malice
Unregistered
|
TOP EDIT -> Finally read the whole thread. Sorry my posts don't really go on topic and add value to the thread. I see the export problem was solved it's just materials at issue. Also what I provided below helps these problem in no way. Sorry Well I'd have to try it first to tell you, but steps( in my thinking) 1)run http://www.conitec.net/beta/ent_mesh.htman get mesh //-> Might need to grab the material separate 2)run this command Same MS DX9 link from the above post 3)exit engine 4)open converter 5)convert saved X file to OBJ(or other format)? or vice-versa EDIT -> Well it's taking me away from other things but... The function is in the d3dx9.h. It's commented out(I don't know why), so if you try to run it you get a error. Un-commenting fixes one error only to lead to another about a syntex error.Fixing that one lead me to another syntex error. fixing the second lead me to a third syntex error... It's there in dx9 and partly there in the engine, but I've no idea how to get it up and running. If I did your code would look like thtis.
#include <acknex.h>
#include <default.c>
#include <d3d9.h>
function main()
{
// ..... The basic sart to main here
ent_dBox=ent_create("grass.mdl", vector(0,0,25),NULL);
if(key_g)
{
while(key_g)
wait(1);
ID3DXMesh* m_pMesh; // Mesh object to be saved to a .x file
D3DXMATERIAL* m_pMaterials; // Array of material structs in the mesh
DWORD m_dwNumMaterials; // Number of material structs in the mesh
DWORD dwFormat = 1; // Binary-format .x file (default)
// MALICE COMMENTED// DWORD dwFormat = D3DXF_FILEFORMAT_TEXT; // Text-format .x file
// Load mesh into m_pMesh and determine values of m_pMaterials and
// m_dwNumMaterials with calls to D3DXLoadMeshxxx or other D3DX functions
// ...
m_pMesh=ent_getmesh(ent_dBox,0,0);
D3DXSaveMeshToX(
L"outputxfilename.x",
m_pMesh,
NULL,
m_pMaterials,
NULL,
m_dwNumMaterials,
dwFormat );
}
wait(1);
}
}
That's kind of simple really... if it worked at all
Last edited by Malice; 06/13/16 04:13.
|
|
|
|