]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tileentry.hxx
Fix line endings
[flightgear.git] / src / Scenery / tileentry.hxx
index a979e677bf757be7fd65aecfbd3e2bc7220fd4ca..e60f4107b49543249daaeafdbf7c3fe59530737a 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Curtis Olson, started May 1998.
 //
-// Copyright (C) 1998 - 2001  Curtis L. Olson  - curt@flightgear.org
+// Copyright (C) 1998 - 2001  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -41,6 +41,8 @@
 #include <simgear/bucket/newbucket.hxx>
 #include <simgear/math/point3d.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/scene/model/placementtrans.hxx>
+#include <simgear/structure/ssgSharedPtr.hxx>
 
 #if defined( sgi )
 #include <strings.h>
@@ -54,13 +56,13 @@ typedef vector < Point3D > point_list;
 typedef point_list::iterator point_list_iterator;
 typedef point_list::const_iterator const_point_list_iterator;
 
+
 class ssgLeaf;
 class ssgBranch;
 class ssgTransform;
 class ssgSelector;
 class ssgRangeSelector;
 class ssgVertexArray;
-
 class FGTileEntry;
 
 
@@ -74,14 +76,14 @@ private:
     string model_path;
     string texture_path;
     FGTileEntry *tile;
-    ssgTransform *obj_trans;
+    ssgSharedPtr<ssgTransform> obj_trans;
     SGBucket bucket;
 
 
 public:
 
     inline FGDeferredModel() { }
-    inline FGDeferredModel( const string mp, const string tp, SGBucket b,
+    inline FGDeferredModel( const string& mp, const string& tp, SGBucket b,
                     FGTileEntry *t, ssgTransform *ot )
     {
        model_path = mp;
@@ -91,9 +93,9 @@ public:
        obj_trans = ot;
     }
     inline ~FGDeferredModel() { }
-    inline string get_model_path() const { return model_path; }
-    inline string get_texture_path() const { return texture_path; }
-    inline SGBucket get_bucket() const { return bucket; }
+    inline const string& get_model_path() const { return model_path; }
+    inline const string& get_texture_path() const { return texture_path; }
+    inline const SGBucket& get_bucket() const { return bucket; }
     inline FGTileEntry *get_tile() const { return tile; }
     inline ssgTransform *get_obj_trans() const { return obj_trans; }
 };
@@ -109,7 +111,6 @@ public:
     // global tile culling data
     Point3D center;
     double bounding_radius;
-    Point3D offset;
 
     // this tile's official location in the world
     SGBucket tile_bucket;
@@ -128,27 +129,27 @@ private:
     //                 - kidn(fan)
 
     // pointer to ssg transform for this tile
-    ssgTransform *terra_transform;
-    ssgTransform *vasi_lights_transform;
-    ssgTransform *rwy_lights_transform;
-    ssgTransform *taxi_lights_transform;
-    ssgTransform *gnd_lights_transform;
+    ssgSharedPtr<ssgPlacementTransform> terra_transform;
+    ssgSharedPtr<ssgPlacementTransform> vasi_lights_transform;
+    ssgSharedPtr<ssgPlacementTransform> rwy_lights_transform;
+    ssgSharedPtr<ssgPlacementTransform> taxi_lights_transform;
+    ssgSharedPtr<ssgPlacementTransform> gnd_lights_transform;
 
     // pointer to ssg range selector for this tile
-    ssgRangeSelector *terra_range;
-    ssgRangeSelector *gnd_lights_range;
+    ssgSharedPtr<ssgRangeSelector> terra_range;
+    ssgSharedPtr<ssgRangeSelector> gnd_lights_range;
 
     // we create several preset brightness and can choose which one we
     // want based on lighting conditions.
-    ssgSelector *gnd_lights_brightness;
+    ssgSharedPtr<ssgSelector> gnd_lights_brightness;
 
     // we need to be able to turn runway lights on or off (doing this
     // via a call back would be nifty, but then the call back needs to
     // know about the higher level application's global state which is
     // a problem if we move the code into simgear.)
-    ssgSelector *vasi_lights_selector;
-    ssgSelector *rwy_lights_selector;
-    ssgSelector *taxi_lights_selector;
+    ssgSharedPtr<ssgSelector> vasi_lights_selector;
+    ssgSharedPtr<ssgSelector> rwy_lights_selector;
+    ssgSharedPtr<ssgSelector> taxi_lights_selector;
 
     /**
      * Indicates this tile has been loaded from a file and connected
@@ -218,15 +219,6 @@ public:
     // completely freed.
     bool free_tile();
 
-    // Calculate this tile's offset
-    void SetOffset( const Point3D& p)
-    {
-       offset = center - p;
-    }
-
-    // Return this tile's offset
-    inline Point3D get_offset() const { return offset; }
-
     // Update the ssg transform node for this tile so it can be
     // properly drawn relative to our (0,0,0) point
     void prep_ssg_node( const Point3D& p, sgVec3 up, float vis);
@@ -257,7 +249,12 @@ public:
     /**
      * Return the "bucket" for this tile
      */
-    inline SGBucket get_tile_bucket() const { return tile_bucket; }
+    inline const SGBucket& get_tile_bucket() const { return tile_bucket; }
+
+    /**
+     * Apply ssgLeaf::makeDList to all leaf of a branch
+     */
+    void makeDList( ssgBranch *b );
 
     /**
      * Add terrain mesh and ground lighting to scene graph.
@@ -278,7 +275,7 @@ public:
     /**
      * return the SSG Transform node for the terrain
      */
-    inline ssgTransform *get_terra_transform() { return terra_transform; }
+    inline ssgPlacementTransform *get_terra_transform() const { return terra_transform; }
 
     inline double get_timestamp() const { return timestamp; }
     inline void set_timestamp( double time_ms ) { timestamp = time_ms; }