#ifdef FG_NETWORK_OLK
#include <NetworkOLK/network.h>
#endif
+#include <Objects/matlib.hxx>
#include <Scenery/scenery.hxx>
#include <Scenery/tilemgr.hxx>
#ifdef ENABLE_AUDIO_SUPPORT
cur_fdm_state->get_Latitude()
* SGD_RADIANS_TO_DEGREES );
+ // see if we need to load any deferred-load textures
+ material_lib.load_next_deferred();
+
// Process/manage pending events
global_events.Process();
0.0 );
globals->set_ephem( ephem );
+ thesky = new SGSky;
+
SGPath sky_tex_path( globals->get_fg_root() );
sky_tex_path.append( "Textures" );
sky_tex_path.append( "Sky" );
- thesky = new SGSky;
thesky->texture_path( sky_tex_path.str() );
thesky->build( 550.0, 550.0,
}
-
-
-
-
-
-
-
-
+// Load one pending "deferred" texture. Return true if a texture
+// loaded successfully, false if no pending, or error.
+void FGMaterialLib::load_next_deferred() {
+ // container::iterator it = begin();
+ for ( material_map_iterator it = begin(); it != end(); it++ ) {
+ const string &key = it->first;
+ FGNewMat &slot = it->second;
+ if ( ! slot.get_texture_loaded() ) {
+ SG_LOG( SG_GENERAL, SG_INFO, "Loading texture for " << key );
+#ifdef PLIB_1_2_X
+ slot.get_textured()->
+ setTexture( (char *)slot.get_texture_name_c_str(), 0, 0, 0 );
+#else
+ slot.get_textured()->
+ setTexture( (char *)slot.get_texture_name_c_str(), 0, 0 );
+#endif
+ slot.set_texture_loaded( true );
+ }
+ }
+}
void set_step (int step);
+ // Load one pending "deferred" texture. Return true if a texture
+ // loaded successfully, false if no pending, or error.
+ void load_next_deferred();
+
material_map_iterator begin() { return matlib.begin(); }
const_material_map_iterator begin() const { return matlib.begin(); }
inline void set_material_name( const string& n ) { material_name = n; }
inline string get_texture_name() const { return texture_name; }
+ inline const char *get_texture_name_c_str() const {
+ return texture_name.c_str();
+ }
inline void set_texture_name( const string& n ) { texture_name = n; }
+ inline ssgSimpleState *get_textured() { return textured; }
+
inline double get_xsize() const { return xsize; }
inline double get_ysize() const { return ysize; }
inline void set_xsize( double x ) { xsize = x; }
inline void set_specular( sgVec4 s ) { sgCopyVec4( specular, s ); }
inline void set_emission( sgVec4 e ) { sgCopyVec4( emission, e ); }
+ inline bool get_texture_loaded() const { return texture_loaded; }
+ inline void set_texture_loaded( bool val ) { texture_loaded = val; }
+
inline double get_light_coverage () const { return light_coverage; }
inline void set_light_coverage (double coverage) {
light_coverage = coverage;