Changeset 231 for trunk/tests


Ignore:
Timestamp:
05/06/14 13:38:28 (11 years ago)
Author:
epyon
Message:
  • further simplification of mesh classes
  • updated tests
Location:
trunk/tests
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/md2_test/md2_test.cc

    r224 r231  
    5858        }
    5959
     60        nv::mesh_interface* get_mesh() { return m_mesh; }
     61
    6062        size_t get_max_frames()
    6163        {
    6264                return m_mesh->get_max_frames();
    63         }
    64 
    65         void draw( nv::render_state& rstate, const glm::mat4& m, const glm::mat4& v, const glm::mat4& p )
    66         {
    67                 NV_PROFILE( "mesh-draw" );
    68                 glm::mat4 mv = v * m;
    69                 m_mesh->get_program()->set_opt_uniform( "nv_m_modelview", mv );
    70                 m_mesh->get_program()->set_opt_uniform( "nv_m_normal", glm::transpose(glm::inverse(glm::mat3(mv))) );
    71                 m_mesh->get_program()->set_uniform( "matrix_mvp", p * mv );
    72                 m_mesh->draw( rstate );
    7365        }
    7466
     
    8072
    8173private:
    82         nv::mesh_data*           m_mesh_data;
    83         nv::keyframed_mesh_gpu*  m_mesh;
     74        nv::mesh_data*       m_mesh_data;
     75        nv::keyframed_mesh*  m_mesh;
    8476};
    8577
     
    10698        NV_PROFILE( "app_construct" );
    10799        m_device = new nv::gl_device();
    108         m_window = m_device->create_window( 800, 600 );
     100        m_window = m_device->create_window( 800, 600, false );
    109101
    110102        nv::sampler sampler( nv::sampler::LINEAR, nv::sampler::REPEAT );
     
    178170                        NV_PROFILE( "draw" );
    179171                        glm::mat4 model      = glm::mat4(1.0f);
    180                         m_mesh->draw( m_render_state, model, view, projection );
     172                        glm::mat4 mv = view * model;
     173                        m_program->set_opt_uniform( "nv_m_modelview", mv );
     174                        m_program->set_opt_uniform( "nv_m_normal", glm::transpose(glm::inverse(glm::mat3(mv))) );
     175                        m_program->set_uniform( "matrix_mvp", projection * mv );
     176                        m_mesh->get_mesh()->update( m_program );
     177                        m_window->get_context()->draw( m_render_state, m_program, m_mesh->get_mesh() );
    181178                }
    182179
  • trunk/tests/render_test/rl.cc

    r214 r231  
    8080{
    8181        m_device = new nv::gl_device();
    82         m_window = m_device->create_window( 800, 600 );
     82        m_window = m_device->create_window( 800, 600, false );
    8383       
    8484        nv::image_data* sprites = m_device->create_image_data( "spritesheet.png" );
Note: See TracChangeset for help on using the changeset viewer.