00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef INDEXEDFACESET_H
00014 #define INDEXEDFACESET_H
00015
00016 #include "pandatoolbase.h"
00017 #include "pvector.h"
00018 #include "pset.h"
00019 #include "eggPolygon.h"
00020 #include "eggVertex.h"
00021 #include "eggAttributes.h"
00022
00023 class VrmlNode;
00024 class EggData;
00025 class EggGroup;
00026 class EggVertexPool;
00027 class VRMLAppearance;
00028 class LMatrix4d;
00029
00030
00031
00032
00033
00034
00035 class IndexedFaceSet {
00036 public:
00037 IndexedFaceSet(const VrmlNode *geometry, const VRMLAppearance &appearance);
00038
00039 void convert_to_egg(EggGroup *group, const LMatrix4d &net_transform);
00040
00041 private:
00042 void get_coord_values();
00043 void get_polys();
00044 void get_vrml_colors(const VrmlNode *color_node, double transparency,
00045 pvector<UnalignedLVecBase4> &color_list);
00046 void get_vrml_normals(const VrmlNode *normal_node,
00047 pvector<LNormald> &normal_list);
00048 void get_vrml_uvs(const VrmlNode *texCoord_node,
00049 pvector<LTexCoordd> &uv_list);
00050
00051 bool get_colors();
00052 bool get_normals();
00053 void assign_per_vertex_normals();
00054 bool get_uvs();
00055 void assign_per_vertex_uvs();
00056 void make_polys(EggVertexPool *vpool, EggGroup *group,
00057 const LMatrix4d &net_transform);
00058 void compute_normals(EggGroup *group);
00059
00060 class VrmlVertex {
00061 public:
00062 int _index;
00063 LVertexd _pos;
00064 EggVertex _attrib;
00065 };
00066 class VrmlPolygon {
00067 public:
00068 EggPolygon _attrib;
00069 epvector<VrmlVertex> _verts;
00070 };
00071 pvector<LVertexd> _coord_values;
00072 epvector<VrmlPolygon> _polys;
00073 pvector<LTexCoordd> _per_vertex_uvs;
00074 pvector<LNormald> _per_vertex_normals;
00075
00076 bool _has_normals;
00077
00078 const VrmlNode *_geometry;
00079 const VRMLAppearance &_appearance;
00080 };
00081
00082 #endif