Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, Ayumi, AndrewAMD, Quad), 1,014 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 5 1 2 3 4 5
Merge 2 Meshes/Entities during game... #400632
05/05/12 07:22
05/05/12 07:22
Joined: Aug 2008
Posts: 394
Germany
Benni003 Offline OP
Senior Member
Benni003  Offline OP
Senior Member

Joined: Aug 2008
Posts: 394
Germany
Hello, I need to merge 2 Entities during game..
I think it should be possible to take the meshpointer of the one entity, take the meshpointer of the other and join them. Then I could set this new mesh to one of the entities. Both have the same skin. Then I also need to merge vertexes which habe the same positions. This is my theory, but in practice my experience in mesh manipulation is not good.
I think d3d9.h have some useful commands.
How can I code it? I would be so thankful for help!

Re: Merge 2 Meshes/Entities during game... [Re: Benni003] #400664
05/05/12 19:16
05/05/12 19:16
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
look into ent_buffers , ent_vertices.
ent_buffers wil give you access to the

triangles buffers (indices into vertices array ,3 vertices forms a triangle)
and the vertices buffers (an array of vectors-positions of vertices)

it will also return the amount of triangles in the triangle buffer
and ent_vertices if its a model will return you the amount of vertices

so you could also use ent_getmesh and ent_setmesh which deals with d3dmesh/buffers of your target meshes

if they are animated im not sure how that would be handled ,maby a parent and
child relationship (in model terms)

i guess theres more than one way to handle it(merging them)
depending on your situation but a start would be to look into those functions
theres also ent_status which would give you valuable information if you
need it..

if perhaps you could be more specific in details as to what you want
to achieve apart from merging meshes ,like are they animated or not etc etc


Compulsive compiler
Re: Merge 2 Meshes/Entities during game... [Re: Wjbender] #400665
05/05/12 19:27
05/05/12 19:27
Joined: Aug 2008
Posts: 394
Germany
Benni003 Offline OP
Senior Member
Benni003  Offline OP
Senior Member

Joined: Aug 2008
Posts: 394
Germany
Hello Wjbender, thanks for your answer. The Entities are not animated. I need it for a kind of wallcreation. I could also use many of entities, but this would damage the framerate, because the peaces are very small and there would be many entities needed. That's why I want to Merge meshes. In this point I would be grateful for some codeexamples, because I never programmed in meshmanipulation like this.

Re: Merge 2 Meshes/Entities during game... [Re: Benni003] #400686
05/06/12 09:51
05/06/12 09:51
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
i will see when i have time if i could perhaps code a function to help
you with this and then post the code up here if i succeed


Compulsive compiler
Re: Merge 2 Meshes/Entities during game... [Re: Wjbender] #400690
05/06/12 11:41
05/06/12 11:41
Joined: Aug 2008
Posts: 394
Germany
Benni003 Offline OP
Senior Member
Benni003  Offline OP
Senior Member

Joined: Aug 2008
Posts: 394
Germany
Ok, I'm waiting for learning from you wink

Re: Merge 2 Meshes/Entities during game... [Re: Benni003] #400715
05/06/12 17:03
05/06/12 17:03
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
I would need this too. EvilSOB put up a code to the forum some days or a week ago how to create a skinned d3d mesh and make an entity from it. it might be useful. (I had no time to really dig into it)


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Merge 2 Meshes/Entities during game... [Re: Benni003] #400750
05/07/12 09:36
05/07/12 09:36
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
this is as far as i can help you out

demo

note : this demo does not take entity rotation into account it uses
the rotation of the models file, and i dont know if the uv's are correct
i didnt test on textured models and also you will have to do the materials
i think but anyway i cant help any further than this...
Oh yes i forgot you have to take position in concideration
and offset vertices positions acordingly same for scale
if i am not mistaken


Last edited by Wjbender; 05/07/12 10:01.

Compulsive compiler
Re: Merge 2 Meshes/Entities during game... [Re: Wjbender] #400751
05/07/12 11:13
05/07/12 11:13
Joined: Aug 2008
Posts: 394
Germany
Benni003 Offline OP
Senior Member
Benni003  Offline OP
Senior Member

Joined: Aug 2008
Posts: 394
Germany
Thank you Wjbender for your help! Yes the Entities are merged! Now I will look into every line of code and try to understand.
Hope I can manage it with material and texture..
laugh

Re: Merge 2 Meshes/Entities during game... [Re: Benni003] #400755
05/07/12 12:06
05/07/12 12:06
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
in A7 I get an error message because of "pvertexdecl", it is said to be undeclared in the line of "D3DXCreateMesh(merged_triangles,merged_vertices,D3DXMESH_MANAGED,pvertexdecl,pd3ddev,&mesh1);"
but some dx things differs in A7 and A8, I can check by A8 only at home.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Merge 2 Meshes/Entities during game... [Re: sivan] #400763
05/07/12 14:27
05/07/12 14:27
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
I think MasterQ32 made soemthign similar. Just ask him laugh

Page 1 of 5 1 2 3 4 5

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1