Panda3D
fltLocalVertexPool.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 fltLocalVertexPool.h
10  * @author drose
11  * @date 2001-02-28
12  */
13 
14 #ifndef FLTLOCALVERTEXPOOL_H
15 #define FLTLOCALVERTEXPOOL_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "fltRecord.h"
20 #include "fltHeader.h"
21 #include "fltVertex.h"
22 
23 #include "pointerTo.h"
24 
25 /**
26  * A local vertex pool, as might appear in the middle of the hierarchy, for
27  * instance for a mesh.
28  */
29 class FltLocalVertexPool : public FltRecord {
30 public:
32 
33  // These bits are not stored in the vertex pool, but are read from the .flt
34  // file and used immediately.
35  enum AttributeMask {
36  AM_has_position = 0x80000000,
37  AM_has_color_index = 0x40000000,
38  AM_has_packed_color = 0x20000000,
39  AM_has_normal = 0x10000000,
40  AM_has_base_uv = 0x08000000,
41  AM_has_uv_1 = 0x04000000,
42  AM_has_uv_2 = 0x02000000,
43  AM_has_uv_3 = 0x01000000,
44  AM_has_uv_4 = 0x00800000,
45  AM_has_uv_5 = 0x00400000,
46  AM_has_uv_6 = 0x00200000,
47  AM_has_uv_7 = 0x00100000
48  };
49 
50  typedef pvector<PT(FltVertex)> Vertices;
51  Vertices _vertices;
52 
53 public:
54  virtual bool extract_record(FltRecordReader &reader);
55  virtual bool build_record(FltRecordWriter &writer) const;
56 
57 public:
58  virtual TypeHandle get_type() const {
59  return get_class_type();
60  }
61  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  static void init_type() {
66  FltRecord::init_type();
67  register_type(_type_handle, "FltLocalVertexPool",
68  FltRecord::get_class_type());
69  }
70 
71 private:
72  static TypeHandle _type_handle;
73 };
74 
75 #include "fltLocalVertexPool.I"
76 
77 #endif
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:44
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
A local vertex pool, as might appear in the middle of the hierarchy, for instance for a mesh.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool extract_record(FltRecordReader &reader)
Fills in the information in this bead based on the information given in the indicated datagram,...
The base class for all kinds of records in a MultiGen OpenFlight file.
Definition: fltRecord.h:36
Represents a single vertex in the vertex palette.
Definition: fltVertex.h:32
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
virtual bool build_record(FltRecordWriter &writer) const
Fills up the current record on the FltRecordWriter with data for this record, but does not advance th...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.