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 / Generating subdivided plain with joined vertices?

Author
Message
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 9th Mar 2011 16:06
So yeah, the title says it all. How would I go about generating a subdivided plain that has it's vertices joined? For now I have created it with the FVF 338, having each face have 3 vertices, and having to control 6 vertices to distort the faces on the plain at each joint. How can I combine these 6 vertices to only use 1?



If anyone could provide some code, and explain what those numbers for the FVF stand for, I would greatly appreciate it

TheComet

Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 9th Mar 2011 17:00 Edited at: 9th Mar 2011 17:02
There is a vertexdata weld example somewhere - if your making the mesh from a memblock, then it might be easiest to just use that after making the object. Along with the usual vertexdata commands, there is vertex indexing, which tells each polygon which vertex to use.

Another option would be to make your sub-plain in a modelling app and weld it up, then adjust the heights with vertexdata commands.

EDIT: This thread might be worth a look - IanM to the rescue again
http://forum.thegamecreators.com/?m=forum_view&t=108704&b=1

Health, Ammo, and bacon and eggs!
Jimpo
21
Years of Service
User Offline
Joined: 9th Apr 2005
Location:
Posted: 9th Mar 2011 17:37
IanM's Matrix1 Utils plugin has a built in command for that. Otherwise, you want to look at indices, which can be set with the vertexdata commands.

In the same way every 3 vertices make a polygon, every 3 indices make a polygon. The difference is, that each index points to a vertex, allowing them to be reused. So you can make a regular plain with only 4 vertices instead of 6.

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Mar 2011 20:16 Edited at: 9th Mar 2011 20:17
That's MAKE OBJECT PLAIN/PLANE from my plug-ins

FVF values are made by adding values together to create a definition of the data that is held for each vertex. Here are the values in #constant format:


Then if you want a vertex to have position, 1 texture, a normal and a colour (diffuse), you add FVF_XYZ, FVF_NORMAL, FVF_DIFFUSE and FVF_TEX1 together, giving a hex value of 0x152, or 338, which is what DBPro used to use. Remove the FVF DIFFUSE and you get 274, which it uses now.

If you end up using a memblock to create meshes, then the order of the data is from lowest value to highest value (ie 338 specifies the data in the order FVF_XYZ, FVF_NORMAL, FVF_DIFFUSE and FVF_TEX1). If you don't use memblocks (I don't any more, since I added plug-in commands to create object from scratch), then you don't need to worry about the order.

Login to post a reply

Server time is: 2026-07-15 03:39:27
Your offset time is: 2026-07-15 03:39:27