Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
4a7866d241

+ 2 - 2
panda/src/parametrics/Sources.pp

@@ -16,7 +16,7 @@
     curveFitter.I curveFitter.cxx curveFitter.h \
     hermiteCurve.cxx hermiteCurve.h \
     nurbsCurve.h \
-    nurbsCurveDrawer.cxx nurbsCurveDrawer.h \
+    nurbsCurveDrawer.I nurbsCurveDrawer.cxx nurbsCurveDrawer.h \
     nurbsCurveInterface.I nurbsCurveInterface.cxx nurbsCurveInterface.h \
     parametricCurve.cxx parametricCurve.h \
     parametricCurveCollection.I parametricCurveCollection.cxx \
@@ -34,7 +34,7 @@
     curveFitter.I curveFitter.h \
     hermiteCurve.h \
     nurbsCurve.h \
-    nurbsCurveDrawer.h \
+    nurbsCurveDrawer.I nurbsCurveDrawer.h \
     nurbsCurveInterface.I nurbsCurveInterface.h \
     nurbsPPCurve.h nurbsPPCurve.I \
     parametricCurve.h \

+ 18 - 0
panda/src/parametrics/nurbsCurveDrawer.I

@@ -0,0 +1,18 @@
+// Filename: nurbsCurveDrawer.I
+// Created by:  drose (05Mar01)
+// 
+////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: NurbsCurveDrawer::hilight
+//       Access: Published
+//  Description: Hilights a particular CV by showing it and its knot
+//               in a different color.  Returns true if the CV exists
+//               and has been drawn, false otherwise.
+////////////////////////////////////////////////////////////////////
+INLINE bool NurbsCurveDrawer::
+hilight(int n) {
+  return hilight(n, 1.0, 1.0, 0.0);
+}
+

+ 21 - 46
panda/src/parametrics/nurbsCurveDrawer.cxx

@@ -2,19 +2,6 @@
 // Created by:  drose (27Feb98)
 // 
 ////////////////////////////////////////////////////////////////////
-// Copyright (C) 1992,93,94,95,96,97  Walt Disney Imagineering, Inc.
-// 
-// These  coded  instructions,  statements,  data   structures   and
-// computer  programs contain unpublished proprietary information of
-// Walt Disney Imagineering and are protected by  Federal  copyright
-// law.  They may  not be  disclosed to third  parties  or copied or
-// duplicated in any form, in whole or in part,  without  the  prior
-// written consent of Walt Disney Imagineering Inc.
-////////////////////////////////////////////////////////////////////
-//
-////////////////////////////////////////////////////////////////////
-// Includes
-////////////////////////////////////////////////////////////////////
 
 #include "nurbsCurveDrawer.h"
 #include "nurbsCurveInterface.h"
@@ -26,7 +13,7 @@ TypeHandle NurbsCurveDrawer::_type_handle;
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::Constructor
-//       Access: Public, Scheme
+//       Access: Published
 //  Description:
 ////////////////////////////////////////////////////////////////////
 NurbsCurveDrawer::
@@ -47,7 +34,7 @@ NurbsCurveDrawer() {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::Destructor
-//       Access: Public, Scheme, Virtual
+//       Access: Published, Virtual
 //  Description:
 ////////////////////////////////////////////////////////////////////
 NurbsCurveDrawer::
@@ -58,7 +45,7 @@ NurbsCurveDrawer::
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::set_cv_color
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Specifies the color of the CV's.
 ////////////////////////////////////////////////////////////////////
 void NurbsCurveDrawer::
@@ -66,14 +53,12 @@ set_cv_color(float r, float g, float b) {
   _cv_color.set(r, g, b);
   _cvs.set_color(r, g, b);
 
-  if (_drawn) {
-    draw();
-  }
+  redraw();
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::set_knot_color
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Specifies the color of the knots.
 ////////////////////////////////////////////////////////////////////
 void NurbsCurveDrawer::
@@ -81,14 +66,12 @@ set_knot_color(float r, float g, float b) {
   _knot_color.set(r, g, b);
   _knots.set_color(r, g, b);
 
-  if (_drawn) {
-    draw();
-  }
+  redraw();
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::set_hull_color
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Specifies the color of the convex hull.
 ////////////////////////////////////////////////////////////////////
 void NurbsCurveDrawer::
@@ -96,16 +79,14 @@ set_hull_color(float r, float g, float b) {
   _hull_color.set(r, g, b);
   _hull.set_color(r, g, b);
 
-  if (_drawn) {
-    draw();
-  }
+  redraw();
 }
 
 
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::draw
-//       Access: Public, Scheme, Virtual
+//       Access: Published, Virtual
 //  Description:
 ////////////////////////////////////////////////////////////////////
 bool NurbsCurveDrawer::
@@ -182,7 +163,7 @@ draw() {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::recompute
-//       Access: Public, Scheme, Virtual
+//       Access: Published, Virtual
 //  Description:
 ////////////////////////////////////////////////////////////////////
 bool NurbsCurveDrawer::
@@ -193,20 +174,18 @@ recompute(float t1, float t2, ParametricCurve *curve) {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::set_show_cvs
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Sets the flag that hides or shows the CV's.
 ////////////////////////////////////////////////////////////////////
 void NurbsCurveDrawer::
 set_show_cvs(bool flag) {
   _show_cvs = flag;
-  if (_drawn) {
-    draw();
-  }
+  redraw();
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::get_show_cvs
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Returns the current state of the show-CV's flag.
 ////////////////////////////////////////////////////////////////////
 bool NurbsCurveDrawer::
@@ -216,20 +195,18 @@ get_show_cvs() const {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::set_show_hull
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Sets the flag that hides or shows the convex hull.
 ////////////////////////////////////////////////////////////////////
 void NurbsCurveDrawer::
 set_show_hull(bool flag) {
   _show_hull = flag;
-  if (_drawn) {
-    draw();
-  }
+  redraw();
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::get_show_hull
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Returns the current state of the show-hull flag.
 ////////////////////////////////////////////////////////////////////
 bool NurbsCurveDrawer::
@@ -239,20 +216,18 @@ get_show_hull() const {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::set_show_knots
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Sets the flag that hides or shows the knots.
 ////////////////////////////////////////////////////////////////////
 void NurbsCurveDrawer::
 set_show_knots(bool flag) {
   _show_knots = flag;
-  if (_drawn) {
-    draw();
-  }
+  redraw();
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::get_show_knots
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Returns the current state of the show-knots flag.
 ////////////////////////////////////////////////////////////////////
 bool NurbsCurveDrawer::
@@ -263,7 +238,7 @@ get_show_knots() const {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::hilight
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Hilights a particular CV by showing it and its knot
 //               in a different color.  Returns true if the CV exists
 //               and has been drawn, false otherwise.
@@ -289,7 +264,7 @@ hilight(int n, float hr, float hg, float hb) {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: NurbsCurveDrawer::unhilight
-//       Access: Public, Scheme
+//       Access: Published
 //  Description: Removes the hilight previously set on a CV.
 ////////////////////////////////////////////////////////////////////
 bool NurbsCurveDrawer::

+ 4 - 1
panda/src/parametrics/nurbsCurveDrawer.h

@@ -36,7 +36,8 @@ PUBLISHED:
   void set_show_knots(bool flag);
   bool get_show_knots() const;
 
-  bool hilight(int n, float hr=1.0, float hg=1.0, float hb=0.0);
+  INLINE bool hilight(int n);
+  bool hilight(int n, float hr, float hg, float hb);
   bool unhilight(int n);
 
 protected:
@@ -65,6 +66,8 @@ public:
 private:
   static TypeHandle _type_handle;
 };
+
+#include "nurbsCurveDrawer.I"
   
 #endif
 

+ 6 - 5
panda/src/parametrics/parametricCurveDrawer.cxx

@@ -289,8 +289,8 @@ get_frame_accurate() const {
 //       Access: Published, Virtual
 //  Description: Creates a series of line segments that approximates
 //               the curve.  These line segments may be made visible
-//               by adding the GeomNode returned by get_geom_node() into the
-//               scene graph.
+//               by parenting the node returned by get_geom_node()
+//               into the scene graph.
 ////////////////////////////////////////////////////////////////////
 bool ParametricCurveDrawer::
 draw() {
@@ -401,7 +401,8 @@ hide() {
 ////////////////////////////////////////////////////////////////////
 //     Function: ParametricCurveDrawer::set_tick_scale
 //       Access: Published
-//  Description: Sets the visible size of the time tick marks.
+//  Description: Sets the visible size of the time tick marks or
+//               geometry.
 ////////////////////////////////////////////////////////////////////
 void ParametricCurveDrawer::
 set_tick_scale(float scale) {
@@ -413,7 +414,7 @@ set_tick_scale(float scale) {
 ////////////////////////////////////////////////////////////////////
 //     Function: ParametricCurveDrawer::get_tick_scale
 //       Access: Published
-//  Description: Returns the size of the time tick marks.
+//  Description: Returns the size of the time tick marks or geometry.
 ////////////////////////////////////////////////////////////////////
 float ParametricCurveDrawer::
 get_tick_scale() const {
@@ -422,7 +423,7 @@ get_tick_scale() const {
 
 ////////////////////////////////////////////////////////////////////
 //     Function: ParametricCurveDrawer::get_tick_marks
-//       Access: Protected, Static
+//       Access: Private, Static
 //  Description: Given a tangent vector, computes two vectors at right
 //               angles to the tangent and to each other, suitable for
 //               drawing as tick marks.

+ 5 - 2
panda/src/parametrics/parametricCurveDrawer.h

@@ -55,18 +55,21 @@ public:
   INLINE float get_max_t() const;
   INLINE void redraw();
 
-protected:
+private:
   static void get_tick_marks(const LVecBase3f &tangent, LVecBase3f &t1, LVecBase3f &t2);
 
+protected:
   PT(GeomNode) _geom_node;
   PT(ParametricCurveCollection) _curves;
+  bool _frame_accurate;
+
+private:
   float _num_segs;
   LineSegs _lines, _ticks;
   PT(Node) _tick_geometry;
   bool _drawn;
   float _num_ticks;
   float _tick_scale;
-  bool _frame_accurate;
 
   typedef vector<PT(NodeRelation)> TickArcs;
   TickArcs _tick_arcs;