This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 330 for ps


Ignore:
Timestamp:
05/31/04 17:52:53 (21 years ago)
Author:
notpete
Message:

Removed zoom FOV hack; changed to actually move camera position.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/terrain/terrainMain.cpp

    r310 r330  
    3232double              g_LastTime;
    3333
     34static float g_CameraZoom = 10;
    3435
    3536const int NUM_ALPHA_MAPS = 13;
     
    9192
    9293    float fov = g_Camera.GetFOV();
     94
     95#if 0
    9396    const float d_key = DEGTORAD(10.0f) * DeltaTime;
    9497    const float d_wheel = DEGTORAD( 50.0f ) * DeltaTime;
     
    114117            fov = fov_min;
    115118    }
    116 
    117 
    118119    ViewFOV = fov;
    119 
    120     g_Camera.SetProjection(1, 1000, fov);
     120    g_Camera.SetProjection(1, 5000, fov);
     121#else
     122    // RC - added ScEd style zoom in and out (actually moving camera, rather than fudging fov) 
     123    float dir=0;
     124    if (mouseButtons[SDL_BUTTON_WHEELUP]) dir=-1;
     125    else if (mouseButtons[SDL_BUTTON_WHEELDOWN]) dir=1;
     126
     127    float factor=dir*dir;
     128    if (factor) {
     129        if (dir<0) factor=-factor;
     130        CVector3D forward=g_Camera.m_Orientation.GetIn();
     131
     132        // check we're not going to zoom into the terrain, or too far out into space
     133        float h=g_Camera.m_Orientation.GetTranslation().Y+forward.Y*factor*g_CameraZoom;
     134        float minh=65536*HEIGHT_SCALE*1.05f;
     135       
     136        if (h<minh || h>1500) {
     137            // yup, we will; don't move anywhere (do clamped move instead, at some point)
     138        } else {
     139            // do a full move
     140            g_CameraZoom-=(factor)*0.1f;
     141            if (g_CameraZoom<0.01f) g_CameraZoom=0.01f;
     142            g_Camera.m_Orientation.Translate(forward*(factor*g_CameraZoom));
     143        }
     144    }
     145#endif
     146
    121147    g_Camera.UpdateFrustum ();
    122148}
     
    150176        case 'H':
    151177            // quick hack to return camera home, for screenshots (after alt+tabbing)
    152             g_Camera.SetProjection (1, 1000, DEGTORAD(20));
     178            g_Camera.SetProjection (1, 5000, DEGTORAD(20));
    153179            g_Camera.m_Orientation.SetXRotation(DEGTORAD(30));
    154180            g_Camera.m_Orientation.RotateY(DEGTORAD(-45));
     
    225251    }
    226252
    227     g_Camera.SetProjection (1, 1000, DEGTORAD(20));
     253    g_Camera.SetProjection (1, 5000, DEGTORAD(20));
    228254    g_Camera.m_Orientation.SetXRotation(DEGTORAD(30));
    229255    g_Camera.m_Orientation.RotateY(DEGTORAD(-45));
Note: See TracChangeset for help on using the changeset viewer.