00001 // Filename: fltBead.h 00002 // Created by: drose (24Aug00) 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 FLTBEAD_H 00020 #define FLTBEAD_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include "fltRecord.h" 00025 #include "fltTransformRecord.h" 00026 00027 #include <luse.h> 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Class : FltBead 00031 // Description : A base class for any of a broad family of flt records 00032 // that represent particular beads in the hierarchy. 00033 // These are things like group beads and object beads, 00034 // as opposed to things like push and pop or comment 00035 // records. 00036 //////////////////////////////////////////////////////////////////// 00037 class FltBead : public FltRecord { 00038 public: 00039 FltBead(FltHeader *header); 00040 00041 bool has_transform() const; 00042 const LMatrix4d &get_transform() const; 00043 void set_transform(const LMatrix4d &mat); 00044 void clear_transform(); 00045 00046 int get_num_transform_steps() const; 00047 FltTransformRecord *get_transform_step(int n); 00048 const FltTransformRecord *get_transform_step(int n) const; 00049 void add_transform_step(FltTransformRecord *record); 00050 00051 int get_replicate_count() const; 00052 void set_replicate_count(int count); 00053 00054 protected: 00055 virtual bool extract_record(FltRecordReader &reader); 00056 virtual bool extract_ancillary(FltRecordReader &reader); 00057 00058 virtual bool build_record(FltRecordWriter &writer) const; 00059 virtual FltError write_ancillary(FltRecordWriter &writer) const; 00060 00061 private: 00062 bool extract_transform_matrix(FltRecordReader &reader); 00063 bool extract_replicate_count(FltRecordReader &reader); 00064 00065 FltError write_transform(FltRecordWriter &writer) const; 00066 FltError write_replicate_count(FltRecordWriter &writer) const; 00067 00068 private: 00069 bool _has_transform; 00070 LMatrix4d _transform; 00071 00072 typedef pvector<PT(FltTransformRecord)> Transforms; 00073 Transforms _transform_steps; 00074 00075 int _replicate_count; 00076 00077 public: 00078 virtual TypeHandle get_type() const { 00079 return get_class_type(); 00080 } 00081 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00082 static TypeHandle get_class_type() { 00083 return _type_handle; 00084 } 00085 static void init_type() { 00086 FltRecord::init_type(); 00087 register_type(_type_handle, "FltBead", 00088 FltRecord::get_class_type()); 00089 } 00090 00091 private: 00092 static TypeHandle _type_handle; 00093 }; 00094 00095 #endif 00096 00097