37   if (_tags != 
nullptr && _tags != tags) {
    38     nout << 
"Multiple Tags fields in effect on the same polygons.\n";
    42   IffId type = lwo_ptags->_tag_type;
    44   bool inserted = _ptags.insert(PTags::value_type(type, lwo_ptags)).second;
    46     nout << 
"Multiple polygon tags on the same polygons of type "    50     if (type == 
IffId(
"SURF")) {
    51       _surf_ptags = lwo_ptags;
    63   IffId map_type = lwo_vmad->_map_type;
    64   const string &name = lwo_vmad->_name;
    67   if (map_type == 
IffId(
"TXUV")) {
    69       _txuv.insert(VMad::value_type(name, lwo_vmad)).second;
    76     nout << 
"Multiple discontinous vertex maps on the same polygons of type "    77          << map_type << 
" named " << name << 
"\n";
    87   if (_surf_ptags == 
nullptr) {
    92   if (!_surf_ptags->
has_tag(polygon_index)) {
    97   int tag_index = _surf_ptags->
get_tag(polygon_index);
    98   if (_tags == 
nullptr || tag_index < 0 ||
   101     nout << 
"Invalid polygon tag index " << tag_index << 
"\n";
   105   string tag = _tags->
get_tag(tag_index);
   109   if (surface == 
nullptr) {
   110     nout << 
"Unknown surface " << tag << 
"\n";
   128 get_uv(
const string &uv_name, 
int pi, 
int vi, LPoint2 &uv)
 const {
   129   VMad::const_iterator ni = _txuv.find(uv_name);
   130   if (ni == _txuv.end()) {
   135   if (vmad->_dimension != 2) {
   136     nout << 
"Unexpected dimension of " << vmad->_dimension
   137          << 
" for discontinuous UV map " << uv_name << 
"\n";
   145   PTA_stdfloat value = vmad->
get_value(pi, vi);
   147   uv.set(value[0], value[1]);
   160   if (_polygons->_polygon_type == 
IffId(
"CURV")) {
   161     nout << 
"Ignoring Catmull-Rom splines.\n";
   163   } 
else if (_polygons->_polygon_type == 
IffId(
"PTCH")) {
   164     nout << 
"Treating subdivision patches as ordinary polygons.\n";
   167   } 
else if (_polygons->_polygon_type == 
IffId(
"MBAL")) {
   168     nout << 
"Ignoring metaballs.\n";
   170   } 
else if (_polygons->_polygon_type == 
IffId(
"BONE")) {
   171     nout << 
"Ignoring bones.\n";
   173   } 
else if (_polygons->_polygon_type == 
IffId(
"FACE")) {
   177     nout << 
"Ignoring unknown geometry type " << _polygons->_polygon_type
   187   nassertv(_points->_layer->_egg_group != 
nullptr);
   188   nassertv(_egg_group != 
nullptr);
   189   _points->_layer->_egg_group->steal_children(*_egg_group);
   198   PN_stdfloat smooth_angle = -1.0;
   200   int num_polygons = _polygons->get_num_polygons();
   201   for (
int pindex = 0; pindex < num_polygons; pindex++) {
   205     bool is_valid = 
true;
   208     const LwoPoints *points = _points->_points;
   218     if (poly->_vertices.size() == 1) {
   227     vector_PT_EggVertex egg_vertices;
   229     int num_vertices = poly->_vertices.size();
   230     for (
int vi = num_vertices; vi > 0; vi--) {
   231       int vindex = poly->_vertices[vi % num_vertices];
   232       if (vindex < 0 || vindex >= num_points) {
   233         nout << 
"Invalid vertex index " << vindex << 
" in polygon.\n";
   237         LPoint3d pos = LCAST(
double, points->
get_point(vindex));
   238         egg_vertex->set_pos(pos);
   244           if (
get_uv(uv_name, pindex, vindex, uv)) {
   247             egg_vertex->set_uv(LCAST(
double, uv));
   249           } 
else if (_points->
get_uv(uv_name, vindex, uv)) {
   252             egg_vertex->set_uv(LCAST(
double, uv));
   256         egg_vertices.push_back(egg_vertex);
   261       if (surface != 
nullptr) {
   266       vector_PT_EggVertex::const_iterator evi;
   267       for (evi = egg_vertices.begin(); evi != egg_vertices.end(); ++evi) {
   270         egg_prim->add_vertex(new_vertex);
   274       _egg_group->add_child(egg_prim.p());
   279   if (smooth_angle > 0.0) {
   280     _egg_group->recompute_vertex_normals(rad_2_deg(smooth_angle), cs);
   282     _egg_group->recompute_polygon_normals(cs);
 A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
int get_num_points() const
Returns the number of points of this group.
const std::string & get_uv_name() const
Returns the name of the set of UV's that are associated with this surface, if has_named_uvs() is true...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_vmad(const LwoDiscontinuousVertexMap *lwo_vmad)
Associates the indicated DiscontinousVertexMap with the polygons.
void add_ptags(const LwoPolygonTags *lwo_ptags, const LwoTags *tags)
Associates the indicated PolygonTags and Tags with the polygons in this chunk.
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 get_uv(const std::string &uv_name, int pi, int vi, LPoint2 &uv) const
Returns true if there is a UV of the indicated name associated with the given vertex of the indicated...
EggData * get_egg_data()
Returns the EggData structure.
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.
A single point, or a collection of points as defined by a single <PointLight> entry.
bool has_named_uvs() const
Returns true if the surface is set up to reference UV's stored on the vertices, by name (as opposed t...
void make_egg()
Creates the egg structures associated with this Lightwave object.
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
const LPoint3 & get_point(int n) const
Returns the nth point of this group.
This class is a wrapper around LwoSurface and stores additional information useful during the convers...
CLwoSurface * get_surface(int polygon_index) const
Returns the surface associated with the given polygon, or NULL if no surface is associated.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void apply_properties(EggPrimitive *egg_prim, vector_PT_EggVertex &egg_vertices, PN_stdfloat &smooth_angle)
Applies the color, texture, etc.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CLwoSurface * get_surface(const std::string &name) const
Returns a pointer to the surface definition with the given name, or NULL if there is no such surface.
bool get_uv(const std::string &uv_name, int n, LPoint2 &uv) const
Returns true if there is a UV of the indicated name associated with the given vertex,...
get_coordinate_system
Returns the coordinate system in which the egg file is defined.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A four-byte chunk ID appearing in an "IFF" file.
void connect_egg()
Connects all the egg structures together.
A mapping of floating-point values per integer index.
EggVertex * create_unique_vertex(const EggVertex ©)
Creates a new vertex in the pool that is a copy of the indicated one and returns it.
A collection of vertices.
An array of points that will be referenced by later chunks.