Panda3D
fltVertexList.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 fltVertexList.h
10  * @author drose
11  * @date 2000-08-25
12  */
13 
14 #ifndef FLTVERTEXLIST_H
15 #define FLTVERTEXLIST_H
16 
17 #include "pandatoolbase.h"
18 
19 #include "fltRecord.h"
20 #include "fltPackedColor.h"
21 #include "fltVertex.h"
22 
23 #include "pointerTo.h"
24 
25 /**
26  * A list of vertices, typically added as a child of a face bead.
27  */
28 class FltVertexList : public FltRecord {
29 public:
30  FltVertexList(FltHeader *header);
31 
32  int get_num_vertices() const;
33  FltVertex *get_vertex(int n) const;
34  void clear_vertices();
35  void add_vertex(FltVertex *vertex);
36 
37  virtual void output(std::ostream &out) const;
38 
39 protected:
40  virtual bool extract_record(FltRecordReader &reader);
41  virtual bool build_record(FltRecordWriter &writer) const;
42 
43 private:
44  typedef pvector<PT(FltVertex)> Vertices;
45  Vertices _vertices;
46 
47 public:
48  virtual TypeHandle get_type() const {
49  return get_class_type();
50  }
51  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
52  static TypeHandle get_class_type() {
53  return _type_handle;
54  }
55  static void init_type() {
56  FltRecord::init_type();
57  register_type(_type_handle, "FltVertexList",
58  FltRecord::get_class_type());
59  }
60 
61 private:
62  static TypeHandle _type_handle;
63 };
64 
65 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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
int get_num_vertices() const
Returns the number of vertices in this vertex list.
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:44
void add_vertex(FltVertex *vertex)
Adds a new vertex to the end of the vertex list.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
A list of vertices, typically added as a child of a face bead.
Definition: fltVertexList.h:28
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
void clear_vertices()
Removes all vertices from this vertex list.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
FltVertex * get_vertex(int n) const
Returns the nth vertex of this vertex list.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
virtual void output(std::ostream &out) const
Writes a quick one-line description of the record, but not its children.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.