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 #ifndef __SGL_SCALE_HPP
00026 #define __SGL_SCALE_HPP
00027
00028 #include <sgl.h>
00029 #include <sglMatrix.hpp>
00030 #include <sglGroup.hpp>
00031
00032
00033
00051 template <class T>
00052 class SGL_DLL_API sglScale : public sglGroup
00053 {
00054 public:
00056 sglScale() : sglGroup(), m_scale(1.), m_inv_scale(1.) {}
00058 virtual ~sglScale() {}
00059
00063 void setScale(T scale);
00064
00068 T getScale() const { return m_scale; }
00069
00070
00071 virtual sglBound::IntersectResultEnum intersect(
00072 sglIntersectf &isector) const;
00073
00074
00075 virtual sglBound::IntersectResultEnum intersect(
00076 sglIntersectd &isector) const;
00077
00078
00079 virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00080
00081
00082 virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00083
00084
00085 virtual void computeTxToParent(sglMat4f &curr_mat) const;
00086
00087
00088 virtual void computeTxToParent(sglMat4d &curr_mat) const;
00089
00090
00091 virtual sglNode *clone(unsigned int mode) const;
00092
00093
00094 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00095
00096 protected:
00097
00098 virtual void computeBound();
00099
00100
00101 virtual void cull(sglCull<float> &trav_state,
00102 unsigned int cull_flags) const;
00103
00104
00105 virtual void cull(sglCull<double> &trav_state,
00106 unsigned int cull_flags) const;
00107
00108 void copyTo(sglScale *dst, unsigned int mode) const;
00109
00110 private:
00111 sglScale(const sglScale &);
00112 sglScale &operator=(const sglScale &);
00113
00114 protected:
00115 T m_scale;
00116 T m_inv_scale;
00117 };
00118
00119
00120
00121
00122
00123 template <class T> class sglScale;
00124
00126 typedef sglScale<float> sglScalef;
00128 typedef sglScale<double> sglScaled;
00129
00130 #endif