00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef QTESSSURFACE_H
00016 #define QTESSSURFACE_H
00017
00018 #include "pandatoolbase.h"
00019 #include "isoPlacer.h"
00020 #include "eggNurbsSurface.h"
00021 #include "eggGroup.h"
00022 #include "eggVertex.h"
00023 #include "nurbsSurfaceEvaluator.h"
00024 #include "nurbsSurfaceResult.h"
00025 #include "referenceCount.h"
00026 #include "pointerTo.h"
00027
00028
00029
00030
00031
00032
00033
00034 class QtessSurface : public ReferenceCount {
00035 public:
00036 QtessSurface(EggNurbsSurface *egg_surface);
00037
00038 INLINE const string &get_name() const;
00039 INLINE bool is_valid() const;
00040
00041 INLINE void set_importance(double importance2);
00042 INLINE void set_match_u(QtessSurface **match_u, bool match_u_to_u);
00043 INLINE void set_match_v(QtessSurface **match_v, bool match_v_to_v);
00044 INLINE void set_min_u(int min_u);
00045 INLINE void set_min_v(int min_v);
00046
00047 INLINE double count_patches() const;
00048 INLINE int count_tris() const;
00049
00050 double get_score(double ratio);
00051
00052 int tesselate();
00053 int write_qtess_parameter(ostream &out);
00054 void omit();
00055 void tesselate_uv(int u, int v, bool autoplace, double ratio);
00056 void tesselate_specific(const pvector<double> &u_list,
00057 const pvector<double> &v_list);
00058 void tesselate_per_isoparam(double pi, bool autoplace, double ratio);
00059 void tesselate_per_score(double pi, bool autoplace, double ratio);
00060 void tesselate_auto(int u, int v, double ratio);
00061
00062 private:
00063 void record_vertex_extras();
00064 INLINE int get_joint_membership_index(EggGroup *joint);
00065 INLINE int get_dxyz_index(const string &morph_name);
00066 INLINE int get_drgba_index(const string &morph_name);
00067
00068 void apply_match();
00069 PT(EggGroup) do_uniform_tesselate(int &tris) const;
00070 PT(EggVertex) evaluate_vertex(double u, double v) const;
00071
00072 PT(EggNurbsSurface) _egg_surface;
00073 PT(NurbsSurfaceEvaluator) _nurbs;
00074 PT(NurbsSurfaceResult) _nurbs_result;
00075 bool _has_vertex_color;
00076
00077
00078
00079
00080 int _next_d;
00081 typedef map<EggGroup *, int> JointTable;
00082 JointTable _joint_table;
00083 typedef map<string, int> MorphTable;
00084 MorphTable _dxyz_table;
00085 MorphTable _drgba_table;
00086
00087 int _num_u, _num_v;
00088 int _tess_u, _tess_v;
00089 pvector<double> _iso_u, _iso_v;
00090
00091
00092
00093
00094 double _importance;
00095 double _importance2;
00096
00097
00098
00099
00100
00101
00102 QtessSurface **_match_u, **_match_v;
00103 bool _match_u_to_u, _match_v_to_v;
00104
00105
00106
00107
00108
00109 int _min_u, _min_v;
00110
00111 IsoPlacer _u_placer, _v_placer;
00112 bool _got_scores;
00113 };
00114
00115 #include "qtessSurface.I"
00116
00117 #endif
00118