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