Jump to content
  • Advertisement
Sign in to follow this  
eviltwigflipper

Half of my level is out of purportion?

This topic is 5035 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Not sure what could be causing it, but it looks as if something is garbling the geometry data. I notice some messed up texture coordinates. It makes me wonder if everything is being loaded in poperly. (But then again, I have never tried loading Doom 3 levels or anything of the like).

Share this post


Link to post
Share on other sites
i dont have any suggestions unless you post code... but speaking of code, where are you learning the details on the file format? ;-) linky linky?
thanks
-Dan

Share this post


Link to post
Share on other sites
Here is my source:


/*
======================================================
void dx9System::RenderPlane(model thisplane);
======================================================
*/


void dx9System::RenderPlane(model thisplane)
{
int i,a;
int texcoordnum = 0;

device->SetRenderState(D3DRS_COLORWRITEENABLE, 0xf);
if(thisplane.numofsurfaces < 1)
sys_error("RenderPlane: Numofsurfaces is invalid for this model\n");

for(a = 0; a<thisplane.numofsurfaces; a++)
{
IDirect3DVertexBuffer9 *vb;
IDirect3DIndexBuffer9 *ib;


if(thisplane.mapsurfaces[a].numofverts < 1 || thisplane.mapsurfaces[a].numofindexs < 1)
sys_error("RenderPlane: This surface has a illegal number of verts or indexs\n");

device->CreateVertexBuffer(thisplane.mapsurfaces[a].numofverts * sizeof(NormalTexVertex),
D3DUSAGE_WRITEONLY,FVF_NORMAL_TEX, D3DPOOL_MANAGED,
&vb,0);
device->CreateIndexBuffer(thisplane.mapsurfaces[a].numofindexs * sizeof(WORD),
D3DUSAGE_WRITEONLY,D3DFMT_INDEX16, D3DPOOL_MANAGED,
&ib,0);

NormalTexVertex *verts;

vb->Lock(0,0,(void **)&verts,0);
int c = 0;
for(i = 0; i < thisplane.mapsurfaces[a].numofverts; i++)
{
float trixyz[3];
float oldxyz[3];

if(thisplane.mapsurfaces[a].verts[c] == 0 && thisplane.mapsurfaces[a].verts[c+1] == 0 &&
thisplane.mapsurfaces[a].verts[c+2] == 0)
sys_error("RenderPlane: Invalid triangle found\n");

trixyz[0] = thisplane.mapsurfaces[a].verts[c];
trixyz[1] = thisplane.mapsurfaces[a].verts[c+2];
trixyz[2] = -thisplane.mapsurfaces[a].verts[c+1];

verts = NormalTexVertex(trixyz[0],trixyz[1],
trixyz[2],
thisplane.mapsurfaces[a].normals[c],
thisplane.mapsurfaces[a].normals[c+2],
-thisplane.mapsurfaces[a].normals[c+1],
thisplane.mapsurfaces[a].texcoords[texcoordnum],
thisplane.mapsurfaces[a].texcoords[texcoordnum+1]);

texcoordnum += 2;
c += 3;
}
vb->Unlock();
WORD *indicies;

ib->Lock(0,0,(void **)&indicies,0);
for(i = 0; i< thisplane.mapsurfaces[a].numofindexs; i++)
{
indicies = thisplane.mapsurfaces[a].indexs;
}
ib->Unlock();

device->SetTexture(0,testtexture);
device->SetStreamSource(0,vb,0,sizeof(NormalTexVertex));
device->SetIndices(ib);
device->SetFVF(FVF_NORMAL_TEX);
device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,thisplane.mapsurfaces[a].numofverts,0,thisplane.mapsurfaces[a].numofverts / 3);
}
}




Doom 3 Unoffical File Formats

The above link gives you all the various for Doom III except the AAS format, which is the AI helper file.

Everything is being loaded correctlly. Ive debugged the points being added to the final arrays(NormalTexVertex *verts, and WORD *indicies), and they are all correct.

Makes me wonder if Doom III has any type of scaling to do before you render the points?

EDIT:

TExture corrds are probley wrong because the polygons are streched out to much.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Looks like you have error either in your data as it is read, or your creation of your vertex buffers, (size, count, offset, stride etc). The give away is the funky skewed texture coordinates, and planes appear to span forever.

Also your code above is not near enough complete for anyone to help you. Try posting some more.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!