47 class AutoParamDataSource;
69 :
public Camera,
public Ogre::RenderObjectListener
75 public:
GpuLaser(
const std::string &_namePrefix,
76 ScenePtr _scene,
bool _autoRender =
true);
82 public:
virtual void Load(sdf::ElementPtr _sdf);
85 public:
virtual void Load();
88 public:
virtual void Init();
91 public:
virtual void Fini();
95 public:
void CreateLaserTexture(
const std::string &_textureName);
98 public:
virtual void PostRender();
102 public:
const float *GetLaserData();
108 public:
template<
typename T>
110 {
return newLaserFrame.Connect(_subscriber); }
115 { newLaserFrame.Disconnect(_c); }
120 public:
void SetRangeCount(
unsigned int _w,
unsigned int _h = 1);
124 public:
virtual void notifyRenderSingleObject(Ogre::Renderable *_rend,
125 const Ogre::Pass *_p,
const Ogre::AutoParamDataSource *_s,
126 const Ogre::LightList *_ll,
bool _supp);
130 public:
double GetHorzHalfAngle()
const;
134 public:
double GetVertHalfAngle()
const;
138 public:
void SetHorzHalfAngle(
double _angle);
142 public:
void SetVertHalfAngle(
double _angle);
146 public:
void SetIsHorizontal(
bool _horizontal);
150 public:
bool IsHorizontal()
const;
154 public:
double GetHorzFOV()
const;
158 public:
double GetCosHorzFOV()
const;
162 public:
void SetCosHorzFOV(
double _chfov);
166 public:
double GetVertFOV()
const;
170 public:
double GetCosVertFOV()
const;
174 public:
void SetCosVertFOV(
double _cvfov);
178 public:
double GetNearClip()
const;
182 public:
double GetFarClip()
const;
186 public:
void SetNearClip(
double _near);
190 public:
void SetFarClip(
double _far);
194 public:
void SetHorzFOV(
double _hfov);
198 public:
void SetVertFOV(
double _vfov);
202 public:
double GetCameraCount()
const;
207 public:
void SetCameraCount(
double _cameraCount);
211 public:
double GetRayCountRatio()
const;
215 public:
void SetRayCountRatio(
double _rayCountRatio);
218 private:
virtual void RenderImpl();
225 private:
void UpdateRenderTarget(Ogre::RenderTarget *_target,
226 Ogre::Material *_material,
228 bool _updateTex =
false);
231 private:
void CreateOrthoCam();
234 private:
void CreateMesh();
237 private:
void CreateCanvas();
247 private: Ogre::Matrix4 BuildScaledOrthoMatrix(
float _left,
float _right,
248 float _bottom,
float _top,
float _near,
float _far);
253 private:
virtual void Set1stPassTarget(Ogre::RenderTarget *_target,
254 unsigned int _index);
258 private:
virtual void Set2ndPassTarget(Ogre::RenderTarget *_target);
299 private:
event::EventT<void(
const float *_frame,
unsigned int _width,
300 unsigned int _height,
unsigned int _depth,
301 const std::string &_format)> newLaserFrame;
304 private:
float *laserBuffer;
307 private:
float *laserScan;
310 private: Ogre::Material *matFirstPass;
313 private: Ogre::Material *matSecondPass;
316 private: Ogre::Texture *firstPassTextures[3];
319 private: Ogre::Texture *secondPassTexture;
322 private: Ogre::RenderTarget *firstPassTargets[3];
325 private: Ogre::RenderTarget *secondPassTarget;
328 private: Ogre::Viewport *firstPassViewports[3];
331 private: Ogre::Viewport *secondPassViewport;
334 private:
unsigned int textureCount;
337 private:
double cameraYaws[4];
340 private: Ogre::RenderTarget *currentTarget;
343 private: Ogre::Material *currentMat;
347 private: Ogre::Camera *orthoCam;
350 private: Ogre::SceneNode *pitchNodeOrtho;
357 private: Ogre::MovableObject *object;
363 private:
unsigned int w2nd;
366 private:
unsigned int h2nd;
369 private:
double lastRenderDuration;
373 private: std::vector<int> texIdx;
376 private:
static int texCount;