Browse Source

remove using statement from collisionHeightfield.h
use PN_stdfloat for get_height() and _max_height

hecris 6 years ago
parent
commit
c496b58293

+ 1 - 1
panda/src/collide/collisionHeightfield.I

@@ -17,7 +17,7 @@ heightfield() {
   return _heightfield;
   return _heightfield;
 }
 }
 
 
-INLINE double CollisionHeightfield::
+INLINE PN_stdfloat CollisionHeightfield::
 get_height(int x, int y) const {
 get_height(int x, int y) const {
   return _heightfield.get_gray(x, y) * _max_height;
   return _heightfield.get_gray(x, y) * _max_height;
 }
 }

+ 1 - 1
panda/src/collide/collisionHeightfield.cxx

@@ -35,7 +35,7 @@ using std::sort;
  */
  */
 CollisionHeightfield::
 CollisionHeightfield::
 CollisionHeightfield(PNMImage &heightfield,
 CollisionHeightfield(PNMImage &heightfield,
-                     double max_height, int subdivisions) {
+                     PN_stdfloat max_height, int subdivisions) {
   _heightfield = heightfield;
   _heightfield = heightfield;
   _max_height = max_height;
   _max_height = max_height;
   setup_quadtree(subdivisions);
   setup_quadtree(subdivisions);

+ 5 - 7
panda/src/collide/collisionHeightfield.h

@@ -5,8 +5,6 @@
 #include "collisionSolid.h"
 #include "collisionSolid.h"
 #include "pnmImage.h"
 #include "pnmImage.h"
 
 
-using std::vector;
-
 /*
 /*
  * CollisionHeightfield efficiently deals with collisions on uneven
  * CollisionHeightfield efficiently deals with collisions on uneven
  * terrain given a heightfield image. A quad tree is implemented to
  * terrain given a heightfield image. A quad tree is implemented to
@@ -17,7 +15,7 @@ using std::vector;
 class EXPCL_PANDA_COLLIDE CollisionHeightfield : public CollisionSolid {
 class EXPCL_PANDA_COLLIDE CollisionHeightfield : public CollisionSolid {
 PUBLISHED:
 PUBLISHED:
   CollisionHeightfield(PNMImage &heightfield,
   CollisionHeightfield(PNMImage &heightfield,
-                       double max_height, int subdivisions);
+                       PN_stdfloat max_height, int subdivisions);
   ~CollisionHeightfield() { delete[] _nodes; }
   ~CollisionHeightfield() { delete[] _nodes; }
   virtual LPoint3 get_collision_origin() const;
   virtual LPoint3 get_collision_origin() const;
   INLINE PNMImage &heightfield();
   INLINE PNMImage &heightfield();
@@ -66,21 +64,21 @@ protected:
 
 
 private:
 private:
   PNMImage _heightfield;
   PNMImage _heightfield;
-  double _max_height;
+  PN_stdfloat _max_height;
   // Todo: PT(QuadTreeNode) _nodes;
   // Todo: PT(QuadTreeNode) _nodes;
   QuadTreeNode *_nodes;
   QuadTreeNode *_nodes;
   int _nodes_count;
   int _nodes_count;
   int _leaf_first_index;
   int _leaf_first_index;
   void setup_quadtree(int subdivisions);
   void setup_quadtree(int subdivisions);
-  INLINE double get_height(int x, int y) const;
-  vector<Triangle> get_triangles(int x, int y) const;
+  INLINE PN_stdfloat get_height(int x, int y) const;
+  std::vector<Triangle> get_triangles(int x, int y) const;
 
 
   // A pointer to a function that tests for intersection between a box and a
   // A pointer to a function that tests for intersection between a box and a
   // solid defined by the given IntersectionParams.
   // solid defined by the given IntersectionParams.
   typedef bool (*BoxIntersection)(const LPoint3 &box_min, const LPoint3 &box_max,
   typedef bool (*BoxIntersection)(const LPoint3 &box_min, const LPoint3 &box_max,
                                   IntersectionParams &params);
                                   IntersectionParams &params);
 
 
-  vector<QuadTreeIntersection> find_intersections(BoxIntersection intersects_box,
+  std::vector<QuadTreeIntersection> find_intersections(BoxIntersection intersects_box,
                                                   IntersectionParams params) const;
                                                   IntersectionParams params) const;
 
 
 protected:
 protected: