Panda3D
 All Classes Functions Variables Enumerations
qtessInputEntry.h
00001 // Filename: qtessInputEntry.h
00002 // Created by:  drose (13Oct03)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef QTESSINPUTENTRY_H
00016 #define QTESSINPUTENTRY_H
00017 
00018 #include "pandatoolbase.h"
00019 #include "globPattern.h"
00020 #include "pvector.h"
00021 
00022 class QtessSurface;
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : QtessInputEntry
00026 // Description : Stores one entry in the qtess input file.  This
00027 //               consists of a list of name patterns and a
00028 //               set of tesselation parameters.
00029 ////////////////////////////////////////////////////////////////////
00030 class QtessInputEntry {
00031 public:
00032   enum Type {
00033     T_undefined, T_omit, T_num_tris, T_uv, T_per_isoparam, T_per_score,
00034     T_importance, T_match_uu, T_match_vv, T_match_uv, T_match_vu,
00035     T_min_u, T_min_v
00036   };
00037 
00038   QtessInputEntry(const string &name = string());
00039   INLINE QtessInputEntry(const QtessInputEntry &copy);
00040   void operator = (const QtessInputEntry &copy);
00041 
00042   INLINE void add_node_name(const string &name);
00043   INLINE void set_importance(double i);
00044   INLINE void set_match_uu();
00045   INLINE void set_match_vv();
00046   INLINE void set_match_uv();
00047   INLINE void set_match_vu();
00048   INLINE void set_min_u(int min_u);
00049   INLINE void set_min_v(int min_v);
00050   INLINE void set_undefined();
00051   INLINE void set_omit();
00052   INLINE void set_num_tris(int nt);
00053   INLINE void set_uv(int u, int v);
00054   void set_uv(int u, int v, const string params[], int num_params);
00055   INLINE void set_per_isoparam(double pi);
00056   INLINE void set_per_score(double pi);
00057   void add_extra_u_isoparam(double u);
00058   void add_extra_v_isoparam(double u);
00059 
00060   Type match(QtessSurface *surface);
00061   INLINE int get_num_surfaces() const;
00062   int count_tris(double tri_factor = 1.0, int attempts = 0);
00063 
00064   static void output_extra(ostream &out, const pvector<double> &iso, char axis);
00065   void output(ostream &out) const;
00066   void write(ostream &out, int indent_level) const;
00067 
00068   bool _auto_place, _auto_distribute;
00069   double _curvature_ratio;
00070   double _importance;
00071   QtessSurface *_constrain_u, *_constrain_v;
00072 
00073 private:
00074   typedef pvector<GlobPattern> NodeNames;
00075   NodeNames _node_names;
00076 
00077   int _num_tris;
00078   int _num_u, _num_v;
00079   double _per_isoparam;
00080   pvector<double> _iso_u, _iso_v;
00081   Type _type;
00082 
00083   typedef pvector<QtessSurface *> Surfaces;
00084   Surfaces _surfaces;
00085 
00086   double _num_patches;
00087 };
00088 
00089 INLINE ostream &operator << (ostream &out, const QtessInputEntry &entry);
00090 
00091 #include "qtessInputEntry.I"
00092 
00093 #endif
00094 
 All Classes Functions Variables Enumerations