lets do the rounding only when uvs are > 1.0 or < -1.0

This commit is contained in:
Asad M. Zaman 2007-03-13 22:13:04 +00:00
parent 611cb9d8e8
commit f9527b4f44

View File

@ -893,6 +893,32 @@ process_model_node(MayaNodeDesc *node_desc) {
<< "Ignoring light node " << path
<< "\n";
}
/*
MFnLight light (dag_path, &status);
if ( !status ) {
status.perror("MFnLight constructor");
mayaegg_cat.error() << "light extraction failed" << endl;
return false;
}
// Get the translation/rotation/scale data
//printTransformData(dag_path, quiet);
// Extract some interesting Light data
MColor color;
color = light.color();
cout << " color: ["
<< color.r << ", "
<< color.g << ", "
<< color.b << "]\n";
color = light.shadowColor();
cout << " shadowColor: ["
<< color.r << ", "
<< color.g << ", "
<< color.b << "]\n";
cout << " intensity: " << light.intensity() << endl;
} else if (dag_path.hasFn(MFn::kNurbsSurface)) {
EggGroup *egg_group = _tree.get_egg_group(node_desc);
@ -909,7 +935,7 @@ process_model_node(MayaNodeDesc *node_desc) {
make_nurbs_surface(node_desc, dag_path, surface, egg_group);
}
}
*/
} else if (dag_path.hasFn(MFn::kNurbsCurve)) {
// Only convert NurbsCurves if we aren't making an animated model.
// Animated models, as a general rule, don't want these sorts of
@ -2045,15 +2071,19 @@ make_polyset(MayaNodeDesc *node_desc, const MDagPath &dag_path,
status.perror("MItMeshPolygon::getUV");
} else {
if (_round_uvs) {
if (uvs[0] > 1.0 || uvs[0] < -1.0) {
// apply upto 1/1000th precision, but round up
uvs[0] = (long)(uvs[0]*1000);
uvs[1] = (long)(uvs[1]*1000);
//cout << "before rounding uvs[0]: " << uvs[0] << endl;
//cout << "before rounding uvs[1]: " << uvs[1] << endl;
cout << "before rounding uvs[0]: " << uvs[0] << endl;
uvs[0] = (double)(round((double)uvs[0]/10.0)*10.0)/1000.0;
cout << "after rounding uvs[0]: " << uvs[0] << endl;
}
if (uvs[1] > 1.0 || uvs[1] < -1.0) {
uvs[1] = (long)(uvs[1]*1000);
cout << "before rounding uvs[1]: " << uvs[1] << endl;
uvs[1] = (double)(round((double)uvs[1]/10.0)*10.0)/1000.0;
//cout << "after rounding uvs[0]: " << uvs[0] << endl;
//cout << "after rounding uvs[1]: " << uvs[1] << endl;
cout << "after rounding uvs[1]: " << uvs[1] << endl;
}
}
vert.set_uv(colordef_uv_name, TexCoordd(uvs[0], uvs[1]));
}