Changeset 1353


Ignore:
Timestamp:
May 9, 2012, 1:35:04 AM (7 years ago)
Author:
sam
Message:

orbital: play with the camera.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/orbital/orbital.cpp

    r1351 r1353  
    3131        for (int i = 0; i < 20; i++)
    3232        {
    33             m.SendCommand(((i + j) % 2) ? "sc.2,.6,.7,1,scb.2,.6,.7,1"
    34                                         : "sc.2,.2,.6,1,scb.2,.2,.6,1");
     33            m.SendCommand(((i + j) % 2) ? "sc.0,.1,.2,1,scb.0,.1,.2,1"
     34                                        : "sc.0,.0,.1,1,scb.0,.0,.1,1");
    3535            m.SendCommand("ac4,2,44,40,0,0,ty-1,ad4,40,0,ry45");
    3636            m.Scale(vec3(std::sqrt(0.5f)));
     
    5858    /* Orange/white alien */
    5959    m.SendCommand("sc1,0.7,0,1,afcb12,3,10,0.4,tz3,sc1,1,1,1,afcb2,10,10,0.4");
    60     m.SendCommand("rx20,ry30,t0,40,-20,fl");
     60    m.SendCommand("t0,40,-20,fl");
     61    //m.SendCommand("rx20,ry30,t0,40,-20,fl");
    6162
    6263    /* Orange fire */
     
    7172
    7273    /* Create a camera that matches the settings of XNA Orbital */
    73     m_camera = new Camera(vec3(0, 50, 0),
    74                           vec3(0, 0, 0),
     74    m_camera = new Camera(vec3(0.f, 600.f, 50.f),
     75                          vec3(0.f, 0.f, 50.f),
    7576                          vec3(0, 0, -1));
     77    m_camera->SetRotation(quat::fromeuler_yxz(0.f, -30.f, 0.f));
    7678    m_camera->SetOrtho(1280.f / 3, 960.f / 3, -1000.f, 1000.f);
    7779    Ticker::Ref(m_camera);
    7880
    7981    /* Add tanks */
    80     for (int j = 0; j < 10; j++)
    81     for (int i = 0; i < 10; i++)
     82    for (int j = 0; j < 5; j++)
     83    for (int i = 0; i < 5; i++)
    8284    {
    8385        m_tanks << new Tank();
    84         m_tanks.Last()->m_position = vec3(i * 40.f - 250.f, 0, j * 40.f - 100.f);
    85         m_tanks.Last()->SetTarget(vec3(i * 80.f - 200.f, 0, j * 80.f - 130.f));
     86        m_tanks.Last()->m_position = vec3(i * 80.f - 250.f, 0, j * 80.f - 100.f);
     87        m_tanks.Last()->SetTarget(vec3(i * 160.f - 200.f, 0, j * 160.f - 130.f));
    8688        Ticker::Ref(m_tanks.Last());
    8789    }
  • trunk/orbital/player.h

    r1348 r1353  
    3030        m_drone_mesh.SendCommand("sc0.2,0.7,0,1,afcb3,6,10,0.4,tx-8,afcb3,6,10,0.4,tx4,ty13,fl,sc1,1,1,1,afcb3,6,10,0.4,rx-30,ty13,fl");
    3131
    32         m_position = vec3(0.f, 3.5f, 0.f);
     32        m_position = vec3(0.f, 3.5f + 50.f, 0.f);
    3333    }
    3434
  • trunk/src/camera.cpp

    r1350 r1353  
    4444{
    4545    m_position = pos;
     46}
     47
     48void Camera::SetRotation(quat const &rot)
     49{
     50    m_rotation = rot;
    4651}
    4752
     
    9499    m_target += vec3(rightleft, 0, -updown) * 200.f * seconds;
    95100
    96     m_view_matrix = mat4::lookat(m_position, m_target, m_up);
     101    m_view_matrix = mat4::lookat(m_position, m_target, m_up)
     102                  * mat4(m_rotation);
    97103}
    98104
  • trunk/src/camera.h

    r1350 r1353  
    3131
    3232    void SetPosition(vec3 const &pos);
     33    void SetRotation(quat const &rot);
    3334    void SetOrtho(float width, float height, float near, float far);
    3435    void SetPerspective(float fov, float width, float height,
Note: See TracChangeset for help on using the changeset viewer.