Panda3D
eggSwitchCondition.h
1 // Filename: eggSwitchCondition.h
2 // Created by: drose (08Feb99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef EGGSWITCHCONDITION
16 #define EGGSWITCHCONDITION
17 
18 #include "pandabase.h"
19 
20 #include "eggObject.h"
21 #include "luse.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : EggSwitchCondition
25 // Description : This corresponds to a <SwitchCondition> entry within
26 // a group. It indicates the condition at which a
27 // level-of-detail is switched in or out. This is
28 // actually an abstract base class for potentially any
29 // number of specific different kinds of switching
30 // conditions; presently, only a <Distance> type is
31 // actually supported.
32 ////////////////////////////////////////////////////////////////////
33 class EXPCL_PANDAEGG EggSwitchCondition : public EggObject {
34 PUBLISHED:
35  virtual EggSwitchCondition *make_copy() const=0;
36  virtual void write(ostream &out, int indent_level) const=0;
37 
38  virtual void transform(const LMatrix4d &mat)=0;
39 
40 
41 public:
42 
43  static TypeHandle get_class_type() {
44  return _type_handle;
45  }
46  static void init_type() {
47  EggObject::init_type();
48  register_type(_type_handle, "EggSwitchCondition",
49  EggObject::get_class_type());
50  }
51  virtual TypeHandle get_type() const {
52  return get_class_type();
53  }
54  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
55 
56 private:
57  static TypeHandle _type_handle;
58 };
59 
60 
61 ////////////////////////////////////////////////////////////////////
62 // Class : EggSwitchConditionDistance
63 // Description : A SwitchCondition that switches the levels-of-detail
64 // based on distance from the camera's eyepoint.
65 ////////////////////////////////////////////////////////////////////
66 class EXPCL_PANDAEGG EggSwitchConditionDistance : public EggSwitchCondition {
67 PUBLISHED:
68  EggSwitchConditionDistance(double switch_in, double switch_out,
69  const LPoint3d &center, double fade = 0.0);
70 
71  virtual EggSwitchCondition *make_copy() const;
72  virtual void write(ostream &out, int indent_level) const;
73 
74  virtual void transform(const LMatrix4d &mat);
75 
76 public:
77  double _switch_in, _switch_out, _fade;
78  LPoint3d _center;
79 
80 public:
81  static TypeHandle get_class_type() {
82  return _type_handle;
83  }
84  static void init_type() {
85  EggSwitchCondition::init_type();
86  register_type(_type_handle, "EggSwitchConditionDistance",
87  EggSwitchCondition::get_class_type());
88  }
89  virtual TypeHandle get_type() const {
90  return get_class_type();
91  }
92 
93 private:
94  static TypeHandle _type_handle;
95 };
96 
97 
98 #endif
99 
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:4716
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:544
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This corresponds to a <SwitchCondition> entry within a group.
The highest-level base class in the egg directory.
Definition: eggObject.h:31
A SwitchCondition that switches the levels-of-detail based on distance from the camera&#39;s eyepoint...