33 , mTextureName(TextureName)
36 , mPosition(
Ogre::Vector2(0,0))
37 , mSize(
Ogre::Vector2(1,1))
38 , mOrientation(
Ogre::Radian(0))
43 mProjector->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
48 mSceneNode->setOrientation(Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::NEGATIVE_UNIT_X));
68 _Pass->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
69 _Pass->setCullingMode(Ogre::CULL_NONE);
70 _Pass->setDepthBias(1,1);
71 _Pass->setLightingEnabled(
false);
72 _Pass->setDepthWriteEnabled(
false);
74 Ogre::TextureUnitState *DecalTexture = _Pass->createTextureUnitState(
mTextureName);
75 DecalTexture->setProjectiveTexturing(
true,
mProjector);
76 DecalTexture->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
77 DecalTexture->setTextureFiltering(Ogre::FO_LINEAR, Ogre::FO_LINEAR, Ogre::FO_NONE);
78 DecalTexture->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_TEXTURE, Ogre::LBS_MANUAL, 1.0,
mTransparency);
96 mSceneNode->setPosition(Position.x, 0, Position.y);
123 ->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_TEXTURE, Ogre::LBS_MANUAL, 1.0,
mTransparency);
141 , mLastUnderwater(false)
143 , mForceToUpdate(false)
174 Ogre::AxisAlignedBox DecalBox;
180 if (!(*DecalIt)->isVisible())
185 if ((*DecalIt)->getRegisteredPass())
187 (*DecalIt)->unregister();
191 (*DecalIt)->registerPass(
193 getTechnique(0)->createPass());
197 (*DecalIt)->registerPass(
199 getTechnique(0)->createPass());
208 if (!(*DecalIt)->isVisible())
213 DPos = (*DecalIt)->getPosition();
214 DSize = (*DecalIt)->getSize()/2;
216 DecalBox = Ogre::AxisAlignedBox(DPos.x - DSize.x, HHeight -
mWaterStrength, DPos.y - DSize.y,
221 if (!(*DecalIt)->getRegisteredPass())
225 (*DecalIt)->registerPass(
227 getTechnique(0)->createPass());
231 (*DecalIt)->registerPass(
233 getTechnique(0)->createPass());
239 (*DecalIt)->unregister();
258 getTechnique(0)->createPass());
270 if((*DecalIt)->getId() == Id)
276 return static_cast<Decal*
>(NULL);
283 if((*DecalIt)->getId() == Id)
313 (*DecalIt)->registerPass(
315 getTechnique(0)->createPass());
319 (*DecalIt)->registerPass(
321 getTechnique(0)->createPass());
Ogre::Frustum * mProjector
Decal projector.
Ogre::Real mTransparency
Transparency.
bool mVisible
Is decal visible?
Ogre::Vector2 mPosition
Position.
void setPosition(const Ogre::Vector2 &Position)
Set decal position.
void setVisible(const bool &Visible)
Set decal visibile or not.
void setOrientation(const Ogre::Radian &Orientation)
Set decal orientation.
Ogre::Pass * mRegisteredPass
Registered pass.
Decal(Hydrax *h, const Ogre::String &TextureName, const int &Id)
Constructor.
Ogre::Radian mOrientation
Orientation.
void registerPass(Ogre::Pass *_Pass)
Register the decal int the specified pass.
Hydrax * mHydrax
Hydrax parent pointer.
Ogre::String mTextureName
Decal texture name.
void unregister()
Unregister from current technique.
Ogre::SceneNode * mSceneNode
Decal scene node.
void setTransparency(const Ogre::Real &Transparency)
Set decal transparency.
void setSize(const Ogre::Vector2 &Size)
Set decal size.
void remove(const int &Id)
Remove decal.
Ogre::Real mWaterStrength
Water strength (For decals culling)
Ogre::Quaternion mLastOrientation
void update()
Update decal manager.
DecalsManager(Hydrax *h)
Constructor.
Ogre::Vector3 mLastPosition
Last camera position, orientation, underwater.
Decal * get(const int &Id)
Get decal.
Decal * add(const Ogre::String &TextureName)
Add decal.
Hydrax * mHydrax
Hydrax parent pointer.
void removeAll()
Remove all decals.
void registerAll()
Register all decals.
void _forceToUpdate()
Call to force to update decals.
std::vector< Decal * > mDecals
Decals std::vector.
~DecalsManager()
Destructor.
std::vector< Decal * >::iterator DecalIt
Decal iterator.
Ogre::Camera * getCamera()
Get rendering camera.
const Ogre::Vector3 & getPosition() const
Get water position.
MaterialManager * getMaterialManager()
Get Hydrax::MaterialManager.
Ogre::SceneManager * getSceneManager()
Get scene manager.
DecalsManager * getDecalsManager()
Get Hydrax::DecalsManager.
const bool & _isCurrentFrameUnderwater() const
Is current frame underwater?
Ogre::MaterialPtr & getMaterial(const MaterialType &Material)
Get material.
const bool & isCreated() const
Is createMaterials() already called?
Struct wich contains an especific width and height value.