Ignition Rendering

API Reference

5.0.0
Ogre2GpuRays.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 IGNITION_RENDERING_OGRE2_OGRE2GPURAYS_HH_
19 #define IGNITION_RENDERING_OGRE2_OGRE2GPURAYS_HH_
20 
21 #include <string>
22 #include <memory>
23 
26 #include "ignition/rendering/ogre2/Export.hh"
31 
32 #include "ignition/common/Event.hh"
34 
35 namespace Ogre
36 {
37  class Material;
38  class RenderTarget;
39  class Texture;
40  class Viewport;
41 }
42 
43 namespace ignition
44 {
45  namespace rendering
46  {
47  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
48  //
49  // Forward declaration
50  class Ogre2GpuRaysPrivate;
51 
65  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2GpuRays :
66  public BaseGpuRays<Ogre2Sensor>
67  {
69  protected: Ogre2GpuRays();
70 
72  public: virtual ~Ogre2GpuRays();
73 
74  // Documentation inherited
75  public: virtual void Init() override;
76 
77  // Documentation inherited
78  public: virtual void Destroy() override;
79 
81  public: virtual void CreateRenderTexture();
82 
83  // Documentation inherited
84  public: virtual void PreRender() override;
85 
86  // Documentation inherited
87  public: virtual void PostRender() override;
88 
89  // Documentation inherited
90  public: virtual const float *Data() const override;
91 
92  // Documentation inherited.
93  public: virtual void Copy(float *_data) override;
94 
95  // Documentation inherited.
96  public: virtual common::ConnectionPtr ConnectNewGpuRaysFrame(
97  std::function<void(const float *_frame, unsigned int _width,
98  unsigned int _height, unsigned int _channels,
99  const std::string &_format)> _subscriber) override;
100 
101  // Documentation inherited.
102  public: virtual RenderTargetPtr RenderTarget() const override;
103 
108  private: virtual void Set1stTextureSize(const unsigned int _w,
109  const unsigned int _h = 1);
110 
115  private: virtual void SetRangeCount(const unsigned int _w,
116  const unsigned int _h = 1);
117 
118  // Documentation inherited.
119  private: virtual void Render() override;
120 
122  private: void ConfigureCamera();
123 
125  private: void CreateCamera();
126 
128  private: virtual void CreateGpuRaysTextures();
129 
131  private: void UpdateRenderTarget1stPass();
132 
134  private: void UpdateRenderTarget2ndPass();
135 
138  private: void CreateSampleTexture();
139 
141  private: void Setup1stPass();
142 
144  private: void Setup2ndPass();
145 
151  private: math::Vector2d SampleCubemap(const math::Vector3d &_v,
152  unsigned int &_faceIndex);
153 
156  private: std::unique_ptr<Ogre2GpuRaysPrivate> dataPtr;
157 
159  private: friend class Ogre2Scene;
160  };
161  }
162  }
163 }
164 #endif
Definition: BaseGpuRays.hh:42
Ogre2.x implementation of the scene class.
Definition: Ogre2Scene.hh:56
STL class.
Represents a render-target to which cameras can render images.
Definition: RenderTarget.hh:37
Definition: OgreCamera.hh:27
Gpu Rays used to render range data into an image buffer The ogre2 implementation takes a 2 pass proce...
Definition: Ogre2GpuRays.hh:65