View previous topic :: View next topic |
Author |
Message |
chronozphere DeleD PRO user
Joined: 20 Jun 2006 Posts: 1010 Location: Netherlands
|
Posted: Tue Jun 20, 2006 8:35 pm Post subject: Triangulation |
|
|
Hi
I'm new here on this forum.. I am working on a D3D game engine wich is written from the scratch using delphi 7. I thought it would be nice to include DMF support, since Deled is an exellent easy-to-use 3d editor
I have checked out the help files and studied the DMF format a bit, i noticed that an object in a DMF contains multiple polygons wich can have more then 3 vertices. In order to render the scene it is neccesary to triangulate and optimize this data.
before i start writing an algorithm i need to know a few things:
*what is the maximum amount of vertices of a polygon (is there a limit)
*can polygons be concave??
*are polygons always flat or not??
I assume that quite a few of you have done this before. Is there some good pascal code available wich shows how to load a deled map into a Direct3d engine. (opengl is okay but i prefer D3D).
Thanx in advance
Chronozphere |
|
Back to top |
|
|
Jeroen Site Admin
Joined: 07 Aug 2004 Posts: 5332 Location: The Netherlands
|
Posted: Tue Jun 20, 2006 8:54 pm Post subject: Re: Triangulation |
|
|
chronozphere wrote: |
Hi
I'm new here on this forum.. I am working on a D3D game engine wich is written from the scratch using delphi 7. I thought it would be nice to include DMF support, since Deled is an exellent easy-to-use 3d editor
I have checked out the help files and studied the DMF format a bit, i noticed that an object in a DMF contains multiple polygons wich can have more then 3 vertices. In order to render the scene it is neccesary to triangulate and optimize this data.
before i start writing an algorithm i need to know a few things:
*what is the maximum amount of vertices of a polygon (is there a limit)
*can polygons be concave??
*are polygons always flat or not??
I assume that quite a few of you have done this before. Is there some good pascal code available wich shows how to load a deled map into a Direct3d engine. (opengl is okay but i prefer D3D).
Thanx in advance
Chronozphere |
Hi there chronozphere, and welcome! Very nice to see you developing a game engine using Delphi7. DeleD is actually developed using Delphi7 as well. Now, about your questions:
- polygons can have an unlimited amount of vertices
- polygons can be concave (in which case OpenGL will not render them correctly in all cases)
- polygons might not be flat, as DeleD allows you to displace any vertex of the polygon; this might mean you having to triangulate convex polygons as well, if they're not flat
Also, check here for example DMF loading code in Delphi. |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Tue Jun 20, 2006 9:54 pm Post subject: |
|
|
DeleD can triagulate for you...
Press CTRL-A, then in object mode use triangulate. I suggest you SAVE AS as new file to not ruin your working copy. _________________
|
|
Back to top |
|
|
chronozphere DeleD PRO user
Joined: 20 Jun 2006 Posts: 1010 Location: Netherlands
|
Posted: Wed Jun 21, 2006 4:18 pm Post subject: |
|
|
Thanx for your replies.
Quote: |
DeleD can triagulate for you...
Press CTRL-A, then in object mode use triangulate. I suggest you SAVE AS as new file to not ruin your working copy.
|
Aah thanx... that's a nice feature. Maybe its an idea to make a "Save Triangulated..." function in Deled ( Just an idea )
I've just downloaded the delphi DMF loader.. I will take a look at it |
|
Back to top |
|
|
hpesoj DeleD PRO user
Joined: 16 Oct 2004 Posts: 184
|
Posted: Wed Jun 21, 2006 5:05 pm Post subject: |
|
|
Geeze, that reminds me, I haven't given you the updated header file (the current one won't work with 1.4 exported dmfs). New version is 1.1.0, as I've added a few extra functions, such as a sorting function which arranges polygons in material order, and a function that generates flat normals (I haven't gotten around to generating smooth normals, it could be quite complicated). Here is the file:
DelphiDMFLoader.zip (479 KB)
DelphiDMFLoader.rar (289 KB) |
|
Back to top |
|
|
|