00001 // Filename: eggJointPointer.cxx 00002 // Created by: drose (26Feb01) 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 #include "eggJointPointer.h" 00020 00021 00022 TypeHandle EggJointPointer::_type_handle; 00023 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: EggJointPointer::add_frame 00027 // Access: Public, Virtual 00028 // Description: Appends a new frame onto the end of the data, if 00029 // possible; returns true if not possible, or false 00030 // otherwise (e.g. for a static joint). 00031 //////////////////////////////////////////////////////////////////// 00032 bool EggJointPointer:: 00033 add_frame(const LMatrix4d &) { 00034 return false; 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: EggJointPointer::begin_rebuild 00039 // Access: Public 00040 // Description: Resets the set of rebuild frames in preparation for 00041 // rebuilding the complete table of frames. Repeated 00042 // calls to add_rebuild_frame() will build up the frames 00043 // without changing the values returned by get_frame(); 00044 // the table will eventually be updated when do_rebuild 00045 // is called. 00046 //////////////////////////////////////////////////////////////////// 00047 void EggJointPointer:: 00048 begin_rebuild() { 00049 _rebuild_frames.clear(); 00050 } 00051 00052 //////////////////////////////////////////////////////////////////// 00053 // Function: EggJointPointer::add_rebuild_frame 00054 // Access: Public, Virtual 00055 // Description: Adds a new frame to the set of rebuild frames. See 00056 // begin_rebuild() and do_rebuild(). Returns true if 00057 // this is valid, false otherwise (e.g. adding multiple 00058 // frames to a static joint). 00059 //////////////////////////////////////////////////////////////////// 00060 bool EggJointPointer:: 00061 add_rebuild_frame(const LMatrix4d &mat) { 00062 _rebuild_frames.push_back(mat); 00063 return true; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: EggJointPointer::do_rebuild 00068 // Access: Public, Virtual 00069 // Description: Rebuilds the entire table all at once, based on the 00070 // frames added by repeated calls to add_rebuild_frame() 00071 // since the last call to begin_rebuild(). 00072 // 00073 // Until do_rebuild() is called, the animation table is 00074 // not changed. 00075 // 00076 // The return value is true if all frames are 00077 // acceptable, or false if there is some problem. 00078 //////////////////////////////////////////////////////////////////// 00079 bool EggJointPointer:: 00080 do_rebuild() { 00081 if (_rebuild_frames.empty()) { 00082 return true; 00083 } 00084 _rebuild_frames.clear(); 00085 return false; 00086 } 00087 00088 //////////////////////////////////////////////////////////////////// 00089 // Function: EggJointPointer::optimize 00090 // Access: Public, Virtual 00091 // Description: Resets the table before writing to disk so that 00092 // redundant rows (e.g. i { 1 1 1 1 1 1 1 1 }) are 00093 // collapsed out. 00094 //////////////////////////////////////////////////////////////////// 00095 void EggJointPointer:: 00096 optimize() { 00097 }