22 #ifndef _PROJECTOR_HH_
23 #define _PROJECTOR_HH_
33 #include "gazebo/transport/transport.hh"
57 public:
void Load(sdf::ElementPtr _sdf);
61 public:
void Load(
const msgs::Projector &_msg);
70 public:
void Load(
const std::string &_name,
72 const std::string &_textureName =
"",
73 double _nearClip = 0.25,
74 double _farClip = 15.0,
75 double _fov = M_PI * 0.25);
79 public:
void SetTexture(
const std::string &_textureName);
82 public:
void Toggle();
90 public:
void SetEnabled(
bool _enabled);
92 private:
void OnMsg(ConstProjectorPtr &_msg);
102 private:
class ProjectorFrameListener :
public Ogre::FrameListener
105 public: ProjectorFrameListener();
108 public:
virtual ~ProjectorFrameListener();
111 const std::string &_textureName,
114 double _fov = 0.785398163);
116 public:
virtual bool frameStarted(
const Ogre::FrameEvent &_evt);
118 public:
void SetTexture(
const std::string &_textureName);
120 public:
void SetEnabled(
bool _enabled);
121 public:
void SetUsingShaders(
bool _usingShaders);
123 public:
void SetPose(
const math::Pose &_pose);
125 private:
void SetSceneNode();
127 private:
void SetFrustumClipDistance(
double _near,
double _far);
128 private:
void SetFrustumFOV(
double _fov);
129 private:
void AddPassToAllMaterials();
130 private:
void AddPassToVisibleMaterials();
131 private:
void AddPassToMaterials(std::list<std::string> &_matList);
132 private:
void AddPassToMaterial(
const std::string &_matName);
133 private:
void RemovePassFromMaterials();
134 private:
void RemovePassFromMaterial(
const std::string &_matName);
136 public:
bool enabled;
137 public:
bool initialized;
138 private:
bool usingShaders;
140 private: std::string nodeName;
141 private: std::string filterNodeName;
143 private: std::string textureName;
145 private: Ogre::Frustum *frustum;
146 private: Ogre::Frustum *filterFrustum;
147 private: Ogre::PlaneBoundedVolumeListSceneQuery *projectorQuery;
151 private: Ogre::SceneNode *node;
152 private: Ogre::SceneNode *filterNode;
153 private: Ogre::SceneManager *sceneMgr;
154 private: std::map<std::string, Ogre::Pass*> projectorTargets;
159 private: ProjectorFrameListener projector;