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 / Vertexdata commands - and a problem...

Author
Message
HartZa
20
Years of Service
User Offline
Joined: 5th Jun 2003
Location:
Posted: 26th Sep 2006 18:28
I've been thinking my head off with this problem, and can't find a solution.

Here's the deal:
I need to get the vertices of every polygons used in an object, for variables called vertex1, vertex2 and vertex3, which are the vertices of the polygon. Here, let me show you a picture...


There. Let's think that the first polygon of the object is formed by the vertices 1, 2 and 6, the second polygon is formed by 1, 5 and 6 and so on.

Now, let's say there's n polygons and we have to get every polygon's vertices out. The for-next frame would look something like this:


...so, there's my problem. How can I get the polygon data out for variables vertex1, vertex2 and vertex3 which forms a polygon?

Excuse me, if you don't understand what I just said there, my english isn't so good and it's pretty complicated thing to explain, if you don't write your native language

Stats: Athlon XP Palomino 2600+ 2088mhz, GF4Ti420 128mb AGP8x, 512mb ddr dual-memory
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 26th Sep 2006 19:41
I don't believe you can do that with the vertexdata commands. What you'll probably want to take a look at is the make memblock from mesh command. If you convert your object to a mesh and then to a memblock, I believe you might be able to get the job done. When you create a memblock to use in conjunction with the make mesh from memblock command, you add the data for each vertex in such a way that groups of 3 entries defines a polygon. Therefore I would guess that when you create a memblock from a mesh using the make memblock from mesh command, the data will be organised in the memblock in the same way. So you might just be able to read the data, vertex by vertex, and every group of 3 may represent a poly.


HartZa
20
Years of Service
User Offline
Joined: 5th Jun 2003
Location:
Posted: 26th Sep 2006 20:36
Fallout:
It's true that the memblocks can do the trick, they just don't do it the right way. With a big object (= lots of polygons) the memblock method crashes DBPro. For example, Newton wrapper does that internally and therefore crashes when trying to use Newton itself to count the vertex points.

Although, I haven't tried to convert the mesh into a FVF type 2, which includes only the vertex data. Hmmm... I gotta try this one out.

Still, I'd like to know the vertex data commands and if it's possible to use them to accomplish the same result.

Stats: Athlon XP Palomino 2600+ 2088mhz, GF4Ti420 128mb AGP8x, 512mb ddr dual-memory
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 26th Sep 2006 20:38
There's plenty of commands avaialble with the vertex commands to pull out the positions of each vertex. I'll knock something up in a minute...

Boo!
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 26th Sep 2006 21:54
I'm struggling. It works with cubes, cones and plains, but not with spheres and cylinders. Anyone else explain why?



Boo!
Alquerian
18
Years of Service
User Offline
Joined: 29th Mar 2006
Location: Reno Nevada
Posted: 27th Sep 2006 00:44
I believe that cylinders and spheres use a different mesh format (tristrips) where as the other primitives use a tri-list format. There are problems with CSG commands with the same primitives due to this issue. Hope that helps.

"We are what we repeatedly do. Excellence, therefore, is not an act, but a habit." - Aristotle
HartZa
20
Years of Service
User Offline
Joined: 5th Jun 2003
Location:
Posted: 1st Oct 2006 20:48
I haven't had time to try anything my own yet.

I guess your method _SHOULD_ work, since the objects I need to do that are big plain-like models (terrains mostly).

But, I still would like to find out a way trough this. I know there is a way - I just don't have the gift of a real programmer

Stats: Athlon XP Palomino 2600+ 2088mhz, GF4Ti420 128mb AGP8x, 512mb ddr dual-memory
Xenocythe
18
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 2nd Oct 2006 04:15
yeah for my 3D modeller you can manipulate a cube or anything but not a 3D model of a sphere. What can I do to fix this?


Login to post a reply

Server time is: 2024-05-10 15:43:34
Your offset time is: 2024-05-10 15:43:34