00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __SGL_DISTANCE_SWITCH_HPP
00027 #define __SGL_DISTANCE_SWITCH_HPP
00028
00029 #include <sgl.h>
00030 #include <vector>
00031
00032 #include <sglVector.hpp>
00033 #include <sglGroup.hpp>
00034 #include <sglLODState.hpp>
00035
00036
00037
00123 class SGL_DLL_API sglDistanceSwitch : public sglGroup
00124 {
00125 public:
00127 sglDistanceSwitch();
00129 virtual ~sglDistanceSwitch();
00130
00136 void setRange(float range);
00137
00141 float getRange() const { return m_range; }
00142
00147 void setCenter(const sglVec3f ¢er) { m_center = center; }
00148
00152 const sglVec3f &getCenter() const { return m_center; }
00153
00159 static void setScaleFactor(float scale) { s_range_scale = scale; }
00160
00164 static float getScaleFactor() { return s_range_scale; }
00165
00177 void setLODState(sglLODState *lod_state);
00178
00183 sglLODState *getLODState() const { return m_lod_state; }
00184
00185
00186 virtual sglBound::IntersectResultEnum intersect(
00187 sglIntersectf &isector) const;
00188
00189
00190 virtual sglBound::IntersectResultEnum intersect(
00191 sglIntersectd &isector) const;
00192
00193
00194 virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00195
00196
00197 virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00198
00199
00200 virtual sglNode *clone(unsigned int mode) const;
00201
00202
00203 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00204
00205 protected:
00206
00207 virtual void cull(sglCull<float> &trav_state,
00208 unsigned int cull_flags) const;
00209
00210
00211 virtual void cull(sglCull<double> &trav_state,
00212 unsigned int cull_flags) const;
00213
00214
00215
00216
00217
00218 virtual float computeRange(float trav_lod_scale,
00219 float trav_lod_offset,
00220 const sglMat4f &view_matrix) const;
00221 virtual float computeRange(float trav_lod_scale,
00222 float trav_lod_offset,
00223 const sglMat4d &view_matrix) const;
00224
00225 void copyTo(sglDistanceSwitch *dst, unsigned int mode) const;
00226
00227 private:
00228 sglDistanceSwitch(const sglDistanceSwitch &);
00229 sglDistanceSwitch &operator=(const sglDistanceSwitch &);
00230
00231 protected:
00232 static float s_range_scale;
00233
00234 sglVec3f m_center;
00235 float m_range;
00236
00237 sglLODState *m_lod_state;
00238 };
00239
00240 #endif