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


C++ ISceneManager::addBillboardSceneNode方法代码示例

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


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

示例1: BasePlayer

DummyObject::DummyObject(vector3df position,
						   double radius,
						   vector3df velocity,
						   double maxSpeed,
						   vector3df heading,
						   double mass,
						   vector3df scale,
						   double turnRate,
						   double maxForce,
						   DUMMY_OBJECT_TYPE initState,
						   u32 groupID)
	: BasePlayer(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce, PLAYER_ROLE_DUMMY)
{
	m_pStateMachine = new StateMachine<DummyObject>(this);
    
	// start from idle state
    m_pStateMachine->SetCurrentState(IdleDummy::Instance());

	// get ready sprite
#if USE_BILL_BOARD_SPRITE	
	ISceneManager* pSmgr = IrrDevice::GetInstance().GetSmgr();
	m_p2DSprite = new BillBoard(pSmgr->getRootSceneNode(), pSmgr, 300);
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	ITexture* pTexture = IrrDevice::GetInstance().GetDriver()->getTexture("Rsrc/hero.bmp");
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, false);
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(0);
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);	
#else
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	m_p2DSprite = pSmgr->addBillboardSceneNode();
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);	
	//video::ITexture* pTexture = pDriver->getTexture("Rsrc/bullet.tga");
	video::ITexture* pTexture = pDriver->getTexture("Rsrc/z_tunnel2.tga");
	pTexture->grab();
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
	m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
	//m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(ID());
//	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);	
	m_initState = initState;

	//patrol¿¡ »ç¿ëµÉ µ¥ÀÌŸ ÃßÈÄ ·¹º§ µðÀÚÀÎµÈ ½ºÅ©¸³Æ®¿¡ ÀÇÇØ ™VÆõǵµ·Ï ¼öÁ¤¿ä
	//ÇöÀç MoviingEntity ¿Í º¯¼ö ¿¬°áÀº ³ªÁß¿¡ AI Å×½ºÆ®¸¦ À§ÇØ Àӽ÷Π¸¸µê.
	m_fSpeed = 30.0f;
 	m_bDirection=true;
	m_3dfStart = this->Pos()-vector3df(30.0f,0.0f,0.0f);
    m_3dfDest= this->Pos()+vector3df(30.0f,0.0f,0.0f);
#endif
	// add into entity mamager	
	m_uGroupID = groupID;
	//EntityMgr.RegisterEntity(m_uGroupID,this);//test code Áö±ÝÀº ±×³É 1·Î ³ªÁß¿¡ ÀÎÀڷΠó¸®	
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:59,代码来源:DummyObject.cpp

示例2: BasePlayer

FugitivePlayer::FugitivePlayer(vector3df position,
							   f64 radius,
							   vector3df velocity,
							   f64 maxSpeed,
							   vector3df heading,
							   f64 mass,
							   vector3df scale,
							   f64 turnRate,
							   f64 maxForce, 
							   s32 gameFieldID)
	: BasePlayer(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce, PLAYER_ROLE_CHASER),
	  m_gameFieldID(gameFieldID),
	  m_pRushLine(null)
{
	//
	m_patrolPoints.clear();

	// get ready state machine
	m_pStateMachine = new StateMachine<FugitivePlayer>(this);
    
	// start from nothing
    m_pStateMachine->ChangeState(IdleFugitive::Instance());

	// get ready sprite
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	m_p2DSprite = pSmgr->addBillboardSceneNode();
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	video::ITexture* pTexture = pDriver->getTexture("Rsrc/hero.tga");
	// shkim, TODO.
	// why should I grap this texture here? as a result, get(+1)->grab(+1)->drop(-1) will give reference count as 1. 
	// that means nobody know when I release texture after using at all. how do I figure it out?
	// answer is, keeping texture resource during Proc life time. it means loading texture at Proc initializing time and releasing them at Proc releasing time.
	// for doing that, need to use grab/drop pair after getTexture()
	pTexture->grab();
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
	m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
	m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(ID());
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureTranslate(0.f,0.5f); // 3th sprite

	// rush line scene node
	m_pRushLine = new RushLineSceneNode(pSmgr->getRootSceneNode(), pSmgr, ID(), this);

	// set weapon
	m_pWeapon[0] = new Pistol_Basic;
	m_pWeapon[1] = new Mechine_Gun;
	m_nCurrentWeaponNum = 0;

	// center point(player pos) in screen coordinates for getting shooting direction
	m_uPosinScreenCoord.X =(u32)(IrrDvc.GetDevice()->getVideoDriver()->getScreenSize().Width * 0.5f);
	m_uPosinScreenCoord.Y =(u32)(IrrDvc.GetDevice()->getVideoDriver()->getScreenSize().Height * 0.5f);	
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:57,代码来源:FugitivePlayer.cpp

示例3: BasePlayer

Human::Human(vector3df position,
			   f64 radius,
			   vector3df velocity,
			   f64 maxSpeed,
			   vector3df heading,
			   f64 mass,
			   vector3df scale,
			   f64 turnRate,
			   f64 maxForce,
			   HUMAN_STATE initState)
	: BasePlayer(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce)
{
	// get ready state machine
	m_pStateMachine = new StateMachine<Human>(this);
    
	// start from nothing
	if(HUMAN_STATE_IDLE == initState){
		m_State = HUMAN_STATE_IDLE;
		m_pStateMachine->ChangeState(StateHumanIdle::Instance());
	}

	// get ready sprite
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	m_p2DSprite = pSmgr->addBillboardSceneNode();
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	video::ITexture* pTexture = pDriver->getTexture(HUMAN_TEXTUREFILENAME);
	// shkim, TODO.
	// why should I grap this texture here? as a result, get(+1)->grab(+1)->drop(-1) will give reference count as 1. 
	// that means nobody know when I release texture after using at all. how do I figure it out?
	// answer is, keeping texture resource during Proc life time. it means loading texture at Proc initializing time and releasing them at Proc releasing time.
	// for doing that, need to use grab/drop pair after getTexture()
	pTexture->grab();
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
	m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
	m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
	m_p2DSprite->setPosition(position);	
	m_p2DSprite->setID(ID());
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureTranslate(0.f,0.5f); // 3th sprite

	// get ready physics model
	m_pHumanPhaysics = new HumanPhysics(&Box2dWld.GetWorld(), ID());
	m_pHumanPhaysics->SetTransform(b2Vec2(position.X, position.Y), 0.f);

#ifdef AI_TEST_DISPLAY_HUMAN_STATE
	m_uScreenHalfWidth  = (u32)(IrrDvc.GetDevice()->getVideoDriver()->getScreenSize().Width * 0.5f);
	m_uScreenHalfHeight = (u32)(IrrDvc.GetDevice()->getVideoDriver()->getScreenSize().Height * 0.5f);
#endif

	m_fCurrentLifeEnergy = HUMAN_LIFE_ENERGY_DEFAULT;
	m_fMaxLifeEnerge = HUMAN_MAX_LIFE_ENERGY_DEFAULT;
	m_uStarvationTimeCount = 0;
	m_uIfectionTimeCount = 0;
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:57,代码来源:Human.cpp

示例4: MovingEntity

Car::Car(vector3df position,
		   f64 radius,
		   vector3df velocity,
		   f64 maxSpeed,
		   vector3df heading,
		   f64 mass,
		   vector3df scale,
		   f64 turnRate,
		   f64 maxForce)
	: MovingEntity(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce),
  	  m_pSceneNode(null),
	  m_pStateMachine(null),
	  m_p2DSprite(null),
	  m_pCarPhaysics(null),
	  m_pMesh(null)
{
	// get ready state machine
	 m_pStateMachine = new StateMachine<Car>(this);
    
	// start from nothing
    m_pStateMachine->ChangeState(IdleCar::Instance());

	// get ready sprite
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	m_p2DSprite = pSmgr->addBillboardSceneNode();
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	video::ITexture* pTexture = pDriver->getTexture("Rsrc/car.tga");
	// shkim, TODO.
	// why should I grap this texture here? as a result, get(+1)->grab(+1)->drop(-1) will give reference count as 1. 
	// that means nobody know when I release texture after using at all. how do I figure it out?
	// answer is, keeping texture resource during Proc life time. it means loading texture at Proc initializing time and releasing them at Proc releasing time.
	// for doing that, need to use grab/drop pair after getTexture()
	pTexture->grab();
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
	m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
	m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(ID());	

	// get ready 3d scene node
#ifdef DRAW_CAR_3D_MODEL // shkim, do not draw mode now
	m_pMesh = pSmgr->getMesh("Rsrc/cube.xml");
	m_pSceneNode = pSmgr->addAnimatedMeshSceneNode(m_pMesh);
	m_pSceneNode->setPosition(vector3df(0.f, 0.f, 0.f));
	m_pSceneNode->setRotation(vector3df(0.f, 0.f, 0.f));
	m_pSceneNode->setScale(vector3df(4.f, 8.f, 1.f));
	m_pSceneNode->setMaterialFlag(EMF_LIGHTING, false);
#endif // DRAW_CAR_3D_MODEL
	// get ready physics model
	m_pCarPhaysics = new iforce2d_TopdownCar(&Box2dWld.GetWorld());	
}
开发者ID:ptptomr,项目名称:project_igf_2013,代码行数:54,代码来源:Car.cpp

示例5: BasePlayer

Ztunnel::Ztunnel(vector3df position,
				 double radius,
				 irr::core::vector3df velocity,
				 double maxSpeed,
				 irr::core::vector3df heading,
				 double mass,
				 irr::core::vector3df scale,
				 double turnRate,
				 double maxForce,
				 ZTUNNEL_TYPE initState,
				 BlackBoard* pbb)
				 : BasePlayer(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce)
{
	m_pStateMachine = new StateMachine<Ztunnel>(this);
    
	// start from idle state
    m_pStateMachine->SetCurrentState(IdleZtunnel::Instance());

	// get ready sprite
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	m_p2DSprite = pSmgr->addBillboardSceneNode();
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);	
	video::ITexture* pTexture = pDriver->getTexture("Rsrc/z_tunnel2.tga");

	pTexture->grab();
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
	m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
	//m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(ID());
//	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);	
	m_State = initState;

	//create skill
	CreateBasicZSkill* pcreatebasicZskill = new CreateBasicZSkill("CreateBasicZ", this, 0.5);//name,baseplayer, prof
	skills.insert(pair<std::string,Skill*>(pcreatebasicZskill->getName(), pcreatebasicZskill));

	//create mission
	
	m_pBlacBoard = pbb;
	
	Mission* pMissionCreateBasdiZ = new Mission("CreateBasicZ",1,1);
    m_pBlacBoard->addMission(pMissionCreateBasdiZ);

	Mission* pMissionAttackBuilding = new LocatableMission("AttackBuilding",2,1,vector2df(-75,-75));
	m_pBlacBoard->addMission(pMissionAttackBuilding);
	}
开发者ID:ptptomr,项目名称:project_ran,代码行数:50,代码来源:Ztunnel.cpp

示例6: viewPortText

/** The result should be as follows: We have three times the same image, a billboard with a cube and the text in front.
They are replicated three times, one centered in the screen without viewport, one in the upper left (qurter screen) and
one on the right (half screen). The latter is stretched due to the changed aspect ratio.
The two viewport scenes get the texture drawn over the center as well, using draw2dimage. This should mark the proper
image position with the top left corner of the texture.
Finally, each scene has a checkbox drawn at the left side, vertically centered. This will show whether GUI elements adhere
to viewports as well. */
static bool viewPortText(E_DRIVER_TYPE driverType)
{
	IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
	if (!device)
		return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs

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

	stabilizeScreenBackground(driver);

	env->addCheckBox(true, core::recti(10,60,28,82));

	logTestString("Testing driver %ls\n", driver->getName());

	IBillboardSceneNode * bnode = smgr->addBillboardSceneNode(0,dimension2d<f32>(32,32),core::vector3df(0,0,10));
	bnode->setMaterialFlag(video::EMF_LIGHTING, false);
	bnode->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
	bnode->setMaterialTexture(0, driver->getTexture("../media/fire.bmp"));

	smgr->addTextSceneNode(device->getGUIEnvironment()->getBuiltInFont(), L"TEST", video::SColor(255,255,255,255), 0);
	smgr->addCubeSceneNode();
	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));

	driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, SColor(255,100,101,140));
	smgr->drawAll();
	env->drawAll();
	driver->setViewPort(rect<s32>(0,0,160/2,120/2));
	smgr->drawAll();
	env->drawAll();
	driver->draw2DImage(driver->getTexture("../media/fire.bmp"), core::vector2di(160/2,120/2));
	driver->setViewPort(rect<s32>(160/2,0,160,120));
	smgr->drawAll();
	env->drawAll();
	driver->draw2DImage(driver->getTexture("../media/fire.bmp"), core::vector2di(160/2,120/2));
	driver->endScene(); 

	bool result = takeScreenshotAndCompareAgainstReference(driver, "-viewPortText.png", 98.71f);

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

	return result;
}
开发者ID:Alberto-Izquierdo,项目名称:irrlicht,代码行数:53,代码来源:viewPort.cpp

示例7: BasePlayer

NaviPlayer::NaviPlayer(vector3df position,
							   f64 radius,
							   vector3df velocity,
							   f64 maxSpeed,
							   vector3df heading,
							   f64 mass,
							   vector3df scale,
							   f64 turnRate,
							   f64 maxForce)
	: BasePlayer(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce, PLAYER_ROLE_CHASER)	  
{
	// get ready state machine
	m_pStateMachine = new StateMachine<NaviPlayer>(this);
    
	// start from nothing
    m_pStateMachine->ChangeState(IdleNavi::Instance());

	// get ready sprite
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	m_p2DSprite = pSmgr->addBillboardSceneNode();
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	video::ITexture* pTexture = pDriver->getTexture("Rsrc/hero.tga");
	// shkim, TODO.
	// why should I grap this texture here? as a result, get(+1)->grab(+1)->drop(-1) will give reference count as 1. 
	// that means nobody know when I release texture after using at all. how do I figure it out?
	// answer is, keeping texture resource during Proc life time. it means loading texture at Proc initializing time and releasing them at Proc releasing time.
	// for doing that, need to use grab/drop pair after getTexture()
	pTexture->grab();
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
	m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
	m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(ID());
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureTranslate(0.f,0.5f); // 3th sprite
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:39,代码来源:NaviPlayer.cpp

示例8: main


//.........这里部分代码省略.........
		}
		loadMap.CollNode->setTriangleSelector(selector);
	}

	if (selector)
	{
		anim = smgr->createCollisionResponseAnimator(selector, plyrNode, vector3df(0.6f, 0.75f, 0.4f), core::vector3df(0.0f, -0.05f, 0.0f),
			core::vector3df(0.0f, -0.725f, 0.0f));

		plyrNode->addAnimator(anim);
	}

	ISceneCollisionManager* collMan = smgr->getSceneCollisionManager();

	////////////// The Sun ////////////
	ILightSceneNode *sun_node;
	SLight sun_data;
	ISceneNode *sun_billboard;
	float sun_angle = 0;
	video::SColorf Diffuse_Night = video::SColorf(0.0f, 0.0f, 0.0f, 1.0f);
	video::SColorf Diffuse_Day = video::SColorf(1.0f, 1.0f, 1.0f, 1.0f);

	sun_node = smgr->addLightSceneNode();
	sun_data.Direction = vector3df(0, 0, 0);
	sun_data.Type = video::ELT_DIRECTIONAL;
	sun_data.AmbientColor = video::SColorf(0.1f, 0.1f, 0.1f, 1);
	sun_data.SpecularColor = video::SColorf(0, 0, 0, 0);
	sun_data.DiffuseColor = Diffuse_Day;
	sun_data.CastShadows = true;
	sun_node->setLightData(sun_data);
	sun_node->setPosition(vector3df(0, 0, 0));
	sun_node->setRotation(vector3df(0, 0, 0));

	sun_billboard = smgr->addBillboardSceneNode(sun_node, core::dimension2d<f32>(60, 60));
	if (sun_billboard)
	{
		sun_billboard->setPosition(vector3df(0, 0, -100));
		sun_billboard->setMaterialFlag(video::EMF_LIGHTING, false);
		sun_billboard->setMaterialFlag(video::EMF_ZWRITE_ENABLE, false);
		sun_billboard->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
		sun_billboard->setMaterialTexture(0, driver->getTexture("Assets/particlewhite.bmp"));
	}
	/////////// End ////////////

	//------- candleLight -----//
	ILightSceneNode *candleLight = smgr->addLightSceneNode();
	SLight candleLight_data;

	candleLight_data.Type = video::ELT_POINT;
	candleLight_data.DiffuseColor = SColorf(1.0f, 0.546f, 0.016f, 1.0f);
	candleLight_data.SpecularColor = video::SColorf(0, 0, 0, 0);
	candleLight->setPosition(vector3df(2.43467f, 1.55795f, -3.94657));
	candleLight_data.Radius = 1.5f;
	candleLight->setLightData(candleLight_data);
	//------- end -----//

	//// Make the player
	//player.AddGold(1000);
	//player.SetCurrentPort(eMapDest::South);
	//Item* itemCi = new Item("Iron Ore", 1);
	//player.getItems()->addItem(itemCi);
	//Item* itemCb = new Item("Bronze Ore", 1);
	//player.getItems()->addItem(itemCb);

	//Vendor vN;
	//Item* itemG = new Item("Gold Ore", 1000);
开发者ID:OmniPlatGames,项目名称:Seas-of-Gold,代码行数:67,代码来源:main.cpp

示例9: mission

Ztunnel::Ztunnel(vector3df position,
				 double radius,
				 irr::core::vector3df velocity,
				 double maxSpeed,
				 irr::core::vector3df heading,
				 double mass,
				 irr::core::vector3df scale,
				 double turnRate,
				 double maxForce,
				 ZTUNNEL_TYPE initState,
				 u32 groupID,
				 BlackBoard* pbb)
				 : BasePlayer(position, radius, velocity, maxSpeed, heading, mass, scale, turnRate, maxForce, PLAYER_ROLE_DUMMY)
{
	m_pStateMachine = new StateMachine<Ztunnel>(this);
    
	// start from idle state
    m_pStateMachine->SetCurrentState(IdleZtunnel::Instance());

	// get ready sprite
#if USE_BILL_BOARD_SPRITE	
	ISceneManager* pSmgr = IrrDevice::GetInstance().GetSmgr();
	m_p2DSprite = new BillBoard(pSmgr->getRootSceneNode(), pSmgr, 300);
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
	ITexture* pTexture = IrrDevice::GetInstance().GetDriver()->getTexture("Rsrc/hero.bmp");
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, false);
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(0);
	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);	
#else
	ISceneManager* pSmgr = IrrDvc.GetSmgr();
	IVideoDriver* pDriver = IrrDvc.GetDriver();
	m_p2DSprite = pSmgr->addBillboardSceneNode();
	m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);	
	//video::ITexture* pTexture = pDriver->getTexture("Rsrc/bullet.tga");
	video::ITexture* pTexture = pDriver->getTexture("Rsrc/z_tunnel2.tga");
	pTexture->grab();
	m_p2DSprite->setMaterialTexture(0, pTexture);
	m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
	m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
	m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
	//m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
	m_p2DSprite->setPosition(position);
	m_p2DSprite->setID(ID());
//	m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);	
	m_initState = initState;


#endif
	// add into entity mamager	
	m_uGroupID = groupID;
	//EntityMgr.RegisterEntity(m_uGroupID,this);//test code 지금은 그냥 1로 나중에 인자로 처리

	//create skill
	CreateBasicZSkill* pcreatebasicZskill = new CreateBasicZSkill("CreateBasicZ", this, 0.5);//name,baseplayer, prof
	skills.insert(pair<std::string,Skill*>(pcreatebasicZskill->getName(), pcreatebasicZskill));

	//create mission
	pBlacBoard = pbb;
	Mission mission("CreateBasicZ",1,1);
	defendmezombieCreateMission = mission;
    pBlacBoard->addMission(defendmezombieCreateMission);
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:65,代码来源:Ztunnel.cpp

示例10: switch

ZombieLeader::ZombieLeader(vector3df position,
                           f64 radius,
                           vector3df velocity,
                           f64 maxSpeed,
                           vector3df heading,
                           f64 mass,
                           vector3df scale,
                           f64 turnRate,
                           f64 maxForce,
                           ZOMBIE_STATE initState,
                           BlackBoard* pbb)
{
    // get ready state machine
    m_pStateMachine = new StateMachine<ZombieLeader>(this);

    // start from nothing
    m_State = initState;//
    switch(initState)
    {
    case Zombie::ZOMBIE_STATE_IDLE:
        m_pStateMachine->ChangeState(StateZombieLeaderIdle::Instance());
        break;
    //case ZOMBIE_STATE_CHASERGROUPSTATE:
    //	m_pStateMachine->ChangeState(StateZomLeaderbieIdle::Instance());
    //	break;
    default:
        m_pStateMachine->ChangeState(StateZombieLeaderIdle::Instance());
        break;
    }

    // get ready sprite
    ISceneManager* pSmgr = IrrDvc.GetSmgr();
    IVideoDriver* pDriver = IrrDvc.GetDriver();
    m_p2DSprite = pSmgr->addBillboardSceneNode();
    m_p2DSprite->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
    video::ITexture* pTexture = pDriver->getTexture(ZOMBIELEADER_TEXTUREFILENAME);
    // shkim, TODO.
    // why should I grap this texture here? as a result, get(+1)->grab(+1)->drop(-1) will give reference count as 1.
    // that means nobody know when I release texture after using at all. how do I figure it out?
    // answer is, keeping texture resource during Proc life time. it means loading texture at Proc initializing time and releasing them at Proc releasing time.
    // for doing that, need to use grab/drop pair after getTexture()
    pTexture->grab();
    m_p2DSprite->setMaterialTexture(0, pTexture);
    m_p2DSprite->setMaterialFlag(video::EMF_LIGHTING, false);
    m_p2DSprite->setMaterialFlag(video::EMF_ZBUFFER, true);
    m_p2DSprite->setMaterialFlag(video::EMF_ZWRITE_ENABLE, true);
    m_p2DSprite->setSize(dimension2df(scale.X, scale.Y));
    m_p2DSprite->setPosition(position);
    m_p2DSprite->setID(ID());
    //m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureScale(0.5f,0.5f);
    m_p2DSprite->getMaterial(0).getTextureMatrix(0).setTextureTranslate(0.f,0.0f); // 1th sprite

    // get ready physics model
    m_pZombiePhaysics = new ZombiePhysics(&Box2dWld.GetWorld(), ID());
    m_pZombiePhaysics->SetTransform(b2Vec2(position.X, position.Y), 0.f);

    //create skill
    AttackBuildingSkill* pcreatebasicZskill = new AttackBuildingSkill("AttackBuilding", this, 0.5);//name,baseplayer, prof
    skills.insert(pair<std::string,Skill*>(pcreatebasicZskill->getName(), pcreatebasicZskill));


    m_VecRoamDest = position;
    m_uLockPosTime = 0;

    m_pBlacBoard = pbb;

    m_pCurrentMission = null;
    m_pMissionPending = null;
    m_pCurrentSkill = null;
}
开发者ID:ptptomr,项目名称:project_ran,代码行数:70,代码来源:ZombieLeader.cpp


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