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";
148 if (has_tangent4()) {
149 indent(out, indent_level + 2)
150 <<
"<Tangent> { " << get_tangent4() <<
" }\n";
151 }
else if (has_tangent()) {
152 indent(out, indent_level + 2)
153 <<
"<Tangent> { " << get_tangent() <<
" }\n";
155 if (has_binormal()) {
156 indent(out, indent_level + 2)
157 <<
"<Binormal> { " << get_binormal() <<
" }\n";
160 indent(out, indent_level) <<
"}\n";
170 if (_flags != other._flags) {
171 return _flags - other._flags;
174 compare = _uvw.compare_to(other._uvw, egg_parameters->_uv_threshold);
180 compare = _tangent.compare_to(other._tangent, egg_parameters->_normal_threshold);
186 if (has_binormal()) {
187 compare = _binormal.compare_to(other._binormal, egg_parameters->_normal_threshold);
193 if (_duvs != other._duvs) {
194 return _duvs < other._duvs ? -1 : 1;
This is a fairly low-level base class–any egg object that has a name.
The set of UV's that may or may not be assigned to a vertex.
void transform(const LMatrix4d &mat)
Applies the indicated transformation matrix to the UV's tangent and/or binormal.
LTexCoordd get_uv() const
Returns the texture coordinate pair, if get_num_dimensions() is 2.
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...
int get_num_dimensions() const
Returns the number of components of the texture coordinate set.
const LTexCoord3d & get_uvw() const
Returns the texture coordinate triple, if get_num_dimensions() is 3.
int compare_to(const EggVertexUV &other) const
An ordering operator to compare two vertices for sorting order.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PT(EggVertexUV) EggVertexUV
Creates a new EggVertexUV that contains the averaged values of the two given objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.