15 #include "lwoDiscontinuousVertexMap.h" 16 #include "lwoInputFile.h" 23 TypeHandle LwoDiscontinuousVertexMap::_type_handle;
33 has_value(
int polygon_index,
int vertex_index)
const {
34 VMad::const_iterator di;
35 di = _vmad.find(polygon_index);
36 if (di != _vmad.end()) {
37 const VMap &vmap = (*di).second;
38 return (vmap.count(vertex_index) != 0);
52 get_value(
int polygon_index,
int vertex_index)
const {
53 VMad::const_iterator di;
54 di = _vmad.find(polygon_index);
55 if (di != _vmad.end()) {
56 const VMap &vmap = (*di).second;
57 VMap::const_iterator vi;
58 vi = vmap.find(vertex_index);
59 if (vi != vmap.end()) {
64 return PTA_stdfloat();
86 int vertex_index = lin->
get_vx();
87 int polygon_index = lin->
get_vx();
90 for (
int i = 0; i < _dimension; i++) {
94 VMap &vmap = _vmad[polygon_index];
95 pair<VMap::iterator, bool> ir =
96 vmap.insert(VMap::value_type(vertex_index, value));
100 PTA_stdfloat orig_value = (*ir.first).second;
102 if (value.v() != orig_value.v()) {
103 nout <<
"Multiple UV values for vertex " << vertex_index
104 <<
" of polygon " << polygon_index
105 <<
" specified by discontinuous vertex map.\n" 106 <<
"Original value = ";
108 PTA_stdfloat::const_iterator vi;
109 for (vi = orig_value.begin(); vi != orig_value.end(); ++vi) {
110 nout << (*vi) <<
" ";
112 nout <<
" new value = ";
113 for (vi = value.begin(); vi != value.end(); ++vi) {
114 nout << (*vi) <<
" ";
129 void LwoDiscontinuousVertexMap::
130 write(ostream &out,
int indent_level)
const {
131 indent(out, indent_level)
132 <<
get_id() <<
" { map_type = " << _map_type
133 <<
", dimension = " << _dimension
134 <<
", name = \"" << _name <<
"\", " 135 << _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.
virtual bool read_iff(IffInputFile *in, size_t stop_at)
Reads the data of the chunk in from the given input file, if possible.
TypeHandle is the identifier used to differentiate C++ class types.
IffId get_id() const
Returns the ID associated with this chunk.