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 / Make basic custom objects (plains...) using memblocks?

Author
Message
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 14th Sep 2010 16:39
First, i would like to know if it is possible:

The many places i could use the stuff just keep popping up, but right now i would use it for making / deforming a custom, just a couple poly plain object to fit the terrain's shape, wherever it is placed to.

I'm aware of there is a memblock command which stands for making an object from memblock(s), and i'm not crying for a function which would determine the vertices world XYZ position, and overall a full program to be written for me.

I just would like you experienced guys to give me the answer for 'is it possible?', or 'is that command for this kinda tasks?'...

So i won't pull out all my hair for nothing.

Of course if someone could place a little example here on just how to start, for example what are the first bytes for an object, as i know for image it is WIDTH, HEIGHT, and DEPTH, but for an object i have no idea. Or a snippet which builds a single polygon...

This memblock topic seems a really powerful thingy but the info about it is painfully sho... nothing really...
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 14th Sep 2010 17:01
Well, not sure how you would go about doing that myself, but you can find out an objects size with get object size x etc. but yes for someone who knows how to alter vertex points (not looked into it myself), it should be possible.

http://s6.bitefight.org/c.php?uid=103081
MSon
22
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 14th Sep 2010 17:04 Edited at: 14th Sep 2010 17:06
By creating a mesh of an object, you can manipulate it, did a quick search and found this one example, but if you do more searching on this site, i remember there being full examples on manipulating a mesh, if this is what you ment?.

http://forum.thegamecreators.com/?m=forum_view&t=167453&b=1

Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 14th Sep 2010 17:36
Since we are talking about a very simple plain with let's say 1 to 20 polygons in a single row, i think it could be completely generated inside DBP. Correct me if i'm wrong.
Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 14th Sep 2010 18:49
yes, it's possible. i was doing it a long time ago for one of the coding challenges, constructing a model with memblock code. never finished it though. what i do remember is that the first few dwords had something to do with how many vertices there were going to be and what format to use. and then from there you just write dwords for the x,y,z of each vertex, and a polygon is constructed for every 3 vertices you make. code stopped working after a while though (updates) so something's changed, i don't know what. that's all i have to say.


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 14th Sep 2010 19:25
Thank you not enough to get going though - at least for me since i spent countless hours even following tutorials for image editing with memblocks without any success - but now at least i can count with the fact that once, i'm gonna be able to do it.

Maybe somebody currently into these things who could provide some more specific help?

Also anybody could enlighten us about the issue about what kind of (massive?) changes have been done to memblocks over time?
MSon
22
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 14th Sep 2010 20:52
i dont know how to create one using a memblock, but this is a function from my editor used to convert a darkbasic object to .x format, shows how to read vertex data, if you change Get to Set then you can manipulate the object, it also shows you the format used to create .x format objects, usually if i want to create an object, then is how i would do it, but i do believe memblocks would be faster.



Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 14th Sep 2010 21:11
Here are some functions for creating meshes using memblocks:



29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 15th Sep 2010 01:32
In addition to Brendy Boy's post, it is entirely possible to make an object from a memblock in DBP. I've been doing this in DBC for a few months now:

http://forum.thegamecreators.com/?m=forum_view&t=164244&b=10

Scroll down to the bottom of the post and there's a screenie showing the models that I've created in DBC.

If you don't have access to DBC then here's a simple DBP demo that constructs a triangle using a memblock. Sorry it's not more impressive and the coding is a bit brutal but I'm still getting to grips with DBP.




One thing to be careful of is that the inbuilt object commands are using a different FVF format (FVF format = 274 and vertex element size = 32) to that described in the help files (FVF format = 338 and vertex element size = 36). The inbuilt objects don't have any diffuse data. I've used the same format as the inbuilt objects.

Happy coding.
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 15th Sep 2010 09:14
Thank you!!!
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Sep 2010 15:59
... or you can avoid using memblocks altogether by creating an object (from my plug-ins - MAKE OBJECT NEW) with the correct number of vertices and using DBPro's built-in vertex commands to construct your object.

Using other commands from the same plug-in, it's also possible to construct multiple-limb objects.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 15th Sep 2010 19:40
Which method do you think would be faster Ian - using memblocks to "constantly build a new custom object / delete the previous state" , or building / loading in a custom plain once, and manipulating its vertices? (also per every frame...)
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 15th Sep 2010 19:42
To that last bit: "manipulating its vertices?" - i meant with the built-in vertex commands, NOT memblocks.
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 15th Sep 2010 19:45
Oh, a critical little detail: when placing vertices with memblocks object creation, are the required coordinates local, or world XYZ positions?
Brendy boy
21
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 15th Sep 2010 20:31
Quote: "are the required coordinates local, or world XYZ positions?"

local

Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 15th Sep 2010 21:01
Why isn't this optional with a flag, would make a lot of sense... and the work easier...
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Sep 2010 21:24
Quote: "and the work easier"


How?
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 15th Sep 2010 21:38
Quote: "Why isn't this optional with a flag"

Why does it need to be?
If you want to work at the world level, then do so, and then just leave the object at coordinates 0,0,0 and rotation 0,0,0 (with that setup, local = global).

Quote: "Which method do you think would be faster Ian"

I would guess that the vertexdata commands would be faster if you aren't manipulating every vertex, or if the number of vertices were small.

You also have the ability to use indexed vertices, which can reduce the number of vertices you need, generally making the object faster to render.

Finally, they are much easier to use/understand IMO too.

Of course, you should try and benchmark it yourself, because all of the above performance points are an educated guess and I don't provide any guarantees

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 15th Sep 2010 22:17
Funny thing but i immediately had the idea coming up Ian mentioned after i pushed the enter...
29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 15th Sep 2010 22:32
Quote: "... or you can avoid using memblocks altogether"


And take away the fun of the needless difficulty? But then again I'm a DBC user so I'm quite used to needless difficulty.

I don't have anything more constructive to say as I don't know anything about the vertexdata commands but they do look useful.

Login to post a reply

Server time is: 2026-07-23 02:48:29
Your offset time is: 2026-07-23 02:48:29