00001 // Filename: eggSwitchCondition.cxx 00002 // Created by: drose (08Feb99) 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 "eggSwitchCondition.h" 00020 00021 #include <indent.h> 00022 00023 TypeHandle EggSwitchCondition::_type_handle; 00024 TypeHandle EggSwitchConditionDistance::_type_handle; 00025 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: EggSwitchConditionDistance::Constructor 00029 // Access: Public 00030 // Description: 00031 //////////////////////////////////////////////////////////////////// 00032 EggSwitchConditionDistance:: 00033 EggSwitchConditionDistance(double switch_in, double switch_out, 00034 const LPoint3d ¢er, double fade) { 00035 _switch_in = switch_in; 00036 _switch_out = switch_out; 00037 _center = center; 00038 _fade = fade; 00039 } 00040 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: EggSwitchConditionDistance::make_copy 00044 // Access: Public, Virtual 00045 // Description: 00046 //////////////////////////////////////////////////////////////////// 00047 EggSwitchCondition *EggSwitchConditionDistance:: 00048 make_copy() const { 00049 return new EggSwitchConditionDistance(*this); 00050 } 00051 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: EggSwitchConditionDistance::write 00055 // Access: Public, Virtual 00056 // Description: 00057 //////////////////////////////////////////////////////////////////// 00058 void EggSwitchConditionDistance:: 00059 write(ostream &out, int indent_level) const { 00060 indent(out, indent_level) << "<SwitchCondition> {\n"; 00061 indent(out, indent_level+2) 00062 << "<Distance> { " << _switch_in << " " << _switch_out; 00063 00064 if (_fade != 0.0) { 00065 out << " " << _fade; 00066 } 00067 00068 out << " <Vertex> { " << _center << " } }\n"; 00069 indent(out, indent_level) << "}\n"; 00070 } 00071 00072 00073 //////////////////////////////////////////////////////////////////// 00074 // Function: EggSwitchConditionDistance::transform 00075 // Access: Public, Virtual 00076 // Description: Applies the indicated transformation matrix to the 00077 // switch condition parameters. 00078 //////////////////////////////////////////////////////////////////// 00079 void EggSwitchConditionDistance:: 00080 transform(const LMatrix4d &mat) { 00081 _center = _center * mat; 00082 }