that.
SGPath mpath( globals->get_fg_root() );
mpath.append( "materials.xml" );
- if ( ! material_lib.load( globals->get_fg_root(), mpath.str() ) ) {
+ if ( ! globals->get_matlib()->load(globals->get_fg_root(), mpath.str()) ) {
SG_LOG( SG_GENERAL, SG_ALERT, "Error loading material lib!" );
exit(-1);
}
class SGCommandMgr;
class SGMagVar;
+class SGMaterialLib;
class SGModelLoader;
class SGPropertyNode;
class SGRoute;
// Magnetic Variation
SGMagVar *mag;
+ // Material properties library
+ SGMaterialLib *matlib;
+
// Current autopilot
FGAutopilot *autopilot;
inline SGMagVar *get_mag() const { return mag; }
inline void set_mag( SGMagVar *m ) { mag = m; }
+ inline SGMaterialLib *get_matlib() const { return matlib; }
+ inline void set_matlib( SGMaterialLib *m ) { matlib = m; }
+
inline FGAutopilot *get_autopilot() const { return autopilot; }
inline void set_autopilot( FGAutopilot *ap) { autopilot = ap; }
globals->get_io()->update( delta_time_sec );
// see if we need to load any deferred-load textures
- material_lib.load_next_deferred();
+ globals->get_matlib()->load_next_deferred();
// Run audio scheduler
#ifdef ENABLE_AUDIO_SUPPORT
ssgModelPath( (char *)modelpath.c_str() );
// Initialize the global scenery manager
+ globals->set_matlib( new SGMaterialLib );
globals->set_scenery( new FGScenery );
globals->get_scenery()->init();
globals->get_scenery()->bind();
#include "obj.hxx"
-ssgBranch *gen_taxi_sign( const string path, const string content ) {
+ssgBranch *gen_taxi_sign( SGMaterialLib *matlib,
+ const string path, const string content )
+{
// for demo purposes we assume each element (letter) is 1x1 meter.
// Sign is placed 0.25 meters above the ground
tex_index.push_back( 2 );
tex_index.push_back( 3 );
- ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLE_STRIP, material,
+ ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLE_STRIP, matlib, material,
nodes, normals, texcoords,
vertex_index, normal_index, tex_index,
false, NULL );
}
-ssgBranch *gen_runway_sign( const string path, const string name ) {
+ssgBranch *gen_runway_sign( SGMaterialLib *matlib,
+ const string path, const string name )
+{
// for demo purposes we assume each element (letter) is 1x1 meter.
// Sign is placed 0.25 meters above the ground
tex_index.push_back( 2 );
tex_index.push_back( 3 );
- ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLE_STRIP, material,
+ ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLE_STRIP, matlib, material,
nodes, normals, texcoords,
vertex_index, normal_index, tex_index,
false, NULL );
#include <plib/ssg.h> // plib include
+class SGMaterialLib; // forward declaration
+
SG_USING_STD(string);
// Generate a taxi sign
-ssgBranch *gen_taxi_sign( const string path, const string content );
+ssgBranch *gen_taxi_sign( SGMaterialLib *matlib,
+ const string path, const string content );
// Generate a runway sign
-ssgBranch *gen_runway_sign( const string path, const string name );
+ssgBranch *gen_runway_sign( SGMaterialLib *matlib,
+ const string path, const string name );
#endif // _APT_SIGNS_HXX
-// obj.hxx -- routines to handle loading scenery and building the plib
+// obj.cxx -- routines to handle loading scenery and building the plib
// scene graph.
//
// Written by Curtis Olson, started October 1997.
#include <Main/globals.hxx>
#include <Main/fg_props.hxx>
#include <Time/light.hxx>
-#include <Scenery/tileentry.hxx>
#include "pt_lights.hxx"
#include "obj.hxx"
// Generate an ocean tile
bool fgGenTile( const string& path, SGBucket b,
- Point3D *center,
- double *bounding_radius,
- ssgBranch* geometry )
+ Point3D *center, double *bounding_radius,
+ SGMaterialLib *matlib, ssgBranch* geometry )
{
- SGMaterial *newmat;
-
ssgSimpleState *state = NULL;
- geometry -> setName ( (char *)path.c_str() ) ;
+ geometry->setName( (char *)path.c_str() );
double tex_width = 1000.0;
// double tex_height;
// find Ocean material in the properties list
- newmat = material_lib.find( "Ocean" );
- if ( newmat != NULL ) {
+ SGMaterial *mat = matlib->find( "Ocean" );
+ if ( mat != NULL ) {
// set the texture width and height values for this
// material
- tex_width = newmat->get_xsize();
+ tex_width = mat->get_xsize();
// tex_height = newmat->get_ysize();
// set ssgState
- state = newmat->get_state();
+ state = mat->get_state();
} else {
SG_LOG( SG_TERRAIN, SG_ALERT,
"Ack! unknown usemtl name = " << "Ocean"
{
public:
bool is_filled_in;
- ssgLeaf * leaf;
- SGMaterial * mat;
- ssgBranch * branch;
+ ssgLeaf *leaf;
+ SGMaterial *mat;
+ ssgBranch *branch;
float sin_lat;
float cos_lat;
float sin_lon;
static void
gen_random_surface_objects (ssgLeaf *leaf,
ssgBranch *branch,
- Point3D * center,
- const string &material_name)
+ Point3D *center,
+ SGMaterial *mat )
{
// If the surface has no triangles, return
// now.
int num_tris = leaf->getNumTriangles();
if (num_tris < 1)
- return;
-
- // Get the material for this surface.
- SGMaterial * mat = material_lib.find(material_name);
- if (mat == 0) {
- SG_LOG(SG_INPUT, SG_ALERT, "Unknown material " << material_name);
- return;
- }
+ return;
// If the material has no randomly-placed
// objects, return now.
if (mat->get_object_group_count() < 1)
- return;
+ return;
// Calculate the geodetic centre of
// the tile, for aligning automatic
////////////////////////////////////////////////////////////////////////
ssgLeaf *gen_leaf( const string& path,
- const GLenum ty, const string& material,
+ const GLenum ty,
+ SGMaterialLib *matlib, const string& material,
const point_list& nodes, const point_list& normals,
const point_list& texcoords,
const int_list& node_index,
ssgSimpleState *state = NULL;
float coverage = -1;
- SGMaterial *newmat = material_lib.find( material );
- if ( newmat == NULL ) {
+ SGMaterial *mat = matlib->find( material );
+ if ( mat == NULL ) {
// see if this is an on the fly texture
string file = path;
string::size_type pos = file.rfind( "/" );
file += "/";
file += material;
// cout << "current file = " << file << endl;
- if ( ! material_lib.add_item( file ) ) {
+ if ( ! matlib->add_item( file ) ) {
SG_LOG( SG_TERRAIN, SG_ALERT,
"Ack! unknown usemtl name = " << material
<< " in " << path );
} else {
// locate our newly created material
- newmat = material_lib.find( material );
- if ( newmat == NULL ) {
+ mat = matlib->find( material );
+ if ( mat == NULL ) {
SG_LOG( SG_TERRAIN, SG_ALERT,
"Ack! bad on the fly material create = "
<< material << " in " << path );
}
}
- if ( newmat != NULL ) {
+ if ( mat != NULL ) {
// set the texture width and height values for this
// material
- tex_width = newmat->get_xsize();
- tex_height = newmat->get_ysize();
- state = newmat->get_state();
- coverage = newmat->get_light_coverage();
+ tex_width = mat->get_xsize();
+ tex_height = mat->get_ysize();
+ state = mat->get_state();
+ coverage = mat->get_light_coverage();
// cout << "(w) = " << tex_width << " (h) = "
// << tex_width << endl;
} else {
bool fgBinObjLoad( const string& path, const bool is_base,
Point3D *center,
double *bounding_radius,
+ SGMaterialLib *matlib,
ssgBranch* geometry,
ssgBranch* rwy_lights,
ssgBranch* taxi_lights,
// returns a transform -> lod -> leaf structure
ssgBranch *branch = gen_directional_lights( nodes, normals,
pts_v[i], pts_n[i],
- pt_materials[i],
+ matlib, pt_materials[i],
up );
// branches don't honor callbacks as far as I know so I'm
// commenting this out to avoid a plib runtime warning.
} else {
material = pt_materials[i];
tex_index.clear();
- ssgLeaf *leaf = gen_leaf( path, GL_POINTS, material,
+ ssgLeaf *leaf = gen_leaf( path, GL_POINTS, matlib, material,
nodes, normals, texcoords,
pts_v[i], pts_n[i], tex_index,
false, ground_lights );
group_list const& tris_n = obj.get_tris_n();
group_list const& tris_tc = obj.get_tris_tc();
for ( i = 0; i < tris_v.size(); ++i ) {
- ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLES, tri_materials[i],
+ ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLES, matlib, tri_materials[i],
nodes, normals, texcoords,
tris_v[i], tris_n[i], tris_tc[i],
is_base, ground_lights );
- if (use_random_objects)
- gen_random_surface_objects(leaf, random_object_branch,
- center, tri_materials[i]);
+ if ( use_random_objects ) {
+ SGMaterial *mat = matlib->find( tri_materials[i] );
+ if ( mat == NULL ) {
+ SG_LOG( SG_INPUT, SG_ALERT,
+ "Unknown material for random surface objects = "
+ << tri_materials[i] );
+ }
+ gen_random_surface_objects( leaf, random_object_branch,
+ center, mat );
+ }
geometry->addKid( leaf );
}
group_list const& strips_n = obj.get_strips_n();
group_list const& strips_tc = obj.get_strips_tc();
for ( i = 0; i < strips_v.size(); ++i ) {
- ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLE_STRIP, strip_materials[i],
+ ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLE_STRIP,
+ matlib, strip_materials[i],
nodes, normals, texcoords,
strips_v[i], strips_n[i], strips_tc[i],
is_base, ground_lights );
- if (use_random_objects)
- gen_random_surface_objects(leaf, random_object_branch,
- center,strip_materials[i]);
+ if ( use_random_objects ) {
+ SGMaterial *mat = matlib->find( strip_materials[i] );
+ if ( mat == NULL ) {
+ SG_LOG( SG_INPUT, SG_ALERT,
+ "Unknown material for random surface objects = "
+ << strip_materials[i] );
+ }
+ gen_random_surface_objects( leaf, random_object_branch,
+ center, mat );
+ }
geometry->addKid( leaf );
}
group_list const& fans_n = obj.get_fans_n();
group_list const& fans_tc = obj.get_fans_tc();
for ( i = 0; i < fans_v.size(); ++i ) {
- ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLE_FAN, fan_materials[i],
+ ssgLeaf *leaf = gen_leaf( path, GL_TRIANGLE_FAN,
+ matlib, fan_materials[i],
nodes, normals, texcoords,
fans_v[i], fans_n[i], fans_tc[i],
is_base, ground_lights );
- if (use_random_objects)
- gen_random_surface_objects(leaf, random_object_branch,
- center, fan_materials[i]);
+ if ( use_random_objects ) {
+ SGMaterial *mat = matlib->find( fan_materials[i] );
+ if ( mat == NULL ) {
+ SG_LOG( SG_INPUT, SG_ALERT,
+ "Unknown material for random surface objects = "
+ << fan_materials[i] );
+ }
+ gen_random_surface_objects( leaf, random_object_branch,
+ center, mat );
+ }
geometry->addKid( leaf );
}
#include <simgear/bucket/newbucket.hxx>
#include <simgear/math/sg_types.hxx>
+#include <simgear/scene/material/matlib.hxx>
SG_USING_STD(string);
bool fgBinObjLoad( const string& path, const bool is_base,
Point3D *center,
double *bounding_radius,
+ SGMaterialLib *matlib,
ssgBranch* geometry,
ssgBranch* rwy_lights,
ssgBranch* taxi_lights,
// Generate an ocean tile
bool fgGenTile( const string& path, SGBucket b,
- Point3D *center,
- double *bounding_radius,
- ssgBranch* geometry );
+ Point3D *center, double *bounding_radius,
+ SGMaterialLib *matlib, ssgBranch* geometry );
// Create a ssg leaf
ssgLeaf *gen_leaf( const string& path,
- const GLenum ty, const string& material,
+ const GLenum ty,
+ SGMaterialLib *matlib, const string& material,
const point_list& nodes, const point_list& normals,
const point_list& texcoords,
const int_list& node_index,
// Generate a directional light
ssgLeaf *gen_directional_light( sgVec3 pt, sgVec3 dir, sgVec3 up,
- const string &material ) {
+ const SGMaterial *mat ) {
// calculate a vector perpendicular to dir and up
sgVec3 perp;
ssgLeaf *leaf =
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
- SGMaterial *newmat = material_lib.find( material );
-
- if ( newmat != NULL ) {
- leaf->setState( newmat->get_state() );
+ if ( mat != NULL ) {
+ leaf->setState( mat->get_state() );
} else {
- SG_LOG( SG_TERRAIN, SG_ALERT, "Warning: can't material = "
- << material );
+ SG_LOG( SG_TERRAIN, SG_ALERT, "Warning: mat = NULL" );
}
return leaf;
}
-ssgTransform *gen_dir_light_group( const point_list &nodes,
- const point_list &normals,
- const int_list &pnt_i,
- const int_list &nml_i,
- const string &material,
- sgVec3 up, bool vertical = false )
+static ssgTransform *gen_dir_light_group( const point_list &nodes,
+ const point_list &normals,
+ const int_list &pnt_i,
+ const int_list &nml_i,
+ const SGMaterial *mat,
+ sgVec3 up, bool vertical = false )
{
sgVec3 center;
calc_center_point( nodes, pnt_i, center );
ssgLeaf *leaf =
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
- SGMaterial *newmat = material_lib.find( material );
-
- if ( newmat != NULL ) {
- leaf->setState( newmat->get_state() );
+ if ( mat != NULL ) {
+ leaf->setState( mat->get_state() );
} else {
- SG_LOG( SG_TERRAIN, SG_ALERT, "Warning: can't material = "
- << material );
+ SG_LOG( SG_TERRAIN, SG_ALERT, "Warning: material = NULL" );
}
// put an LOD on each lighting component
}
-ssgTransform *gen_reil_lights( const point_list &nodes,
- const point_list &normals,
- const int_list &pnt_i,
- const int_list &nml_i,
- const string &material,
- sgVec3 up )
+static ssgTransform *gen_reil_lights( const point_list &nodes,
+ const point_list &normals,
+ const int_list &pnt_i,
+ const int_list &nml_i,
+ SGMaterialLib *matlib,
+ sgVec3 up )
{
sgVec3 center;
calc_center_point( nodes, pnt_i, center );
ssgLeaf *leaf =
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
- SGMaterial *newmat = material_lib.find( "RWY_WHITE_LIGHTS" );
+ SGMaterial *mat = matlib->find( "RWY_WHITE_LIGHTS" );
- if ( newmat != NULL ) {
- leaf->setState( newmat->get_state() );
+ if ( mat != NULL ) {
+ leaf->setState( mat->get_state() );
} else {
- SG_LOG( SG_TERRAIN, SG_ALERT, "Warning: can't material = "
- << material );
+ SG_LOG( SG_TERRAIN, SG_ALERT,
+ "Warning: can't find material = RWY_WHITE_LIGHTS" );
}
leaf->setCallback( SSG_CALLBACK_PREDRAW, StrobePreDraw );
}
-ssgTransform *gen_odals_lights( const point_list &nodes,
- const point_list &normals,
- const int_list &pnt_i,
- const int_list &nml_i,
- const string &material,
- sgVec3 up )
+static ssgTransform *gen_odals_lights( const point_list &nodes,
+ const point_list &normals,
+ const int_list &pnt_i,
+ const int_list &nml_i,
+ SGMaterialLib *matlib,
+ sgVec3 up )
{
sgVec3 center;
calc_center_point( nodes, pnt_i, center );
sgVec4 color;
sgSetVec4( color, 1.0, 1.0, 1.0, 1.0 );
+ // we don't want directional lights here
+ SGMaterial *mat = matlib->find( "GROUND_LIGHTS" );
+ if ( mat == NULL ) {
+ SG_LOG( SG_TERRAIN, SG_ALERT,
+ "Warning: can't material = GROUND_LIGHTS" );
+ }
+
// center line strobes
int i;
sgVec3 pt;
ssgLeaf *leaf =
new ssgVtxTable ( GL_POINTS, vl, NULL, NULL, cl );
- // we don't want directional lights here
- SGMaterial *newmat = material_lib.find( "GROUND_LIGHTS" );
-
- if ( newmat != NULL ) {
- leaf->setState( newmat->get_state() );
- } else {
- SG_LOG( SG_TERRAIN, SG_ALERT, "Warning: can't material = "
- << material );
- }
-
+ leaf->setState( mat->get_state() );
leaf->setCallback( SSG_CALLBACK_PREDRAW, StrobePreDraw );
leaf->setCallback( SSG_CALLBACK_POSTDRAW, StrobePostDraw );
ssgLeaf *leaf =
new ssgVtxTable ( GL_POINTS, vl, NULL, NULL, cl );
- // we don't want directional lights here
- SGMaterial *newmat = material_lib.find( "GROUND_LIGHTS" );
-
- if ( newmat != NULL ) {
- leaf->setState( newmat->get_state() );
- } else {
- SG_LOG( SG_TERRAIN, SG_ALERT, "Warning: can't material = "
- << material );
- }
-
+ leaf->setState( mat->get_state() );
leaf->setCallback( SSG_CALLBACK_PREDRAW, StrobePreDraw );
leaf->setCallback( SSG_CALLBACK_POSTDRAW, StrobePostDraw );
}
-ssgTransform *gen_rabbit_lights( const point_list &nodes,
- const point_list &normals,
- const int_list &pnt_i,
- const int_list &nml_i,
- const string &material,
- sgVec3 up )
+static ssgTransform *gen_rabbit_lights( const point_list &nodes,
+ const point_list &normals,
+ const int_list &pnt_i,
+ const int_list &nml_i,
+ SGMaterialLib *matlib,
+ sgVec3 up )
{
sgVec3 center;
calc_center_point( nodes, pnt_i, center );
ssgTimedSelector *rabbit = new ssgTimedSelector;
+ SGMaterial *mat = matlib->find( "RWY_WHITE_LIGHTS" );
+ if ( mat == NULL ) {
+ SG_LOG( SG_TERRAIN, SG_ALERT,
+ "Warning: can't material = RWY_WHITE_LIGHTS" );
+ }
+
int i;
sgVec3 pt, normal;
for ( i = (int)pnt_i.size() - 1; i >= 0; --i ) {
ssgLeaf *leaf =
new ssgVtxTable ( GL_TRIANGLES, vl, nl, NULL, cl );
- SGMaterial *newmat = material_lib.find( "RWY_WHITE_LIGHTS" );
-
- if ( newmat != NULL ) {
- leaf->setState( newmat->get_state() );
- } else {
- SG_LOG( SG_TERRAIN, SG_ALERT, "Warning: can't material = "
- << material );
- }
-
+ leaf->setState( mat->get_state() );
leaf->setCallback( SSG_CALLBACK_PREDRAW, StrobePreDraw );
leaf->setCallback( SSG_CALLBACK_POSTDRAW, StrobePostDraw );
}
-// Generate a directional light
-ssgLeaf *gen_normal_line( sgVec3 pt, sgVec3 dir, sgVec3 up ) {
+#if 0 // debugging infrastructure
+// Generate a normal line
+static ssgLeaf *gen_normal_line( SGMaterialLib *matlib,
+ sgVec3 pt, sgVec3 dir, sgVec3 up ) {
ssgVertexArray *vl = new ssgVertexArray( 3 );
ssgColourArray *cl = new ssgColourArray( 3 );
ssgLeaf *leaf =
new ssgVtxTable ( GL_LINES, vl, NULL, NULL, cl );
- SGMaterial *newmat = material_lib.find( "GROUND_LIGHTS" );
- leaf->setState( newmat->get_state() );
+ SGMaterial *mat = matlib->find( "GROUND_LIGHTS" );
+ leaf->setState( mat->get_state() );
return leaf;
}
+#endif
ssgBranch *gen_directional_lights( const point_list &nodes,
const point_list &normals,
const int_list &pnt_i,
const int_list &nml_i,
+ SGMaterialLib *matlib,
const string &material,
sgVec3 up )
{
sgVec3 nup;
sgNormalizeVec3( nup, up );
+ SGMaterial *mat = matlib->find( material );
+
if ( material == "RWY_REIL_LIGHTS" ) {
// cout << "found a reil" << endl;
ssgTransform *reil = gen_reil_lights( nodes, normals, pnt_i, nml_i,
- material, up );
+ matlib, up );
return reil;
} else if ( material == "RWY_ODALS_LIGHTS" ) {
// cout << "found a odals" << endl;
ssgTransform *odals = gen_odals_lights( nodes, normals, pnt_i, nml_i,
- material, up );
+ matlib, up );
return odals;
} else if ( material == "RWY_SEQUENCED_LIGHTS" ) {
// cout << "found a rabbit" << endl;
ssgTransform *rabbit = gen_rabbit_lights( nodes, normals,
pnt_i, nml_i,
- material, up );
+ matlib, up );
return rabbit;
} else if ( material == "RWY_BLUE_TAXIWAY_LIGHTS" ) {
ssgTransform *light_group = gen_dir_light_group( nodes, normals, pnt_i,
- nml_i, material, up,
+ nml_i, mat, up,
true );
return light_group;
} else {
ssgTransform *light_group = gen_dir_light_group( nodes, normals, pnt_i,
- nml_i, material, up );
+ nml_i, mat, up );
return light_group;
}
const point_list &normals,
const int_list &pnt_i,
const int_list &nml_i,
+ SGMaterialLib *matlib,
const string &material,
sgVec3 up );
#include <simgear/compiler.h>
+#include STL_STRING
+
#include <simgear/bucket/newbucket.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include "tileentry.hxx"
#include "tilemgr.hxx"
+SG_USING_STD(string);
+
// Constructor
FGTileEntry::FGTileEntry ( const SGBucket& b )
}
-ssgLeaf* FGTileEntry::gen_lights( ssgVertexArray *lights, int inc, float bright ) {
+ssgLeaf* FGTileEntry::gen_lights( SGMaterialLib *matlib, ssgVertexArray *lights,
+ int inc, float bright )
+{
// generate a repeatable random seed
float *p1 = lights->get( 0 );
unsigned int *seed = (unsigned int *)p1;
new ssgVtxTable ( GL_POINTS, vl, nl, tl, cl );
// assign state
- SGMaterial *newmat = material_lib.find( "GROUND_LIGHTS" );
- leaf->setState( newmat->get_state() );
+ SGMaterial *mat = matlib->find( "GROUND_LIGHTS" );
+ leaf->setState( mat->get_state() );
leaf->setCallback( SSG_CALLBACK_PREDRAW, fgLightsPredraw );
leaf->setCallback( SSG_CALLBACK_POSTDRAW, fgLightsPostdraw );
}
-bool FGTileEntry::obj_load( const std::string& path,
+bool FGTileEntry::obj_load( const string& path,
ssgBranch* geometry,
ssgBranch* rwy_lights,
ssgBranch* taxi_lights,
// try loading binary format
if ( fgBinObjLoad( path, is_base,
- &c, &br, geometry,
+ &c, &br, globals->get_matlib(), geometry,
rwy_lights, taxi_lights, ground_lights ) )
{
if ( is_base ) {
}
} else {
// default to an ocean tile
- if ( fgGenTile( path, tile_bucket, &c, &br, geometry ) ) {
+ if ( fgGenTile( path, tile_bucket, &c, &br,
+ globals->get_matlib(), geometry ) )
+ {
center = c;
bounding_radius = br;
} else {
obj_trans->setTransform( &obj_pos );
ssgBranch *custom_obj
- = gen_taxi_sign( custom_path.str(), name );
+ = gen_taxi_sign( globals->get_matlib(),
+ custom_path.str(), name );
// wire the pieces together
if ( custom_obj != NULL ) {
obj_trans->setTransform( &obj_pos );
ssgBranch *custom_obj
- = gen_runway_sign( custom_path.str(), name );
+ = gen_runway_sign( globals->get_matlib(),
+ custom_path.str(), name );
// wire the pieces together
if ( custom_obj != NULL ) {
ssgBranch *geometry = new ssgBranch;
Point3D c;
double br;
- if ( fgGenTile( basename.str(), tile_bucket, &c, &br, geometry ) ) {
+ if ( fgGenTile( basename.str(), tile_bucket, &c, &br,
+ globals->get_matlib(), geometry ) ) {
center = c;
bounding_radius = br;
new_tile -> addKid( geometry );
gnd_lights_brightness = new ssgSelector;
ssgLeaf *lights;
- lights = gen_lights( light_pts, 4, 0.7 );
+ lights = gen_lights( globals->get_matlib(), light_pts, 4, 0.7 );
gnd_lights_brightness->addKid( lights );
- lights = gen_lights( light_pts, 2, 0.85 );
+ lights = gen_lights( globals->get_matlib(), light_pts, 2, 0.85 );
gnd_lights_brightness->addKid( lights );
- lights = gen_lights( light_pts, 1, 1.0 );
+ lights = gen_lights( globals->get_matlib(), light_pts, 1, 1.0 );
gnd_lights_brightness->addKid( lights );
gnd_lights_range->addKid( gnd_lights_brightness );
*/
volatile int pending_models;
- bool obj_load( const std::string& path,
- ssgBranch* geometry,
- ssgBranch* rwy_lights,
- ssgBranch* taxi_lights,
- ssgVertexArray* gound_lights,
- bool is_base );
-
- ssgLeaf* gen_lights( ssgVertexArray *lights, int inc, float bright );
+ bool obj_load( const string& path,
+ ssgBranch* geometry,
+ ssgBranch* rwy_lights,
+ ssgBranch* taxi_lights,
+ ssgVertexArray* gound_lights,
+ bool is_base );
+
+ ssgLeaf* gen_lights( SGMaterialLib *matlib, ssgVertexArray *lights,
+ int inc, float bright );
double timestamp;