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_TRANSLATE_HPP
00026 #define __SGL_TRANSLATE_HPP
00027
00028 #include <sgl.h>
00029 #include <sglMatrix.hpp>
00030 #include <sglGroup.hpp>
00031
00032
00033
00052 template <class T>
00053 class SGL_DLL_API sglTranslate : public sglGroup
00054 {
00055 public:
00057 sglTranslate()
00058 : sglGroup(), m_no_translation_flag(true), m_translation(0.,0.,0.) {}
00059
00061 virtual ~sglTranslate() {}
00062
00063
00070 void setTranslation(T x, T y, T z);
00071
00077 void getTranslation(T &x, T &y, T &z) const;
00078
00079
00080 virtual sglBound::IntersectResultEnum intersect(
00081 sglIntersectf &isector) const;
00082
00083
00084 virtual sglBound::IntersectResultEnum intersect(
00085 sglIntersectd &isector) const;
00086
00087
00088 virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00089
00090
00091 virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00092
00093
00094 virtual void computeTxToParent(sglMat4f &curr_mat) const;
00095
00096
00097 virtual void computeTxToParent(sglMat4d &curr_mat) const;
00098
00099
00100 virtual sglNode *clone(unsigned int mode) const;
00101
00102
00103 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00104
00105 protected:
00106
00107 virtual void computeBound();
00108
00109
00110 virtual void cull(sglCull<float> &trav_state,
00111 unsigned int cull_flags) const;
00112
00113
00114 virtual void cull(sglCull<double> &trav_state,
00115 unsigned int cull_flags) const;
00116
00117 void copyTo(sglTranslate *dst, unsigned int mode) const;
00118
00119 private:
00120 sglTranslate(const sglTranslate &);
00121 sglTranslate& operator=(const sglTranslate &);
00122
00123 protected:
00124 bool m_no_translation_flag;
00125 sglVec3<T> m_translation;
00126 };
00127
00128
00129
00130
00131
00132 template <class T> class sglTranslate;
00133
00135 typedef sglTranslate<float> sglTranslatef;
00137 typedef sglTranslate<double> sglTranslated;
00138
00139 #endif