当前位置: 首页>>代码示例>>C++>>正文


C++ ISceneNodeAnimator类代码示例

本文整理汇总了C++中ISceneNodeAnimator的典型用法代码示例。如果您正苦于以下问题:C++ ISceneNodeAnimator类的具体用法?C++ ISceneNodeAnimator怎么用?C++ ISceneNodeAnimator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ISceneNodeAnimator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

 int main()
 {
    IrrlichtDevice* irrDevice   = createDevice(EDT_OPENGL,dimension2d<s32>(800,600),32,false,false,false,0);
    IVideoDriver*   irrVideo    = irrDevice->getVideoDriver();
    ISceneManager*  irrSceneMgr = irrDevice->getSceneManager();
    TMovie* movie = new TMovie(irrDevice->getTimer());
    movie->LoadMovie("Mymovie.avi");
    irrVideo->setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, false);
    u32 w = movie->getMovieWidth();
    u32 h = movie->getMovieHeight();
    ITexture* movTxtr = irrVideo->addTexture(dimension2d<s32>(w<513?512:1024,h<513?512:1024),"imovie"); 
    irrSceneMgr->addCameraSceneNode(0, vector3df(0,0,-20), vector3df(0,0,0));
    CSampleSceneNode* myNode = new CSampleSceneNode(irrSceneMgr->getRootSceneNode(), irrSceneMgr, 666);
    myNode->setMaterialTexture( 0, movTxtr);
    myNode->drop();
    ISceneNodeAnimator* anim = irrSceneMgr->createRotationAnimator(vector3df(0,0.1f,0));
    myNode->addAnimator(anim);
    anim->drop();
 
    while(irrDevice->run())
     {
        irrVideo->beginScene(true, true, SColor(0,200,200,200));
                  if (movie->NextMovieFrame())
                    movie->DrawMovie(0,0,movTxtr);
                  irrSceneMgr->drawAll();
        irrVideo->endScene();
     }       
    irrDevice->drop();

    return 0;
}
开发者ID:tecan,项目名称:IrrlichtDemos,代码行数:31,代码来源:hybridVideoTexture.cpp

示例2: example_customscenenode

int example_customscenenode()
{
    // create device
    IrrlichtDevice *device = startup();
    if (device == 0) return 1; // could not create selected driver.

    // create engine and camera
    EventReceiver_basic receiver(device);
    device->setEventReceiver(&receiver);

    IVideoDriver* driver = device->getVideoDriver();
    ISceneManager* smgr = device->getSceneManager();
    IGUIEnvironment* guienv = device->getGUIEnvironment();

    smgr->addCameraSceneNode(0, vector3df(0, -40, 0), vector3df(0, 0, 0));

    CSampleSceneNode *myNode = new CSampleSceneNode(smgr->getRootSceneNode(), smgr, 666);

    ISceneNodeAnimator* anim = smgr->createRotationAnimator(vector3df(0.8f, 0, 0.8f));

    if (anim) {
        myNode->addAnimator(anim);
        anim->drop();
        anim = 0; // As I shouldn't refer to it again, ensure that I can't
    }

    myNode->drop();
    myNode = 0; // As I shouldn't refer to it again, ensure that I can't

    return run(device);
}
开发者ID:osom8979,项目名称:example,代码行数:31,代码来源:t17.cpp

示例3: fire

/*********************************************************************
 * Animates a muzzle flash billboard with firing sound and does
 * damage to borbie.  This method is only called when the soldier
 * is within range and has direct line of sight.  He has an 80%
 * chance of hitting his target.
 *********************************************************************/
void Soldier::fire(int distance){
	lastFireTime = gameInstance->getDevice()->getTimer()->getTime();
	IBillboardSceneNode * bill;
	bill = smgr->addBillboardSceneNode();
	bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR );
    bill->setMaterialTexture(0, driver->getTexture("assets/textures/muzFlash.png"));
	bill->setMaterialFlag(video::EMF_LIGHTING, false);
	bill->setMaterialFlag(video::EMF_ZBUFFER, false);
	float randomNum = Random::randomFloat(-10.0, 15.0);
	bill->setSize(core::dimension2d<f32>(30.0+randomNum, 30.0+randomNum));
	bill->setID(0);//not pickable by ray caster
		
	//get enemy position, adjust muzzle flash height to barrel
	vector3df start = sceneNode->getPosition();
	start.Y+=60;
	bill->setPosition(start);

    this->audioSystem->playSound3d(gameInstance->gunShot1,
	    this);
	
	const int MUZZLE_FLASH_TIME = 50;
	
	ISceneNodeAnimator* anim =
	    gameInstance->getSceneManager()->createDeleteAnimator(MUZZLE_FLASH_TIME);
	bill->addAnimator(anim);
	anim->drop();
    if (!miss(distance))
	    gameInstance->player->applyBulletDamage(BULLET_DAMAGE);
    else
        gameInstance->player->ricochet();		
}
开发者ID:leepage87,项目名称:borbie,代码行数:37,代码来源:soldier.cpp

示例4: createMuzzleFlash

void CRaycastTankExample::createMuzzleFlash(irr::scene::IBoneSceneNode *node)
{
    IBillboardSceneNode *muzzleFlash = device->getSceneManager()->addBillboardSceneNode(0,
        dimension2d<f32>(30.0f, 30.0f), node->getAbsoluteTransformation().getTranslation());

    muzzleFlash->setMaterialFlag(EMF_LIGHTING, false);
    muzzleFlash->setMaterialTexture(0,device->getVideoDriver()->getTexture("particlewhite.bmp"));
    muzzleFlash->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);


    ISceneNodeAnimator* deleteAnim = device->getSceneManager()->createDeleteAnimator(100);
    muzzleFlash->addAnimator(deleteAnim);
    deleteAnim->drop();
}
开发者ID:pdpdds,项目名称:Win32OpenSourceSample,代码行数:14,代码来源:raycasttankexample.cpp

示例5: moveToPlayer

/*********************************************************************
 * Moves the soldier toward the enemy, only gets called when
 * there is a direct line of sight
 *********************************************************************/
void Soldier::moveToPlayer(){
    vector3df start = sceneNode->getPosition();
    destination = gameInstance->getCamera()->getPosition();
    destination.X = start.X + 0.2*(destination.X-start.X);
    destination.Z = start.Z + 0.2*(destination.Z-start.Z);
    destination.Y = 70;//ground height
    f32 length = (f32)ray.start.getDistanceFrom(destination);
    const int SOLDIER_MOVE_SPEED = 1.5;
    f32 time = length * SOLDIER_MOVE_SPEED;
    ISceneNodeAnimator* anim =
            gameInstance->getSceneManager()->createFlyStraightAnimator(start,
            destination, time, false);
    sceneNode->addAnimator(anim);
    anim->drop();
    moving = true;
}
开发者ID:leepage87,项目名称:borbie,代码行数:20,代码来源:soldier.cpp

示例6: addCollision

  void Entity::addCollision(Entity coll, f32 tx, f32 ty, f32 tz,  f32 sx, f32 sy, f32 sz, f32 gx, f32 gy, f32 gz)
  {
    ITriangleSelector* selector = 0;

    if(coll.type == MESH_TYPE)
    {
      selector = Scene->createTriangleSelector(coll.tmesh, coll.sceneNode);
      coll.sceneNode->setTriangleSelector(selector);
    }
    if(coll.type == ANIM_TYPE)
    {
      selector = Scene->createTriangleSelector(coll.animNode->getMesh(), coll.animNode);
      coll.animNode->setTriangleSelector(selector);
    }
    if(coll.type == MAP_TYPE)
    {
      selector = Scene->createOctreeTriangleSelector(coll.bmesh->getMesh(0), coll.sceneNode);
      coll.sceneNode->setTriangleSelector(selector);
    }


    ISceneNodeAnimator* anim;

    if(type == MESH_TYPE)
    {
      anim = Scene->createCollisionResponseAnimator(selector, sceneNode, vector3df(sx,sy,sz), \
        vector3df(gx,gy,gz), vector3df(tx,ty,tz));
      sceneNode->addAnimator(anim);
    }
    if(type == ANIM_TYPE)
    {
      anim = Scene->createCollisionResponseAnimator(selector, animNode, vector3df(sx,sy,sz), \
        vector3df(gx,gy,gz), vector3df(tx,ty,tz));
      animNode->addAnimator(anim);
    }
    if(type == MAP_TYPE)
    {
      anim = Scene->createCollisionResponseAnimator(selector, sceneNode, vector3df(sx,sy,sz), \
        vector3df(gx,gy,gz), vector3df(tx,ty,tz));
      sceneNode->addAnimator(anim);
    }
    else
      return;

    selector->drop();
    anim->drop();
  }
开发者ID:paulkiernan,项目名称:hack-the-gibson,代码行数:47,代码来源:mesh.cpp

示例7: createSceneNodeAnimator

//! creates a scene node animator based on its type id
ISceneNodeAnimator* CBulletAnimatorManager::createSceneNodeAnimator(ESCENE_NODE_ANIMATOR_TYPE type, ISceneNode* target)
{
  ESCENE_NODE_BULLET_ANIMATOR_TYPE animType = (ESCENE_NODE_BULLET_ANIMATOR_TYPE)type;

  ISceneNodeAnimator* anim = NULL;
  switch (animType)
  {
    case ESNAT_BULLET_WORLD:
    {
      // create bullet world animator
      //if (BulletWorldAnimator != NULL) { BulletWorldAnimator->drop(); BulletWorldAnimator = NULL; } 
      anim = createEmptyBulletWorldAnimator(sceneManager, target);
    } break;

    case ESNAT_BULLET_OBJECT:
    {
      // create object
      anim = createEmptyBulletObjectAnimator(sceneManager, target);
    } break;

	//나중에 확장을...
	case ESNAT_BULLET_OBJECT_FPS_CTRL:
    {
      // create object		
		//anim = new CBulletFpsCamAnimator();
	
		//anim = createBulletFpsCamAnimator(sceneManager, target);
    } break;
	case ESNAT_BULLET_OBJECT_CHACTER_CTRL:
    {
      // create object
		anim = new CBulletChracterAnimator();
		target->addAnimator(anim);
		anim->drop();
		//anim = createBulletCharcterAnimator(sceneManager, target,0,);
    } break;
  }

  if (anim && target)
  {
    target->addAnimator(anim);
  }

  return anim;
}
开发者ID:JamesLee2,项目名称:ukgtut,代码行数:46,代码来源:CBulletAnimatorManager.cpp

示例8: vector3df

void Player::SetGravity(vector3df gravityVector)
{
	//Set the new collision vector
	collisionAnimator->setGravity(gravityVector);
	//Remove the outdated response animator
	fpsCamera->GetCamera()->removeAnimator(collisionAnimator);
	//Set the new collision response animator
	fpsCamera->GetCamera()->addAnimator(collisionAnimator);

	//TODO: If player is falling, make descent slower.
	if(collisionAnimator->isFalling())
	{
		ISceneNodeAnimator* anim = smgr->createFlyStraightAnimator(fpsCamera->GetPosition(), vector3df(0,-100, 0), 1000, false);
		fpsCamera->GetCamera()->addAnimator(anim);
		
		anim->drop();

	}

}//end SetGravity()
开发者ID:Ayoub-89,项目名称:Software-Portfolio,代码行数:20,代码来源:Player.cpp

示例9: load_map

void load_map() {
	IAnimatedMesh* mesh = smgr->getMesh("resources/nodes/maps/room.3ds");

	smgr->getMeshManipulator()->makePlanarTextureMapping(mesh->getMesh(0), 0.008f);
	ISceneNode* node = 0;

	node = smgr->addAnimatedMeshSceneNode(mesh);
	node->setMaterialTexture(0,	driver->getTexture("resources/textures/maps/wall.jpg"));
	node->getMaterial(0).SpecularColor.set(0,0,0,0);

	mesh = smgr->addHillPlaneMesh("myHill",
			dimension2d<f32>(20,20),
			dimension2d<u32>(40,40),
			0,
			0,
			dimension2d<f32>(0,0),
			dimension2d<f32>(10,10)
		);

	node = smgr->addWaterSurfaceSceneNode(mesh->getMesh(0), 3.0f, 300.0f, 30.0f);
	node->setPosition(vector3df(0,7,0));

	node->setMaterialTexture(0,	driver->getTexture("resources/textures/maps/stones.jpg"));
	node->setMaterialTexture(1,	driver->getTexture("resources/textures/maps/water.jpg"));

	node->setMaterialType(video::EMT_REFLECTION_2_LAYER);

	// create light
	node = smgr->addLightSceneNode(0, vector3df(0,0,0), SColorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f);
	ISceneNodeAnimator* anim = 0;
	anim = smgr->createFlyCircleAnimator (vector3df(0,150,0),250.0f);
	node->addAnimator(anim);
	anim->drop();

	// attach billboard to light
	node = smgr->addBillboardSceneNode(node, dimension2d<f32>(50, 50));
	node->setMaterialFlag(EMF_LIGHTING, false);
	node->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
	node->setMaterialTexture(0,	driver->getTexture("resources/textures/particles/particlewhite.bmp"));
}
开发者ID:asxetos,项目名称:TheGame,代码行数:40,代码来源:TheGame.cpp

示例10: while

//! reads animators of a node
void CSceneLoaderIrr::readAnimators(io::IXMLReader* reader, ISceneNode* node)
{
	while(reader->read())
	{
		const wchar_t* name = reader->getNodeName();

		switch(reader->getNodeType())
		{
		case io::EXN_ELEMENT_END:
			if (IRR_XML_FORMAT_ANIMATORS == name)
				return;
			break;
		case io::EXN_ELEMENT:
			if (IRR_XML_FORMAT_ATTRIBUTES == name)
			{
				// read animator data from attribute list
				io::IAttributes* attr = FileSystem->createEmptyAttributes(SceneManager->getVideoDriver());
				attr->read(reader);

				if (node)
				{
					core::stringc typeName = attr->getAttributeAsString("Type");
					ISceneNodeAnimator* anim = SceneManager->createSceneNodeAnimator(typeName.c_str(), node);

					if (anim)
					{
						anim->deserializeAttributes(attr);
						anim->drop();
					}
				}

				attr->drop();
			}
			break;
		default:
			break;
		}
	}
}
开发者ID:2223108045,项目名称:YGOMobile,代码行数:40,代码来源:CSceneLoaderIrr.cpp

示例11: aStarToPlayer

/*********************************************************************
 * Moves the soldier toward the Borbie over a longer distance, using
 * A* algorithm to find a shortest path using roads.
 *********************************************************************/
void Soldier::aStarToPlayer(){
    // Find shortest path using the MapSearcher from this soldier to the player
    //  using the closest available road intersection points.
    MapSearcher *searcher = this->gameInstance->getMapSearcher();
    vector3df curPosition = this->sceneNode->getPosition();
    std::vector<RoadIntersection> path = searcher->getShortestPath(
	    curPosition,
	    this->gameInstance->getCamera()->getPosition());
    
    // If path is unavailable, or already near Borbie, do nothing.
    int numPathPoints = path.size();
    if(numPathPoints == 0)
        return;
    
    // set up a list of coordinates to move through, starting with the
    //  soldier's current position.
    array<vector3df> coords;
    coords.push_back(this->sceneNode->getPosition());
    for(int i=0; i<numPathPoints; ++i){
        vector3df point;
        point.X = path[i].X;
        point.Y = curPosition.Y;
        point.Z = path[i].Y;
        coords.push_back(point);
    }
    
    // set the destination to the location of the last coordinate
    this->destination.X = path[numPathPoints-1].X;
    this->destination.Y = curPosition.Y;
    this->destination.Z = path[numPathPoints-1].Y;
    
    // create a spline animator (follows the path of coordinates) to animate
    //  the soldier to move to Borbie.
    ISceneNodeAnimator *anim = smgr->createFollowSplineAnimator(
        this->gameInstance->currentGameTime, coords, 0.1f, 0.0, false);
    sceneNode->addAnimator(anim);
    anim->drop();
    moving = true;
}
开发者ID:leepage87,项目名称:borbie,代码行数:43,代码来源:soldier.cpp

示例12: createDevice

void Game::init()
{
#ifdef WIN32
	device = createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(640, 480));
#else
	device = createDevice(video::EDT_OPENGL, core::dimension2d<s32>(640, 480));
#endif
	
	driver = device->getVideoDriver();
	smgr = device->getSceneManager();
	guienv = device->getGUIEnvironment();
	
	device->setWindowCaption(L"Not So Much Super Offroad - By Andreas Kröhnke");
	
	IMeshSceneNode *node = smgr->addMeshSceneNode( smgr->getMesh("data/car3.3ds")->getMesh(0) );
	GameObject *car = new GameObject();
	car->setSceneNode(node);
	node->setMaterialFlag(EMF_LIGHTING, false);
	node->setScale(vector3df(0.09,0.09,0.09));
	node->setRotation(vector3df(0,0,0));
	node->setPosition(vector3df(3454,500,1256));
	//node->setDebugDataVisible(EDS_BBOX);
	object->push_back(car);
	
	ITerrainSceneNode *terrain = smgr->addTerrainSceneNode("data/level1.bmp");
	GameObject *go_terrain = new GameObject();
	go_terrain->setSceneNode(terrain);
	terrain->setMaterialFlag(EMF_LIGHTING, false);
	terrain->setScale(core::vector3df(18, 3.0f, 18));
	terrain->setMaterialFlag(video::EMF_LIGHTING, false);
	terrain->setMaterialTexture(0, driver->getTexture("data/terrain-texture.jpg"));
	terrain->setMaterialTexture(1, driver->getTexture("data/detailmap3.jpg"));
	terrain->setMaterialType(video::EMT_DETAIL_MAP);
	terrain->scaleTexture(1.0f, 20.0f);
	terrain->setDebugDataVisible(EDS_BBOX);
	object->push_back(go_terrain);
	
	// Camera
	Camera *cam = new Camera();
	cam->setSceneNode(smgr->addCameraSceneNode());
	object->push_back(cam);
	cam->followNode(car->getSceneNode());
	
	reciever = new EventReciever();
	reciever->setSteer(car->getSceneNode());
	device->setEventReceiver(reciever);
	
	// create triangle selector for the terrain	
	ITriangleSelector* selector = smgr->createTerrainTriangleSelector(terrain, 0);
	terrain->setTriangleSelector(selector);
	selector->drop();
	
	// create collision response animator and attach it to the camera
	ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(selector, car->getSceneNode(), core::vector3df(10,10,10),
																			core::vector3df(0,-5.0f,0), 
																			core::vector3df(0,0,0)
	);
	
	car->getSceneNode()->addAnimator(anim);
	anim->drop();
	
	// Skybox
	smgr->addSkyBoxSceneNode(
							 driver->getTexture("data/irrlicht2_up.jpg"),
							 driver->getTexture("data/irrlicht2_dn.jpg"),
							 driver->getTexture("data/irrlicht2_lf.jpg"),
							 driver->getTexture("data/irrlicht2_rt.jpg"),
							 driver->getTexture("data/irrlicht2_ft.jpg"),
							 driver->getTexture("data/irrlicht2_bk.jpg"));
	
	// Checkpoints
	pair<vector3df, vector3df> cp1(vector3df(3112,393,1234), vector3df(90,90,0));
	addCheckPoint(cp1.first, cp1.second);
	pair<vector3df, vector3df> cp2(vector3df(2531,281,1389), vector3df(90,120,0));
	addCheckPoint(cp2.first, cp2.second);
	addCheckPoint(vector3df(2304,160,1826), vector3df(90,140,0));
	addCheckPoint(vector3df(2132,111,2672), vector3df(90,120,0));
	addCheckPoint(vector3df(1130,415,3313), vector3df(90,75,0));
	addCheckPoint(vector3df(746,471,1753), vector3df(90,0,0));
	addCheckPoint(vector3df(1985,269,1457), vector3df(90,-120,0));
	addCheckPoint(vector3df(2475,146,2868), vector3df(90,-120,0));
	addCheckPoint(vector3df(3707,417,2915), vector3df(90,-60,0));
	
	// Arrows
	addArrow(vector3df(3012,320,1234), vector3df(100,-55,0));
	addArrow(vector3df(2531,220,1389), vector3df(100,-10,0));
	//addArrow(vector3df(2304,110,1826), vector3df(90,10,0));
	addArrow(vector3df(2232,20,2272), vector3df(90,-20,0));

	// HUD
	info = guienv->addStaticText(L"USE ARROW KEYS TO PLAY",
								 rect<int>(10,10,200,60), true);
	info->setOverrideColor(SColor(255, 255, 255, 255));

	//IGUIStaticText *quick_info = guienv->addStaticText(L"Arrow keys to play\n", rect<int>(10,50,200,50), true);
	//quick_info->setOverrideColor(SColor(255,255,255,255));
	initSound();
}
开发者ID:NinZine,项目名称:Not-So-Super-Off-Road,代码行数:98,代码来源:Game.cpp

示例13: sceneNodeAnimator

/** Test functionality of the ISceneNodeAnimator implementations. */
bool sceneNodeAnimator(void)
{
	IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<u32>(160, 120));
	assert_log(device);
	if(!device)
		return false;

	ISceneManager * smgr = device->getSceneManager();

	// Test the hasFinished() method.
	ISceneNodeAnimatorCollisionResponse* collisionResponseAnimator
		= smgr->createCollisionResponseAnimator(0, 0);

	ISceneNodeAnimator* deleteAnimator = smgr->createDeleteAnimator(1);

	ISceneNodeAnimator* flyCircleAnimator = smgr->createFlyCircleAnimator();

	ISceneNodeAnimator* flyStraightAnimator
		= smgr->createFlyStraightAnimator(vector3df(0, 0, 0), vector3df(0, 0, 0), 1, false);

	ISceneNodeAnimator* flyStraightAnimatorLooping
		= smgr->createFlyStraightAnimator(vector3df(0, 0, 0), vector3df(0, 0, 0), 1, true);

	ISceneNodeAnimator* rotationAnimator = smgr->createRotationAnimator(vector3df(0, 0, 0));

	array<vector3df> points;
	points.push_back(vector3df(0, 0, 0));
	points.push_back(vector3df(0, 0, 0));
	ISceneNodeAnimator* followSplineAnimator = smgr->createFollowSplineAnimator(0, points, 1000.f);

	array<video::ITexture*> textures;
	textures.push_back(0);
	textures.push_back(0);

	ISceneNodeAnimator* textureAnimator = smgr->createTextureAnimator(textures, 1, false);
	ISceneNodeAnimator* textureAnimatorLooping = smgr->createTextureAnimator(textures, 1, true);

	bool result = true;

	ISceneNode * deletedNode = smgr->addEmptySceneNode();
	deletedNode->addAnimator(deleteAnimator);

	ISceneNode * testNode = smgr->addEmptySceneNode();
	testNode->addAnimator(collisionResponseAnimator);
	testNode->addAnimator(deleteAnimator);
	testNode->addAnimator(flyCircleAnimator);
	testNode->addAnimator(flyStraightAnimator);
	testNode->addAnimator(flyStraightAnimatorLooping);
	testNode->addAnimator(rotationAnimator);
	testNode->addAnimator(followSplineAnimator);
	testNode->addAnimator(textureAnimator);
	testNode->addAnimator(textureAnimatorLooping);

	result &= !collisionResponseAnimator->hasFinished();
	result &= !deleteAnimator->hasFinished();
	result &= !flyCircleAnimator->hasFinished();
	result &= !flyStraightAnimator->hasFinished();
	result &= !flyStraightAnimatorLooping->hasFinished();
	result &= !rotationAnimator->hasFinished();
	result &= !followSplineAnimator->hasFinished();
	result &= !textureAnimator->hasFinished();
	result &= !textureAnimatorLooping->hasFinished();

	device->run();
	device->sleep(10);
	device->run();
	smgr->drawAll();

	// These animators don't have an endpoint.
	result &= !collisionResponseAnimator->hasFinished();
	result &= !flyCircleAnimator->hasFinished();
	result &= !rotationAnimator->hasFinished();
	result &= !followSplineAnimator->hasFinished();

	// These animators are looping and so can't finish.
	result &= !flyStraightAnimatorLooping->hasFinished();
	result &= !textureAnimatorLooping->hasFinished();

	// These have an endpoint and have reached it.
	result &= deleteAnimator->hasFinished();
	result &= flyStraightAnimator->hasFinished();
	result &= textureAnimator->hasFinished();

	collisionResponseAnimator->drop();
	deleteAnimator->drop();
	flyCircleAnimator->drop();
	flyStraightAnimator->drop();
	flyStraightAnimatorLooping->drop();
	rotationAnimator->drop();
	followSplineAnimator->drop();
	textureAnimator->drop();
	textureAnimatorLooping->drop();

	device->closeDevice();
	device->run();
	device->drop();

	if(!result)
	{
//.........这里部分代码省略.........
开发者ID:Habaut,项目名称:GameBindings,代码行数:101,代码来源:sceneNodeAnimator.cpp

示例14: Terrain


//.........这里部分代码省略.........
  this->light = new WorldLight(smgr);

  //set shadow color: dark purplish
  smgr->setShadowColor(video::SColor(120,35,20,47));

  this->rainParticleSystem = 0;


  /*** Setup Game Objects (BUILDINGS, VEHICLES) ***/

  // Read the map file into the global static MapReader object.
  this->mapReader = new MapReader("assets/map/coords.bor");
  this->mapSearcher = this->mapReader->getMapSearcher();

  // add the buildings and generate city based on coordinate file
  this->buildings = new Buildings(metaTriSelector, this);
  this->buildings->generateObjects();

  // add the vehicles and generate initial spawns
  this->vehicles = new Vehicles(metaTriSelector, this);
  this->vehicles->generateObjects();

  // default vehicle throwing variables to nothing
  this->carriedVehicle = 0;
  this->vehicleThrown = false;
  this->targetPos = vector3df(0,0,0);

  // add and generate enemies
  this->enemies = new Enemies (metaTriSelector, this);
  this->enemies->generateObjects();



  /*** Setup User Interface (HUD) ***/

  // add the hud object
  this->hud = new Hud(this);



  /*** Setup Camera ***/

  // set key bindings (WASD=move, SPACE=jump) to camera
  SKeyMap keyMap[9];
  KeyBindings *keys = new KeyBindings(&keyMap[0]);
  keys->setKeys();
  // added: (remove if setKeys() becomes static)
  delete keys;

  // setup camera
  camera = smgr->addCameraSceneNodeFPS(
      0,						// parent (none)
      PLAYER_ROTATE_SPEED,	// rotate speed
      playerMoveSpeed,        // move speed
      IDFlag_IsPickable,		// ID
      keyMap,					// keymap
      9,						// keymap size
      noVerticalMovement,		// no vertical movement (true = up/down disabled)
      PLAYER_JUMP_SPEED		// jump speed
      );

  //TODO: read camera position from map file
  camera->setPosition(vector3df(2500, 1000, 4450));
  // set view distance
  camera->setFarValue(30000.0f);
  // hide cursor
  device->getCursorControl()->setVisible(false);

  // add automatic collision response to camera
  ISceneNodeAnimator* anim =
    smgr->createCollisionResponseAnimator(metaTriSelector, camera,
        core::vector3df(60, 150, 60), // radius
        core::vector3df(0, gravity, 0), // gravity (negative y = go down)
        core::vector3df(0, PLAYER_HEIGHT, 0), //radius offset
        0.1f); // sliding value TODO tweak as needed
  camera->addAnimator(anim);
  anim->drop();

  //create beatDown ray selector
  selector = new CastRay(smgr, camera);
  highlightedSceneNode = 0;

  //create objectCarrier for picking shit up
  objCarry = new ObjectCarrier(smgr, device, camera);
  //tell the mouse listener that right mouse isn't pressed to start with
  ((BorbiesEventReceiver *)receiver)->setRightMouse(false);

  /*** Add Hands ***/

  hands = new Hands(this);  

  /*** Add The Borbie ***/

  this->player = new Borbie(this); 	

  this->nextScoreEvent = 10000;

  // initialize world state to fabulous
  this->setWorldState(FABULOUS);
}
开发者ID:leepage87,项目名称:borbie,代码行数:101,代码来源:gameInstance.cpp

示例15: main

int main(int argc, char **argv) {

	// Help?
	if (argv[1] && argv[1][0] == '-') die(helpmsg);

	putenv((char *) "vblank_mode=0"); // No vsync for us, thanks.

	MyEventReceiver *r = new MyEventReceiver();
	IrrlichtDevice *dev = createDevice(EDT_OPENGL, core::dimension2d<u32>(1024,768), 32,
				false, false, false, r);
	if (!dev) die("Can't initialize Irrlicht");

	IVideoDriver *drv = dev->getVideoDriver();
	ISceneManager *smgr = dev->getSceneManager();
	IGPUProgrammingServices *gpu = drv->getGPUProgrammingServices();
	ICameraSceneNode *cam = NULL;
	ITexture *pic = NULL;
	IMeshSceneNode *ball = NULL;
	bool showpic = false;

	IReadFile *areamap = createMemoryReadFile(AreaMap33, sizeof(AreaMap33), "AreaMap33", false);
	if (!areamap) die("Failed to load areamap");
	ITexture *areamaptex = drv->getTexture(areamap);
	areamap->drop();

	// If there's an argument, assume it is a pic to load; otherwise, draw a sphere

	if (argv[1] && access(argv[1], R_OK) == 0) {
		showpic = true;
		pic = drv->getTexture(argv[1]);
		if (!pic) die("Can't load image");

		cam = smgr->addCameraSceneNode();
	} else {
		cam = smgr->addCameraSceneNodeMaya();
		cam->setTarget(vector3df(0, 0, 0));
		ball = smgr->addSphereSceneNode(40, 8);

		int ballshader = gpu->addHighLevelShaderMaterial(rnd,0,EVST_VS_1_1,0);
		ball->setMaterialType((E_MATERIAL_TYPE) ballshader);

		ISceneNodeAnimator *cool = smgr->createRotationAnimator(vector3df(-0.1, 0.1, -0.1));
		ball->addAnimator(cool);
		cool->drop();
	}

	// Set up static defines, RTTs, quads
	dimension2d<u32> screensize = drv->getScreenSize();
	char defines[128];
	snprintf(defines, 128,
		"#define PIXEL_SIZE vec2(1.0f / %u.0, 1.0f / %u.0)\n"
		"#define MAX_SEARCH_STEPS 8.0\n#define MAX_DISTANCE 33.0\n",
		screensize.Width, screensize.Height);

	ITexture *rt1 = drv->addRenderTargetTexture(screensize, "rt1", ECF_A8R8G8B8);
	ITexture *rt2 = drv->addRenderTargetTexture(screensize, "rt2", ECF_A8R8G8B8);
	ITexture *rt3 = drv->addRenderTargetTexture(screensize, "rt3", ECF_A8R8G8B8);
	if (!rt1 || !rt2 || !rt3) die("No RTT");

	ScreenQuad *def = new ScreenQuad(drv);
	ScreenQuad *sq = new ScreenQuad(drv);
	ScreenQuad *sq2 = new ScreenQuad(drv);
	ScreenQuad *sq3 = new ScreenQuad(drv);
	ScreenQuad *norm = new ScreenQuad(drv);
	if (showpic) def->SetTexture(pic);
	sq->SetTexture(rt1);
	sq->GetMaterial().setFlag(EMF_BILINEAR_FILTER, false);
	norm->SetTexture(rt1);
	norm->GetMaterial().setFlag(EMF_BILINEAR_FILTER, false);

	sq2->SetTexture(rt2);
	sq2->SetTexture(rt2, 1);
	sq2->SetTexture(areamaptex, 2);
	sq2->GetMaterial().TextureLayer[2].BilinearFilter = false;

	sq3->SetTexture(rt3);
	sq3->GetMaterial().setFlag(EMF_BILINEAR_FILTER, false);
	sq3->SetTexture(rt1,1);
	state_t state = MLAA_OFF;

	stringc tmp1, tmp2;
	tmp1 = defines;
	tmp1 += offsetvs;
	tmp2 = defines;
	tmp2 += color1fs;

	// Load shaders
	int edge = gpu->addHighLevelShaderMaterial(tmp1.c_str(),0,EVST_VS_1_1,tmp2.c_str());
	sq->SetMaterialType((E_MATERIAL_TYPE) edge);

	tmp2 = defines;
	tmp2 += blend2fs;

	blendcb *bcb = new blendcb();
	edge = gpu->addHighLevelShaderMaterial(tmp1.c_str(),0,EVST_VS_1_1,tmp2.c_str(),0,EPST_PS_1_1,bcb);
	sq2->SetMaterialType((E_MATERIAL_TYPE) edge);

	tmp2 = defines;
	tmp2 += neigh3fs;

//.........这里部分代码省略.........
开发者ID:clbr,项目名称:MLAA-test-app,代码行数:101,代码来源:mlaatest.cpp


注:本文中的ISceneNodeAnimator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。