本文整理汇总了C++中ogre::Entity::setCastShadows方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::setCastShadows方法的具体用法?C++ Entity::setCastShadows怎么用?C++ Entity::setCastShadows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Entity
的用法示例。
在下文中一共展示了Entity::setCastShadows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupContent
void StencilShadowTest::setupContent()
{
// turn ambient light off
mSceneMgr->setAmbientLight(ColourValue(0.0, 0.0, 0.0));
// turn on stencil shadows
mSceneMgr->setShadowTechnique(SHADOWTYPE_STENCIL_ADDITIVE);
// add a couple lights
Ogre::Light* light = mSceneMgr->createLight("Light1");
light->setDiffuseColour(0.5f,0.4f,0.35f);
light->setSpecularColour(0, 0, 0);
light->setAttenuation(8000,1,0.0005,0);
light->setPosition(220,100,0);
light->setCastShadows(true);
light->setType(Light::LT_POINT);
light = mSceneMgr->createLight("Light2");
light->setDiffuseColour(0.5f,0.4f,0.35f);
light->setSpecularColour(0, 0, 0);
light->setAttenuation(8000,1,0.0005,0);
light->setPosition(220,100,-200);
light->setCastShadows(true);
light->setType(Light::LT_POINT);
// create a ground plane to receive some shadows
Plane pln = MovablePlane("plane");
pln.normal = Vector3::UNIT_Y;
pln.d = 107;
MeshManager::getSingleton().createPlane("ground_plane",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, pln,
1500,1500,50,50,true,1,5,5,Vector3::UNIT_Z);
Ogre::Entity* groundPlane = mSceneMgr->createEntity( "plane", "ground_plane" );
groundPlane->setMaterialName("Examples/Rocky");
groundPlane->setCastShadows(false);
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(groundPlane);
// and a couple objects to cast the shadows
Ogre::Entity* bar = mSceneMgr->createEntity( "barrel", "Barrel.mesh" );
bar->setCastShadows(true);
Ogre::SceneNode* barNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
barNode->attachObject(bar);
barNode->setScale(7,7,7);
barNode->setPosition(Ogre::Vector3(0,-85,-320));
Ogre::Entity* head = mSceneMgr->createEntity( "ogrehead", "ogrehead.mesh" );
head->setCastShadows(true);
Ogre::SceneNode* headNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
headNode->attachObject(head);
headNode->setPosition(Ogre::Vector3(-100,-80,-320));
Ogre::Entity* torus = mSceneMgr->createEntity( "torus", "knot.mesh" );
torus->setCastShadows(true);
torus->setMaterialName("Examples/RustySteel");
Ogre::SceneNode* torusNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
torusNode->setScale(0.5,0.5,0.5);
torusNode->attachObject(torus);
torusNode->setPosition(Ogre::Vector3(100,-60,-320));
// point the camera down a bit
mCamera->pitch(Ogre::Degree(-20.f));
}
示例2: setup
bool Application::setup()
{
Ogre::OverlayManager::getSingleton().getByName("InfoPanel")->show();
m_NXOgreScene->getMaterial(0)->setStaticFriction(0.5);
m_NXOgreScene->getMaterial(0)->setDynamicFriction(0.5);
m_NXOgreScene->getMaterial(0)->setRestitution(0.1);
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 20, 0),"cube.1m.mesh");
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(-1, 30, 0),"cube.1m.mesh");
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 25, 0),"cube.1m.mesh");
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(5, 20, 0),"cube.1m.mesh");
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(-5, 20, 0),"cube.1m.mesh");
m_NXOgreScene->createSceneGeometry(new NxOgre::PlaneGeometry(0, NxOgre::Vec3(0, 1, 0)), Matrix44_Identity);
Ogre::Plane *plane = new Ogre::Plane;
plane->normal = Ogre::Vector3::UNIT_Y;
plane->d = 0;
Ogre::MeshManager::getSingleton().createPlane("ground",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, *plane,
150, 150, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
Ogre::Entity* pPlaneEnt = m_sceneMgr->createEntity("groundInstance", "ground");
pPlaneEnt->setCastShadows(false);
pPlaneEnt->setMaterialName("Examples/GrassFloor");
m_sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt);
return true;
}
示例3: createBasicScenary
bool Application::createBasicScenary()
{
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 0.5, 5),"cube.1m.mesh");
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 1.5, 5),"cube.1m.mesh");
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 2.5, 5),"cube.1m.mesh");
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 3.5, 5),"cube.1m.mesh");
m_NXOgreRenderSystem->createBody(new NxOgre::Box(1, 1, 1),NxOgre::Vec3(0, 12.5, 5),"cube.1m.mesh");
//m_NXOgreRenderSystem->createBody(new NxOgre::Capsule(2, 4),NxOgre::Vec3(0, 25, 5),"cube.1m.mesh");
NxOgre::PlaneGeometry * planeGeometry = new NxOgre::PlaneGeometry(0, NxOgre::Vec3(0, 1, 0));
planeGeometry->setGroup(GROUP_COLLIDABLE_NON_PUSHABLE);
m_NXOgreScene->createSceneGeometry(planeGeometry, Matrix44_Identity);
Ogre::Plane *plane = new Ogre::Plane;
plane->normal = Ogre::Vector3::UNIT_Y;
plane->d = 0;
Ogre::MeshManager::getSingleton().createPlane("ground",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, *plane,
150, 150, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
Ogre::Entity* pPlaneEnt = m_sceneMgr->createEntity("groundInstance", "ground");
pPlaneEnt->setCastShadows(false);
pPlaneEnt->setMaterialName("Examples/GrassFloor");
m_sceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt);
return true;
}
示例4:
Ogre::SceneNode* AWGraphics::SceneDirector::createPlane(float x, float y, float z)
{
Ogre::Plane plane = Ogre::Plane(Ogre::Vector3::UNIT_Y, 0);
// Initialize a ground entity for later use
Ogre::MeshManager::getSingleton().createPlane(
"ground",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
plane,
1500, 1500, 20, 20,
true,
1, 5, 5,
Ogre::Vector3::UNIT_Z);
//Ogre::MeshManager::getSingleton().createPlane()
Ogre::Entity* groundEntity = mSceneMgr->createEntity("ground");
groundEntity->setMaterialName("Rockwall");
groundEntity->setCastShadows(false);
Ogre::SceneNode* ogreNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
ogreNode->attachObject(groundEntity);
ogreNode->setPosition(x, y, z);
ogreNode->setOrientation(Ogre::Quaternion::IDENTITY); // hope this is a good reference
return ogreNode;
}
示例5: plane
Level::Level(Ogre::SceneManager *a_scenemgr)
: IEvent()
{
m_castle = new Castle(a_scenemgr);
// Belysningen, tillfällingt
m_light1 = new LightSource(a_scenemgr, Ogre::Vector3(-600, 100, -600), "Light1");
m_light2 = new LightSource(a_scenemgr, Ogre::Vector3(600, 100, 600), "Light2");
// Skyboxen, tillfällingt
a_scenemgr->setSkyBox(true, "Ruins");
// Plane, tillfällingt
Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
Ogre::MeshManager::getSingleton().createPlane("ground",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
1500,1500,20,20,true,1,5,5,Ogre::Vector3::UNIT_Z);
Ogre::Entity *entGround = a_scenemgr->createEntity("GroundEntity", "ground");
entGround->setMaterialName("test1");
entGround->setCastShadows(false);
a_scenemgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);
for (int x = 0; x < MAX_ENEMIES-1 ; x++)
{
m_enemy[x] = NULL;
}
m_enemyId = 0;
// Bara för att hämta boundingboxen..
m_enemy[0] = new Enemy( a_scenemgr, m_enemyId);
collisionTest = new Collision(m_enemy[0]->GetAABB());
delete m_enemy[0];
m_enemy[0] = NULL;
}
示例6: crearEscenario
void TutorialApplication::crearEscenario(void)
{
Ogre::Light* luzPrincipal = mSceneMgr->createLight();
luzPrincipal->setType(Ogre::Light::LT_DIRECTIONAL);
luzPrincipal->setPosition(Ogre::Vector3(0, 100, 0));
luzPrincipal->setDirection(Ogre::Vector3(0, -1, 0));
luzPrincipal->setDiffuseColour(Ogre::ColourValue(1, 1, 1));
luzPrincipal->setSpecularColour(Ogre::ColourValue(1, 1, 1));
Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
plane, 254, 127, 10, 10, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
Ogre::Entity* groundEntity = mSceneMgr->createEntity("ground");
mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(groundEntity);
groundEntity->setCastShadows(false);
groundEntity->setMaterialName("Custom/TelaBillar");
PxPhysics* gPhysics = PhysxOgr::PhysxController::getInstance()->getPhysics();
PxRigidStatic* groundPlane = PxCreatePlane(*gPhysics, PxPlane(0, 1, 0, 0), *gPhysics->createMaterial(0.5f, 0.5f, 0.6f));
mPhysx->getScene()->addActor(*groundPlane);
crearBorde(Ogre::Vector3(-132, 0, 0), Ogre::Vector3(0.1, 0.1, 1.27));
crearBorde(Ogre::Vector3(132, 0, 0), Ogre::Vector3(0.1, 0.1, 1.27));
crearBorde(Ogre::Vector3(0, 0, 68.5), Ogre::Vector3(2.54, 0.1, 0.1));
crearBorde(Ogre::Vector3(0, 0, -68.5), Ogre::Vector3(2.54, 0.1, 0.1));
}
示例7: loadEntity
bool VehicleRenderable::loadEntity(TinyXml::TiXmlElement* ele, Ogre::SceneNode* parent)
{
Ogre::String name = getAttrib(ele, "name");
Ogre::String castShadow = getAttrib(ele, "castShadows");
Ogre::String receiveShadow = getAttrib(ele, "receiveShadows");
Ogre::String meshFile = getAttrib(ele, "meshFile");
Ogre::String materialFile = getAttrib(ele, "materialFile");
try
{
Ogre::Entity* ent = mSceneMgr->createEntity(name, meshFile);
mEntities.push_back(ent);
ent->setCastShadows(Ogre::StringConverter::parseBool(castShadow));
if (!materialFile.empty())
ent->setMaterialName(materialFile);
parent->attachObject(ent);
}
catch (...)
{
Ogre::LogManager::getSingleton().logMessage("VehicleRenderable Error : parsing <" + name + "> error!");
return false;
}
return true;
}
示例8: throwSphere
void DPSHelper::throwSphere(void)
{
Ogre::Vector3 pos = mCamera->getDerivedPosition() + mCamera->getDerivedDirection().normalisedCopy() * 10;
Ogre::Quaternion rot = Ogre::Quaternion::IDENTITY;
Ogre::Entity *ent = mSceneMgr->createEntity("sphere.mesh");
//Ogre::Entity *ent = mSceneMgr->createEntity("cube.mesh");
ent->setCastShadows(true);
//ent->setMaterialName("Examples/BumpyMetal");
Ogre::SceneNode* sphereNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(pos,rot);
setColor(ent, Ogre::Vector3(0.3021f,0.3308f,0.3671f));
sphereNode->attachObject(ent);
sphereNode->setScale(Ogre::Vector3(0.1f,0.1f,0.1f));
BtOgre::StaticMeshToShapeConverter converter(ent);
btCollisionShape* entShape = converter.createSphere();
//btCollisionShape* entShape = converter.createTrimesh();
//Calculate inertia.
btScalar mass = 1;
btVector3 inertia(0,0,0);
entShape->calculateLocalInertia(mass, inertia);
//Create BtOgre MotionState (connects Ogre and Bullet).
BtOgre::RigidBodyState* entState = new BtOgre::RigidBodyState(sphereNode);
//Create the Body.
btRigidBody* entBody = new btRigidBody(mass, entState, entShape, inertia);
Ogre::Vector3 thro = mCamera->getRealDirection() * 800;
entBody->applyCentralForce(btVector3(pos.x,pos.y,pos.z) * 50000);
entBody->setLinearVelocity(btVector3(thro.x,thro.y,thro.z));
phyWorld->addRigidBody(entBody);
}
示例9: AddConstructionCapability
void LagomPlayerBase::AddConstructionCapability(LagomActorFactory* f)
{
if(!f)
return;
if(_actorFactories.find(f) != _actorFactories.end())
return;
Ogre::SceneManager* manager = _state.GetSceneManager();
Ogre::SceneNode* node = manager->createSceneNode();
Ogre::Entity* constructionObject = manager->createEntity(f->Mesh.c_str());
Ogre::MaterialPtr materialPtr = Ogre::MaterialManager::getSingleton().getByName(getIntFactory().ConstructingMaterial);
materialPtr->setSelfIllumination(1.0f,1.0f,1.0f);
constructionObject->setCastShadows(false);
constructionObject->setRenderQueueGroup(RENDER_QUEUE_SKIES_LATE);
constructionObject->setMaterialName(getIntFactory().ConstructingMaterial);
node->attachObject(constructionObject);
node->setScale( f->MeshScale );
_actorFactories.insert(FactoryMap::value_type(f,node));
if( _selectedActorFactory ==_actorFactories.end())
_selectedActorFactory=_actorFactories.begin();
}
示例10: createOgreHead
void DPSHelper::createOgreHead(void)
{
Ogre::Vector3 pos = Ogre::Vector3(0,100,0);
Ogre::Quaternion rot = Ogre::Quaternion::IDENTITY;
//Create Ogre stuff.
Ogre::Entity* ogreHeadEntity = mSceneMgr->createEntity("ogrehead.mesh");
Ogre::SceneNode* ogreHeadNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(pos, rot);
ogreHeadNode->attachObject(ogreHeadEntity);
ogreHeadNode->setScale(Ogre::Vector3(1,1,1));
ogreHeadEntity->setCastShadows(true);
//setColor(mNinjaEntity, Ogre::Vector3(0.3021,0.3308,0.3671));
//mNinjaEntity->setMaterialName("Examples/Rockwall");
//Create shape.
BtOgre::StaticMeshToShapeConverter converter(ogreHeadEntity);
//BtOgre::AnimatedMeshToShapeConverter converter(mNinjaEntity);
//mNinjaShape = converter.createTrimesh();
btCollisionShape* ogreHeadShape = converter.createConvex();
//mNinjaShape = converter.createConvex();
//Calculate inertia.
btScalar mass = 1;
btVector3 inertia;
ogreHeadShape->calculateLocalInertia(mass, inertia);
//Create BtOgre MotionState (connects Ogre and Bullet).
BtOgre::RigidBodyState *ogreheadState = new BtOgre::RigidBodyState(ogreHeadNode);
//Create the Body.
btRigidBody* ogreHeadBody = new btRigidBody(mass, ogreheadState, ogreHeadShape, inertia);
phyWorld->addRigidBody(ogreHeadBody);
}
示例11: render
void OgreBuilding::render()
{
while (readNextSymbol())
{
if (!boundingBox->encloses(cursor.getPosition()))
{
finishDrawing();
break;
}
}
Ogre::String name = buildingObject->getName();
buildingObject->convertToMesh(name + "Mesh");
Ogre::SceneNode* sceneNode = parentSceneNode->createChildSceneNode(name+"Node");
Ogre::StaticGeometry* staticObject = sceneManager->createStaticGeometry(name+"Static");
Ogre::Entity* entity;
entity = sceneManager->createEntity(name + "Entity", name + "Mesh");
entity->setCastShadows(true);
staticObject->addEntity(entity, Ogre::Vector3(0,0,0));
staticObject->setCastShadows(true);
staticObject->build();
//sceneNode->attachObject(entity);
}
示例12: createScene
void QOgreWindow::createScene()
{
// Put anything in here, I'll just put a plane and a dragon here for testing purposes. Go crazy.
// Plane
Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
Ogre::MeshManager::getSingleton().createPlane(
"ground",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
plane,
1500,1500,20,20,
true,
1,5,5,
Ogre::Vector3::UNIT_Z);
Ogre::Entity* ground = oSceneMgr->createEntity("ground");
oSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(ground);
ground->setCastShadows(false);
ground->setMaterialName("Examples/Rockwall");
// Dragon Mesh
oSceneMgr->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5));
Ogre::Entity* ogreHead = oSceneMgr->createEntity("Icosphere.mesh");
Ogre::SceneNode* node = oSceneMgr->getRootSceneNode()->createChildSceneNode();
node->attachObject(ogreHead);
node->setPosition(0.0,70.0,0.0);
Ogre::Light* light = oSceneMgr->createLight("MainLight");
light->setPosition(20, 80, 50);
}
示例13: mHasBeenCollected
Powerup::Powerup(PowerupType powerupType, Ogre::Vector3 spawnAt, int poolIndex)
: mHasBeenCollected(false),
mPowerupType(powerupType),
mPoolIndex(poolIndex),
mUniqueID(GameCore::mPhysicsCore->getUniqueEntityID()),
mSound(NULL),
mNode(NULL),
mBigScreenOverlayElement(NULL),
mRigidBody(NULL)
{
#ifdef COLLISION_DOMAIN_CLIENT
mSound = GameCore::mAudioCore->getSoundInstance(powerupType, mUniqueID, NULL);
mNode = GameCore::mSceneMgr->getRootSceneNode()->createChildSceneNode("PowerupNode" + boost::lexical_cast<std::string>(mUniqueID));
PhysicsCore::auto_scale_scenenode(mNode);
Ogre::Entity* entity = GameCore::mSceneMgr->createEntity("PowerupEntity" + boost::lexical_cast<std::string>(mUniqueID) , "crate.mesh");
entity->setCastShadows(true);
entity->setMaterialName("crate_uv");
mNode->attachObject(entity);
mNode->translate(spawnAt);
if ( GameCore::mClientGraphics->mBigScreen != NULL )
mBigScreenOverlayElement = GameCore::mClientGraphics->mBigScreen->createPowerupOverlayElement(spawnAt, mUniqueID);
#endif
// Add the physics box for both client and server. Make the client's not collide with anyone
btScalar bodyRestitution = 0.3f;
btScalar bodyFriction = 1.0f;
btScalar bodyMass = 40.0f;
btCollisionShape *shape = GameCore::mPhysicsCore->getCollisionShape( PHYS_SHAPE_POWERUP );
btVector3 inertia;
shape->calculateLocalInertia(bodyMass, inertia);
#ifdef COLLISION_DOMAIN_SERVER
mRigidBody = new btRigidBody( bodyMass, NULL, shape, inertia );
#else
mRigidBody = new btRigidBody( bodyMass, (btMotionState *)( new BtOgre::RigidBodyState( mNode ) ), shape, inertia );
#endif
mRigidBody->setRestitution( bodyRestitution );
mRigidBody->setFriction( bodyFriction );
// We must set NO CONTACT COLLISIONS to allow cars to drive through the powerups
mRigidBody->setUserPointer( this );
mRigidBody->setActivationState( DISABLE_DEACTIVATION );
//mRigidBody->translate( BtOgre::Convert::toBullet( spawnAt ) );
mRigidBody->setWorldTransform( btTransform( btQuaternion::btQuaternion().getIdentity(), BtOgre::Convert::toBullet( spawnAt ) ) );
#ifdef COLLISION_DOMAIN_SERVER
GameCore::mPhysicsCore->addRigidBody( mRigidBody, COL_POWERUP, COL_CAR | COL_POWERUP | COL_ARENA );
#else
GameCore::mPhysicsCore->addRigidBody( mRigidBody, COL_POWERUP, COL_POWERUP | COL_ARENA );
#endif
}
示例14: renderObject
/**
* renders the Ball
* we've modularized this function apart from the Ball's constructor for more
* flexibility in createScene
*/
void Ball::renderObject(Ogre::SceneManager* mSceneMgr)
{
Ogre::Entity* ballEntity = mSceneMgr->createEntity("Ball", "sphere.mesh");
ballEntity->setCastShadows(true);
ballNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("sphereNode");
ballNode->attachObject(ballEntity);
}
示例15: createChildEntity
void Application::createChildEntity(std::string name, std::string mesh, Ogre::SceneNode* sceneNode, int x, int y, int z) {
Ogre::Entity* ogreEntity = mSceneManager->createEntity(name, mesh);
ogreEntity->setCastShadows(true);
Ogre::SceneNode* ogreNode = sceneNode->createChildSceneNode(name);
ogreNode->attachObject(ogreEntity);
ogreNode->setPosition(x, y, z);
}