src/gldraw.cpp

changeset 336
9dd47cc12ab8
parent 324
31c6e53e1e4e
child 351
6fdd32c4886c
equal deleted inserted replaced
335:30c11cff511d 336:9dd47cc12ab8
1389 1389
1390 obj->m_glinit = false; 1390 obj->m_glinit = false;
1391 } 1391 }
1392 1392
1393 // ============================================================================= 1393 // =============================================================================
1394 Axis GLRenderer::cameraAxis (bool y) { 1394 Axis GLRenderer::cameraAxis (bool y, GL::Camera camid) {
1395 const staticCameraMeta* cam = &g_staticCameras[m_camera]; 1395 if( camid == (GL::Camera) -1 )
1396 camid = m_camera;
1397
1398 const staticCameraMeta* cam = &g_staticCameras[camid];
1396 return (y) ? cam->axisY : cam->axisX; 1399 return (y) ? cam->axisY : cam->axisX;
1397 } 1400 }
1398 1401
1399 // ============================================================================= 1402 // =============================================================================
1400 bool GLRenderer::setupOverlay ( GL::Camera cam, str file, int x, int y, int w, int h ) 1403 bool GLRenderer::setupOverlay ( GL::Camera cam, str file, int x, int y, int w, int h )
1421 if( info.lw == 0 ) 1424 if( info.lw == 0 )
1422 info.lw = ( info.lh * img->width() ) / img->height(); 1425 info.lw = ( info.lh * img->width() ) / img->height();
1423 elif( info.lh == 0 ) 1426 elif( info.lh == 0 )
1424 info.lh = ( info.lw * img->height() ) / img->width(); 1427 info.lh = ( info.lw * img->height() ) / img->width();
1425 1428
1426 const Axis x2d = cameraAxis( false ), 1429 const Axis x2d = cameraAxis( false, cam ),
1427 y2d = cameraAxis( true ); 1430 y2d = cameraAxis( true, cam );
1428 1431
1429 double negXFac = g_staticCameras[m_camera].negX ? -1 : 1, 1432 double negXFac = g_staticCameras[cam].negX ? -1 : 1,
1430 negYFac = g_staticCameras[m_camera].negY ? -1 : 1; 1433 negYFac = g_staticCameras[cam].negY ? -1 : 1;
1431 1434
1432 info.v0 = info.v1 = g_origin; 1435 info.v0 = info.v1 = g_origin;
1433 info.v0[x2d] = -( info.ox * info.lw * negXFac ) / img->width(); 1436 info.v0[x2d] = -( info.ox * info.lw * negXFac ) / img->width();
1434 info.v0[y2d] = ( info.oy * info.lh * negYFac ) / img->height(); 1437 info.v0[y2d] = ( info.oy * info.lh * negYFac ) / img->height();
1435 info.v1[x2d] = info.v0[x2d] + info.lw; 1438 info.v1[x2d] = info.v0[x2d] + info.lw;

mercurial