Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Tools

Archive::Tools Archive area for Tools's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #31  
Old 09-20-2004, 10:26 AM
jbb
Hill Giant
 
Join Date: Mar 2003
Location: UK
Posts: 242
Default

Well I'm doing this... Based slightly on your code... It's not perfect code but I've been hacking it a lot as I go, it could do with some proper structures and stuff. Too many global variables :(

I'm hoping that "verts" and "tris" will contain pointers to the vertex and triangle structures based on counting back from the end of the file. Which is why I suspected that either I've somehow got yhe counts, or the file size wrong.

Code:
void ProcessTERFile(char* terdata, int size)
{
	int magic		= *(long*)(terdata+0);
	int unk			= *(long*)(terdata+4);
	int list_length = *(long*)(terdata+8);
	int obj_count   = *(long*)(terdata+12);
	int vert_count  = *(long*)(terdata+16);
	int poly_count  = *(long*)(terdata+20);

	assert(sizeof(TERVertex) == 32);
	assert(sizeof(TERTriangle) == 20);

	char* verts = terdata + size - (vert_count * sizeof(TERVertex) + poly_count * sizeof(TERTriangle) + 4);
	char* tris  = terdata + sizeof(TERVertex) * vert_count;

	g_nVerts = vert_count;
	g_Verts  = (TERVertex*)verts;

	g_nTriangles = poly_count;
	g_Triangles  = (TERTriangle*)tris;

	/* Now process the texture names part */
	char* p = terdata + 24;
Reply With Quote
  #32  
Old 09-20-2004, 10:35 AM
jbb
Hill Giant
 
Join Date: Mar 2003
Location: UK
Posts: 242
Default

Ok there is a big mistake there calculating "tris" - the location of the triangle structures, but the problem is that the verts are not right either.
Reply With Quote
  #33  
Old 09-20-2004, 10:36 AM
jbb
Hill Giant
 
Join Date: Mar 2003
Location: UK
Posts: 242
Default

Oops, I found my problem. My zlib code earlier on was faulty and was leaving a byte between uncompressed chunks so all the data was in the wrong place. I'm amazed it worked at all.
Reply With Quote
  #34  
Old 09-20-2004, 10:42 AM
daeken_bb
Discordant
 
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
Default

So it works now? Cool

I gotta go to the doctor in a few, but I'll be back shortly hehe.
__________________
Keep me unemployed and working on OpenEQ, PM me about donating

Check out my deviantART page at http://daeken.deviantart.com/
Reply With Quote
  #35  
Old 09-20-2004, 10:44 AM
jbb
Hill Giant
 
Join Date: Mar 2003
Location: UK
Posts: 242
Default

Yes it works! Amazing how trying to explain the problem causes you to suddenly realise what the problem it is



Next I'll try converted potranquility
Reply With Quote
  #36  
Old 09-20-2004, 11:06 AM
daeken_bb
Discordant
 
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
Default

Looks great man. Nice work
__________________
Keep me unemployed and working on OpenEQ, PM me about donating

Check out my deviantART page at http://daeken.deviantart.com/
Reply With Quote
  #37  
Old 09-20-2004, 11:36 AM
jbb
Hill Giant
 
Join Date: Mar 2003
Location: UK
Posts: 242
Default



and




Thanks to your work figuring out the file format and making the converter
Reply With Quote
  #38  
Old 09-20-2004, 12:20 PM
daeken_bb
Discordant
 
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
Default

No problem, it looks great
__________________
Keep me unemployed and working on OpenEQ, PM me about donating

Check out my deviantART page at http://daeken.deviantart.com/
Reply With Quote
  #39  
Old 09-20-2004, 07:32 PM
jbb
Hill Giant
 
Join Date: Mar 2003
Location: UK
Posts: 242
Default

I notice that in the poknowledge file there is a lot missing, like trees, the portal stones etc.

I presume these are added as objects onto the basic map.

Do we have any information on the file formats for these objects & their locations at all?
Reply With Quote
  #40  
Old 09-20-2004, 07:46 PM
jbb
Hill Giant
 
Join Date: Mar 2003
Location: UK
Posts: 242
Default

Quote:
Heh, it's so incredibly fast it's not even funny Very Happy

Still stuff I can do... in particular, using vertex buffers where supported. Right now, each end octree node has a compiled display list on it that we execute to render that node, and replacing that with a vertex buffer in video RAM might help a bit.
On my directX9 renderer at the moment I'm just creating one huge vertex buffer with all the vertices in and one huge index buffer with all the triangles in.

And then I'm going through every triangle and setting it's texture and then drawing it via the index buffer. The only optimization I'm doing is checking if the texture is the same for two consecutive triangles and not setting it again.


Even drawing every triangle individually I'm getting about 3 frames per second on poknowledge.

My next plan would be to pre-sort all triangles into a seperate list for each texture so I can draw many triangles with a single index buffer.

Not sure how culling triangles for visibility fits in with this... I suppose that every frame I need to check each triangle for potential visibility using the octree stuff (Does it have this information for the older zones?) and build a new index buffer containing only the triangles I want to draw for each frame.
Reply With Quote
  #41  
Old 09-20-2004, 10:37 PM
Mongrel
Hill Giant
 
Join Date: Jul 2003
Location: Germany
Posts: 232
Default

Old zones use BSP trees, you have to create the octree yourself (very straighforward and takes like 2 hours max. to implement fully).

When you have that octree, group the faces by texture for each leaf in the tree. After that you can easily do frustum culling against the bounding boxes of the leafs. That's almost all you need to do to get fast rendering.
Reply With Quote
  #42  
Old 09-20-2004, 10:41 PM
daeken_bb
Discordant
 
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
Default

Yea, it's very easy to do frustum culling using the octree. If you want, pull octree.c/octree.h from OpenEQ's source... should help you quite a bit. It's released under the GPL, btw, though I haven't yet put it in the source :P
__________________
Keep me unemployed and working on OpenEQ, PM me about donating

Check out my deviantART page at http://daeken.deviantart.com/
Reply With Quote
  #43  
Old 09-21-2004, 05:56 AM
jbb
Hill Giant
 
Join Date: Mar 2003
Location: UK
Posts: 242
Default

Thanks, I had a look at your code.

The idea seems pretty simple really but your code doesn't really work with the way I've stored things so I'll probably have to re-do it myself this time.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:00 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3