22 TypeHandle LwoDiscontinuousVertexMap::_type_handle;
30 has_value(
int polygon_index,
int vertex_index)
const {
31 VMad::const_iterator di;
32 di = _vmad.find(polygon_index);
33 if (di != _vmad.end()) {
34 const VMap &vmap = (*di).second;
35 return (vmap.count(vertex_index) != 0);
46 get_value(
int polygon_index,
int vertex_index)
const {
47 VMad::const_iterator di;
48 di = _vmad.find(polygon_index);
49 if (di != _vmad.end()) {
50 const VMap &vmap = (*di).second;
51 VMap::const_iterator vi;
52 vi = vmap.find(vertex_index);
53 if (vi != vmap.end()) {
58 return PTA_stdfloat();
76 int vertex_index = lin->
get_vx();
77 int polygon_index = lin->
get_vx();
80 for (
int i = 0; i < _dimension; i++) {
84 VMap &vmap = _vmad[polygon_index];
85 std::pair<VMap::iterator, bool> ir =
86 vmap.insert(VMap::value_type(vertex_index, value));
90 PTA_stdfloat orig_value = (*ir.first).second;
92 if (value.v() != orig_value.v()) {
93 nout <<
"Multiple UV values for vertex " << vertex_index
94 <<
" of polygon " << polygon_index
95 <<
" specified by discontinuous vertex map.\n" 96 <<
"Original value = ";
98 PTA_stdfloat::const_iterator vi;
99 for (vi = orig_value.begin(); vi != orig_value.end(); ++vi) {
100 nout << (*vi) <<
" ";
102 nout <<
" new value = ";
103 for (vi = value.begin(); vi != value.end(); ++vi) {
104 nout << (*vi) <<
" ";
117 void LwoDiscontinuousVertexMap::
118 write(std::ostream &out,
int indent_level)
const {
120 <<
get_id() <<
" { map_type = " << _map_type
121 <<
", dimension = " << _dimension
122 <<
", name = \"" << _name <<
"\", " 123 << _vmad.size() <<
" polygons }\n";
PTA_stdfloat get_value(int polygon_index, int vertex_index) const
Returns the mapping value associated with the given index, or an empty PTA_stdfloat if there is no ma...
bool has_value(int polygon_index, int vertex_index) const
Returns true if the map has a value associated with the given index, false otherwise.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool read_iff(IffInputFile *in, size_t stop_at)
Reads the data of the chunk in from the given input file, if possible.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
IffId get_id() const
Returns the ID associated with this chunk.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.