Panda3D
 All Classes Functions Variables Enumerations
indexedFaceSet.h
1 // Filename: indexedFaceSet.h
2 // Created by: drose (24Jun99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 // PANDA 3D SOFTWARE
6 // Copyright (c) Carnegie Mellon University. All rights reserved.
7 //
8 // All use of this software is subject to the terms of the revised BSD
9 // license. You should have received a copy of this license along
10 // with this source code in a file named "LICENSE."
11 ////////////////////////////////////////////////////////////////////
12 
13 #ifndef INDEXEDFACESET_H
14 #define INDEXEDFACESET_H
15 
16 #include "pandatoolbase.h"
17 #include "pvector.h"
18 #include "epvector.h"
19 #include "pset.h"
20 #include "eggPolygon.h"
21 #include "eggVertex.h"
22 #include "eggAttributes.h"
23 
24 class VrmlNode;
25 class EggData;
26 class EggGroup;
27 class EggVertexPool;
28 class VRMLAppearance;
29 class LMatrix4d;
30 
31 ////////////////////////////////////////////////////////////////////
32 // Class : IndexedFaceSet
33 // Description : Decodes the vertices and faces in a VRML indexed face
34 // set, and creates the corresponding egg geometry.
35 ////////////////////////////////////////////////////////////////////
37 public:
38  IndexedFaceSet(const VrmlNode *geometry, const VRMLAppearance &appearance);
39 
40  void convert_to_egg(EggGroup *group, const LMatrix4d &net_transform);
41 
42 private:
43  void get_coord_values();
44  void get_polys();
45  void get_vrml_colors(const VrmlNode *color_node, double transparency,
46  pvector<UnalignedLVecBase4> &color_list);
47  void get_vrml_normals(const VrmlNode *normal_node,
48  pvector<LNormald> &normal_list);
49  void get_vrml_uvs(const VrmlNode *texCoord_node,
50  pvector<LTexCoordd> &uv_list);
51 
52  bool get_colors();
53  bool get_normals();
54  void assign_per_vertex_normals();
55  bool get_uvs();
56  void assign_per_vertex_uvs();
57  void make_polys(EggVertexPool *vpool, EggGroup *group,
58  const LMatrix4d &net_transform);
59  void compute_normals(EggGroup *group);
60 
61  class VrmlVertex {
62  public:
63  int _index;
64  LVertexd _pos;
65  EggVertex _attrib;
66  };
67  class VrmlPolygon {
68  public:
69  EggPolygon _attrib;
70  epvector<VrmlVertex> _verts;
71  };
72  pvector<LVertexd> _coord_values;
73  epvector<VrmlPolygon> _polys;
74  pvector<LTexCoordd> _per_vertex_uvs;
75  pvector<LNormald> _per_vertex_normals;
76 
77  bool _has_normals;
78 
79  const VrmlNode *_geometry;
80  const VRMLAppearance &_appearance;
81 };
82 
83 #endif
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:4716
This is the primary interface into all the egg data, and the root of the egg file structure...
Definition: eggData.h:41
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
The main glue of the egg hierarchy, this corresponds to the &lt;Group&gt;, &lt;Instance&gt;, and &lt;Joint&gt; type nod...
Definition: eggGroup.h:36
Decodes the vertices and faces in a VRML indexed face set, and creates the corresponding egg geometry...
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
Definition: eggVertex.h:41
A single polygon.
Definition: eggPolygon.h:26
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:531
A collection of vertices.
Definition: eggVertexPool.h:46