25 EggVertexUV(
const std::string &name,
const LTexCoordd &uv) :
28 _uvw(uv[0], uv[1], 0.0)
30 if (get_name() ==
"default") {
39 EggVertexUV(
const std::string &name,
const LTexCoord3d &uvw) :
44 if (get_name() ==
"default") {
57 _tangent(copy._tangent),
58 _binormal(copy._binormal),
68 EggNamedObject::operator = (copy);
71 _tangent = copy._tangent;
72 _binormal = copy._binormal;
91 nassertr(first->get_name() == second->get_name(),
nullptr);
92 int flags = first->_flags & second->_flags;
94 LTexCoord3d uvw = (first->_uvw + second->_uvw) / 2;
97 new_obj->_flags = flags;
98 new_obj->_tangent = (first->_tangent + second->_tangent) / 2;
99 new_obj->_binormal = (first->_binormal + second->_binormal) / 2;
102 new_obj->_tangent.normalize();
103 new_obj->_binormal.normalize();
114 _tangent = _tangent * mat;
115 _tangent.normalize();
117 if (has_binormal()) {
118 _binormal = _binormal * mat;
119 _binormal.normalize();
127 write(std::ostream &out,
int indent_level)
const {
128 std::string inline_name = get_name();
129 if (!inline_name.empty()) {
133 if (_duvs.empty() && (_flags & ~F_has_w) == 0) {
136 <<
"<UV> " << inline_name <<
"{ " <<
get_uvw() <<
" }\n";
139 <<
"<UV> " << inline_name <<
"{ " <<
get_uv() <<
" }\n";
142 indent(out, indent_level) <<
"<UV> " << inline_name <<
"{\n";
149 indent(out, indent_level + 2)
150 <<
"<Tangent> { " << get_tangent() <<
" }\n";
152 if (has_binormal()) {
153 indent(out, indent_level + 2)
154 <<
"<Binormal> { " << get_binormal() <<
" }\n";
157 indent(out, indent_level) <<
"}\n";
167 if (_flags != other._flags) {
168 return _flags - other._flags;
171 compare = _uvw.compare_to(other._uvw, egg_parameters->_uv_threshold);
177 compare = _tangent.compare_to(other._tangent, egg_parameters->_normal_threshold);
183 if (has_binormal()) {
184 compare = _binormal.compare_to(other._binormal, egg_parameters->_normal_threshold);
190 if (_duvs != other._duvs) {
191 return _duvs < other._duvs ? -1 : 1;
The set of UV's that may or may not be assigned to a vertex.
const LTexCoord3d & get_uvw() const
Returns the texture coordinate triple, if get_num_dimensions() is 3.
LTexCoordd get_uv() const
Returns the texture coordinate pair, if get_num_dimensions() is 2.
void clear_name()
Resets the Namable's name to empty.
PT(EggVertexUV) EggVertexUV
Creates a new EggVertexUV that contains the averaged values of the two given objects.
int get_num_dimensions() const
Returns the number of components of the texture coordinate set.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool has_w() const
Returns true if the texture coordinate has a third, w component, false if it is just a normal 2-d tex...
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
int compare_to(const EggVertexUV &other) const
An ordering operator to compare two vertices for sorting order.
This is a fairly low-level base class–any egg object that has a name.
void transform(const LMatrix4d &mat)
Applies the indicated transformation matrix to the UV's tangent and/or binormal.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.