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_BILLBOARD_HPP
00027 #define __SGL_BILLBOARD_HPP
00028
00029 #include <sgl.h>
00030 #include <sglVector.hpp>
00031 #include <sglMatrix.hpp>
00032 #include <sglGroup.hpp>
00033
00034
00035
00097 class SGL_DLL_API sglBillboard : public sglGroup
00098 {
00099 public:
00101 enum ModeEnum
00102 {
00103 ePOINT_ROT_EYE,
00104 ePOINT_ROT_WORLD,
00105 eAXIAL_ROT
00106 };
00107
00108 public:
00110 sglBillboard();
00112 virtual ~sglBillboard();
00113
00117 const sglVec3d &getPos() const { return m_pos; }
00118
00124 void setPos(const sglVec3d &p);
00125
00130 const sglVec3d &getAxis() const { return m_axis; }
00131
00137 void setAxis(const sglVec3d &v);
00138
00142 void setMode(ModeEnum mode);
00143
00147 ModeEnum getMode() { return m_mode; }
00148
00149
00150 virtual sglBound::IntersectResultEnum intersect(
00151 sglIntersectf &isector) const;
00152
00153
00154 virtual sglBound::IntersectResultEnum intersect(
00155 sglIntersectd &isector) const;
00156
00157
00158 virtual void pick(sglPickf &pick_state, unsigned int cull_flags) const;
00159
00160
00161 virtual void pick(sglPickd &pick_state, unsigned int cull_flags) const;
00162
00163
00164 virtual sglNode *clone(unsigned int mode) const;
00165
00166
00167 virtual void printInfo(ostream &ostrm, const char *indent_string) const;
00168
00169 protected:
00170 void computeOrientation(const sglMat4f ¤t_mat,
00171 sglMat4f &new_mat) const;
00172 void computeOrientation(const sglMat4d ¤t_mat,
00173 sglMat4d &new_mat) const;
00174
00175
00176 virtual void computeBound();
00177
00178
00179 virtual void cull(sglCull<float> &trav_state,
00180 unsigned int cull_flags) const;
00181
00182
00183 virtual void cull(sglCull<double> &trav_state,
00184 unsigned int cull_flags) const;
00185
00186 void copyTo(sglBillboard *dst, unsigned int mode) const;
00187
00188 private:
00189 sglBillboard(const sglBillboard &);
00190 sglBillboard &operator=(const sglBillboard &);
00191
00192 protected:
00193 ModeEnum m_mode;
00194 sglVec3d m_pos;
00195 sglVec3d m_axis;
00196 };
00197
00198 #endif