mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
parm -> param
This commit is contained in:
parent
e936606b8d
commit
5abb4121ca
@ -47,16 +47,16 @@ EggQtess() {
|
|||||||
|
|
||||||
add_option
|
add_option
|
||||||
("up", "subdiv", 0,
|
("up", "subdiv", 0,
|
||||||
"Specify a uniform subdivision per patch (isoparm). Each NURBS "
|
"Specify a uniform subdivision per patch (isoparam). Each NURBS "
|
||||||
"surface is made up of N x M patches, each of which is divided "
|
"surface is made up of N x M patches, each of which is divided "
|
||||||
"into subdiv x subdiv quads. A fractional number is allowed.",
|
"into subdiv x subdiv quads. A fractional number is allowed.",
|
||||||
&EggQtess::dispatch_double, NULL, &_uniform_per_isoparm);
|
&EggQtess::dispatch_double, NULL, &_uniform_per_isoparam);
|
||||||
|
|
||||||
add_option
|
add_option
|
||||||
("us", "subdiv", 0,
|
("us", "subdiv", 0,
|
||||||
"Specify a uniform subdivision per surface. Each NURBS "
|
"Specify a uniform subdivision per surface. Each NURBS "
|
||||||
"surface is subdivided into subdiv x subdiv quads, regardless "
|
"surface is subdivided into subdiv x subdiv quads, regardless "
|
||||||
"of the number of isoparms it has. A fractional number is "
|
"of the number of isoparams it has. A fractional number is "
|
||||||
"meaningless.",
|
"meaningless.",
|
||||||
&EggQtess::dispatch_int, NULL, &_uniform_per_surface);
|
&EggQtess::dispatch_int, NULL, &_uniform_per_surface);
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ EggQtess() {
|
|||||||
("ad", "", 0,
|
("ad", "", 0,
|
||||||
"Attempt to automatically distribute polygons among the surfaces "
|
"Attempt to automatically distribute polygons among the surfaces "
|
||||||
"where they are most needed according to curvature and size, "
|
"where they are most needed according to curvature and size, "
|
||||||
"instead of according to the number of isoparms. This only has "
|
"instead of according to the number of isoparams. This only has "
|
||||||
"meaning when used in conjunction with -t.",
|
"meaning when used in conjunction with -t.",
|
||||||
&EggQtess::dispatch_none, &QtessGlobals::_auto_distribute);
|
&EggQtess::dispatch_none, &QtessGlobals::_auto_distribute);
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ EggQtess() {
|
|||||||
"Describe the format of the qtess parameter file specified with -f.",
|
"Describe the format of the qtess parameter file specified with -f.",
|
||||||
&EggQtess::dispatch_none, &_describe_qtess);
|
&EggQtess::dispatch_none, &_describe_qtess);
|
||||||
|
|
||||||
_uniform_per_isoparm = 0.0;
|
_uniform_per_isoparam = 0.0;
|
||||||
_uniform_per_surface = 0;
|
_uniform_per_surface = 0;
|
||||||
_total_tris = 0;
|
_total_tris = 0;
|
||||||
}
|
}
|
||||||
@ -173,14 +173,14 @@ run() {
|
|||||||
|
|
||||||
default_entry.set_num_tris(extra_tris);
|
default_entry.set_num_tris(extra_tris);
|
||||||
|
|
||||||
} else if (_uniform_per_isoparm!=0.0) {
|
} else if (_uniform_per_isoparam!=0.0) {
|
||||||
default_entry.set_per_isoparm(_uniform_per_isoparm);
|
default_entry.set_per_isoparam(_uniform_per_isoparam);
|
||||||
|
|
||||||
} else if (_uniform_per_surface!=0.0) {
|
} else if (_uniform_per_surface!=0.0) {
|
||||||
default_entry.set_uv(_uniform_per_surface, _uniform_per_surface);
|
default_entry.set_uv(_uniform_per_surface, _uniform_per_surface);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
default_entry.set_per_isoparm(1.0);
|
default_entry.set_per_isoparam(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
default_entry.count_tris();
|
default_entry.count_tris();
|
||||||
@ -252,11 +252,11 @@ describe_qtess_format() {
|
|||||||
|
|
||||||
show_text(" NUM NUM [[!]u# [!]u# ...] [[!]v# [!]v# ...]", 10,
|
show_text(" NUM NUM [[!]u# [!]u# ...] [[!]v# [!]v# ...]", 10,
|
||||||
"Tesselate to NUM x NUM quads. If u# or v# appear, they indicate "
|
"Tesselate to NUM x NUM quads. If u# or v# appear, they indicate "
|
||||||
"additional isoparms to insert (or remove if preceded by an "
|
"additional isoparams to insert (or remove if preceded by an "
|
||||||
"exclamation point). The range is [0, 1].\n\n");
|
"exclamation point). The range is [0, 1].\n\n");
|
||||||
|
|
||||||
show_text(" iNUM", 10,
|
show_text(" iNUM", 10,
|
||||||
"Subdivision amount per isoparm. Equivalent to the command-line "
|
"Subdivision amount per isoparam. Equivalent to the command-line "
|
||||||
"option -u NUM.\n\n");
|
"option -u NUM.\n\n");
|
||||||
|
|
||||||
show_text(" NUM%", 10,
|
show_text(" NUM%", 10,
|
||||||
@ -308,7 +308,7 @@ describe_qtess_format() {
|
|||||||
|
|
||||||
show_text(" !ad", 10,
|
show_text(" !ad", 10,
|
||||||
"Do not automatically distribute polygons; distribute "
|
"Do not automatically distribute polygons; distribute "
|
||||||
"them according to the number of isoparms of each surface.\n\n");
|
"them according to the number of isoparams of each surface.\n\n");
|
||||||
|
|
||||||
show_text(" arNUM", 10,
|
show_text(" arNUM", 10,
|
||||||
"Specify the ratio of dominance of size to curvature.\n\n");
|
"Specify the ratio of dominance of size to curvature.\n\n");
|
||||||
|
@ -46,7 +46,7 @@ private:
|
|||||||
void find_surfaces(EggNode *egg_node);
|
void find_surfaces(EggNode *egg_node);
|
||||||
|
|
||||||
Filename _qtess_filename;
|
Filename _qtess_filename;
|
||||||
double _uniform_per_isoparm;
|
double _uniform_per_isoparam;
|
||||||
int _uniform_per_surface;
|
int _uniform_per_surface;
|
||||||
int _total_tris;
|
int _total_tris;
|
||||||
bool _qtess_output;
|
bool _qtess_output;
|
||||||
|
@ -27,7 +27,7 @@ class NurbsSurfaceResult;
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Class : IsoPlacer
|
// Class : IsoPlacer
|
||||||
// Description : Contains the logic used to place isoparms where
|
// Description : Contains the logic used to place isoparams where
|
||||||
// they'll do the most good on a surface.
|
// they'll do the most good on a surface.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class IsoPlacer {
|
class IsoPlacer {
|
||||||
|
@ -156,14 +156,14 @@ set_uv(int u, int v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: QtessInputEntry::set_per_isoparm
|
// Function: QtessInputEntry::set_per_isoparam
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description:
|
// Description:
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE void QtessInputEntry::
|
INLINE void QtessInputEntry::
|
||||||
set_per_isoparm(double pi) {
|
set_per_isoparam(double pi) {
|
||||||
_per_isoparm = pi;
|
_per_isoparam = pi;
|
||||||
_type = T_per_isoparm;
|
_type = T_per_isoparam;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -173,7 +173,7 @@ set_per_isoparm(double pi) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE void QtessInputEntry::
|
INLINE void QtessInputEntry::
|
||||||
set_per_score(double pi) {
|
set_per_score(double pi) {
|
||||||
_per_isoparm = pi;
|
_per_isoparam = pi;
|
||||||
_type = T_per_score;
|
_type = T_per_score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ operator = (const QtessInputEntry ©) {
|
|||||||
_num_tris = copy._num_tris;
|
_num_tris = copy._num_tris;
|
||||||
_num_u = copy._num_u;
|
_num_u = copy._num_u;
|
||||||
_num_v = copy._num_v;
|
_num_v = copy._num_v;
|
||||||
_per_isoparm = copy._per_isoparm;
|
_per_isoparam = copy._per_isoparam;
|
||||||
_iso_u = copy._iso_u;
|
_iso_u = copy._iso_u;
|
||||||
_iso_v = copy._iso_v;
|
_iso_v = copy._iso_v;
|
||||||
_surfaces = copy._surfaces;
|
_surfaces = copy._surfaces;
|
||||||
@ -100,11 +100,11 @@ public:
|
|||||||
// Function: QtessInputEntry::set_uv
|
// Function: QtessInputEntry::set_uv
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Sets specific tesselation. The tesselation will be u
|
// Description: Sets specific tesselation. The tesselation will be u
|
||||||
// by v quads, with the addition of any isoparms
|
// by v quads, with the addition of any isoparams
|
||||||
// described in the list of parms.
|
// described in the list of params.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void QtessInputEntry::
|
void QtessInputEntry::
|
||||||
set_uv(int u, int v, const string parms[], int num_parms) {
|
set_uv(int u, int v, const string params[], int num_params) {
|
||||||
_num_u = u;
|
_num_u = u;
|
||||||
_num_v = v;
|
_num_v = v;
|
||||||
|
|
||||||
@ -118,16 +118,16 @@ set_uv(int u, int v, const string parms[], int num_parms) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Then get out all the additional entries.
|
// Then get out all the additional entries.
|
||||||
for (i = 0; i < num_parms; i++) {
|
for (i = 0; i < num_params; i++) {
|
||||||
const string &parm = parms[i];
|
const string ¶m = params[i];
|
||||||
|
|
||||||
if (parm[0] == '!' && parm.size() > 2) {
|
if (param[0] == '!' && param.size() > 2) {
|
||||||
double value;
|
double value;
|
||||||
if (!string_to_double(parm.substr(2), value)) {
|
if (!string_to_double(param.substr(2), value)) {
|
||||||
qtess_cat.warning()
|
qtess_cat.warning()
|
||||||
<< "Ignoring invalid parameter: " << parm << "\n";
|
<< "Ignoring invalid parameter: " << param << "\n";
|
||||||
} else {
|
} else {
|
||||||
switch (tolower(parm[1])) {
|
switch (tolower(param[1])) {
|
||||||
case 'u':
|
case 'u':
|
||||||
_auto_place = false;
|
_auto_place = false;
|
||||||
_iso_u.erase(remove_if(_iso_u.begin(), _iso_u.end(),
|
_iso_u.erase(remove_if(_iso_u.begin(), _iso_u.end(),
|
||||||
@ -144,16 +144,16 @@ set_uv(int u, int v, const string parms[], int num_parms) {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
qtess_cat.warning()
|
qtess_cat.warning()
|
||||||
<< "Ignoring invalid parameter: " << parms[i] << "\n";
|
<< "Ignoring invalid parameter: " << params[i] << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
double value;
|
double value;
|
||||||
if (!string_to_double(parm.substr(1), value)) {
|
if (!string_to_double(param.substr(1), value)) {
|
||||||
qtess_cat.warning()
|
qtess_cat.warning()
|
||||||
<< "Ignoring invalid parameter: " << parm << "\n";
|
<< "Ignoring invalid parameter: " << param << "\n";
|
||||||
} else {
|
} else {
|
||||||
switch (tolower(parm[0])) {
|
switch (tolower(param[0])) {
|
||||||
case 'u':
|
case 'u':
|
||||||
_auto_place = false;
|
_auto_place = false;
|
||||||
_iso_u.push_back(value);
|
_iso_u.push_back(value);
|
||||||
@ -166,7 +166,7 @@ set_uv(int u, int v, const string parms[], int num_parms) {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
qtess_cat.warning()
|
qtess_cat.warning()
|
||||||
<< "Ignoring invalid parameter: " << parms[i] << "\n";
|
<< "Ignoring invalid parameter: " << params[i] << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,24 +183,24 @@ set_uv(int u, int v, const string parms[], int num_parms) {
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: QtessInputEntry::add_extra_u_isoparm
|
// Function: QtessInputEntry::add_extra_u_isoparam
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: May be called a number of times before set_uv() to add
|
// Description: May be called a number of times before set_uv() to add
|
||||||
// specific additional isoparms to the tesselation.
|
// specific additional isoparams to the tesselation.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void QtessInputEntry::
|
void QtessInputEntry::
|
||||||
add_extra_u_isoparm(double u) {
|
add_extra_u_isoparam(double u) {
|
||||||
_iso_u.push_back(u);
|
_iso_u.push_back(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: QtessInputEntry::add_extra_v_isoparm
|
// Function: QtessInputEntry::add_extra_v_isoparam
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: May be called a number of times before set_uv() to add
|
// Description: May be called a number of times before set_uv() to add
|
||||||
// specific additional isoparms to the tesselation.
|
// specific additional isoparams to the tesselation.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void QtessInputEntry::
|
void QtessInputEntry::
|
||||||
add_extra_v_isoparm(double v) {
|
add_extra_v_isoparam(double v) {
|
||||||
_iso_v.push_back(v);
|
_iso_v.push_back(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,12 +321,12 @@ count_tris(double tri_factor, int attempts) {
|
|||||||
|
|
||||||
if (_type == T_num_tris && _num_patches > 0.0) {
|
if (_type == T_num_tris && _num_patches > 0.0) {
|
||||||
// If we wanted to aim for a particular number of triangles for
|
// If we wanted to aim for a particular number of triangles for
|
||||||
// the group, choose a per-isoparm setting that will approximately
|
// the group, choose a per-isoparam setting that will approximately
|
||||||
// achieve this.
|
// achieve this.
|
||||||
if (_auto_distribute) {
|
if (_auto_distribute) {
|
||||||
set_per_score(sqrt(0.5 * (double)_num_tris / _num_patches / tri_factor));
|
set_per_score(sqrt(0.5 * (double)_num_tris / _num_patches / tri_factor));
|
||||||
} else {
|
} else {
|
||||||
set_per_isoparm(sqrt(0.5 * (double)_num_tris / _num_patches / tri_factor));
|
set_per_isoparam(sqrt(0.5 * (double)_num_tris / _num_patches / tri_factor));
|
||||||
}
|
}
|
||||||
aim_for_tris = true;
|
aim_for_tris = true;
|
||||||
}
|
}
|
||||||
@ -349,12 +349,12 @@ count_tris(double tri_factor, int attempts) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_per_isoparm:
|
case T_per_isoparam:
|
||||||
surface->tesselate_per_isoparm(_per_isoparm, _auto_place, _curvature_ratio);
|
surface->tesselate_per_isoparam(_per_isoparam, _auto_place, _curvature_ratio);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_per_score:
|
case T_per_score:
|
||||||
surface->tesselate_per_score(_per_isoparm, _auto_place, _curvature_ratio);
|
surface->tesselate_per_score(_per_isoparam, _auto_place, _curvature_ratio);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -380,7 +380,7 @@ count_tris(double tri_factor, int attempts) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: QtessInputEntry::output_extra
|
// Function: QtessInputEntry::output_extra
|
||||||
// Access: Public, Static
|
// Access: Public, Static
|
||||||
// Description: This function is used to identify the extra isoparms
|
// Description: This function is used to identify the extra isoparams
|
||||||
// in the list added by user control.
|
// in the list added by user control.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void QtessInputEntry::
|
void QtessInputEntry::
|
||||||
@ -439,9 +439,9 @@ output(ostream &out) const {
|
|||||||
show_auto = true;
|
show_auto = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_per_isoparm:
|
case T_per_isoparam:
|
||||||
case T_per_score:
|
case T_per_score:
|
||||||
out << "i" << _per_isoparm;
|
out << "i" << _per_isoparam;
|
||||||
show_auto = true;
|
show_auto = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class QtessSurface;
|
|||||||
class QtessInputEntry {
|
class QtessInputEntry {
|
||||||
public:
|
public:
|
||||||
enum Type {
|
enum Type {
|
||||||
T_undefined, T_omit, T_num_tris, T_uv, T_per_isoparm, T_per_score,
|
T_undefined, T_omit, T_num_tris, T_uv, T_per_isoparam, T_per_score,
|
||||||
T_importance, T_match_uu, T_match_vv, T_match_uv, T_match_vu,
|
T_importance, T_match_uu, T_match_vv, T_match_uv, T_match_vu,
|
||||||
T_min_u, T_min_v
|
T_min_u, T_min_v
|
||||||
};
|
};
|
||||||
@ -55,11 +55,11 @@ public:
|
|||||||
INLINE void set_omit();
|
INLINE void set_omit();
|
||||||
INLINE void set_num_tris(int nt);
|
INLINE void set_num_tris(int nt);
|
||||||
INLINE void set_uv(int u, int v);
|
INLINE void set_uv(int u, int v);
|
||||||
void set_uv(int u, int v, const string parms[], int num_parms);
|
void set_uv(int u, int v, const string params[], int num_params);
|
||||||
INLINE void set_per_isoparm(double pi);
|
INLINE void set_per_isoparam(double pi);
|
||||||
INLINE void set_per_score(double pi);
|
INLINE void set_per_score(double pi);
|
||||||
void add_extra_u_isoparm(double u);
|
void add_extra_u_isoparam(double u);
|
||||||
void add_extra_v_isoparm(double u);
|
void add_extra_v_isoparam(double u);
|
||||||
|
|
||||||
Type match(QtessSurface *surface);
|
Type match(QtessSurface *surface);
|
||||||
INLINE int get_num_surfaces() const;
|
INLINE int get_num_surfaces() const;
|
||||||
@ -80,7 +80,7 @@ private:
|
|||||||
|
|
||||||
int _num_tris;
|
int _num_tris;
|
||||||
int _num_u, _num_v;
|
int _num_u, _num_v;
|
||||||
double _per_isoparm;
|
double _per_isoparam;
|
||||||
pvector<double> _iso_u, _iso_v;
|
pvector<double> _iso_u, _iso_v;
|
||||||
Type _type;
|
Type _type;
|
||||||
|
|
||||||
|
@ -96,10 +96,10 @@ read(const Filename &filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Split the line into two groups of words at the colon: names
|
// Split the line into two groups of words at the colon: names
|
||||||
// before the colon, and parms following it.
|
// before the colon, and params following it.
|
||||||
vector_string names, parms;
|
vector_string names, params;
|
||||||
extract_words(line.substr(0, colon), names);
|
extract_words(line.substr(0, colon), names);
|
||||||
extract_words(line.substr(colon + 1), parms);
|
extract_words(line.substr(colon + 1), params);
|
||||||
|
|
||||||
vector_string::const_iterator ni;
|
vector_string::const_iterator ni;
|
||||||
for (ni = names.begin(); ni != names.end(); ++ni) {
|
for (ni = names.begin(); ni != names.end(); ++ni) {
|
||||||
@ -109,19 +109,19 @@ read(const Filename &filename) {
|
|||||||
// Scan for things like ap, ad, ar, and pull them out of the
|
// Scan for things like ap, ad, ar, and pull them out of the
|
||||||
// stream.
|
// stream.
|
||||||
vector_string::iterator ci, cnext;
|
vector_string::iterator ci, cnext;
|
||||||
ci = parms.begin();
|
ci = params.begin();
|
||||||
while (ci != parms.end()) {
|
while (ci != params.end()) {
|
||||||
cnext = ci;
|
cnext = ci;
|
||||||
++cnext;
|
++cnext;
|
||||||
|
|
||||||
string parm = *ci;
|
string param = *ci;
|
||||||
bool invert = false;
|
bool invert = false;
|
||||||
if (parm[0] == '!' && parm.size() > 1) {
|
if (param[0] == '!' && param.size() > 1) {
|
||||||
invert = true;
|
invert = true;
|
||||||
parm = parm.substr(1);
|
param = param.substr(1);
|
||||||
}
|
}
|
||||||
if (tolower(parm[0]) == 'a' && parm.size() > 1) {
|
if (tolower(param[0]) == 'a' && param.size() > 1) {
|
||||||
switch (tolower(parm[1])) {
|
switch (tolower(param[1])) {
|
||||||
case 'p':
|
case 'p':
|
||||||
entry._auto_place = !invert;
|
entry._auto_place = !invert;
|
||||||
break;
|
break;
|
||||||
@ -131,10 +131,10 @@ read(const Filename &filename) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
if (!string_to_double(parm.substr(2), entry._curvature_ratio)) {
|
if (!string_to_double(param.substr(2), entry._curvature_ratio)) {
|
||||||
qtess_cat.error()
|
qtess_cat.error()
|
||||||
<< _filename << ": line " << line_number
|
<< _filename << ": line " << line_number
|
||||||
<< " - invalid field " << parm << "\n";
|
<< " - invalid field " << param << "\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -145,84 +145,84 @@ read(const Filename &filename) {
|
|||||||
<< line_number << ".\n";
|
<< line_number << ".\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
parms.erase(ci);
|
params.erase(ci);
|
||||||
} else {
|
} else {
|
||||||
ci = cnext;
|
ci = cnext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parms.empty()) {
|
if (!params.empty()) {
|
||||||
bool okflag = true;
|
bool okflag = true;
|
||||||
if (cmp_nocase(parms[0], "omit")==0) {
|
if (cmp_nocase(params[0], "omit")==0) {
|
||||||
entry.set_omit();
|
entry.set_omit();
|
||||||
|
|
||||||
} else if (cmp_nocase(parms[0], "matchuu")==0) {
|
} else if (cmp_nocase(params[0], "matchuu")==0) {
|
||||||
entry.set_match_uu();
|
entry.set_match_uu();
|
||||||
if (parms.size() > 1 && cmp_nocase(parms[1], "matchvv")==0) {
|
if (params.size() > 1 && cmp_nocase(params[1], "matchvv")==0) {
|
||||||
entry.set_match_vv();
|
entry.set_match_vv();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (cmp_nocase(parms[0], "matchvv")==0) {
|
} else if (cmp_nocase(params[0], "matchvv")==0) {
|
||||||
entry.set_match_vv();
|
entry.set_match_vv();
|
||||||
if (parms.size() > 1 && cmp_nocase(parms[1], "matchuu")==0) {
|
if (params.size() > 1 && cmp_nocase(params[1], "matchuu")==0) {
|
||||||
entry.set_match_uu();
|
entry.set_match_uu();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (cmp_nocase(parms[0], "matchuv")==0) {
|
} else if (cmp_nocase(params[0], "matchuv")==0) {
|
||||||
entry.set_match_uv();
|
entry.set_match_uv();
|
||||||
if (parms.size() > 1 && cmp_nocase(parms[1], "matchvu")==0) {
|
if (params.size() > 1 && cmp_nocase(params[1], "matchvu")==0) {
|
||||||
entry.set_match_vu();
|
entry.set_match_vu();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (cmp_nocase(parms[0], "matchvu")==0) {
|
} else if (cmp_nocase(params[0], "matchvu")==0) {
|
||||||
entry.set_match_vu();
|
entry.set_match_vu();
|
||||||
if (parms.size() > 1 && cmp_nocase(parms[1], "matchuv")==0) {
|
if (params.size() > 1 && cmp_nocase(params[1], "matchuv")==0) {
|
||||||
entry.set_match_uv();
|
entry.set_match_uv();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (cmp_nocase(parms[0], "minu")==0) {
|
} else if (cmp_nocase(params[0], "minu")==0) {
|
||||||
// minu #: minimum tesselation in U.
|
// minu #: minimum tesselation in U.
|
||||||
if (parms.size() < 2) {
|
if (params.size() < 2) {
|
||||||
okflag = false;
|
okflag = false;
|
||||||
} else {
|
} else {
|
||||||
int value = 0;
|
int value = 0;
|
||||||
okflag = string_to_int(parms[1], value);
|
okflag = string_to_int(params[1], value);
|
||||||
entry.set_min_u(value);
|
entry.set_min_u(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (cmp_nocase(parms[0], "minv")==0) {
|
} else if (cmp_nocase(params[0], "minv")==0) {
|
||||||
// minu #: minimum tesselation in V.
|
// minu #: minimum tesselation in V.
|
||||||
if (parms.size() < 2) {
|
if (params.size() < 2) {
|
||||||
okflag = false;
|
okflag = false;
|
||||||
} else {
|
} else {
|
||||||
int value = 0;
|
int value = 0;
|
||||||
okflag = string_to_int(parms[1], value);
|
okflag = string_to_int(params[1], value);
|
||||||
entry.set_min_v(value);
|
entry.set_min_v(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (tolower(parms[0][0]) == 'i') {
|
} else if (tolower(params[0][0]) == 'i') {
|
||||||
// "i#": per-isoparm tesselation.
|
// "i#": per-isoparam tesselation.
|
||||||
int value = 0;
|
int value = 0;
|
||||||
okflag = string_to_int(parms[0].substr(1), value);
|
okflag = string_to_int(params[0].substr(1), value);
|
||||||
entry.set_per_isoparm(value);
|
entry.set_per_isoparam(value);
|
||||||
|
|
||||||
} else if (parms[0][parms[0].length() - 1] == '%') {
|
} else if (params[0][params[0].length() - 1] == '%') {
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
okflag = string_to_double(parms[0].substr(0, parms[0].length() - 1), value);
|
okflag = string_to_double(params[0].substr(0, params[0].length() - 1), value);
|
||||||
entry.set_importance(value / 100.0);
|
entry.set_importance(value / 100.0);
|
||||||
|
|
||||||
} else if (parms.size() == 1) {
|
} else if (params.size() == 1) {
|
||||||
// One numeric parameter: the number of triangles.
|
// One numeric parameter: the number of triangles.
|
||||||
int value = 0;
|
int value = 0;
|
||||||
okflag = string_to_int(parms[0], value);
|
okflag = string_to_int(params[0], value);
|
||||||
entry.set_num_tris(value);
|
entry.set_num_tris(value);
|
||||||
|
|
||||||
} else if (parms.size() >= 2) {
|
} else if (params.size() >= 2) {
|
||||||
// Two or more numeric parameters: the number of u by v quads,
|
// Two or more numeric parameters: the number of u by v quads,
|
||||||
// followed by an optional list of specific isoparms.
|
// followed by an optional list of specific isoparams.
|
||||||
int u = 0, v = 0;
|
int u = 0, v = 0;
|
||||||
okflag = string_to_int(parms[0], u) && string_to_int(parms[1], v);
|
okflag = string_to_int(params[0], u) && string_to_int(params[1], v);
|
||||||
entry.set_uv(u, v, &parms[2], parms.size() - 2);
|
entry.set_uv(u, v, ¶ms[2], params.size() - 2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
okflag = false;
|
okflag = false;
|
||||||
|
@ -117,7 +117,7 @@ set_min_v(int min_v) {
|
|||||||
// Function: QtessSurface::count_patches
|
// Function: QtessSurface::count_patches
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Returns the number of patches the NURBS contains.
|
// Description: Returns the number of patches the NURBS contains.
|
||||||
// Each patch is a square area bounded by isoparms.
|
// Each patch is a square area bounded by isoparams.
|
||||||
// This actually scales by the importance of the
|
// This actually scales by the importance of the
|
||||||
// surface, if it is not 1.
|
// surface, if it is not 1.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -90,9 +90,9 @@ QtessSurface(EggNurbsSurface *egg_surface) :
|
|||||||
// Description: Computes the curvature/stretch score for the surface,
|
// Description: Computes the curvature/stretch score for the surface,
|
||||||
// if it has not been already computed, and returns the
|
// if it has not been already computed, and returns the
|
||||||
// net surface score. This is used both for
|
// net surface score. This is used both for
|
||||||
// automatically distributing isoparms among the
|
// automatically distributing isoparams among the
|
||||||
// surfaces by curvature, as well as for automatically
|
// surfaces by curvature, as well as for automatically
|
||||||
// placing the isoparms within each surface by
|
// placing the isoparams within each surface by
|
||||||
// curvature.
|
// curvature.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
double QtessSurface::
|
double QtessSurface::
|
||||||
@ -203,7 +203,7 @@ tesselate_uv(int u, int v, bool autoplace, double ratio) {
|
|||||||
// Function: QtessSurface::tesselate_specific
|
// Function: QtessSurface::tesselate_specific
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Sets the surface up to tesselate itself at specific
|
// Description: Sets the surface up to tesselate itself at specific
|
||||||
// isoparms only.
|
// isoparams only.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void QtessSurface::
|
void QtessSurface::
|
||||||
tesselate_specific(const pvector<double> &u_list,
|
tesselate_specific(const pvector<double> &u_list,
|
||||||
@ -215,13 +215,13 @@ tesselate_specific(const pvector<double> &u_list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: QtessSurface::tesselate_per_isoparm
|
// Function: QtessSurface::tesselate_per_isoparam
|
||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Sets the surface up to tesselate itself to a uniform
|
// Description: Sets the surface up to tesselate itself to a uniform
|
||||||
// amount per isoparm.
|
// amount per isoparam.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void QtessSurface::
|
void QtessSurface::
|
||||||
tesselate_per_isoparm(double pi, bool autoplace, double ratio) {
|
tesselate_per_isoparam(double pi, bool autoplace, double ratio) {
|
||||||
if (_num_u == 0 || _num_v == 0) {
|
if (_num_u == 0 || _num_v == 0) {
|
||||||
omit();
|
omit();
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ tesselate_per_score(double pi, bool autoplace, double ratio) {
|
|||||||
// Access: Public
|
// Access: Public
|
||||||
// Description: Sets the surface up to tesselate itself by
|
// Description: Sets the surface up to tesselate itself by
|
||||||
// automatically determining the best place to put the
|
// automatically determining the best place to put the
|
||||||
// indicated u x v isoparms.
|
// indicated u x v isoparams.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void QtessSurface::
|
void QtessSurface::
|
||||||
tesselate_auto(int u, int v, double ratio) {
|
tesselate_auto(int u, int v, double ratio) {
|
||||||
@ -388,7 +388,7 @@ apply_match() {
|
|||||||
// Access: Private
|
// Access: Private
|
||||||
// Description: Subdivide the surface uniformly according to the
|
// Description: Subdivide the surface uniformly according to the
|
||||||
// parameters specified by an earlier call to omit(),
|
// parameters specified by an earlier call to omit(),
|
||||||
// teseselate_uv(), or tesselate_per_isoparm().
|
// teseselate_uv(), or tesselate_per_isoparam().
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
PT(EggGroup) QtessSurface::
|
PT(EggGroup) QtessSurface::
|
||||||
do_uniform_tesselate(int &tris) const {
|
do_uniform_tesselate(int &tris) const {
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
void tesselate_uv(int u, int v, bool autoplace, double ratio);
|
void tesselate_uv(int u, int v, bool autoplace, double ratio);
|
||||||
void tesselate_specific(const pvector<double> &u_list,
|
void tesselate_specific(const pvector<double> &u_list,
|
||||||
const pvector<double> &v_list);
|
const pvector<double> &v_list);
|
||||||
void tesselate_per_isoparm(double pi, bool autoplace, double ratio);
|
void tesselate_per_isoparam(double pi, bool autoplace, double ratio);
|
||||||
void tesselate_per_score(double pi, bool autoplace, double ratio);
|
void tesselate_per_score(double pi, bool autoplace, double ratio);
|
||||||
void tesselate_auto(int u, int v, double ratio);
|
void tesselate_auto(int u, int v, double ratio);
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ private:
|
|||||||
|
|
||||||
int _num_u, _num_v;
|
int _num_u, _num_v;
|
||||||
int _tess_u, _tess_v;
|
int _tess_u, _tess_v;
|
||||||
pvector<double> _iso_u, _iso_v; // If nonempty, isoparms at which to tess.
|
pvector<double> _iso_u, _iso_v; // If nonempty, isoparams at which to tess.
|
||||||
|
|
||||||
// _importance is the relative importance of the surface along either
|
// _importance is the relative importance of the surface along either
|
||||||
// axis; _importance2 is this number squared, which is the value set by
|
// axis; _importance2 is this number squared, which is the value set by
|
||||||
|
Loading…
x
Reference in New Issue
Block a user