Norman Vine
>
>Following 'untested code' 

Ooops after testing here is a minor fix
< moved the get_position() to follow the getMatrixCall() 
   so as to pick up the 'updated' location

This seems to work and should be fast enough for LOTS
of static models :-)

Cheers

Norman

void
FG3DModel::update (int dt)
{
  for (unsigned int i = 0; i < _animations.size(); i++)
    _animations[i]->update(dt);

//  static sgdVec3 last_sc = [ SGD_ZERO, SGD_ZERO, SGD_ZERO ];
//  if( last_sc[0]-scenery_center.x() != 0.0 ||
//      last_sc[1]-scenery_center.y() != 0.0 ||
//      scenery_center.z() != 0.0 || (type != FGMODEL_STATIC) ) {
//      sgdSetVec3(last_sc, scenery_center.x(),
//                         scenery_center.y(), scenery_center.z());
        
    _location->setPosition( _lon_deg, _lat_deg, _elev_ft );
    _location->setOrientation( _roll_deg, _pitch_deg, _heading_deg );

        sgMat4 POS;
        sgCopyMat4(POS, _location->getTransformMatrix());
  
        sgVec3 trans;
        sgCopyVec3(trans, _location->get_view_pos());

        for( int i=0; i<4; i++) {
          float tmp = POS[i][3];
          for( int j=0; j<3; j++ ) {
                POS[i][j] += (tmp * trans[j]);
          }
        }
        _position->setTransform(POS);
//  }
}

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to