00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "eggSwitchCondition.h"
00016
00017 #include "indent.h"
00018
00019 TypeHandle EggSwitchCondition::_type_handle;
00020 TypeHandle EggSwitchConditionDistance::_type_handle;
00021
00022
00023
00024
00025
00026
00027
00028 EggSwitchConditionDistance::
00029 EggSwitchConditionDistance(double switch_in, double switch_out,
00030 const LPoint3d ¢er, double fade) {
00031 _switch_in = switch_in;
00032 _switch_out = switch_out;
00033 _center = center;
00034 _fade = fade;
00035 }
00036
00037
00038
00039
00040
00041
00042
00043 EggSwitchCondition *EggSwitchConditionDistance::
00044 make_copy() const {
00045 return new EggSwitchConditionDistance(*this);
00046 }
00047
00048
00049
00050
00051
00052
00053
00054 void EggSwitchConditionDistance::
00055 write(ostream &out, int indent_level) const {
00056 indent(out, indent_level) << "<SwitchCondition> {\n";
00057 indent(out, indent_level+2)
00058 << "<Distance> { " << _switch_in << " " << _switch_out;
00059
00060 if (_fade != 0.0) {
00061 out << " " << _fade;
00062 }
00063
00064 out << " <Vertex> { " << _center << " } }\n";
00065 indent(out, indent_level) << "}\n";
00066 }
00067
00068
00069
00070
00071
00072
00073
00074
00075 void EggSwitchConditionDistance::
00076 transform(const LMatrix4d &mat) {
00077 _center = _center * mat;
00078
00079 LVector3d in = LVector3d(_switch_in, 0.0, 0.0) * mat;
00080 LVector3d out = LVector3d(_switch_out, 0.0, 0.0) * mat;
00081
00082 _switch_in = in.length();
00083 _switch_out = out.length();
00084 }