Panda3D
|
00001 // Filename: fltMeshPrimitive.h 00002 // Created by: drose (28Feb01) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef FLTMESHPRIMITIVE_H 00016 #define FLTMESHPRIMITIVE_H 00017 00018 #include "pandatoolbase.h" 00019 00020 #include "fltBead.h" 00021 #include "fltHeader.h" 00022 00023 #include "luse.h" 00024 #include "vector_int.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : FltMeshPrimitive 00028 // Description : A single primitive of a mesh, like a triangle strip 00029 // or fan. 00030 //////////////////////////////////////////////////////////////////// 00031 class FltMeshPrimitive : public FltBead { 00032 public: 00033 FltMeshPrimitive(FltHeader *header); 00034 00035 enum PrimitiveType { 00036 PT_tristrip = 1, 00037 PT_trifan = 2, 00038 PT_quadstrip = 3, 00039 PT_polygon = 4, 00040 }; 00041 00042 typedef vector_int Vertices; 00043 00044 PrimitiveType _primitive_type; 00045 Vertices _vertices; 00046 00047 00048 protected: 00049 virtual bool extract_record(FltRecordReader &reader); 00050 virtual bool build_record(FltRecordWriter &writer) const; 00051 00052 public: 00053 virtual TypeHandle get_type() const { 00054 return get_class_type(); 00055 } 00056 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00057 static TypeHandle get_class_type() { 00058 return _type_handle; 00059 } 00060 static void init_type() { 00061 FltBead::init_type(); 00062 register_type(_type_handle, "FltMeshPrimitive", 00063 FltBead::get_class_type()); 00064 } 00065 00066 private: 00067 static TypeHandle _type_handle; 00068 }; 00069 00070 #include "fltMeshPrimitive.I" 00071 00072 #endif 00073 00074