00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef LOD_H
00020 #define LOD_H
00021
00022 #include "pandabase.h"
00023
00024 #include "luse.h"
00025 #include "typedReferenceCount.h"
00026
00027 class Datagram;
00028 class DatagramIterator;
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 class EXPCL_PANDA LODSwitch {
00043 public:
00044 INLINE LODSwitch();
00045 INLINE LODSwitch(float in, float out);
00046 INLINE LODSwitch(const LODSwitch ©);
00047 INLINE void operator = (const LODSwitch ©);
00048
00049 INLINE void get_range(float &in, float &out) const;
00050 INLINE float get_in() const;
00051 INLINE float get_out() const;
00052 INLINE void set_range(float in, float out);
00053 INLINE bool in_range(float dist_squared) const;
00054
00055 INLINE void rescale(float factor_squared);
00056
00057
00058
00059 INLINE bool operator == (const LODSwitch &other) const;
00060 INLINE bool operator != (const LODSwitch &other) const;
00061 INLINE bool operator < (const LODSwitch &other) const;
00062
00063 INLINE void write_datagram(Datagram &destination) const;
00064 INLINE void read_datagram(DatagramIterator &source);
00065
00066 protected:
00067 float _in;
00068 float _out;
00069 };
00070
00071 #define EXPCL EXPCL_PANDA
00072 #define EXPTP EXPTP_PANDA
00073 #define TYPE LODSwitch
00074 #define NAME LODSwitchVector
00075
00076 #include <vector_src.h>
00077
00078
00079
00080
00081
00082
00083 class EXPCL_PANDA LOD {
00084 public:
00085 LOD();
00086 LOD(const LOD ©);
00087 ~LOD();
00088
00089 void xform(const LMatrix4f &mat);
00090
00091 int compute_child(const LPoint3f &cam_pos,
00092 const LPoint3f ¢er) const;
00093
00094 void write_datagram(Datagram &destination) const;
00095 void read_datagram(DatagramIterator &source);
00096
00097 void output(ostream &out) const;
00098 void write(ostream &out, int indent_level = 0) const;
00099
00100 PUBLISHED:
00101 static void set_stress_factor(float stress_factor);
00102 static float get_stress_factor();
00103
00104 public:
00105 LPoint3f _center;
00106 LODSwitchVector _switch_vector;
00107
00108 private:
00109 static float _stress_factor;
00110 };
00111
00112 INLINE ostream &operator << (ostream &out, const LOD &lod) {
00113 lod.output(out);
00114 return out;
00115 }
00116
00117 #include "LOD.I"
00118
00119 #endif