Panda3D

qtessInputEntry.h
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file qtessInputEntry.h
10 * @author drose
11 * @date 2003-10-13
12 */
13
14 #ifndef QTESSINPUTENTRY_H
15 #define QTESSINPUTENTRY_H
16
17 #include "pandatoolbase.h"
18 #include "globPattern.h"
19 #include "pvector.h"
20
21 class QtessSurface;
22
23 /**
24 * Stores one entry in the qtess input file. This consists of a list of name
25 * patterns and a set of tesselation parameters.
26 */
27 class QtessInputEntry {
28 public:
29 enum Type {
30 T_undefined, T_omit, T_num_tris, T_uv, T_per_isoparam, T_per_score,
31 T_importance, T_match_uu, T_match_vv, T_match_uv, T_match_vu,
32 T_min_u, T_min_v
33 };
34
35 QtessInputEntry(const std::string &name = std::string());
36 INLINE QtessInputEntry(const QtessInputEntry &copy);
37 void operator = (const QtessInputEntry &copy);
38
39 INLINE void add_node_name(const std::string &name);
40 INLINE void set_importance(double i);
41 INLINE void set_match_uu();
42 INLINE void set_match_vv();
43 INLINE void set_match_uv();
44 INLINE void set_match_vu();
45 INLINE void set_min_u(int min_u);
46 INLINE void set_min_v(int min_v);
47 INLINE void set_undefined();
48 INLINE void set_omit();
49 INLINE void set_num_tris(int nt);
50 INLINE void set_uv(int u, int v);
51 void set_uv(int u, int v, const std::string params[], int num_params);
52 INLINE void set_per_isoparam(double pi);
53 INLINE void set_per_score(double pi);
54 void add_extra_u_isoparam(double u);
55 void add_extra_v_isoparam(double u);
56
57 Type match(QtessSurface *surface);
58 INLINE int get_num_surfaces() const;
59 int count_tris(double tri_factor = 1.0, int attempts = 0);
60
61 static void output_extra(std::ostream &out, const pvector<double> &iso, char axis);
62 void output(std::ostream &out) const;
63 void write(std::ostream &out, int indent_level) const;
64
65 bool _auto_place, _auto_distribute;
66 double _curvature_ratio;
67 double _importance;
68 QtessSurface *_constrain_u, *_constrain_v;
69
70 private:
71 typedef pvector<GlobPattern> NodeNames;
72 NodeNames _node_names;
73
74 int _num_tris;
75 int _num_u, _num_v;
76 double _per_isoparam;
77 pvector<double> _iso_u, _iso_v;
78 Type _type;
79
80 typedef pvector<QtessSurface *> Surfaces;
81 Surfaces _surfaces;
82
83 double _num_patches;
84 };
85
86 INLINE std::ostream &operator << (std::ostream &out, const QtessInputEntry &entry);
87
88 #include "qtessInputEntry.I"
89
90 #endif
QtessInputEntry
Stores one entry in the qtess input file.
Definition: qtessInputEntry.h:27
QtessInputEntry::match
Type match(QtessSurface *surface)
Tests the surface to see if it matches any of the regular expressions that define this node entry.
Definition: qtessInputEntry.cxx:197
QtessInputEntry::add_extra_u_isoparam
void add_extra_u_isoparam(double u)
May be called a number of times before set_uv() to add specific additional isoparams to the tesselati...
Definition: qtessInputEntry.cxx:177
QtessInputEntry::add_extra_v_isoparam
void add_extra_v_isoparam(double u)
May be called a number of times before set_uv() to add specific additional isoparams to the tesselati...
Definition: qtessInputEntry.cxx:186
QtessInputEntry::output_extra
static void output_extra(std::ostream &out, const pvector< double > &iso, char axis)
This function is used to identify the extra isoparams in the list added by user control.
Definition: qtessInputEntry.cxx:359
QtessInputEntry::count_tris
int count_tris(double tri_factor=1.0, int attempts=0)
Determines the tesselation u,v amounts of each attached surface, and stores this information in the s...
Definition: qtessInputEntry.cxx:294
QtessSurface
A reference to an EggNurbsSurface in the egg file, and its parameters as set by the user input file a...
Definition: qtessSurface.h:32
pvector< double >
globPattern.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pvector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
qtessInputEntry.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.