Exemplo n.º 1
0
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));
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
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;
}
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));
}
Exemplo n.º 7
0
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;
}
Exemplo n.º 8
0
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);
}
Exemplo n.º 9
0
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();
}
Exemplo n.º 10
0
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);
}
Exemplo n.º 11
0
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);
}
Exemplo n.º 12
0
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);
}
Exemplo n.º 13
0
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
}
Exemplo n.º 14
0
/**
 * 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);
}
Exemplo n.º 15
0
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);
}
Exemplo n.º 16
0
void TerrainOgreComponent::init()
{
	OgreComponent::init();
	Ogre::SceneManager* sMgr = StateManager::getInstance()->inGameState->getSceneMgr();

	// Copy-pasted from the tutorials, need to tweak
	sMgr->setAmbientLight(Ogre::ColourValue(0.0, 0.0, 0.0));
	sMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);

/*
	Ogre::Entity* entNinja = sMgr->createEntity("Ninja", "chassis.mesh");
    entNinja->setCastShadows(true);
    Ogre::SceneNode* ninjaNode = sMgr->getRootSceneNode()->createChildSceneNode();
//    ninjaNode->setScale(20, 20, 20);
	ninjaNode->setPosition(0, 2, 2);
    ninjaNode->attachObject(entNinja);
*/

	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 = sMgr->createEntity("GroundEntity", "ground");
	sMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);

	entGround->setMaterialName("Ground/Grid");
	entGround->setCastShadows(false);
/*
	Ogre::Light* pointLight = sMgr->createLight("pointLight");
    pointLight->setType(Ogre::Light::LT_POINT);
    pointLight->setPosition(Ogre::Vector3(0, 50, 0));
    pointLight->setDiffuseColour(1.0, 1.0, 1.0);
    pointLight->setSpecularColour(1.0, 1.0, 1.0);
*/

    Ogre::Light* directionalLight = sMgr->createLight("directionalLight");
    directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
    directionalLight->setDiffuseColour(Ogre::ColourValue(.1, .1, .1));
    directionalLight->setSpecularColour(Ogre::ColourValue(.1, .1, .1));
    directionalLight->setDirection(Ogre::Vector3( 0, -1, .3));

    Ogre::Light* spotLight = sMgr->createLight("spotLight");
    spotLight->setType(Ogre::Light::LT_SPOTLIGHT);
    spotLight->setDiffuseColour(1.0, 1.0, 1.0);
    spotLight->setSpecularColour(1.0, 1.0, 1.0);
    spotLight->setDirection(-1, -1, 0);
    spotLight->setPosition(Ogre::Vector3(30, 30, 0));
    spotLight->setSpotlightRange(Ogre::Degree(10), Ogre::Degree(50));

	//sMgr->setSkyDome(true, "Sky/Stars", 5, 8);

	/* Consider: weirnc: Add fog in the future? Can't get the 2nd line to work
	   Ogre::ColourValue fadeColour(0.9, 0.9, 0.9);
	   Application::getInstance()->getWindow()->getViewport(0)->setBackgroundColour(fadeColour);
	   sMgr->setFog(Ogre::FOG_EXP, fadeColour, 0.0, 50, 500);
	 */
}
void BasicTutorial2::createScene(void)
{
    mSceneMgr->setAmbientLight(Ogre::ColourValue(0, 0, 0));
    mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);

    // the ninja
    Ogre::Entity *entNinja = mSceneMgr->createEntity("Ninja", "ninja.mesh");
    entNinja->setCastShadows(true);
    mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entNinja);

    // the ground mesh
    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);

    // the ground entity
    Ogre::Entity *entGround = mSceneMgr->createEntity("GroundEntity", "ground");
    entGround->setCastShadows(false);
    entGround->setMaterialName("Examples/Rockwall");
    mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);

    // creating lights
    Ogre::Light *pointLight = mSceneMgr->createLight("pointLight");
    pointLight->setType(Ogre::Light::LT_POINT);
    pointLight->setPosition(Ogre::Vector3(0, 150, 250));
    pointLight->setDiffuseColour(1.0, 0.0, 0.0);
    pointLight->setSpecularColour(1.0, 0.0, 0.0);

    Ogre::Light *directionalLight = mSceneMgr->createLight("directionalLight");
    directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
    directionalLight->setDiffuseColour(.25, .25, 0);
    directionalLight->setSpecularColour(.25, .25, 0);
    directionalLight->setDirection(Ogre::Vector3(0, -1, 1));

    Ogre::Light* spotLight = mSceneMgr->createLight("spotLight");
    spotLight->setType(Ogre::Light::LT_SPOTLIGHT);
    spotLight->setDiffuseColour(0, 0, 1.0);
    spotLight->setSpecularColour(0, 0, 1.0);
    spotLight->setDirection(-1, -1, 0);
    spotLight->setPosition(Ogre::Vector3(300, 300 ,0));
    spotLight->setSpotlightRange(Ogre::Degree(35), Ogre::Degree(50));
}
Exemplo n.º 18
0
void TutorialApplication::createPhysics(void)
{
	mTimeMultiplier = DEFAULT_TIME_MULTIPLIER;
	mAnimationSpeed = DEFAULT_ANIMATION_SPEED;
	mTimeAccumulator = 0;
	// setup bullet
	Ogre::Vector3 gravityVector( 0, -9.81, 0);
	Ogre::AxisAlignedBox bounds( Ogre::Vector3(-100,-100,-100), Ogre::Vector3(100,100,100));
	mNumEntitiesInstanced = 0;
	// start bullet
	//mWorld = new OgreBulletDynamics::DynamicsWorld( mSceneMgr, bounds, gravityVector );
	mWorld = new FeatherstoneMultibodyDynamicsWorld( mSceneMgr, bounds, gravityVector );
	// add debug info display tool
	debugDrawer = new OgreBulletCollisions::DebugDrawer();
	debugDrawer->setDrawWireframe(false);
	debugDrawer->setDrawAabb(true);
	mWorld->setDebugDrawer(debugDrawer);
	mWorld->setShowDebugShapes(PHYSICS_SHOW_DEBUG_SHAPES);
	
	// use more iterations for the consraints solver
	mWorld->getBulletDynamicsWorld()->getSolverInfo().m_numIterations = 30;
	
	
	OgreAssert( debugDrawer, "no debug drawer" );
	// create a node for the debug drawer, add to the scene
	Ogre::SceneNode *debugDrawerNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("bulletDebugDrawer", Ogre::Vector3::ZERO);
	debugDrawerNode->attachObject(static_cast<Ogre::SimpleRenderable*>(debugDrawer));

	
	// define a floor plane mesh
	Ogre::Plane p;
	// plane definition
	p.normal = Ogre::Vector3(0,1,0);
	p.d = 0;
	// make the flor plane
	Ogre::MeshManager::getSingleton().createPlane("FloorPlane", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, p, 2000, 2000, 20, 20, true, 1, 1000, 1000, Ogre::Vector3::UNIT_Z );
	
	Ogre::Entity* floorEnt = mSceneMgr->createEntity( "floor", "FloorPlane" );
	floorEnt->setMaterialName("Examples/Rockwall");
	floorEnt->setCastShadows(false);
	mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(floorEnt);
	
	// create collision shape
	OgreBulletCollisions::CollisionShape *floorShape = new OgreBulletCollisions::StaticPlaneCollisionShape(Ogre::Vector3(0,1,0), 0); // normal vector, distance
	OgreBulletDynamics::RigidBody* defaultPlaneBody = new OgreBulletDynamics::RigidBody( "BasePlane", mWorld );
	float restitution = 0.0f;
	float friction = 1.0f;
	defaultPlaneBody->setStaticShape(floorShape, restitution, friction); // shape, restitution, friction
	// store
	mShapes.push_back(floorShape);
	mRigidBodies.push_back(defaultPlaneBody);
	mGroundPlaneBody = defaultPlaneBody;
	
}
Exemplo n.º 19
0
void LightSample::CreateGround()
{
	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
	Ogre::String name = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME;
	Ogre::MeshManager::getSingleton().createPlane("ground", name, plane, 1500, 1500, 20, 20, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);

	Ogre::Entity* groundEntity = mSceneMgr->createEntity("ground");
	mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(groundEntity);
	groundEntity->setMaterialName("Examples/Rockwall");
	groundEntity->setCastShadows(false);
}
Exemplo n.º 20
0
void TutorialApplication::crearBorde(Ogre::Vector3 posicion, Ogre::Vector3 escala)
{
	Ogre::Entity *borde = mSceneMgr->createEntity("cube.mesh");
	borde->setMaterialName("Custom/TelaBillar");
	borde->setCastShadows(false);

	Ogre::SceneNode *nodoBorde = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	nodoBorde->setPosition(posicion);
	nodoBorde->attachObject(borde);
	nodoBorde->scale(escala);
}
Exemplo n.º 21
0
int Create_Static_Object::create(Ogre::SceneManager *mainSceneMgr) {
    if (meshName.empty() ) {
        std::cout << "Whoops, what do you think you're doing? You didn't give a mesh name!" << std::endl;
        return 0;
    }

    if (meshFile.empty() ) {
        std::cout << "Well what did you expect? There's no mesh file to load!" << std::endl;
        return 0;
    }

    Ogre::SceneNode *nodeStaticObject = mainSceneMgr->getRootSceneNode()->createChildSceneNode(meshName, location, rotation);
    Ogre::Entity *entityStaticObject = mainSceneMgr->createEntity(meshName, meshFile);

    if (!materialName.empty() ){
        entityStaticObject->setMaterialName(materialName);
    }

    entityStaticObject->setCastShadows(shadow);

    nodeStaticObject->attachObject(entityStaticObject);
    nodeStaticObject->showBoundingBox(showBBox);
    nodeStaticObject->scale(scale);

    //Create the ground shape.
    BtOgre::StaticMeshToShapeConverter ogreBulletShapeConverter(entityStaticObject);
    if (bulletCollision == "sphere"){
        shapeStaticObject = ogreBulletShapeConverter.createSphere();
    } else if (bulletCollision == "box"){
        shapeStaticObject = ogreBulletShapeConverter.createBox();
        offsetLocation = entityStaticObject->getBoundingBox().getHalfSize();
        location.y = location.y - offsetLocation.y;
    } else if (bulletCollision == "trimesh"){
        shapeStaticObject = ogreBulletShapeConverter.createTrimesh();
    } else if (bulletCollision == "cylinder"){
        shapeStaticObject = ogreBulletShapeConverter.createCylinder();
    } else if (bulletCollision == "convex"){
        shapeStaticObject = ogreBulletShapeConverter.createConvex();
    }else{
        return 0;
    }

    shapeStaticObject->setLocalScaling(BtOgre::Convert::toBullet(nodeStaticObject->getScale() ) );

    //Create MotionState (no need for BtOgre here, you can use it if you want to though).
    stateStaticObject = new btDefaultMotionState(btTransform( BtOgre::Convert::toBullet(rotation),  BtOgre::Convert::toBullet(location) ) );

    //Create the Body.
    bodyStaticObject = new btRigidBody(0, stateStaticObject, shapeStaticObject, btVector3(0,0,0));
    Globals::phyWorld->addRigidBody(bodyStaticObject);

    return 1;
}
Exemplo n.º 22
0
Pencil::Pencil(Ogre::SceneManager * sceneMgr, int marker_id)
: BaseSketchObject(sceneMgr, "pencil") {

    attachedObject = NULL;
    objectAttachedOnTop = pencilBusy = false;
    Ogre::Entity * ent = sceneMgr->createEntity("pencil_pointer", "Pointer.mesh");
    ent->setCastShadows(true);
    pointerNode = surfPlaneNode->createChildSceneNode(Ogre::Vector3(0, 5, 0));
    pointerNode->setScale(0.5, 0.5, 0.5);
    //    pointerNode->rotate(Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_Z), Ogre::Node::TS_LOCAL);
    pointerNode->attachObject(ent);
}
Exemplo n.º 23
0
SceneNode* Bridge::createObject( SceneNode* parentNode,str name,str matName,str meshName, 
								Ogre::Vector3 pos /*= Ogre::Vector3::ZERO*/, 
								Ogre::Quaternion rot /*= Ogre::Quaternion::IDENTITY*/ )
{
	SceneNode* node = parentNode->createChildSceneNode(name+"Node",pos,rot);
	Ogre::Entity* entity = game->visualSystem.getSceneMgr()->createEntity(name,meshName);
	entity->setMaterialName(matName);
	entity->setCastShadows(false);
	entity->getMesh()->buildTangentVectors();
	node->attachObject(entity);
	return node;
}
Exemplo n.º 24
0
//-----------------------------------------------------------------------------------
void Sample_Compositor::setupScene(void)
{
	mSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE);
	mSceneMgr->setShadowFarDistance(1000);
    
	Ogre::MovableObject::setDefaultVisibilityFlags(0x00000001);

	// Set ambient light
	mSceneMgr->setAmbientLight(Ogre::ColourValue(0.3, 0.3, 0.2));

	Ogre::Light* l = mSceneMgr->createLight("Light2");
	Ogre::Vector3 dir(-1,-1,0);
	dir.normalise();
	l->setType(Ogre::Light::LT_DIRECTIONAL);
	l->setDirection(dir);
	l->setDiffuseColour(1, 1, 0.8);
	l->setSpecularColour(1, 1, 1);


	Ogre::Entity* pEnt;

	// House
	pEnt = mSceneMgr->createEntity( "1", "tudorhouse.mesh" );
	Ogre::SceneNode* n1 = mSceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::Vector3(350, 450, -200));
	n1->attachObject( pEnt );

	pEnt = mSceneMgr->createEntity( "2", "tudorhouse.mesh" );
	Ogre::SceneNode* n2 = mSceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::Vector3(-350, 450, -200));
	n2->attachObject( pEnt );

	pEnt = mSceneMgr->createEntity( "3", "knot.mesh" );
	mSpinny = mSceneMgr->getRootSceneNode()->createChildSceneNode(Ogre::Vector3(0, 0, 300));
	mSpinny->attachObject( pEnt );
	pEnt->setMaterialName("Examples/MorningCubeMap");

	mSceneMgr->setSkyBox(true, "Examples/MorningSkyBox");


	Ogre::Plane plane;
	plane.normal = Ogre::Vector3::UNIT_Y;
	plane.d = 100;
	Ogre::MeshManager::getSingleton().createPlane("Myplane",
		Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane,
		1500, 1500, 10, 10, true, 1, 5, 5, Ogre::Vector3::UNIT_Z);
	Ogre::Entity* pPlaneEnt = mSceneMgr->createEntity( "plane", "Myplane" );
	pPlaneEnt->setMaterialName("Examples/Rockwall");
	pPlaneEnt->setCastShadows(false);
	mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt);

	mCamera->setPosition(-400, 50, 900);
	mCamera->lookAt(0,80,0);
}
Exemplo n.º 25
0
void DotSceneLoader::processEntity(rapidxml::xml_node<>* XMLNode, Ogre::SceneNode *pParent)
{
	// Process attributes
	Ogre::String name = getAttrib(XMLNode, "name");
	Ogre::String id = getAttrib(XMLNode, "id");
	Ogre::String meshFile = getAttrib(XMLNode, "meshFile");
	Ogre::String materialFile = getAttrib(XMLNode, "materialFile");
	bool isStatic = getAttribBool(XMLNode, "static", false);;
	bool castShadows = getAttribBool(XMLNode, "castShadows", true);

	// TEMP: Maintain a list of static and dynamic objects
	if (isStatic)
		staticObjects.push_back(name);
	else
		dynamicObjects.push_back(name);

	rapidxml::xml_node<>* pElement;

	// Process vertexBuffer (?)
	pElement = XMLNode->first_node("vertexBuffer");
	if (pElement)
		;//processVertexBuffer(pElement);

	// Process indexBuffer (?)
	pElement = XMLNode->first_node("indexBuffer");
	if (pElement)
		;//processIndexBuffer(pElement);

	// Create the entity
	Ogre::Entity *pEntity = 0;
	try
	{
		Ogre::MeshManager::getSingleton().load(meshFile, m_sGroupName);
		pEntity = mSceneMgr->createEntity(name, meshFile);
		pEntity->setCastShadows(castShadows);
		pParent->attachObject(pEntity);

		if (!materialFile.empty())
			pEntity->setMaterialName(materialFile);
	}
	catch (Ogre::Exception &/*e*/)
	{
		Ogre::LogManager::getSingleton().logMessage("[DotSceneLoader] Error loading an entity!");
	}

	// Process userDataReference (?)
	pElement = XMLNode->first_node("userDataReference");
	if (pElement)
		processUserDataReference(pElement, pEntity);


}
Exemplo n.º 26
0
void Viewer::createScene()
{
    ogreRoot->loadPlugin("Plugin_BSPSceneManager");
    ogreRoot->loadPlugin("Plugin_CgProgramManager");
    ogreRoot->loadPlugin("Plugin_OctreeSceneManager");
//    ogreRoot->loadPlugin("Plugin_OctreeZone");
    ogreRoot->loadPlugin("Plugin_ParticleFX");
    ogreRoot->loadPlugin("Plugin_PCZSceneManager");
    loadResourses();
    Ogre::Vector3 lightdir(-0.55, -0.3, -0.75);
    lightdir.normalise();
    Ogre::Light* light = ogreSceneManager->createLight("tstLight");
    light->setType(Ogre::Light::LT_DIRECTIONAL);
    light->setDirection(lightdir);
    light->setDiffuseColour(Ogre::ColourValue::White);
    light->setSpecularColour(Ogre::ColourValue(0.4, 0.4, 0.4));
    ogreSceneManager->setAmbientLight(Ogre::ColourValue(0.2, 0.2, 0.2));
    ogreCamera = ogreSceneManager->createCamera("myCamera");
    ogreCamera->setPosition(Ogre::Vector3(0,0,0));
    ogreCamera->lookAt(Ogre::Vector3(0,0,0));
    ogreCamera->setNearClipDistance(0.1);
    ogreCamera->setFarClipDistance(50000);


if (ogreRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_INFINITE_FAR_PLANE))
    {
        ogreCamera->setFarClipDistance(0);   // enable infinite far clip distance if we can
    }
ogreViewport = ogreRenderWindow->addViewport(ogreCamera);
setBackgroundColor(QColor(100,100,100));

ogreCamera->setAspectRatio(Ogre::Real(this->parentWidget()->width()) / Ogre::Real(this->parentWidget()->height()));
    Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);

    Ogre::MeshManager::getSingleton().createPlane("ground", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        plane, 1500, 1500, 5, 5, true, 1, 30, 30, Ogre::Vector3::UNIT_Z);

    Ogre::Entity* entGround = ogreSceneManager->createEntity("GroundEntity", "ground");
    ogreSceneManager->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);

    entGround->setMaterialName("Examples/Rockwall");
    entGround->setCastShadows(false);
    ogreCamNode = ogreSceneManager->getRootSceneNode()->createChildSceneNode("CamNode1");
    ogreCamNode->attachObject(ogreCamera);
    mainNode = ogreSceneManager->getRootSceneNode()->createChildSceneNode("MainNode");
    updateCamPos();

//    Ogre::ResourceGroupManager::getSingleton().unloadUnreferencedResourcesInGroup("General",true);
//    Ogre::ResourceGroupManager::getSingleton().unloadUnreferencedResourcesInGroup("Popular",true);
//    Ogre::ResourceGroupManager::getSingleton().unloadUnreferencedResourcesInGroup("Essential",true);
}
Exemplo n.º 27
0
void GameState::createScene()
{
    // --- Objects
    m_pNpc01 = new BaseNpc("Blacksmith", m_pSceneMgr, Ogre::Vector3(50.0f,  0.0f,  50.0f));
    m_pNpc01->ChangeState(Work::Instance());
    //m_pNpc02 = new BaseNpc("Woman", m_pSceneMgr, Ogre::Vector3(-50.0f,  0.0f,  -50.0f));
    //m_pNpc01->addLocation(Ogre::Vector3(-100.0f,0.0f,-100.0f));

    // --- World
    // Light
    m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.7, 0.7, 0.7));

    // Objects
    // Home
    Ogre::Entity* home = m_pSceneMgr->createEntity("Home", "tudorhouse.mesh");
    //home->setCastShadows(true);
    Ogre::SceneNode* homeNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("HomeNode");
    homeNode->attachObject(home);
    homeNode->setPosition(Ogre::Vector3(-400.0f,220.0f,-400.0f));
    homeNode->setScale(0.4f, 0.4f, 0.4f);

    // Work
    Ogre::Entity* work = m_pSceneMgr->createEntity("Work", "tudorhouse.mesh");
    //work->setCastShadows(true);
    Ogre::SceneNode* workNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("WorkNode");
    workNode->attachObject(work);
    workNode->setPosition(Ogre::Vector3(400.0f,220.0f,400.0f));
    workNode->setScale(0.4f, 0.4f, 0.4f);
    workNode->yaw(Ogre::Degree(180));

    // Tavern
    Ogre::Entity* tavern = m_pSceneMgr->createEntity("Tavern", "tudorhouse.mesh");
    //tavern->setCastShadows(true);
    Ogre::SceneNode* tavernNode = m_pSceneMgr->getRootSceneNode()->createChildSceneNode("TavernNode");
    tavernNode->attachObject(tavern);
    tavernNode->setPosition(Ogre::Vector3(-400.0f,220.0f,400.0f));
    tavernNode->setScale(0.4f, 0.4f, 0.4f);
    tavernNode->yaw(Ogre::Degree(180));


    // Ground
    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 = m_pSceneMgr->createEntity("GroundEntity", "ground");
    m_pSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(entGround);
    entGround->setMaterialName("Examples/Rockwall");
    entGround->setCastShadows(false);
}
Exemplo n.º 28
0
void MyApp::createScene() {
  // Carga del sonido.
  _mainTrack = _pTrackManager->load("windloop.ogg");
  _simpleEffect = _pSoundFXManager->load("nightmare.wav");

  _sceneManager->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_MODULATIVE);	
  _sceneManager->setShadowColour(Ogre::ColourValue(0.5, 0.5, 0.5) );
  _sceneManager->setAmbientLight(Ogre::ColourValue(0.9, 0.9, 0.9));

  _sceneManager->setShadowTextureCount(2);
  _sceneManager->setShadowTextureSize(512);
  
  Ogre::Light* light = _sceneManager->createLight("Light1");
  light->setPosition(-5,12,2);
  light->setType(Ogre::Light::LT_SPOTLIGHT);
  light->setDirection(Ogre::Vector3(1,-1,0));
  light->setSpotlightInnerAngle(Ogre::Degree(25.0f));
  light->setSpotlightOuterAngle(Ogre::Degree(60.0f));
  light->setSpotlightFalloff(0.0f);
  light->setCastShadows(true);

  Ogre::Light* light2 = _sceneManager->createLight("Light2");
  light2->setPosition(3,12,3);
  light2->setDiffuseColour(0.2,0.2,0.2);
  light2->setType(Ogre::Light::LT_SPOTLIGHT);
  light2->setDirection(Ogre::Vector3(-0.3,-1,0));
  light2->setSpotlightInnerAngle(Ogre::Degree(25.0f));
  light2->setSpotlightOuterAngle(Ogre::Degree(60.0f));
  light2->setSpotlightFalloff(5.0f);
  light2->setCastShadows(true);

  Ogre::Entity* ent1 = _sceneManager->createEntity("Neptuno", "Neptuno.mesh");
  Ogre::SceneNode* node1 = _sceneManager->createSceneNode("Neptuno");
  ent1->setCastShadows(true);
  node1->attachObject(ent1);
  _sceneManager->getRootSceneNode()->addChild(node1);

  Ogre::Plane plane1(Ogre::Vector3::UNIT_Y, 0);
  Ogre::MeshManager::getSingleton().createPlane("plane1",
	Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, plane1,
	200,200,1,1,true,1,20,20,Ogre::Vector3::UNIT_Z);

  Ogre::SceneNode* node2 = _sceneManager->createSceneNode("ground");
  Ogre::Entity* groundEnt = _sceneManager->createEntity("planeEnt", "plane1");
  groundEnt->setMaterialName("Ground");
  groundEnt->setCastShadows(false);
  node2->attachObject(groundEnt);
  _sceneManager->getRootSceneNode()->addChild(node2);
}
Exemplo n.º 29
0
Penguin::Penguin(Ogre::SceneManager* sceneMgr, std::string name) {
  Ogre::Entity* entPenguin = sceneMgr->createEntity(name, "penguin.mesh");
  mAnimationState = entPenguin->getAnimationState("amuse");
  mAnimationState->setLoop(true);
  mAnimationState->setEnabled(true);
  entPenguin->setCastShadows(true);
  Ogre::SceneNode* penguinNode = sceneMgr->getRootSceneNode()->createChildSceneNode(name, Ogre::Vector3(0,30,0));
  penguinNode->attachObject(entPenguin);
  penguinNode->scale(60 / 63.0057, 50 / 47.99059, 50 / 49.27139);
  Ogre::Camera* cam = sceneMgr->getCamera("GameCam");
  cameraNode = penguinNode->createChildSceneNode("CameraNode");
  cameraNode->attachObject(cam);

  setNode(penguinNode);
}
Exemplo n.º 30
0
void SceneLoader::createWall( Ogre::Vector3 pos, Ogre::Real scale )
{
	Ogre::Entity* ent = mSceneMgr->createEntity("atd_cube.mesh");
//  	Ogre::MeshPtr mesh = ent->getMesh();
//  	mesh->freeEdgeList();
//  	mesh->buildEdgeList();

	ent->setCastShadows(true);
	ent->setQueryFlags(AugmentedTowerDefense::MASK_WALLS);
	Ogre::SceneNode* node = mSceneRootNode->createChildSceneNode("Wall_" + AugmentedTowerDefense::HelperClass::ToString(mWallCount));
	node->setPosition(pos);
	node->setScale(Ogre::Vector3::UNIT_SCALE*scale);
	node->attachObject(ent);
	
	mWallCount++;
}