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


C++ FnObject::Object方法代码示例

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


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

示例1: TActor

EditData& TFlyObjectEdit::createActor( char const* name , unsigned modelID )
{
	EditData data;
	data.flag |= EF_SAVE_XFORM | EF_CREATE;

	TCamera& cam = m_game->getCamControl();

	Vec3D pos = cam.getCameraPos() + 500 * cam.getViewDir();

	XForm trans;
	trans.setIdentity();

	TActor* entity = new TActor( modelID ,trans );
	data.type = EOT_TNPC;
	m_curLevel->addEntity( entity );
	data.flag |= EF_LOAD_MODEL;

	FnObject obj;
	obj.Object(  entity->getFlyActor().GetBaseObject() );

	obj.SetPosition( pos );
	obj.SetDirection( Vec3D(1,0,0) , Vec3D(0,0,1) );
	obj.SetName( (char*) name );
	entity->getFlyActor().SetName((char*) name);

	data.id     = obj.Object();
	data.entity = entity;

	g_editDataVec.push_back( data );

	return g_editDataVec.back();

}
开发者ID:uvbs,项目名称:GameProject,代码行数:33,代码来源:TFlyObjectEdit.cpp

示例2:

MiniMap::MiniMap(WORLDid gID, SCENEid sMiniID, Lyubu *lyubu, int x_pos, int y_pos, int width, int height )
{
	FnWorld gw;
	FnScene scene;
	FnViewport vp;
	FnCamera camera;
	FnObject camStand;
	FnTerrain terrain;
	//adr_turn = this->turn;
	/*
	pos_begin[0]=3569.0;
	pos_begin[1]=-3208.0;
	pos_begin[2]=1000.0f;
	*/
	gw.Object(gID);

	//miniMap
	gw.SetObjectPath("Data\\NTU4\\Scenes");
	FnScene miniScene;
	miniScene.Object(sMiniID);
	miniTerrainID = miniScene.CreateObject(ROOT);
	FnObject miniTerrain;
	miniTerrain.Object(miniTerrainID);
	miniTerrain.Load("terrain");
	miniTerrain.SetOpacity(0.8f);

	// create a camera stand for minimap
	miniMapStandID = miniScene.CreateObject(ROOT);

	gw.SetObjectPath("Data\\NTU4\\Characters");
	anchorID = miniScene.CreateObject(miniMapStandID);
	FnObject anchor;
	anchor.Object(anchorID);
	anchor.Load("arrowGreen");
	float pos[]={0,0,10};
	anchor.SetPosition(pos);

   // create a camera for minimap
	miniMapCameraID = miniScene.CreateCamera(miniMapStandID);
	FnCamera miniCamera;
	miniCamera.Object(miniMapCameraID);
	miniCamera.Translate(0.0f, 0.0f, 5000.0f, REPLACE);
	miniCamera.SetNear(5.0f);
	miniCamera.SetFar(100000.0f);
	miniCamera.Rotate(Z_AXIS, 180.0f, LOCAL);

	// create a light for minimap camera
	FnLight miniLight;
	miniLight.Object(miniScene.CreateLight(miniMapCameraID));
	miniLight.SetIntensity(1.0f);
	miniLight.SetRange(9500.0f);

	vpMiniMapID = gw.CreateViewport(x_pos, y_pos, width, height);
}
开发者ID:MBRSL,项目名称:NTUGameProgramming2011,代码行数:54,代码来源:MiniMap.cpp

示例3: save

	void save(EditData& data)
	{
		type = data.type;
		flag = data.flag;

		switch( data.type )
		{
		case EOT_TOBJECT:
			if  ( data.flag & EF_LOAD_MODEL )
			{
				TObject* tObj = TObject::upCast( data.entity );
				modelID = tObj->getModelID();
			}
			break;
		case EOT_TNPC:
			{
				TActor* actor = TActor::upCast( data.entity );
				modelID = actor->getModelID();
			}
			break;
		case EOT_TERRAIN:
		case EOT_FLY_OBJ:
		case EOT_OTHER:
			break;
		}


		FnObject obj; obj.Object( data.id );
		name = obj.GetName();
		if ( data.flag & EF_SAVE_XFORM )
		{
			obj.GetWorldPosition( pos );
			obj.GetWorldDirection( front , up );
		}
	}
开发者ID:uvbs,项目名称:GameProject,代码行数:35,代码来源:TFlyObjectEdit.cpp

示例4: initLife

BOOL ActorStateMachine::initLife(){
	this->life = (int) MAX_LIFE;

	FnScene scene;
	scene.Object(sID);
	bloodID = scene.CreateObject(ROOT);
	FnObject blood;
	blood.Object(bloodID);
	//FnBillBoard blood;
	//blood.Object(bloodID, 0);
	FnActor actor;
	actor.Object(this->character);
	OBJECTid baseID = actor.GetBaseObject();

	float pos[3], size[2], color[3];
	pos[0] = 0.0f;
	pos[1] = 0.0f;
	pos[2] = 80.0f;
	size[0] = 50.0f;
	size[1] = 2.0f;
	color[0] = 1.0f; color[1] = color[2] = 0.0f;
	blood.Billboard(pos, size, NULL, 0, color);
	blood.SetParent(baseID);
	return TRUE;
}
开发者ID:trantorLiu,项目名称:GameProgramming,代码行数:25,代码来源:ActorStateMachine.cpp

示例5: render

void WorldEditor::render( int skip )
{

	viewportScreen.Render( camView.Object() , TRUE , TRUE );

	float fps = updateFPS();

	TMessageShow msgShow( m_world );
	msgShow.start();
	msgShow.push( "Fps: %6.2f", fps );
	{
		Vec3D pos = camControl.getPosition();
		Vec3D dir = camControl.getViewDir();
		msgShow.push( "Cam pos = ( %.1f %.1f %.1f ) viewDir = ( %.2f %.2f %.2f )" ,
			pos.x() , pos.y() , pos.z() , dir.x() , dir.y() , dir.z() );
	}


	g_devLog.show( msgShow );

	//if ( EditData* data = m_objEdit.getSelectEditData())
	//{
	//	if ( TActor* actor = TActor::upCast( data->entity ) )
	//	{
	//		Vec3D  pos = actor->getPosition();
	//		msgShow.push( "Hit pos = ( %.1f %.1f %.1f ) " ,
	//			pos.x() , pos.y() ,pos.z()  );
	//		actor->getFlyActor().GetWorldPosition( pos );
	//		msgShow.push( "Hit pos = ( %.1f %.1f %.1f ) " ,
	//			pos.x() , pos.y() ,pos.z()  );
	//	}
	//}
	
	if ( m_player )
	{
		Vec3D dir = m_player->getFaceDir();
		msgShow.push( "viewDir = ( %.2f %.2f %.2f )" , dir.x() , dir.y() , dir.z() );
		m_player->getFlyActor().GetDirection( dir , NULL );
		msgShow.push( "viewDir = ( %.2f %.2f %.2f )" , dir.x() , dir.y() , dir.z() );
		FnObject obj; obj.Object( m_player->getFlyActor().GetBaseObject() );
		msgShow.push( "viewDir = ( %.2f %.2f %.2f )" , dir.x() , dir.y() , dir.z() );
	}

	if ( m_Mode == MODE_RUN )
	{
		TProfileIterator* profIter = TProfileManager::createIterator();

		profIter->getCurNode()->showAllChild( true );
		showProfileInfo( profIter , msgShow , NULL );
		TProfileManager::releaseIterator( profIter );
	}



	msgShow.finish();

	m_world.SwapBuffers();
}
开发者ID:uvbs,项目名称:GameProject,代码行数:58,代码来源:WorldEditor.cpp

示例6: FuShadowDisplayCallback

static void FuShadowDisplayCallback(OBJECTid oID)
{
   FnObject seed;
   FuCShadowModify **s;

   seed.Object(oID);
   s = (FuCShadowModify **) seed.GetData();

   (*s)->Display();
}
开发者ID:uvbs,项目名称:GameProject,代码行数:10,代码来源:TShadow.cpp

示例7: showObject

void TFlyObjectEdit::showObject( unsigned typeBit , bool isShow )
{
	int type = 1 << typeBit;
	for( int i =0;i < g_editDataVec.size() ; ++i )
	{
		EditData& data = g_editDataVec[i];
		if ( data.type & typeBit )
		{
			FnObject obj; obj.Object( data.id );
			obj.Show( isShow );
		}
	}
}
开发者ID:uvbs,项目名称:GameProject,代码行数:13,代码来源:TFlyObjectEdit.cpp

示例8: GameAI

//------------------------------------------------------------------------------------
// timer callback function which will be invoked by TheFly3D System every 1/30 second
// C.Wang 0308, 2004
//------------------------------------------------------------------------------------
void GameAI(int skip)
{
   if (mmID != FAILED_ID) {
      FnMedia md;
      md.Object(mmID);
      if (md.GetState() == MEDIA_STOPPED) {
         // after playing, delete the media object
         FyDeleteMediaPlayer(mmID);
         mmID = FAILED_ID;
      }
      else {
         return;
      }
   }

   FnLight lgt;
   lgt.Object(lID);
   lgt.Rotate(Z_AXIS, 0.5f, GLOBAL);

   FnObject model;
   model.Object(nID);
   model.Rotate(Z_AXIS, 3.0f, GLOBAL);

   // render the scene
   FnViewport vp;
   vp.Object(vID);
   vp.Render3D(cID, TRUE, TRUE);

   // show frame rate

   static char string[128];

   if (frame == 0) {
      FyTimerReset(0);
   }

   if (frame/10*10 == frame) {
      float curTime;

      curTime = FyTimerCheckTime(0);
      sprintf(string, "Fps: %6.2f", frame/curTime);
   }

   frame += skip;

   if (frame >= 1000) {
      frame = 0;
   }

   FySwapBuffers();
}
开发者ID:younger50,项目名称:GameDesignFinal,代码行数:55,代码来源:test_media.cpp

示例9: load

	void load(EditData& data , TLevel* level )
	{
		FnScene& scene = level->getFlyScene();
		data.type  = type;
		data.flag  = flag;

		switch( data.type )
		{
		case EOT_TOBJECT:
			if  ( data.flag & EF_LOAD_MODEL )
			{
				TObject* tObj = new TObject( modelID );
				level->addEntity( tObj );
				data.id = tObj->getFlyObj().Object();
				data.entity = tObj;
			}
			break;
		case EOT_TNPC:
			{
				XForm trans; trans.setIdentity();
				TActor* actor = new TActor(  modelID , trans );
				level->addEntity( actor );
				data.id = actor->getFlyActor().GetBaseObject();
				data.entity = actor;
			}
			break;
		case EOT_TERRAIN:
		case EOT_FLY_OBJ:
		case EOT_OTHER:
			data.id = scene.GetObjectByName( (char*) name.c_str() );
			break;
		}

		FnObject obj; obj.Object( data.id );
		obj.SetName( (char*) name.c_str() );

		if ( data.flag & EF_SAVE_XFORM )
		{
			obj.SetWorldPosition( pos );
			obj.SetWorldDirection( front , up );
		}
	}
开发者ID:uvbs,项目名称:GameProject,代码行数:42,代码来源:TFlyObjectEdit.cpp

示例10: saveTerrainData

void TFlyObjectEdit::saveTerrainData( char const* name )
{
	TTerrainData terrain;

	for( int i=0; i < g_editDataVec.size(); ++i )
	{
		EditData& data = g_editDataVec[i];

		if ( data.type == EOT_TERRAIN )
		{
			FnObject obj; obj.Object( data.id );
			terrain.add( obj );
		}
	}
	TString terrFile = TString(name) + ".ter"; 
	terrain.save( terrFile.c_str() );

	TString bvhFile = TString(name) + ".bvh";
	btBvhTriangleMeshShape* shape = terrain.createConcaveShape( bvhFile.c_str() );
	delete shape;

}
开发者ID:uvbs,项目名称:GameProject,代码行数:22,代码来源:TFlyObjectEdit.cpp

示例11:

/*-------------------------------------
  constructor of classic shadow object
  C.Wang 0608, 2007
 --------------------------------------*/
FuCShadowModify::FuCShadowModify(SCENEid sID, int rgID)
{
   // initialize the shadow
   mHost = sID;
   mShadowMat = FAILED_MATERIAL_ID;
   mViewport = FAILED_ID;
   mRenderTarget = FAILED_MATERIAL_ID;

   // create the camera
   FnScene scene;
   FnObject seed;

   scene.Object(sID);
   m_lightCam.Object( scene.CreateCamera(ROOT) );

   // backup the rendering group
   int oldRG = scene.GetCurrentRenderGroup();

   if (rgID >= 0) {
      // set current rendering group
      scene.SetCurrentRenderGroup(rgID);
   }

   // create the seed object for displaying the shadow
   mSeed = scene.CreateObject(ROOT);
   seed.Object(mSeed);
   seed.BindPostRenderFunction(FuShadowDisplayCallback);
   seed.SetRenderOption(ALPHA, TRUE);
   FuCShadowModify **s = (FuCShadowModify **)seed.InitData(sizeof(FuCShadowModify *));
   *s = this;

   mShadowHeightOffset = 0.4f;
   mShadowSize = 50.0f;

   // recover current rendering group
   scene.SetCurrentRenderGroup(oldRG);

}
开发者ID:uvbs,项目名称:GameProject,代码行数:42,代码来源:TShadow.cpp

示例12: Display

/*----------------------------------
  display the shadow on the terrain
  C.Wang 0522, 2006
 -----------------------------------*/
void FuCShadowModify::Display()
{
	TPROFILE("Shadow Display");

	if ( m_fyActor.Object() == FAILED_ID ) 
		return;

	FnObject model;
	model.Object(mSeed);
	if (!model.GetVisibility()) 
		return;

	WORLDid wID;
	FnTriangle tT;
	FnScene scene;
	FnTerrain terrain;
	int vLen , texLen = 2, tri[3];
	float M[16], *G, vLC[3];
	
	// get all neighboring triangles
	//nList = terrain.GetAllVertexNeighborTriangles(iOne, list, 64);
	//if (nList <= 0) return;

	// get the matrix to character's base coordinate
	m_lightCam.SetWorldPosition( m_actorPos );
	G = m_lightCam.GetMatrix(TRUE);
	FyInverseM16(G, M);

	tT.Object( m_terrain.Object() , 0);
	scene.Object(mHost);
	wID = scene.GetWorld();

	// reset all rendering states
	FyResetRenderStates(wID);
	FySetD3DRenderState(wID, D3DRS_LIGHTING, FALSE);
	FySetD3DRenderState(wID, D3DRS_FOGENABLE, FALSE);
	FySetD3DRenderState(wID, D3DRS_ZWRITEENABLE, FALSE);

	// set current material
	FySetCurrentMaterial(wID, mRenderTarget, FALSE, 1.0f);

	FySetD3DRenderState(wID, D3DRS_ALPHABLENDENABLE, TRUE);
	FySetD3DRenderState(wID, D3DRS_ALPHATESTENABLE, FALSE);
	FySetD3DRenderState(wID, D3DRS_SRCBLEND, D3DBLEND_ZERO);
	FySetD3DRenderState(wID, D3DRS_DESTBLEND, D3DBLEND_SRCCOLOR);

	LPDIRECT3DDEVICE9 dev = FyGetD3DDevice(wID);
	float pos[16];


	FuLitedVertex v[3];

	// display these triangles
	vLen = 6;

	v[0].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
	v[1].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);
	v[2].diffuse = D3DCOLOR_RGBA(255, 255, 255, 255);

	int nTri = m_triIDVec.size();
	for ( int i = 0; i < nTri ; i++) 
	{
		// get the triangle vertices
		tT.GetTopology( m_triIDVec[i] , tri);

		for ( int j = 0; j < 3; ++j ) 
		{
			tT.GetVertex(tri[2-j], pos);
			v[j].pos[0] = pos[0];
			v[j].pos[1] = pos[1];
			v[j].pos[2] = pos[2] + mShadowHeightOffset;

			// calculate the texture coordinate
			FUTransformVertexWithM16_Simple(vLC, v[j].pos, M);
			CalculateShadowUV(vLC, v[j].uv);
		}

		FyDrawTriangles(wID, XYZ_DIFFUSE, 3 , 1 , &texLen, (float *) &v[0] );

	}

}
开发者ID:uvbs,项目名称:GameProject,代码行数:86,代码来源:TShadow.cpp

示例13: Show

/*-----------------------
  show / hide the shadow
  C.Wang 0910, 2006
 ------------------------*/
void FuCShadowModify::Show(BOOL beShow)
{
   FnObject seed;
   seed.Object(mSeed);
   seed.Show(beShow);
}
开发者ID:uvbs,项目名称:GameProject,代码行数:10,代码来源:TShadow.cpp

示例14: OurAction

Donzo::Donzo( WORLDid gID, SCENEid sID )
{
	FnWorld gw;
	FnScene scene;

	HP_MAX = 9000;
	HP = HP_MAX;

	pos_begin[0]=3469.0;
	pos_begin[1]=-3208.0;
	pos_begin[2]=1000.0f;

	this->gID = gID;
	this->sID = sID;

	gw.Object(gID);
	scene.Object(sID);

	gw.SetObjectPath("Data\\NTU4\\Characters");
	gw.SetTexturePath("Data\\NTU4\\Characters");
	gw.SetCharacterPath("Data\\NTU4\\Characters");
	gw.SetShaderPath( "Data\\NTU4\\Shaders" );

	aID = scene.LoadActor("Donzo");
	actor.Object(aID);


	//-------action---------
	//IDLE
	ourIdleAction = new OurAction();
	ourIdleAction->actID = actor.GetBodyAction(NULL, "CombatIdle");
	ourIdleAction->frames_num = 0;
	ourIdleAction->play_speed = 1;
	ourIdleAction->priority = 0;
	ourIdleAction->type.value = DonzoAction::ACTION_IDLE();

	current_OurAction = ourIdleAction;
	actor.MakeCurrentAction(0, NULL, ourIdleAction->actID);

	ourCombatIdleAction = ourIdleAction;
	
	//Run
	ourRunAction = new OurAction();
	ourRunAction->actID = actor.GetBodyAction(NULL, "Run");
	ourRunAction->frames_num = 0;
	ourRunAction->play_speed = 1;
	ourRunAction->priority = 0;
	ourRunAction->type.value = Action_type::ACTION_WALK();

	//Attack
	ourAttack1Action = new OurAction();
	ourAttack1Action->actID = actor.GetBodyAction(NULL, "AttackL1");
	ourAttack1Action->isAttack = true;
	ourAttack1Action->frames_num = 0;
	ourAttack1Action->play_speed = 1;
	ourAttack1Action->priority = 5;
	ourAttack1Action->type.value = Action_type::ACTION_ATTACK();
	ourAttack1Action->numOfKeyFrames = 1;
	ourAttack1Action->keyFrames = new OurFrame*[1];
	ourAttack1Action->keyFrames[0] = new OurFrame;
	ourAttack1Action->keyFrames[0]->frameNO = 10;
	ourAttack1Action->keyFrames[0]->start_angle = 320;
	ourAttack1Action->keyFrames[0]->plus_angle = 80;
	ourAttack1Action->keyFrames[0]->valid_dis = 200;
	ourAttack1Action->keyFrames[0]->damage_pt = 100;

	ourHeavyAttack1Action = new OurAction();
	ourHeavyAttack1Action->actID = actor.GetBodyAction(NULL, "AttackH");
	ourHeavyAttack1Action->isAttack = true;
	ourHeavyAttack1Action->frames_num = 0;
	ourHeavyAttack1Action->play_speed = 1;
	ourHeavyAttack1Action->priority = ourAttack1Action->priority + 10;
	ourHeavyAttack1Action->type.value = Action_type::ACTION_ATTACK();
	ourHeavyAttack1Action->numOfKeyFrames = 3;
	ourHeavyAttack1Action->keyFrames = new OurFrame*[3];
	ourHeavyAttack1Action->keyFrames[0] = new OurFrame;
	ourHeavyAttack1Action->keyFrames[0]->frameNO = 23;
	ourHeavyAttack1Action->keyFrames[0]->start_angle = 270;
	ourHeavyAttack1Action->keyFrames[0]->plus_angle = 100;
	ourHeavyAttack1Action->keyFrames[0]->valid_dis = 200;
	ourHeavyAttack1Action->keyFrames[0]->damage_pt = 100;
	ourHeavyAttack1Action->keyFrames[1] = new OurFrame;
	ourHeavyAttack1Action->keyFrames[1]->frameNO = 42;
	ourHeavyAttack1Action->keyFrames[1]->start_angle = 270;
	ourHeavyAttack1Action->keyFrames[1]->plus_angle = 180;
	ourHeavyAttack1Action->keyFrames[1]->valid_dis = 200;
	ourHeavyAttack1Action->keyFrames[1]->damage_pt = 90;
	ourHeavyAttack1Action->keyFrames[2] = new OurFrame;
	ourHeavyAttack1Action->keyFrames[2]->frameNO = 70;
	ourHeavyAttack1Action->keyFrames[2]->start_angle = 0;
	ourHeavyAttack1Action->keyFrames[2]->plus_angle = 360;
	ourHeavyAttack1Action->keyFrames[2]->valid_dis = 200;
	ourHeavyAttack1Action->keyFrames[2]->damage_pt = 80;

	ourHeavyAttack2Action = new OurAction();
	ourHeavyAttack2Action->actID = actor.GetBodyAction(NULL, "HeavyAttack");
	ourHeavyAttack2Action->isAttack = true;
	ourHeavyAttack2Action->frames_num = 0;
	ourHeavyAttack2Action->play_speed = 1;
	ourHeavyAttack2Action->priority = ourAttack1Action->priority + 10;
//.........这里部分代码省略.........
开发者ID:fikacschoko,项目名称:NTUGameProgramming2011,代码行数:101,代码来源:Donzo.cpp


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