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
FltVertexList::add_vertex
void add_vertex(FltVertex *vertex)
Adds a new vertex to the end of the vertex list.
Definition: fltVertexList.cxx:57
FltRecordWriter
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
Definition: fltRecordWriter.h:31
pvector
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
FltRecordReader
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
Definition: fltRecordReader.h:30
FltVertexList::clear_vertices
void clear_vertices()
Removes all vertices from this vertex list.
Definition: fltVertexList.cxx:49
FltVertexList::get_num_vertices
int get_num_vertices() const
Returns the number of vertices in this vertex list.
Definition: fltVertexList.cxx:32
register_type
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
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
FltHeader
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:44
FltRecord
The base class for all kinds of records in a MultiGen OpenFlight file.
Definition: fltRecord.h:36
FltVertex
Represents a single vertex in the vertex palette.
Definition: fltVertex.h:32
fltRecord.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
fltPackedColor.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
FltVertexList::output
virtual void output(std::ostream &out) const
Writes a quick one-line description of the record, but not its children.
Definition: fltVertexList.cxx:68
fltVertex.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
FltVertexList
A list of vertices, typically added as a child of a face bead.
Definition: fltVertexList.h:28
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
FltVertexList::get_vertex
FltVertex * get_vertex(int n) const
Returns the nth vertex of this vertex list.
Definition: fltVertexList.cxx:40