Ignore:
Timestamp:
Feb 18, 2011, 1:09:21 AM (10 years ago)
Author:
sam
Message:

Merge more code from the experimental MVP refactor into the old GL code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scene.cpp

    r659 r662  
    3939extern Shader *stdshader;
    4040#endif
     41extern float4x4 projection_matrix, view_matrix, model_matrix;
    4142
    4243/*
     
    135136    qsort(data->tiles, data->ntiles, sizeof(Tile), SceneData::Compare);
    136137
     138    // XXX: debug stuff
     139    model_matrix = float4x4::translate(320.0f, 240.0f, 0.0f);
     140    model_matrix = model_matrix * float4x4::rotate(-data->angle, 1.0f, 0.0f, 0.0f);
     141#if 0
     142    static float f = 0.0f;
     143    f += 0.01f;
     144    model_matrix = model_matrix * float4x4::rotate(0.1f * sinf(f), 1.0f, 0.0f, 0.0f);
     145    model_matrix = model_matrix * float4x4::rotate(0.3f * cosf(f), 0.0f, 0.0f, 1.0f);
     146#endif
     147    model_matrix = model_matrix * float4x4::translate(-320.0f, -240.0f, 0.0f);
     148    // XXX: end of debug stuff
     149
    137150#if LOL_EXPERIMENTAL
     151    GLuint uni;
     152    uni = stdshader->GetUniformLocation("model_matrix");
     153    glUniformMatrix4fv(uni, 1, GL_FALSE, &model_matrix[0][0]);
     154
    138155    float *vertices = new float[18];
    139     vertices[0] = -0.5f; vertices[1] = 0.5f; vertices[2] = 0.0f;
    140     vertices[3] = 0.5f; vertices[4] = 0.5f; vertices[5] = 0.0f;
    141     vertices[6] = -0.5f; vertices[7] = -0.5f; vertices[8] = 0.0f;
    142 
    143     vertices[9] = 0.5f; vertices[10] = -0.5f; vertices[11] = 0.0f;
    144     vertices[12] = -0.5f; vertices[13] = -0.5f; vertices[14] = 0.0f;
    145     vertices[15] = 0.5f; vertices[16] = 0.5f; vertices[17] = 0.0f;
     156    vertices[0] = 0.0f; vertices[1] = 480.0f; vertices[2] = 0.0f;
     157    vertices[3] = 640.0f; vertices[4] = 480.0f; vertices[5] = 0.0f;
     158    vertices[6] = 0.0f; vertices[7] = 0.0f; vertices[8] = 0.0f;
     159
     160    vertices[9] = 640.0f; vertices[10] = 0.0f; vertices[11] = 0.0f;
     161    vertices[12] = 0.0f; vertices[13] = 0.0f; vertices[14] = 0.0f;
     162    vertices[15] = 640.0f; vertices[16] = 480.0f; vertices[17] = 0.0f;
    146163
    147164    const GLfloat colors[6][3] = {
     
    194211
    195212#else
    196     // XXX: debug stuff
    197     glPushMatrix();
    198     static float f = 0.0f;
    199     f += 0.05f;
    200     glTranslatef(320.0f, 240.0f, 0.0f);
    201     glRotatef(-data->angle, 1.0f, 0.0f, 0.0f);
    202 #if 0
    203     glRotatef(3.0f * sinf(f), 1.0f, 0.0f, 0.0f);
    204     glRotatef(8.0f * cosf(f), 0.0f, 0.0f, 1.0f);
    205 #endif
    206     glTranslatef(-320.0f, -240.0f, 0.0f);
    207     // XXX: end of debug stuff
     213    glLoadIdentity();
     214    glMultMatrixf(&model_matrix[0][0]);
    208215
    209216    for (int buf = 0, i = 0, n; i < data->ntiles; i = n, buf += 2)
     
    255262        free(texture);
    256263    }
    257 
    258     glPopMatrix();
    259264#endif
    260265
Note: See TracChangeset for help on using the changeset viewer.