22 #ifndef _PROJECTOR_HH_
23 #define _PROJECTOR_HH_
33 #include "gazebo/transport/transport.hh"
56 public:
void Load(sdf::ElementPtr _sdf);
60 public:
void Load(
const msgs::Projector &_msg);
69 public:
void Load(
const std::string &_name,
71 const std::string &_textureName =
"",
72 double _nearClip = 0.25,
73 double _farClip = 15.0,
74 double _fov = M_PI * 0.25);
78 public:
void SetTexture(
const std::string &_textureName);
91 private:
void OnMsg(ConstProjectorPtr &_msg);
101 private:
class ProjectorFrameListener :
public Ogre::FrameListener
104 public: ProjectorFrameListener();
107 public:
virtual ~ProjectorFrameListener();
110 const std::string &_textureName,
113 double _fov = 0.785398163);
115 public:
virtual bool frameStarted(
const Ogre::FrameEvent &_evt);
117 public:
void SetTexture(
const std::string &_textureName);
120 public:
void SetUsingShaders(
bool _usingShaders);
122 public:
void SetPose(
const math::Pose &_pose);
124 private:
void SetSceneNode();
126 private:
void SetFrustumClipDistance(
double _near,
double _far);
127 private:
void SetFrustumFOV(
double _fov);
128 private:
void AddPassToAllMaterials();
129 private:
void AddPassToVisibleMaterials();
130 private:
void AddPassToMaterials(std::list<std::string> &_matList);
131 private:
void AddPassToMaterial(
const std::string &_matName);
132 private:
void RemovePassFromMaterials();
133 private:
void RemovePassFromMaterial(
const std::string &_matName);
135 public:
bool enabled;
136 public:
bool initialized;
137 private:
bool usingShaders;
139 private: std::string nodeName;
140 private: std::string filterNodeName;
142 private: std::string textureName;
144 private: Ogre::Frustum *frustum;
145 private: Ogre::Frustum *filterFrustum;
146 private: Ogre::PlaneBoundedVolumeListSceneQuery *projectorQuery;
150 private: Ogre::SceneNode *node;
151 private: Ogre::SceneNode *filterNode;
152 private: Ogre::SceneManager *sceneMgr;
153 private: std::map<std::string, Ogre::Pass*> projectorTargets;
158 private: ProjectorFrameListener projector;