LensFlare.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17
18#ifndef GAZEBO_RENDERING_LENSFLARE_HH_
19#define GAZEBO_RENDERING_LENSFLARE_HH_
20
21#include <memory>
22
23#include "gazebo/msgs/msgs.hh"
24
27#include "gazebo/util/system.hh"
28
29namespace gazebo
30{
33 namespace rendering
34 {
35 class LensFlarePrivate;
36
37 class LensFlareCompositorListenerPrivate;
38
41 class GZ_RENDERING_VISIBLE LensFlareCompositorListener
42 : public Ogre::CompositorInstance::Listener
43 {
46
49
52 public: void SetLight(LightPtr _light);
53
56 public: void SetScale(const double _scale);
57
60 public: void SetColor(const ignition::math::Vector3d &_color);
61
65 public: virtual void notifyMaterialRender(unsigned int _passId,
66 Ogre::MaterialPtr &_mat);
67
72 private: void CameraPosScale(const CameraPtr &_camera,
73 ignition::math::Vector3d &_pos, double &_scale);
74
79 private: void WideAngleCameraPosScale(
80 const WideAngleCameraPtr &_wideAngleCam,
81 ignition::math::Vector3d &_pos, double &_scale);
82
88 private: double OcclusionScale(const CameraPtr &_cam,
89 const ignition::math::Vector3d &_imgPos,
90 const ignition::math::Vector3d &_worldPos);
91
94 private: std::unique_ptr<LensFlareCompositorListenerPrivate> dataPtr;
95 };
96
99
106 class GZ_RENDERING_VISIBLE LensFlare
107 {
109 public: LensFlare();
110
112 public: virtual ~LensFlare();
113
116 public: void SetCamera(CameraPtr _camera);
117
120 public: void SetScale(const double _scale);
121
124 public: void SetColor(const ignition::math::Vector3d &_color);
125
129 public: void SetCompositorName(const std::string &_name);
130
132 protected: void Update();
133
136 protected: void SetCameraImpl(CameraPtr _camera);
137
141 std::shared_ptr<LensFlareCompositorListener> _listener);
142
145 protected: void SetLensFlareInstance(Ogre::CompositorInstance *_instance);
146
149 private: void OnRequest(ConstRequestPtr &_msg);
150
153 private: std::unique_ptr<LensFlarePrivate> dataPtr;
154 };
156 }
157}
158#endif
rendering
Definition RenderEngine.hh:31
We'll create an instance of this class for each camera, to be used to inject lens flare uniforms in e...
Definition LensFlare.hh:43
LensFlareCompositorListener(CameraPtr _camera, LightPtr _light)
Constructor.
void SetScale(const double _scale)
Set the scale of lens flare.
virtual void notifyMaterialRender(unsigned int _passId, Ogre::MaterialPtr &_mat)
Callback that OGRE will invoke for us on each render call.
void SetColor(const ignition::math::Vector3d &_color)
Set the color of lens flare.
void SetLight(LightPtr _light)
Set directional light that generates lens flare.
Camera lens flare compositor.
Definition LensFlare.hh:107
void SetScale(const double _scale)
Set the scale of lens flare.
void SetLensFlareInstance(Ogre::CompositorInstance *_instance)
Set lensFlareInstance stored in LensFlarePrivate.
void SetCameraImpl(CameraPtr _camera)
Set camera stored in LensFlarePrivate.
void SetCamera(CameraPtr _camera)
Set the camera which lensFlare will be applied to.
virtual ~LensFlare()
Destructor.
void SetLensFlareCompositorListener(std::shared_ptr< LensFlareCompositorListener > _listener)
Set lensFlareCompositorListener stored in LensFlarePrivate.
void SetColor(const ignition::math::Vector3d &_color)
Set the color of lens flare.
void Update()
Update function to search light source.
void SetCompositorName(const std::string &_name)
Set the name of the lens flare compositor to use the next time SetCamera is called.
boost::shared_ptr< Light > LightPtr
Definition RenderTypes.hh:86
boost::shared_ptr< Camera > CameraPtr
Definition RenderTypes.hh:90
boost::shared_ptr< WideAngleCamera > WideAngleCameraPtr
Definition RenderTypes.hh:102
Forward declarations for the common classes.
Definition Animation.hh:27