17 #ifndef _AMBIENTLIGHT_HH_
18 #define _AMBIENTLIGHT_HH_
20 #include <OgreSimpleRenderable.h>
37 template<
class techniquePolicy>
39 :
public Ogre::SimpleRenderable,
public techniquePolicy
44 this->setRenderQueueGroup(Ogre::RENDER_QUEUE_2);
46 this->mRenderOp.vertexData =
new Ogre::VertexData();
47 this->mRenderOp.indexData = 0;
51 this->mRenderOp.operationType =
52 Ogre::RenderOperation::OT_TRIANGLE_STRIP;
53 this->mRenderOp.useIndexes =
false;
56 this->setBoundingBox(Ogre::AxisAlignedBox(-10000, -10000, -10000,
57 10000, 10000, 10000));
60 this->matPtr = Ogre::MaterialManager::getSingleton().getByName(
61 this->GetMaterialPrefix() +
"/AmbientLight");
63 if (this->matPtr.isNull())
73 delete this->mRenderOp.indexData;
74 delete this->mRenderOp.vertexData;
90 public:
virtual const Ogre::MaterialPtr &
getMaterial(
void)
const
97 *_xform = Ogre::Matrix4::IDENTITY;
102 Ogre::Technique* tech = this->getMaterial()->getBestTechnique();
103 Ogre::Vector3 farCorner = _camera->getViewMatrix(
true) *
104 _camera->getWorldSpaceCorners()[4];
106 for (uint16_t i = 0; i < tech->getNumPasses(); ++i)
108 Ogre::Pass *pass = tech->getPass(i);
111 Ogre::GpuProgramParametersSharedPtr params =
112 pass->getVertexProgramParameters();
115 if (params->_findNamedConstantDefinition(
"farCorner"))
116 params->setNamedConstant(
"farCorner", farCorner);
118 params = pass->getFragmentProgramParameters();
119 if (params->_findNamedConstantDefinition(
"farCorner"))
120 params->setNamedConstant(
"farCorner", farCorner);
virtual const Ogre::MaterialPtr & getMaterial(void) const
Definition: AmbientLight.hh:90
#define gzthrow(msg)
This macro logs an error to the throw stream and throws an exception that contains the file name and ...
Definition: Exception.hh:39
~AmbientLight()
Destructor.
Definition: AmbientLight.hh:70
Ogre::Real radius
Definition: AmbientLight.hh:124
Ogre::MaterialPtr matPtr
Definition: AmbientLight.hh:125
AmbientLight()
Constructor.
Definition: AmbientLight.hh:42
virtual void getWorldTransforms(Ogre::Matrix4 *_xform) const
Definition: AmbientLight.hh:95
virtual Ogre::Real getSquaredViewDepth(const Ogre::Camera *) const
Definition: AmbientLight.hh:84
Definition: AmbientLight.hh:38
static void CreateQuad(Ogre::VertexData *&_vertexData)
Fill up a fresh copy of VertexData with a normalized quad.
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
virtual Ogre::Real getBoundingRadius(void) const
Definition: AmbientLight.hh:78
void UpdateFromCamera(Ogre::Camera *_camera)
Definition: AmbientLight.hh:100