Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] Creating a 3D Object with MemBlock Meshes

Author
Message
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 10th Jul 2018 18:43 Edited at: 10th Jul 2018 18:49
I'm trying to dynamically create a 3D object with Memblock meshes.
However, I need to be able to position the meshes inside the new 3D Object.
How do I offset/set the Position of a mesh inside of a Memblock?

Essentially I'm trying to combine several Clones of a 3D Object into a single 3D Object.
Make a forest 3D Object out of a tree 3D Object for example.



Looks like I could use SetMeshMemblockVertexPosition( memID, vertexIndex, x, y, z ) to offset all of the vertices.
However how do I get the vertex count of any given 3D Object or Mesh?

The author of this post has marked a post as an answer.

Go to answer

Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 10th Jul 2018 19:33 Edited at: 10th Jul 2018 19:35
This post has been marked by the post author as the answer.
From the documentation of CreateMemblockFromObjectMesh

"The first 4 bytes of the memblock represent the number of vertices in the mesh. "

So you use NumVertices = GetMemblockInt(blk,0)


There are other issues with what your doing there...in that your creating new meshes....rather than puttin all the trees into one mesh which is really what you want. plus you would need to copy the vertices and the indices to do it correctly. your also creating "Thememblock" then deleting it over and over again when you dont need to.
Santman
13
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 10th Jul 2018 22:00
Seems the whole world of AppGameKit suddenly discovered memblock meshes. Lol.
puzzler2018
User Banned
Posted: 10th Jul 2018 22:03
and thats fantastic - it the way to go..

just got to get our own memblocks organised
Nieb
10
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 11th Jul 2018 08:34
Thank you very much Bengismo, that is exactly what I was looking for.
I must have missed it in that wall of text.

Yes, that example code is pretty bad. I might post what I came up with at some point.

Login to post a reply

Server time is: 2024-11-23 17:52:29
Your offset time is: 2024-11-23 17:52:29