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


C++ FnScene类代码示例

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


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

示例1: 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

示例2: SetRenderTarget

/*--------------------------
  set rendering target data
  C.Wang 0522, 2006
 ---------------------------*/
void FuCShadowModify::SetRenderTarget(int w, float *bgColor)
{
   FnScene scene;
   FnWorld gw;
   FnViewport vp;
   char shadowName[256];

   scene.Object(mHost);
   gw.Object(scene.GetWorld());
   gw.DeleteMaterial(mRenderTarget);
   gw.DeleteViewport(mViewport);

   // create the viewport with the associated size
   mViewport = gw.CreateViewport(0, 0, w, w);

   // create the render target material
   mRenderTarget = gw.CreateMaterial(NULL, NULL, NULL, 1.0f, NULL);

   // generate a unique shadow texture name
   sprintf(shadowName, "shadow%d", mRenderTarget);

   FnMaterial mat;
   mat.Object(mRenderTarget);
   mat.AddRenderTargetTexture(0, 0, shadowName, TEXTURE_32, mViewport);
   mat.SetTextureAddressMode(0, CLAMP_TEXTURE);

   // set render target
   vp.Object(mViewport);
   vp.SetRenderTarget(mRenderTarget, 0, 0, 0);
   vp.SetBackgroundColor(bgColor[0], bgColor[1], bgColor[2]);
}
开发者ID:uvbs,项目名称:GameProject,代码行数:35,代码来源:TShadow.cpp

示例3:

OurEnemyActor::OurEnemyActor()
{
    FnScene scene;
    scene.Object(sMiniID);
    anchorID = scene.CreateObject();
    arrowID = scene.CreateObject(anchorID);
}
开发者ID:MBRSL,项目名称:NTUGameProgramming2011,代码行数:7,代码来源:OurEnemyActor.cpp

示例4: FyMain

/*------------------
  the main program
  C.Wang 0904, 2012
 -------------------*/
void FyMain(int argc, char **argv)
{
   // create a new world
   FyStartFlyWin32("Hello Fly2 !", 0, 0, 800, 600, FALSE);

   FySetModelPath("Data\\Models");
   FySetTexturePath("Data\\textures");
   FySetShaderPath("Data\\shaders");

   // create a viewport
   vID = FyCreateViewport(0, 0, 800, 600);
   FnViewport vp;
   vp.ID(vID);
   vp.SetBackgroundColor(0.3f, 0.4f, 0.5f);

   // create a 3D scene & the 3D entities
   sID = FyCreateScene(1);

   FnScene scene;
   scene.ID(sID);
   nID = scene.CreateObject(OBJECT);
   cID = scene.CreateObject(CAMERA);
   lID = scene.CreateObject(LIGHT);

   // load the teapot model
   FnObject model;
   model.ID(nID);
   model.Load("teapot");

   // translate the camera
   FnCamera camera;
   camera.ID(cID);
   camera.Rotate(X_AXIS, 90.0f, LOCAL);
   camera.Translate(0.0f, 10.0f, 100.0f, LOCAL);

   // translate the light
   FnLight light;
   light.ID(lID);
   light.SetName("MainLight");
   light.Translate(-50.0f, -50.0f, 50.0f, GLOBAL);

   // set Hotkeys
   FyDefineHotKey(FY_ESCAPE, QuitGame, FALSE);

   // define some mouse functions
   FyBindMouseFunction(LEFT_MOUSE, InitPivot, PivotCam, NULL, NULL);
   FyBindMouseFunction(MIDDLE_MOUSE, InitZoom, ZoomCam, NULL, NULL);
   FyBindMouseFunction(RIGHT_MOUSE, InitMove, MoveCam, NULL, NULL);

   // bind a timer, frame rate = 30 fps
   FyBindTimer(0, 30.0f, GameAI, TRUE);

   // invoke the system
   FyInvokeFly(TRUE);
}
开发者ID:edison4987,项目名称:Fly2_API,代码行数:59,代码来源:Hello.cpp

示例5:

ActorStateMachine::~ActorStateMachine(void)
{
	FnScene scene;
	scene.Object(sID);
	scene.DeleteObject(this->bloodID);
	/*
	FnWorld gw;
	gw.Object(gID);
	gw.DeleteAudio(audioG);
	gw.DeleteAudio(audioD);
	*/
}
开发者ID:trantorLiu,项目名称:GameProgramming,代码行数:12,代码来源:ActorStateMachine.cpp

示例6: CreateShadowMaterial

/*-------------------------------
  create the material for shadow
  C.Wang 0522, 2006
 --------------------------------*/
void FuCShadowModify::CreateShadowMaterial(float *color)
{
   FnWorld gw;
   FnScene scene;
   scene.Object(mHost);
   gw.Object(scene.GetWorld());

   if (mShadowMat != FAILED_MATERIAL_ID) {
      gw.DeleteMaterial(mShadowMat);
   }

   // create the material
   float blackColor[3];

   blackColor[0] = blackColor[1] = blackColor[2] = 0.0f;
   mShadowMat = gw.CreateMaterial(blackColor, blackColor, blackColor, 1.0f, color);
}
开发者ID:uvbs,项目名称:GameProject,代码行数:21,代码来源:TShadow.cpp

示例7:

TShadow::TShadow( FnScene& scene ) 
	:FuCShadowModify( scene.Object() )
{
	//scene.SetCurrentRenderGroup(RG_SHADOW);
	CreateShadowMaterial( Vec3D(0.4,0.4,0.4) );
	SetRenderTarget( 512 , Vec3D(1,1,1) );
	SetShadowOffsetFromGround( 0.2f );
}
开发者ID:uvbs,项目名称:GameProject,代码行数:8,代码来源:TShadow.cpp

示例8:

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

示例9: if

BOOL ActorStateMachine::PlayAction(int skip){
	FnActor actor;
	actor.Object(this->character);
	if (this->CanBeControl() == TRUE){
		actor.Play(0,LOOP, (float)skip, FALSE,TRUE);
	}else if (this->state == STATEATTACK){
		this->PlayAttackAction(skip);
	}else if (this->state == STATEDAMAGE){
		BOOL ret = actor.Play(0,ONCE, (float)skip, TRUE,TRUE);
		if (ret == FALSE){
			//sprintf(debug, "%s damage end\n",debug);
			this->ChangeState(STATEIDLE);
		}
	}else if (this->state == STATEDIE){
		BOOL ret = actor.Play(0,ONCE, (float)skip, TRUE,TRUE);
		
		if (ret == FALSE){
			sprintf(debug, "%s character die\n",debug);
			this->ChangeState(STATEVANISH);
		}
	}else if (this->state == STATEVANISH){
		if (this->fxDie != NULL) {
			BOOL beOK = this->fxDie->Play((float) skip);
			if (!beOK) {
				//fxDie->Reset();  // make it from the starting position and play it again
				// should delete the character
				delete fxDie;
				this->fxDie = NULL;
				FnScene scene;
				scene.Object(sID);
				scene.DeleteActor(this->character);
			}
		}
	}
	return TRUE;
}
开发者ID:trantorLiu,项目名称:GameProgramming,代码行数:36,代码来源:ActorStateMachine.cpp

示例10: FyMain

/*------------------
  the main program
  C.Wang 0308, 2004
 -------------------*/
void FyMain(int argc, char **argv)
{
   // create a new world
   FyStartFlyWin32("Hello TheFly3D !", 0, 0, 800, 600, beFullScreen);

   FySetModelPath("Data\\Models");
   FySetTexturePath("Data\\textures");
   FySetShaderPath("Data\\Shaders");

   FyBeginMedia("data\\media", 2);
   //mmID = FyCreateMediaPlayer("dawn.mpg", 0, 0, 800, 600);
   //mmID = FyCreateMediaPlayer("opening.avi", 0, 0, 800, 600);
   mmID = FyCreateMediaPlayer("MUSIC_fogforest.mp3", 0, 0, 800, 600);
   FnMedia mP;
   mP.Object(mmID);
   mP.Play(ONCE);
   //mP.SetVolume(0.1f);
   
   // create a viewport
   vID = FyCreateViewport(0, 0, 800, 600);
   FnViewport vp;
   vp.Object(vID);
   vp.SetBackgroundColor(0.3f, 0.4f, 0.5f);

   // create a 3D scene & the 3D entities
   sID = FyCreateScene(1);

   FnScene scene;
   scene.Object(sID);
   nID = scene.CreateObject(OBJECT);
   cID = scene.CreateObject(CAMERA);
   lID = scene.CreateObject(LIGHT);

   // load the teapot
   FnObject model;
   model.ID(nID);
   model.Load("teapot.cw3");
   model.Translate(20.0f, 0.0f, 0.0f, GLOBAL);
   
   // translate the camera
   FnCamera camera;
   camera.ID(cID);
   camera.Rotate(X_AXIS, 90.0f, LOCAL);
   camera.SetAspectRatio(800.0f/600.0f);
   camera.Translate(0.0f, 10.0f, 200.0f, LOCAL);

   // translate the light
   FnLight light;
   light.ID(lID);
   light.Translate(-30.0f, -30.0f, 0.0f, GLOBAL);
   light.SetName("MainLight");
   light.SetColor(0.9f, 0.9f, 0.7f);

   // set Hotkeys
   FyDefineHotKey(FY_ESCAPE, QuitGame, FALSE);

   // define some mouse functions
   FyBindMouseFunction(LEFT_MOUSE, InitPivot, PivotCam, NULL, NULL);
   FyBindMouseFunction(MIDDLE_MOUSE, InitZoom, ZoomCam, NULL, NULL);
   FyBindMouseFunction(RIGHT_MOUSE, InitMove, MoveCam, NULL, NULL);

   /* bind a timer, frame rate = 30 fps */
   FyBindTimer(0, 30.0f, GameAI, TRUE);

   // invoke the system
   FyInvokeFly(TRUE);
}
开发者ID:ike35,项目名称:game-design-final,代码行数:71,代码来源:test_media.cpp

示例11: 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

示例12: FyMain

/*------------------
the main program
C.Wang 1010, 2014
-------------------*/
void FyMain(int argc, char **argv)
{
	// create a new world
	BOOL4 beOK = FyStartFlyWin32("[email protected] Homework #02 - Use Fly2", 0, 0, 1024, 768, FALSE);

	// setup the data searching paths
	FySetShaderPath("Data\\NTU6\\Shaders");
	FySetModelPath("Data\\NTU6\\Scenes");
	FySetTexturePath("Data\\NTU6\\Scenes\\Textures");
	FySetScenePath("Data\\NTU6\\Scenes");

	//Tang: FX
	FySetGameFXPath("Data\\NTU6\\FX");
	//Tang

	// create a viewport
	vID = FyCreateViewport(0, 0, 1024, 768);
	FnViewport vp;
	vp.ID(vID);

	// create a 3D scene
	sID = FyCreateScene(10);
	FnScene scene;
	scene.ID(sID);

	// load the scene
	scene.Load("gameScene02");
	scene.SetAmbientLights(1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f);

	// load the terrain
	tID = scene.CreateObject(OBJECT);
	FnObject terrain;
	terrain.ID(tID);
	BOOL beOK1 = terrain.Load("terrain");
	terrain.Show(FALSE);

	// set terrain environment
	terrainRoomID = scene.CreateRoom(SIMPLE_ROOM, 10);
	FnRoom room;
	room.ID(terrainRoomID);
	room.AddObject(tID);

	// load the character
	FySetModelPath("Data\\NTU6\\Characters");
	FySetTexturePath("Data\\NTU6\\Characters");
	FySetCharacterPath("Data\\NTU6\\Characters");
	actorID = scene.LoadCharacter("Lyubu2");

	// put the character on terrain
	float pos[3], fDir[3], uDir[3];
	SetValues(pos, 3569.0f, -3208.0f, 1000.0f);
	SetValues(fDir, 1.0f, 1.0f, 0.0f);
	SetValues(uDir, 0.0f, 0.0f, 1.0f);

	ActorGen(scene, terrainRoomID, LyubuID, "Lyubu2", "Idle", pos, fDir, uDir);
	actorID = LyubuID.actorID;

	FnCharacter actor;
	actor.ID(actorID);

	// Get two character actions pre-defined at Lyubu2
	idleID = actor.GetBodyAction(NULL, "Idle");
	runID = actor.GetBodyAction(NULL, "Run");
	NormalAttack1ID = actor.GetBodyAction(NULL, "NormalAttack1");
	NormalAttack2ID = actor.GetBodyAction(NULL, "NormalAttack2");
	HeavyAttack1ID = actor.GetBodyAction(NULL, "HeavyAttack1");

	// translate the camera
	cID = scene.CreateObject(CAMERA);
	FnCamera camera;
	camera.ID(cID);
	camera.SetNearPlane(5.0f);
	camera.SetFarPlane(100000.0f);

	//hw3 : Donzo and Robber02 initialization
	float temp_pos[3];
	float temp_fDir[3];

	/*
	for (int i = 0; i < NUM_OF_BADGUYS; i++)
	{
	temp_pos[0] = pos[0] + 30 * (rand()%8);
	temp_pos[1] = pos[1] + 30 * (rand()%8);
	temp_pos[2] = pos[2] + 30 * (rand()%8);
	temp_fDir[0] = -1.0f; temp_fDir[1] = -1.0f; temp_fDir[2] = 1.0f;

	ActorGen(scene, terrainRoomID, badguyID[i], "Robber02", "CombatIdle", temp_pos, temp_fDir, uDir);
	}
	*/
	for (int i = 0; i < NUM_OF_BOSS; i++)
	{
		temp_pos[0] = pos[0] + 30 * (rand() % 8);
		temp_pos[1] = pos[1] + 30 * (rand() % 8);
		temp_pos[2] = pos[2] + 30 * (rand() % 8);
		SetValues(temp_fDir, -1.0f, -1.0f, 1.0f);

//.........这里部分代码省略.........
开发者ID:dragonkiss81,项目名称:Fly2_API,代码行数:101,代码来源:hw01_Tang.cpp

示例13: GameAI

/*-------------------------------------------------------------
30fps timer callback in fixed frame rate for major game loop
--------------------------------------------------------------*/
void GameAI(int skip)
{



	// play character pose
	FnCharacter actor;
	FnCharacter cur_actor;
	FnObject terrain;
	terrain.ID(tID);
	FnScene scene;
	scene.ID(sID);
	LyubuID.actorID = actorID;
	//Tang: FX
	float actorPos[3];
	vector<char*> FX_FileName;
	//Tang

	actor.ID(actorID);
	//Tang: FX
	actor.GetPosition(actorPos);
	//Tang

	if (curPoseID == runID || curPoseID == idleID)
		actor.Play(LOOP, (float)skip, FALSE, TRUE);
	else if (actor.Play(ONCE, (float)skip, FALSE, TRUE) == 0)
		actor.SetCurrentAction(NULL, 0, idleID, 10.0f);

	
	for (int i = 0; i < NUM_OF_BADGUYS; i++)
	{
		cur_actor.ID(badguyID[i].actorID);

		if (badguyID[i].blood_remain > 0)
		{
			bool checkMove = MoveToTargetLocation(badguyID[i], LyubuID, badguyID, terrain);

			
			if (cur_actor.Play(ONCE, (float)skip, FALSE, TRUE) == 0)
			{
				if (checkMove)
				{
					ACTIONid CombatIdleID = cur_actor.GetBodyAction(NULL, "Run");
					cur_actor.SetCurrentAction(NULL, 0, CombatIdleID);
				}
				else
				{
					ACTIONid CombatIdleID = cur_actor.GetBodyAction(NULL, "NormalAttack2");
					cur_actor.SetCurrentAction(NULL, 0, CombatIdleID);

					//Tang: FX
					FX_FileName.clear();
					FX_FileName.push_back("HitForRobber");
					GenFX(sID, gFXID, dummyID, actorPos, FX_FileName);
					//Tang
				}
			}
		}
	}

	for (int i = 0; i < NUM_OF_BOSS; i++)
	{
		cur_actor.ID(BossID[i].actorID);
		ACTIONid cur_action = cur_actor.GetCurrentAction(NULL, 0);
		ACTIONid DieID = cur_actor.GetBodyAction(NULL, "Die");

		if (cur_action == DieID)
			cur_actor.Play(ONCE, (float)skip, FALSE, TRUE);
		else if (BossID[i].blood_remain > 0)
		{
			bool checkMove = MoveToTargetLocation(BossID[i], LyubuID, BossID, terrain);

			if (cur_actor.Play(ONCE, (float)skip, FALSE, TRUE) == 0)
			{
				if (checkMove)
				{
					ACTIONid CombatIdleID = cur_actor.GetBodyAction(NULL, "Run");
					cur_actor.SetCurrentAction(NULL, 0, CombatIdleID);
				}
				else
				{
					ACTIONid CombatIdleID = cur_actor.GetBodyAction(NULL, "HeavyAttack");
					cur_actor.SetCurrentAction(NULL, 0, CombatIdleID);

					//Tang: FX
					FX_FileName.clear();
					FX_FileName.push_back("HitForRobber");
					GenFX(sID, gFXID, dummyID, actorPos, FX_FileName);
					//Tang
				}
			}
		}
	}




//.........这里部分代码省略.........
开发者ID:dragonkiss81,项目名称:Fly2_API,代码行数:101,代码来源:hw01_Tang.cpp

示例14: FyMain

/*------------------
the main program
C.Wang 1010, 2014
-------------------*/
void FyMain(int argc, char **argv)
{
	// create a new world
	BOOL4 beOK = FyStartFlyWin32("[email protected] Homework #01 - Use Fly2", 0, 0, 1024, 768, FALSE);

	// setup the data searching paths
	FySetShaderPath("Data\\NTU6\\Shaders");
	FySetModelPath("Data\\NTU6\\Scenes");
	FySetTexturePath("Data\\NTU6\\Scenes\\Textures");
	FySetScenePath("Data\\NTU6\\Scenes");

	// create a viewport
	vID = FyCreateViewport(0, 0, 1024, 768);
	FnViewport vp;
	vp.ID(vID);

	// create a 3D scene
	sID = FyCreateScene(10);
	FnScene scene;
	scene.ID(sID);

	// load the scene
	scene.Load("gameScene02");
	scene.SetAmbientLights(1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f);

	// load the terrain
	tID = scene.CreateObject(OBJECT);
	FnObject terrain;
	terrain.ID(tID);
	BOOL beOK1 = terrain.Load("terrain");
	terrain.Show(FALSE);

	// set terrain environment
	terrainRoomID = scene.CreateRoom(SIMPLE_ROOM, 10);
	FnRoom room;
	room.ID(terrainRoomID);
	room.AddObject(tID);

	// load the character
	FySetModelPath("Data\\NTU6\\Characters");
	FySetTexturePath("Data\\NTU6\\Characters");
	FySetCharacterPath("Data\\NTU6\\Characters");
	actorID = scene.LoadCharacter("Lyubu2");

	// put the character on terrain
	float pos[3], fDir[3], uDir[3];
	FnCharacter actor;
	actor.ID(actorID);
	pos[0] = 3569.0f; pos[1] = -3208.0f; pos[2] = 1000.0f;
	fDir[0] = 1.0f; fDir[1] = -1.0f; fDir[2] = 0.0f;
	uDir[0] = 0.0f; uDir[1] = 0.0f; uDir[2] = 1.0f;
	actor.SetDirection(fDir, uDir);

	actor.SetTerrainRoom(terrainRoomID, 10.0f);
	beOK = actor.PutOnTerrain(pos);

	// Get two character actions pre-defined at Lyubu2
	idleID = actor.GetBodyAction(NULL, "Idle");
	runID = actor.GetBodyAction(NULL, "Run");

	// set the character to idle action
	curPoseID = idleID;
	actor.SetCurrentAction(NULL, 0, curPoseID);
	actor.Play(START, 0.0f, FALSE, TRUE);
	actor.TurnRight(90.0f);

	// translate the camera
	cID = scene.CreateObject(CAMERA);
	FnCamera camera;
	camera.ID(cID);
	camera.SetNearPlane(5.0f);
	camera.SetFarPlane(100000.0f);

	// set camera initial position and orientation
	pos[0] = 4069.0f; pos[1] = -3208.0f; pos[2] = 93.046f;
	fDir[0] = -500.0f; fDir[1] = -0.0f; fDir[2] = -0.0f;
	uDir[0] = -0.116f; uDir[1] = -0.031f; uDir[2] = 0.993f;
	camera.SetPosition(pos);
	camera.SetDirection(fDir, uDir);

	float mainLightPos[3] = { -4579.0, -714.0, 15530.0 };
	float mainLightFDir[3] = { 0.276, 0.0, -0.961 };
	float mainLightUDir[3] = { 0.961, 0.026, 0.276 };

	FnLight lgt;
	lgt.ID(scene.CreateObject(LIGHT));
	lgt.Translate(mainLightPos[0], mainLightPos[1], mainLightPos[2], REPLACE);
	lgt.SetDirection(mainLightFDir, mainLightUDir);
	lgt.SetLightType(PARALLEL_LIGHT);
	lgt.SetColor(1.0f, 1.0f, 1.0f);
	lgt.SetName("MainLight");
	lgt.SetIntensity(0.4f);

	// create a text object for displaying messages on screen
	textID = FyCreateText("Trebuchet MS", 18, FALSE, FALSE);

//.........这里部分代码省略.........
开发者ID:pierre0218,项目名称:GameDesign2015_HW1,代码行数:101,代码来源:Hello.cpp

示例15: TPROFILE

/*----------------------------------
  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


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