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.

3 Dimensional Chat / Meshes as memblocks

Author
Message
skovron
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 2nd Oct 2003 11:15
I learnt that when I convert some mesh into memblock then it is represented as following

offset | size | meaning
00 | DWORD | FVF format (default 338)
04 | DWORD | size of vertex struct (default 36)
08 | DWORD | vertex count
12 | FLOAT | start of vertex data
...

and following 3 verts forms a triangle, then next 3 verts form next triangle and so...

but I saw an example code to CollisionDll:



so here memblock represent mesh (made from whole object) as:

offset | size | meaning
00 | DWORD | vertex count
04 | DWORD | vertex data offset
08 | DWORD | face count
12 | DWORD | face data offset
...

so I am a little confused wright now.

Could someone tell me the true?
Beta 1
21
Years of Service
User Offline
Joined: 27th Aug 2003
Location:
Posted: 2nd Oct 2003 13:00
Theres quite a few different formats. If you stick to 338 (which is what I've been using) the memblock needs to be laid out as described in the help text under make mesh from memblock.

Your first header should work but remember the vertexes are noth just three set of x,y,z data. For each vertex there is x,y,z the normal x,y,z, the vertex color (as an RGB DWORD) and u and v texture coordinates.

It is a little confusin to start with. It took me ages to manage to make a single triangle but I soon got it and am now generateing terrain meshes from scratch far far faster than I could with matrixes.
Dr OcCuLt
22
Years of Service
User Offline
Joined: 27th Nov 2002
Location: a Dark Deep Dark pit, it dark in here
Posted: 2nd Oct 2003 18:04 Edited at: 2nd Oct 2003 18:06
if you look at the code base under VXV (.x file exporter),there some code in that where a mesh is convert into memblock in the FVF 338 format that may help you to under standing whats going on.

one pit fall you my find is that is that 338 is not the default if you make a mesh uesing DBpro it will be of format 210? or some thing so you have to convert the FVF to 338 for all you mesh.

--Dr 0--
arras
22
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 6th Oct 2003 13:58
Default is FVF Format 274:

byte 0 DWORD FVF Format, which controls which components each vertex of your mesh will contain. 274 in this case.

byte 4 DWORD FVF Size, which is the size in bytes of a single vertex element. This size is respective of the FVF Format you specified, which is 32 for FVF Format 274

byte 8 DWORD, number of Vertices in your mesh

byte 12 FLOAT X coordinate of 1 vertex in model space

byte 16 FLOAT Y coordinate of 1 vertex in model space

byte 20 FLOAT Z coordinate of 1 vertex in model space

byte 24 FLOAT X normal coordinate of 1 vertex in model space

byte 28 FLOAT Y normal coordinate of 1 vertex in model space

byte 32 FLOAT Z normal coordinate of 1 vertex in model space

byte 36 FLOAT U texture coordinate for the 1 vertex

byte 40 FLOAT V texture coordinate for the 1 vertex
skovron
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 9th Oct 2003 20:31
Ok I know this format (I was wrong only about the default FVF value) but if so then how can you explain this piece of code;
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Oct 2003 11:00
I can, It won't work .

That must be from an old format memblock, like when DBPro was in beta stages, that's not how it does things now (although it looks like a more useful format).


Van-B

arras
22
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Slovakia
Posted: 10th Oct 2003 11:14
In help is writen that default is 338 but if you make mesh from object it creates format 274 so for DB this is the default probably. They difer onli in wertex color information.

One you are shoving I dont know. From where do you have that code?

Anyway both 338 and 274 should work. Right now I try to make terain matrix using 274 and so far it seems to work fine.
skovron
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 10th Oct 2003 11:52
Thank you for your posts.
Van B:
it looks like a more useful format to me thats why I'm so interested in it.

arras:
I took this code from example to CollisionDll.
I havent installed it so I'm not able to check if this code works.

But nevermind. If its old format then I'll use FVF
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 10th Oct 2003 12:56
the format you provided is used by
DarkBASIC 1.1x Enhanced, DarkBASIC Pro upto 2.0

after that they implimented a full FVF memblock setup, and so the new format could started to be used.

in 3.x the format is 338 (FVF_XYZ||FVF_NORMAL||FVF_DIFFUSE||FVF_TEX1)
in 4.x & 5.x the format is 274 (FVF_XYZ||FVF_NORMAL||FVF_TEX1)

however you can change this by converting the object fvf
CONVERT OBJECT FVF ... and setting the new FVF code and that will be what it uses when you make a memblock from it.

checkout my codebase to see a working example of the new system in-depth

skovron
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 10th Oct 2003 16:28
Oh. Thanks.
I'll checkout your code base.

Login to post a reply

Server time is: 2025-06-27 04:32:02
Your offset time is: 2025-06-27 04:32:02