15 #include "eggVertexUV.h"
16 #include "eggParameters.h"
28 EggVertexUV(
const string &name,
const LTexCoordd &uv) :
31 _uvw(uv[0], uv[1], 0.0)
33 if (get_name() ==
"default") {
44 EggVertexUV(
const string &name,
const LTexCoord3d &uvw) :
49 if (get_name() ==
"default") {
64 _tangent(copy._tangent),
65 _binormal(copy._binormal),
77 EggNamedObject::operator = (copy);
80 _tangent = copy._tangent;
81 _binormal = copy._binormal;
105 nassertr(first->get_name() == second->get_name(), NULL);
106 int flags = first->_flags & second->_flags;
108 LTexCoord3d uvw = (first->_uvw + second->_uvw) / 2;
111 new_obj->_flags = flags;
112 new_obj->_tangent = (first->_tangent + second->_tangent) / 2;
113 new_obj->_binormal = (first->_binormal + second->_binormal) / 2;
116 new_obj->_tangent.normalize();
117 new_obj->_binormal.normalize();
131 _tangent = _tangent * mat;
132 _tangent.normalize();
134 if (has_binormal()) {
135 _binormal = _binormal * mat;
136 _binormal.normalize();
146 write(ostream &out,
int indent_level)
const {
147 string inline_name = get_name();
148 if (!inline_name.empty()) {
152 if (_duvs.empty() && (_flags & ~F_has_w) == 0) {
154 indent(out, indent_level)
155 <<
"<UV> " << inline_name <<
"{ " <<
get_uvw() <<
" }\n";
157 indent(out, indent_level)
158 <<
"<UV> " << inline_name <<
"{ " <<
get_uv() <<
" }\n";
161 indent(out, indent_level) <<
"<UV> " << inline_name <<
"{\n";
163 indent(out, indent_level+2) <<
get_uvw() <<
"\n";
165 indent(out, indent_level+2) <<
get_uv() <<
"\n";
168 indent(out, indent_level + 2)
169 <<
"<Tangent> { " << get_tangent() <<
" }\n";
171 if (has_binormal()) {
172 indent(out, indent_level + 2)
173 <<
"<Binormal> { " << get_binormal() <<
" }\n";
176 indent(out, indent_level) <<
"}\n";
189 if (_flags != other._flags) {
190 return _flags - other._flags;
193 compare = _uvw.
compare_to(other._uvw, egg_parameters->_uv_threshold);
199 compare = _tangent.
compare_to(other._tangent, egg_parameters->_normal_threshold);
205 if (has_binormal()) {
206 compare = _binormal.
compare_to(other._binormal, egg_parameters->_normal_threshold);
212 if (_duvs != other._duvs) {
213 return _duvs < other._duvs ? -1 : 1;
The set of UV's that may or may not be assigned to a vertex.
This is a 4-by-4 transform matrix.
int get_num_dimensions() const
Returns the number of components of the texture coordinate set.
void clear_name()
Resets the Namable's name to empty.
This is a two-component point in space.
LTexCoordd get_uv() const
Returns the texture coordinate pair, if get_num_dimensions() is 2.
void transform(const LMatrix4d &mat)
Applies the indicated transformation matrix to the vertex.
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...
const LTexCoord3d & get_uvw() const
Returns the texture coordinate triple, if get_num_dimensions() is 3.
This is a fairly low-level base class–any egg object that has a name.
int compare_to(const EggVertexUV &other) const
An ordering operator to compare two vertices for sorting order.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
int compare_to(const LVecBase3d &other) const
This flavor of compare_to uses a default threshold value based on the numeric type.
TypeHandle is the identifier used to differentiate C++ class types.