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