Panda3D
 All Classes Functions Variables Enumerations
fltMeshPrimitive.h
1 // Filename: fltMeshPrimitive.h
2 // Created by: drose (28Feb01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef FLTMESHPRIMITIVE_H
16 #define FLTMESHPRIMITIVE_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "fltBead.h"
21 #include "fltHeader.h"
22 
23 #include "luse.h"
24 #include "vector_int.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : FltMeshPrimitive
28 // Description : A single primitive of a mesh, like a triangle strip
29 // or fan.
30 ////////////////////////////////////////////////////////////////////
31 class FltMeshPrimitive : public FltBead {
32 public:
33  FltMeshPrimitive(FltHeader *header);
34 
35  enum PrimitiveType {
36  PT_tristrip = 1,
37  PT_trifan = 2,
38  PT_quadstrip = 3,
39  PT_polygon = 4,
40  };
41 
42  typedef vector_int Vertices;
43 
44  PrimitiveType _primitive_type;
45  Vertices _vertices;
46 
47 
48 protected:
49  virtual bool extract_record(FltRecordReader &reader);
50  virtual bool build_record(FltRecordWriter &writer) const;
51 
52 public:
53  virtual TypeHandle get_type() const {
54  return get_class_type();
55  }
56  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
57  static TypeHandle get_class_type() {
58  return _type_handle;
59  }
60  static void init_type() {
61  FltBead::init_type();
62  register_type(_type_handle, "FltMeshPrimitive",
63  FltBead::get_class_type());
64  }
65 
66 private:
67  static TypeHandle _type_handle;
68 };
69 
70 #include "fltMeshPrimitive.I"
71 
72 #endif
73 
74 
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...
A base class for any of a broad family of flt records that represent particular beads in the hierarch...
Definition: fltBead.h:33
A single primitive of a mesh, like a triangle strip or fan.
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to readi...
Definition: fltHeader.h:48
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85