Panda3D
indexedFaceSet.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file indexedFaceSet.h
10  * @author drose
11  * @date 1999-06-24
12  */
13 
14 #ifndef INDEXEDFACESET_H
15 #define INDEXEDFACESET_H
16 
17 #include "pandatoolbase.h"
18 #include "pvector.h"
19 #include "epvector.h"
20 #include "pset.h"
21 #include "eggPolygon.h"
22 #include "eggVertex.h"
23 #include "eggAttributes.h"
24 
25 class VrmlNode;
26 class EggData;
27 class EggGroup;
28 class EggVertexPool;
29 class VRMLAppearance;
30 class LMatrix4d;
31 
32 /**
33  * Decodes the vertices and faces in a VRML indexed face set, and creates the
34  * 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 the primary interface into all the egg data, and the root of the egg file structure.
Definition: eggData.h:37
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:34
A single polygon.
Definition: eggPolygon.h:24
A collection of vertices.
Definition: eggVertexPool.h:41
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal.
Definition: eggVertex.h:39
Decodes the vertices and faces in a VRML indexed face set, and creates the corresponding egg geometry...
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.