void CObject::changeState(EEntityStateTypes eState) { switch (m_uiType) { case OBJECT_GREEN_BUSH: case OBJECT_LIGHT_STONE: if (eState == EST_LIFTED) { btRigidBody *pRB = btRigidBody::upcast(this->getCollisionObject()); ASSERT(pRB); m_pMap->getPhysicsManager()->getWorld()->removeCollisionObject(pRB); m_pMap->getPhysicsManager()->getWorld()->addRigidBody(pRB, COL_DAMAGE_P, MASK_DAMAGE_P_COLLIDES_WITH); // Entities now cast shadows Ogre::SceneNode::ObjectIterator itObject = this->getSceneNode()->getAttachedObjectIterator(); while (itObject.hasMoreElements()) { Ogre::MovableObject* pObject = static_cast<Ogre::MovableObject*>(itObject.getNext()); pObject->setCastShadows(true); } } else if (eState == EST_THROWN) { btRigidBody *pRB = btRigidBody::upcast(this->getCollisionObject()); ASSERT(pRB); pRB->setLinearFactor(btVector3(1, 1, 1)); pRB->setAngularFactor(0); pRB->activate(); } break; } CWorldEntity::changeState(eState); }
void Actor::setCastShadows(bool hasShadows) { assert(mNode); Ogre::SceneNode::ObjectIterator it = mNode->getAttachedObjectIterator(); while(it.hasMoreElements()) { Ogre::MovableObject* obj = static_cast<Ogre::MovableObject*>(it.getNext()); obj->setCastShadows(hasShadows); } }
VideoVisual::VideoVisual( const std::string &name, rendering::VisualPtr parent, int height, int width) : rendering::Visual(name, parent), height_(height), width_(width) { texture_ = Ogre::TextureManager::getSingleton().createManual( name + "__VideoTexture__", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, width_, height_, 0, Ogre::PF_BYTE_BGRA, Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE); Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create( name + "__VideoMaterial__", "General"); material->getTechnique(0)->getPass(0)->createTextureUnitState( name + "__VideoTexture__"); material->setReceiveShadows(false); double factor = 1.0; Ogre::ManualObject mo(name + "__VideoObject__"); mo.begin(name + "__VideoMaterial__", Ogre::RenderOperation::OT_TRIANGLE_LIST); mo.position(-factor / 2, factor / 2, 0.51); mo.textureCoord(0, 0); mo.position(factor / 2, factor / 2, 0.51); mo.textureCoord(1, 0); mo.position(factor / 2, -factor / 2, 0.51); mo.textureCoord(1, 1); mo.position(-factor / 2, -factor / 2, 0.51); mo.textureCoord(0, 1); mo.triangle(0, 3, 2); mo.triangle(2, 1, 0); mo.end(); mo.convertToMesh(name + "__VideoMesh__"); Ogre::MovableObject *obj = (Ogre::MovableObject*) this->GetSceneNode()->getCreator()->createEntity( name + "__VideoEntity__", name + "__VideoMesh__"); obj->setCastShadows(false); this->AttachObject(obj); }
///void setCastShadows(bool enabled); void movableobject_set_cast_shadows(MovableObjectHandle handle, int enabled) { Ogre::MovableObject* obj = static_cast<Ogre::MovableObject*>(handle); obj->setCastShadows(enabled); }