Ignore:
Timestamp:
Aug 17, 2011, 5:20:09 PM (8 years ago)
Author:
sam
Message:

shader: factor the uniform handling logic into platform-independent methods
for both OpenGL and the PS3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scene.cpp

    r831 r832  
    267267    stdshader->Bind();
    268268
     269    uni_mat = stdshader->GetUniformLocation("proj_matrix");
     270    stdshader->SetUniform(uni_mat, Video::GetProjMatrix());
     271    uni_mat = stdshader->GetUniformLocation("view_matrix");
     272    stdshader->SetUniform(uni_mat, Video::GetViewMatrix());
     273    uni_mat = stdshader->GetUniformLocation("model_matrix");
     274    stdshader->SetUniform(uni_mat, data->model_matrix);
     275
    269276#if !defined __CELLOS_LV2__
    270     uni_mat = stdshader->GetUniformLocation("proj_matrix");
    271     glUniformMatrix4fv(uni_mat, 1, GL_FALSE, &Video::GetProjMatrix()[0][0]);
    272     uni_mat = stdshader->GetUniformLocation("view_matrix");
    273     glUniformMatrix4fv(uni_mat, 1, GL_FALSE, &Video::GetViewMatrix()[0][0]);
    274     uni_mat = stdshader->GetUniformLocation("model_matrix");
    275     glUniformMatrix4fv(uni_mat, 1, GL_FALSE, &data->model_matrix[0][0]);
    276 
    277277    uni_tex = stdshader->GetUniformLocation("in_Texture");
    278278    glUniform1i(uni_tex, 0);
    279279#else
    280     uni_mat = stdshader->GetUniformLocation("proj_matrix");
    281     cgGLSetMatrixParameterfc((CGparameter)(intptr_t)uni_mat, &Video::GetProjMatrix()[0][0]);
    282     uni_mat = stdshader->GetUniformLocation("view_matrix");
    283     cgGLSetMatrixParameterfc((CGparameter)(intptr_t)uni_mat, &Video::GetViewMatrix()[0][0]);
    284     uni_mat = stdshader->GetUniformLocation("model_matrix");
    285     cgGLSetMatrixParameterfc((CGparameter)(intptr_t)uni_mat, &data->model_matrix[0][0]);
    286 
    287280    // WTF? this doesn't exist
    288281    //uni_tex = stdshader->GetUniformLocation("in_Texture");
Note: See TracChangeset for help on using the changeset viewer.