View Single Post
  #6  
Old 11-26-2004, 04:36 AM
daeken_bb
Discordant
 
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
Default

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)
__________________
Keep me unemployed and working on OpenEQ, PM me about donating

Check out my deviantART page at http://daeken.deviantart.com/
Reply With Quote