All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DeferredLight.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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 #ifndef _DEFERREDLIGHT_HH_
18 #define _DEFERREDLIGHT_HH_
19 
20 #include <OgreSimpleRenderable.h>
21 #include <OgreInstancedEntity.h>
22 #include <OgreTechnique.h>
23 
25 #include "gazebo/util/system.hh"
26 
27 namespace gazebo
28 {
29  namespace rendering
30  {
34  class GAZEBO_VISIBLE DeferredLight: public Ogre::SimpleRenderable
35  {
37  public: DeferredLight(MaterialGenerator *_gen, Ogre::Light *_parentLight,
38  Ogre::MaterialPtr _vplMaterial);
39 
41  public: ~DeferredLight();
42 
44  public: void UpdateFromParent();
45 
47  public: void UpdateFromCamera(Ogre::Camera *_camera);
48 
50  public: virtual bool getCastShadows() const;
51 
53  public: virtual Ogre::Real getBoundingRadius(void) const;
54 
56  public: virtual Ogre::Real getSquaredViewDepth(const Ogre::Camera*) const;
57 
59  public: virtual const Ogre::MaterialPtr &getMaterial(void) const;
60 
62  public: virtual void getWorldTransforms(Ogre::Matrix4 *_xform) const;
63 
64  public: virtual void UpdateRSM(const Ogre::TexturePtr &_shadowTex);
65  public: virtual void UpdateShadowInvProj(Ogre::Matrix4 &_invproj);
66  public: Ogre::Light *GetParentLight() {return this->parentLight;}
67 
68  public: void SetVPLCount(uint32_t _n, Ogre::SceneManager *_sm,
69  Ogre::InstanceManager *_im);
70 
71  public: void RenderVPLs(Ogre::SceneManager *_sm,
72  Ogre::InstanceManager *_im);
73 
75  protected: bool IsCameraInsideLight(Ogre::Camera *_camera);
76 
78  protected: void RebuildGeometry(float _radius);
79 
81  protected: void CreateSphere(float _radius, int _nRings, int _nSegments);
82 
84  protected: void CreateRectangle2D();
85 
87  protected: void CreateCone(float _radius, float _height,
88  int _nVerticesInBase);
89 
91  protected: void SetAttenuation(float _c, float _b, float _a);
92 
94  protected: void SetSpecularColor(const Ogre::ColourValue &_col);
95 
97  protected: Ogre::Light *parentLight;
98 
100  protected: bool ignoreWorld;
101 
103  protected: float radius;
104 
107 
109  protected: unsigned int permutation;
110 
111  protected: Ogre::MaterialPtr VPLMaterial;
112  };
113  }
114 }
115 #endif
Ogre::MaterialPtr VPLMaterial
Definition: DeferredLight.hh:111
float radius
Bounding sphere radius.
Definition: DeferredLight.hh:103
Ogre::Light * GetParentLight()
Definition: DeferredLight.hh:66
bool ignoreWorld
Mode to ignore world orientation/position.
Definition: DeferredLight.hh:100
Ogre::Light * parentLight
The light that this DLight renders.
Definition: DeferredLight.hh:97
Deferred light geometry.
Definition: DeferredLight.hh:34
unsigned int permutation
Material permutation.
Definition: DeferredLight.hh:109
MaterialGenerator * generator
Deferred shading system this minilight is part of.
Definition: DeferredLight.hh:106
Caching, on-the-fly material generator.
Definition: MaterialGenerator.hh:39
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48