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.

DarkBASIC Professional Discussion / How to use Change Mesh From Memblock?

Author
Message
Mistrel
Retired Moderator
20
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 18th Mar 2010 01:07
For the documentation rewrite (see here):
http://forum.thegamecreators.com/?m=forum_view&t=167219&b=1

I'm trying to write the description for "Change Mesh From Memblock" but I can't make any sense of it.

Would someone provide an explanation of what it's for, why it's useful, and how to use it, I would appreciate it.

If you post any code please comment each step of it so I can understand what each part does.

Visigoth
21
Years of Service
User Offline
Joined: 8th Jan 2005
Location: Bakersfield, California
Posted: 18th Mar 2010 08:10 Edited at: 18th Mar 2010 08:15
I think I have it, see this code snippet:



I suppose it could be useful if you have a dummy FVF object, and a bunch of objects as memblocks already loaded. Instead of creating new objects, maybe just changing them on the fly? One of those ones we have to play with for a bit, I think.
Mistrel
Retired Moderator
20
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 18th Mar 2010 09:18 Edited at: 18th Mar 2010 20:35
So the whole point of this command, if I understand correctly, is to:

* Free the memory allocated by the mesh
* Allocate memory for memblock to mesh copy
* Copy memblock data to mesh

The mesh now has the same data as the memblock.

That's it? I was anticipating something a little more.. I don't know.. amazing?

Thanks for the code and explanation, Visigoth.

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Mar 2010 15:36
I think you need to re-read Visigoths code. It updates the mesh from the memblock, it does not copy one memblock to another.

Mistrel
Retired Moderator
20
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 18th Mar 2010 18:52 Edited at: 18th Mar 2010 20:37
If the memory used to store the mesh is too small then it has to be deallocated and reallocated.

Unless I'm mistaken, it's a contiguous block of memory.

The process I wrote before was incorrect. I've corrected that.

So the point of this command then is to copy data from a memblock to a mesh without creating a new mesh ID?

Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 18th Mar 2010 22:41
Quote: "So the point of this command then is to copy data from a memblock to a mesh without creating a new mesh ID?"

If i understood it correctly it's the opposite: it copies data from a mesh to a memblock without creating a new memblock.

God is real unless declared integer.
Mistrel
Retired Moderator
20
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 18th Mar 2010 22:45 Edited at: 18th Mar 2010 22:45
Brendy boy, it's change mesh from memblock not to memblock.

Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 18th Mar 2010 23:06
Quote: "Brendy boy, it's change mesh from memblock not to memblock."

yeah, sorry, i wasn't reading carefully so i misunderstood it

God is real unless declared integer.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 19th Mar 2010 01:26
@Mistrel,
Yes, your summary is now correct
It moves data from the memblock into the mesh, where you can then potentially use it to add a limb to an object, update an existing object limb, or even create a new object.

Mistrel
Retired Moderator
20
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 19th Mar 2010 01:52
Thanks for confirming, Ian.

Login to post a reply

Server time is: 2026-07-26 23:41:03
Your offset time is: 2026-07-26 23:41:03