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.

Dark GDK / Simple cube has 36 vertices???? memblock

Author
Message
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd Oct 2009 03:03
I create a cube:



Then in a function I create a memblock and extract the data:


The output says...
FVFFormat: 274
FVFSize: 32
numberofVertices: 36
memblockSize: 1164

Surly a cube has 8 vertices? What am I doing wrong?

While I'm here, searching the forums on this issue there is talk of commands to directly extract the vertex data/indices of an object, they dont seem to be in the docs, anyone know where to find them?

Thanks in advance.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 3rd Oct 2009 03:32
Each cube is composed of:

6 square faces
= 12 triangular polys
= 36 vertices

Even though the vertices have the same coordinates, the object is stored as series of the vertices for each triangular polygon and not as a list of what vertices a polygon contains.

On your other question, the data can be extracted from the objects memblock given its FVF type and size.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd Oct 2009 03:56
Quote: "Even though the vertices have the same coordinates, the object is stored as series of the vertices for each triangular polygon and not as a list of what vertices a polygon contains."


Thanks Luke, that makes sense now.


Quote: "On your other question, the data can be extracted from the objects memblock given its FVF type and size."


Yeh, I know, apparently there is a way to do it without a memblock from reading various posts but all code fragments are from dbPro. You can use the commands to extract the indices as well which as from what I read, can not be done with a memblock.

Thanks for your help.
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 3rd Oct 2009 05:13
Quote: "Surly a cube has 8 vertices? What am I doing wrong?"


It has 8 unique vertex positions, but if you were to use 8 vertices the normals and UV data would be very incorrect. It's possible to use 24 vertices for a standard cube and GDK may do this, just keep in mind that when converting to a memblock you lose all the index data, you can check the actual amount of vertices using the vertexData function set though.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd Oct 2009 12:15
Thanks DarkCoder, I'm interested in getting the index data, what is the vertexData function set and where can I find it?
dark coder
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 3rd Oct 2009 12:19
It's part of the basic 3D library, write something like dbGetIndexData() in your code and go to its declaration to see the others, or look in the help files and find the section with that in.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd Oct 2009 15:42
Thanks again DarkCoder, I never knew there was more commands other than the ones that are in the documentation, I will be going straight from the header files from now on.

Login to post a reply

Server time is: 2024-10-01 14:29:27
Your offset time is: 2024-10-01 14:29:27