|
|
![](/forums/images/Darkness/misc/spacer.gif) |
![](/forums/images/Darkness/misc/spacer.gif) |
![](/forums/images/Darkness/misc/spacer.gif) |
![](/forums/images/Darkness/misc/q1.jpg) |
|
![](/forums/images/Darkness/misc/q1-1.jpg) |
![](/forums/images/Darkness/misc/q4.jpg) |
|
![](/forums/images/Darkness/misc/q4-1.jpg) |
![](/forums/images/Darkness/misc/a1.jpg) |
|
![](/forums/images/Darkness/misc/a1-1.jpg) |
|
OpenEQ::Development Development discussion for OpenEQ. Do not post for support. |
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-21-2004, 11:40 AM
|
Discordant
|
|
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
|
|
Placeable object help please.
I need a bit of help with the .zon file format. I have placeable objects rendering perfectly, but the scaling is way off. I'm currently using the scaling variable as a float and scaling x and y by this. Is that not the proper way to do it? If not, please tell me how to scale the objects
Happy Hacking,
Lord Daeken M. BlackBlade
(Cody Brocious)
|
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 02:31 AM
|
Hill Giant
|
|
Join Date: Mar 2003
Location: UK
Posts: 242
|
|
I'll look what I did in my renderer where it seemed about right.
But it's on my other computer which is currently in pieces... When I put it back together I'll have a look. In an hour or two maybe.
|
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 02:38 AM
|
Discordant
|
|
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
|
|
Quote:
Originally Posted by jbb
I'll look what I did in my renderer where it seemed about right.
But it's on my other computer which is currently in pieces... When I put it back together I'll have a look. In an hour or two maybe.
|
Great, thanks ![Very Happy](http://www.eqemulator.net/forums/images/smilies/icon_biggrin.gif)
|
![](/forums/images/Darkness/misc/a4.gif) |
|
![](/forums/images/Darkness/misc/a6.gif) |
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 03:08 AM
|
Hill Giant
|
|
Join Date: Mar 2003
Location: UK
Posts: 242
|
|
Ok, my other PC isn't connected to the network at the moment so I'll have to retype some of this here... If you can't get it to work I'll be able to post my code later on probably.
I have this structure for placable objects
struct Object
{
long id;
long offset;
float x, y, z;
float rx, ry, rz;
float scale;
}
You're probably loading this already.
x, y, z are the locations in the world of the object and rx, ry, and rz are the rotations (In radians I guess, not sure) and scale is the scaling factor on the size of the object.
To draw it I have this code (which is using D3D vector objects and the vector math library)
D3DMATRIX tMat, rxMat, ryMat, rzMat;
D3DXMatrixTranslation(&tMat, mesh->x, mesh->y, mesh-z);
// Hmm, wierd swapping of coordinates below, can't remember why
D3DXMatrixRotationX(&rxMat, mesh->rz);
D3DXMatrixRotationY(&rxMat, mesh->ry);
D3DXMatrixRotationZ(&rxMat, mesh->rx);
// These are vector multiplies that the direct 3d library provides in their c++ classes
matWorld = mesh->scale * rzMat * ryMat * rxMat;
matWorld = matWorld * tMat;
m_pD3DDevice->SetTransform(D3DTS_WORLD, &matWorld);
So yes, basically I scale the object (in x y and z), then rotate it and then move it to it's place in the world. (I think the order of the matrix multiplies means I do it in this order)
Maybe you've got the order of these operations wrong so you're trying to scale an object which isn't at the coordinate system origin or something.
Also, the main terrain object has x, y, z coordinates and the placable objects are all positioned relative to the world object.... So you either need to add the x, y, z coordinates of the objects to those of the landscape model or do what I did and zero out the x, y, z coordinates of the terrain model before drawing it so that the placeable objects are in the same system.
Well, I'll post the actual code when I'm able to but this did seem to work for me.
|
![](/forums/images/Darkness/misc/a1.gif) |
|
![](/forums/images/Darkness/misc/a3.gif) |
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 03:51 AM
|
Hill Giant
|
|
Join Date: Mar 2003
Location: UK
Posts: 242
|
|
The full source is here:
http://eqengine.fx2100.com/eqengine_src.zip
It's windows, c++ and direct3d 9 but hopefull it will make some sense.
I don't know if this version even builds at all but hopefully it's not too far from the one that did.
|
![](/forums/images/Darkness/misc/a4.gif) |
|
![](/forums/images/Darkness/misc/a6.gif) |
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 04:36 AM
|
Discordant
|
|
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
|
|
This is really starting to bug the hell out of me now lol.
It seems that I'm not only doing the scaling properly, but also the rotation seems waaaaay off. I tried converting radians into degrees, but that just made the problem worse heh.
I'm about ready to call sony up and ask for a bit of help on this
Here's the code for the placeable object draw routine, in case this is where the problem is:
Code:
for(j = 0; j < this->model_data->plac_count; ++j) {
plac = this->model_data->placeable[j];
glPushMatrix();
glLoadIdentity();
glRotatef(270, 1.0, 0.0, 0.0);
glRotatef(rot[1], 1.0, 0.0, 0.0);
glRotatef(rot[0], 0.0, 0.0, 1.0);
glScalef(plac->scale, plac->scale, plac->scale);
glTranslatef(trans[0], trans[1], trans[2]);
glTranslatef(plac->x, plac->y, plac->z);
glRotatef(plac->rx, 1.0f, 0.0f, 0.0f);
glRotatef(plac->ry, 0.0f, 1.0f, 0.0f);
glRotatef(plac->rz, 0.0f, 0.0f, 1.0f);
glCallList(this->model_lists[plac->model]);
glPopMatrix();
}
And here's the code for the placeable object placement/rotation loader from zon.cpp:
Code:
for(i = 0; i < hdr->obj_count; ++i) {
plac = (zon_placeable *) buffer;
this->model_data.placeable[i] = new Placeable;
this->model_data.placeable[i]->x = plac->x;
this->model_data.placeable[i]->y = plac->y;
this->model_data.placeable[i]->z = plac->z;
this->model_data.placeable[i]->rx = plac->rx;
this->model_data.placeable[i]->ry = plac->ry;
this->model_data.placeable[i]->rz = plac->rz;
this->model_data.placeable[i]->scale = plac->scale;
this->model_data.placeable[i]->model = 0;
zon_tmp = zon_orig + plac->loc;
while(zon_tmp[strlen((char *) zon_tmp) - 4] != '.')
zon_tmp += strlen((char *) zon_tmp) + 1;
for(j = 0; j < this->model_data.model_count; ++j) {
if(!strcmp(model_names[j], (char *) zon_tmp)) {
this->model_data.placeable[i]->model = j;
break;
}
}
buffer += sizeof(zon_placeable);
}
If you see anything obviously wrong, please let me know hehe.
Happy Hacking,
Lord Daeken M. BlackBlade
(Cody Brocious)
|
![](/forums/images/Darkness/misc/a1.gif) |
|
![](/forums/images/Darkness/misc/a3.gif) |
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 04:45 AM
|
Hill Giant
|
|
Join Date: Mar 2003
Location: UK
Posts: 242
|
|
I don't see anything immediatly wrong. The only thing I can think of immediately is are you locating the start of the array of objects in the zone file properly?
Is it drawing the objects in what look like the right places?
Even if they are the wrong size & orientation?
You can usually spot things like likes of torches down corridors in some of the zones.
|
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 04:47 AM
|
Discordant
|
|
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
|
|
Quote:
Originally Posted by jbb
I don't see anything immediatly wrong. The only thing I can think of immediately is are you locating the start of the array of objects in the zone file properly?
Is it drawing the objects in what look like the right places?
Even if they are the wrong size & orientation?
You can usually spot things like likes of torches down corridors in some of the zones.
|
Yea, they objects are definitely where they're supposed to be, it's just that the scaling and rotation is waaay off it seems.
|
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 04:54 AM
|
Hill Giant
|
|
Join Date: Mar 2003
Location: UK
Posts: 242
|
|
Hmm,
maybe if you print out the scaling, location and rotation vectors of some of the objects inside the drawing loop then I could compare them with what I get.
Then at least you might be able to establish if the problem is in the loading or the drawing code.
Probably not going to be able to do that with my code until tomorrow though.
|
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 06:31 AM
|
Hill Giant
|
|
Join Date: Mar 2003
Location: UK
Posts: 242
|
|
Sorry I'm not going to have time to look at this tonight, but i'll see what mine is outputting tomorrow morning. Yours looks like it is probably right though.
|
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 06:34 AM
|
Hill Giant
|
|
Join Date: Mar 2003
Location: UK
Posts: 242
|
|
You don't have any additional rotations and scaling in the display list do you?
|
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 06:38 AM
|
Discordant
|
|
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
|
|
Quote:
Originally Posted by jbb
Sorry I'm not going to have time to look at this tonight, but i'll see what mine is outputting tomorrow morning. Yours looks like it is probably right though.
You don't have any additional rotations and scaling in the display list do you?
|
Thanks... whenever you have time that's fine
No, the display list doesn't have anything aside from the triangle drawing and tex coords.
|
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-26-2004, 09:14 AM
|
Discordant
|
|
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
|
|
Well, I have the doors in anguish placed properly, but they're the only objects showing up in the right place with the right rotation lol:
I'm making some progress, but it's still not quite right.
|
![Old](/forums/images/Darkness/statusicon/post_old.gif)
11-27-2004, 12:02 AM
|
Hill Giant
|
|
Join Date: Mar 2003
Location: UK
Posts: 242
|
|
Good morning!
I've put my dump for dranksscar at
http://eqengine.fx2100.com/output.txt
The position data looks the same as yours.
However my renderer seems to be rather wrong in that zone too.
I need to do some more checking.
Edit: I rewrote this post as first of all I though mine was working but it's not. Perhaps we've misinterpreted the data structure in some way. It looks right, but maybe those aren't just x, y, z rotations,
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 05:54 AM.
|
|
![](/forums/images/Darkness/misc/s1.jpg) |
|
![](/forums/images/Darkness/misc/s1-1.jpg) |
|
|
|
![](/forums/images/Darkness/misc/z1.jpg) |
|
![](/forums/images/Darkness/misc/z1-1.jpg) |
|
![](/forums/images/Darkness/misc/side3.jpg) |