Panda3D

eggSwitchCondition.h

00001 // Filename: eggSwitchCondition.h
00002 // Created by:  drose (08Feb99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef EGGSWITCHCONDITION
00016 #define EGGSWITCHCONDITION
00017 
00018 #include "pandabase.h"
00019 
00020 #include "eggObject.h"
00021 #include "luse.h"
00022 
00023 ////////////////////////////////////////////////////////////////////
00024 //       Class : EggSwitchCondition
00025 // Description : This corresponds to a <SwitchCondition> entry within
00026 //               a group.  It indicates the condition at which a
00027 //               level-of-detail is switched in or out.  This is
00028 //               actually an abstract base class for potentially any
00029 //               number of specific different kinds of switching
00030 //               conditions; presently, only a <Distance> type is
00031 //               actually supported.
00032 ////////////////////////////////////////////////////////////////////
00033 class EXPCL_PANDAEGG EggSwitchCondition : public EggObject {
00034 PUBLISHED:
00035   virtual EggSwitchCondition *make_copy() const=0;
00036   virtual void write(ostream &out, int indent_level) const=0;
00037 
00038   virtual void transform(const LMatrix4d &mat)=0;
00039 
00040 
00041 public:
00042 
00043   static TypeHandle get_class_type() {
00044     return _type_handle;
00045   }
00046   static void init_type() {
00047     EggObject::init_type();
00048     register_type(_type_handle, "EggSwitchCondition",
00049                   EggObject::get_class_type());
00050   }
00051   virtual TypeHandle get_type() const {
00052     return get_class_type();
00053   }
00054   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00055 
00056 private:
00057   static TypeHandle _type_handle;
00058 };
00059 
00060 
00061 ////////////////////////////////////////////////////////////////////
00062 //       Class : EggSwitchConditionDistance
00063 // Description : A SwitchCondition that switches the levels-of-detail
00064 //               based on distance from the camera's eyepoint.
00065 ////////////////////////////////////////////////////////////////////
00066 class EXPCL_PANDAEGG EggSwitchConditionDistance : public EggSwitchCondition {
00067 PUBLISHED:
00068   EggSwitchConditionDistance(double switch_in, double switch_out,
00069                              const LPoint3d &center, double fade = 0.0);
00070 
00071   virtual EggSwitchCondition *make_copy() const;
00072   virtual void write(ostream &out, int indent_level) const;
00073 
00074   virtual void transform(const LMatrix4d &mat);
00075 
00076   double _switch_in, _switch_out, _fade;
00077   LPoint3d _center;
00078 
00079 public:
00080 
00081   static TypeHandle get_class_type() {
00082     return _type_handle;
00083   }
00084   static void init_type() {
00085     EggSwitchCondition::init_type();
00086     register_type(_type_handle, "EggSwitchConditionDistance",
00087                   EggSwitchCondition::get_class_type());
00088   }
00089   virtual TypeHandle get_type() const {
00090     return get_class_type();
00091   }
00092 
00093 private:
00094   static TypeHandle _type_handle;
00095 };
00096 
00097 
00098 #endif
00099 
 All Classes Functions Variables Enumerations