]> git.mxchange.org Git - flightgear.git/commitdiff
Updates to material properties so --disable-textures now works, although
authorcurt <curt>
Wed, 11 Aug 1999 16:52:15 +0000 (16:52 +0000)
committercurt <curt>
Wed, 11 Aug 1999 16:52:15 +0000 (16:52 +0000)
textures still cannot be toggled on and off with F9 while the sim is running.

src/Objects/fragment.hxx
src/Objects/materialmgr.cxx

index cd631420f9abe39e54745a65cdef59714eb8ddea..14809a393261a139a5448fc224fd238572270141 100644 (file)
@@ -45,7 +45,6 @@
 #include <vector>
 
 #include <Include/fg_constants.h>
-#include <Math/mat3.h>
 #include <Math/point3d.hxx>
 
 FG_USING_STD(vector);
index 30495b8f2a831452171fa987e1bb45887a4c5980..90b007636197b6561322a345827e52f06efedad1 100644 (file)
@@ -178,12 +178,28 @@ fgMATERIAL_MGR::load_lib ( void )
            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 ) ;
+           if ( current_options.get_textures() ) {
+               state->enable( GL_TEXTURE_2D );
+               state->setTexture( tex_file.c_str() );
+               state->setMaterial ( GL_AMBIENT_AND_DIFFUSE, 1, 1, 1, 1 ) ;
+           } else {
+               state->disable( GL_TEXTURE_2D );
+               state->disable( GL_COLOR_MATERIAL );
+               GLfloat *ambient, *diffuse;
+               ambient = m.get_ambient();
+               diffuse = m.get_diffuse();
+               /* cout << "ambient = " << ambient[0] << "," << ambient[1] 
+                    << "," << ambient[2] << endl; */
+               state->setMaterial ( GL_AMBIENT, 
+                                    ambient[0], ambient[1], 
+                                    ambient[2], ambient[3] ) ;
+               state->setMaterial ( GL_DIFFUSE, 
+                                    diffuse[0], diffuse[1], 
+                                    diffuse[2], diffuse[3] ) ;
+           }
            m_slot.set_state( state );
 
            material_mgr.material_map[material_name] = m_slot;