X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FObjects%2Fmaterialmgr.cxx;h=30495b8f2a831452171fa987e1bb45887a4c5980;hb=243b73c10b5385374a2d4bdfe48e5a85521c0bb3;hp=28e21c8034495d276bbc0d8cb603e6a0a7de116f;hpb=c90db01dc8d5462a3da22771ffa7c96f5ea31217;p=flightgear.git diff --git a/src/Objects/materialmgr.cxx b/src/Objects/materialmgr.cxx index 28e21c803..30495b8f2 100644 --- a/src/Objects/materialmgr.cxx +++ b/src/Objects/materialmgr.cxx @@ -69,19 +69,24 @@ FGMaterialSlot::~FGMaterialSlot ( void ) { // Constructor fgMATERIAL_MGR::fgMATERIAL_MGR ( void ) { - textures_loaded = false; + materials_loaded = false; } void FGMaterialSlot::render_fragments() { + FG_LOG( FG_GENERAL, FG_ALERT, + "FGMaterialSlot::render_fragments() is depricated ... " << + "we shouldn't be here!" ); + int tris_rendered = current_view.get_tris_rendered(); // cout << "rendering " + texture_name + " = " << list_size << "\n"; - if ( empty() ) + if ( empty() ) { return; + } if ( current_options.get_textures() ) { @@ -116,7 +121,7 @@ FGMaterialSlot::render_fragments() // Woohoo!!! We finally get to draw something! // printf(" display_list = %d\n", frag_ptr->display_list); - xglCallList( frag_ptr->display_list ); + // xglCallList( frag_ptr->display_list ); } current_view.set_tris_rendered( tris_rendered ); @@ -163,18 +168,30 @@ fgMATERIAL_MGR::load_lib ( void ) FGMaterial m; in >> m; - // if ( current_options.get_textures() ) { - // m.load_texture( current_options.get_fg_root() ); - // } - FGMaterialSlot m_slot; m_slot.set_m( m ); + + // build the ssgSimpleState + FGPath tex_file( current_options.get_fg_root() ); + tex_file.append( "Textures" ); + tex_file.append( m.get_texture_name() ); + tex_file.concat( ".rgb" ); + + ssgSimpleState *state = new ssgSimpleState; + state->setTexture( tex_file.c_str() ); + state->enable( GL_TEXTURE_2D ); + state->enable( GL_LIGHTING ); + state->setShadeModel( GL_SMOOTH ); + state->enable ( GL_CULL_FACE ) ; + state->setMaterial ( GL_AMBIENT_AND_DIFFUSE, 1, 1, 1, 1 ) ; + m_slot.set_state( state ); + material_mgr.material_map[material_name] = m_slot; } } if ( current_options.get_textures() ) { - textures_loaded = true; + materials_loaded = true; } return(1);