Ignition Rendering

API Reference

4.1.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 
30 
31 namespace ignition
32 {
33  namespace rendering
34  {
35  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
36  //
37  // Forward declaration
38  class Ogre2GpuRaysPrivate;
39 
53  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2GpuRays :
54  public BaseGpuRays<Ogre2Sensor>
55  {
57  protected: Ogre2GpuRays();
58 
60  public: virtual ~Ogre2GpuRays();
61 
62  // Documentation inherited
63  public: virtual void Init() override;
64 
65  // Documentation inherited
66  public: virtual void Destroy() override;
67 
69  public: virtual void CreateRenderTexture();
70 
71  // Documentation inherited
72  public: virtual void PreRender() override;
73 
74  // Documentation inherited
75  public: virtual void PostRender() override;
76 
77  // Documentation inherited
78  public: virtual const float *Data() const override;
79 
80  // Documentation inherited.
81  public: virtual void Copy(float *_data) override;
82 
83  // Documentation inherited.
84  public: virtual common::ConnectionPtr ConnectNewGpuRaysFrame(
85  std::function<void(const float *_frame, unsigned int _width,
86  unsigned int _height, unsigned int _channels,
87  const std::string &_format)> _subscriber) override;
88 
89  // Documentation inherited.
90  public: virtual RenderTargetPtr RenderTarget() const override;
91 
96  private: virtual void Set1stTextureSize(const unsigned int _w,
97  const unsigned int _h = 1);
98 
103  private: virtual void SetRangeCount(const unsigned int _w,
104  const unsigned int _h = 1);
105 
106  // Documentation inherited.
107  private: virtual void Render() override;
108 
110  private: void ConfigureCamera();
111 
113  private: void CreateCamera();
114 
116  private: virtual void CreateGpuRaysTextures();
117 
119  private: void UpdateRenderTarget1stPass();
120 
122  private: void UpdateRenderTarget2ndPass();
123 
126  private: void CreateSampleTexture();
127 
129  private: void Setup1stPass();
130 
132  private: void Setup2ndPass();
133 
139  private: math::Vector2d SampleCubemap(const math::Vector3d &_v,
140  unsigned int &_faceIndex);
141 
144  private: std::unique_ptr<Ogre2GpuRaysPrivate> dataPtr;
145 
147  private: friend class Ogre2Scene;
148  };
149  }
150  }
151 }
152 #endif
Definition: BaseGpuRays.hh:42
Ogre2.x implementation of the scene class.
Definition: Ogre2Scene.hh:45
STL class.
Represents a render-target to which cameras can render images.
Definition: RenderTarget.hh:37
Gpu Rays used to render range data into an image buffer The ogre2 implementation takes a 2 pass proce...
Definition: Ogre2GpuRays.hh:53