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


C++ FnObject类代码示例

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


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

示例1: ZoomCam

/*------------------
zoom the camera
C.Wang 0329, 2005
-------------------*/
void ZoomCam(int x, int y)
{
	if (x != oldXMM || y != oldYMM) {
		FnObject model;

		model.ID(cID);
		model.Translate(0.0f, 0.0f, (float)(x - oldXMM)*10.0f, LOCAL);
		oldXMM = x;
		oldYMM = y;
	}
}
开发者ID:pierre0218,项目名称:GameDesign2015_HW1,代码行数:15,代码来源:Hello.cpp

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

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

示例4: PivotCam

/*------------------
  pivot the camera
  C.Wang 0329, 2004
 -------------------*/
void PivotCam(int x, int y)
{
   FnObject model;

   if (x != oldX) {
      model.ID(cID);
      model.Rotate(Z_AXIS, (float) (x - oldX), GLOBAL);
      oldX = x;
   }

   if (y != oldY) {
      model.ID(cID);
      model.Rotate(X_AXIS, (float) (y - oldY), GLOBAL);
      oldY = y;
   }
}
开发者ID:ike35,项目名称:game-design-final,代码行数:20,代码来源:test_media.cpp

示例5:

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

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

示例7: MoveCam

/*------------------
  move the camera
  C.Wang 0329, 2005
 -------------------*/
void MoveCam ( int x, int y )
{
	float dx = float(x - oldXM);
	float dy = float(y - oldYM);
	float dd = sqrt(dx*dx + dy*dy);
	if (sgn(dd) == 0)return;
	dx /= dd;
	dy /= dd;
	FnObject model;
	if ( x != oldXM ) {
		model.ID ( cID );
		model.Translate(0.1f*dx, 0.0f, 0.0f, LOCAL);
		oldXM = x;
	}
	if ( y != oldYM ) {
		model.ID ( cID );
		model.Translate(0.0f, 0.1f*dy, 0.0f, LOCAL);
		oldYM = y;
	}
}
开发者ID:spaded06543,项目名称:GP_homework,代码行数:24,代码来源:main.cpp

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

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

示例10:

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

示例11: MoveCam

/*------------------
  move the camera
  C.Wang 0329, 2004
 -------------------*/
void MoveCam(int x, int y)
{
   if (x != oldXM) {
      FnObject model;

      model.ID(cID);
      model.Translate((float)(x - oldXM)*0.1f, 0.0f, 0.0f, LOCAL);
      oldXM = x;
   }
   if (y != oldYM) {
      FnObject model;

      model.ID(cID);
      model.Translate(0.0f, (float)(oldYM - y)*0.1f, 0.0f, LOCAL);
      oldYM = y;
   }
}
开发者ID:ike35,项目名称:game-design-final,代码行数:21,代码来源:test_media.cpp

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

示例13: FyMain

void FyMain(int argc, char **argv) {
	
	srand(time(NULL));

	AllocConsole(); 
	freopen("CONIN$", "r", stdin);
	freopen("CONOUT$", "w", stdout);
	freopen("CONOUT$", "w", stderr);
	string ip, port;
	cout << "Enter ip   [" << GAME_PROGRAMMING_DEFAULT_IP << "]: ";getline(cin, ip);
	cout << "Enter port [" << GAME_PROGRAMMING_DEFAULT_PORT << "]: ";getline(cin, port);

	if(ip.empty()) {ip = GAME_PROGRAMMING_DEFAULT_IP;}
	if(port.empty()) {port = GAME_PROGRAMMING_DEFAULT_PORT;}

	cout << "Connect to server: " << ip << "/" << port << endl;
	game_client.initialize(ip, port, &game_updater);
	game_client.connectServer();
	cout << "Server connected." << endl;
	game_timer.initialize(&game_updater, game_client.getGmTree().getTotalGameTime(), game_client.getGmTree().getTotalGameRounds());
	std::cout<<"Start Game" << std::endl;
	//create a new window
	FyStartFlyWin32("Final Project - with Fly2", 0, 0, window_w, window_h, FALSE);
	
	//set up path
	FySetShaderPath("C:\\Fly2Data\\Shaders");
	FySetModelPath("C:\\Fly2Data\\Scenes");
	FySetTexturePath("C:\\Fly2Data\\Scenes\\Textures");
	FySetScenePath("C:\\Fly2Data\\Scenes");
	FySetAudioPath("C:\\Fly2Data\\Audio");

	//create a viewport
	viewportID = FyCreateViewport(0, 0, viewPortWidth, viewPortHeight);
	FnViewport viewport(viewportID);

	mouseInput.setWindowSize(wndWidth, wndHeight);
	//create 3D scene
	sceneID = FyCreateScene(10);
	FnScene scene(sceneID);

	scene.Load("gameScene01");
	scene.SetAmbientLights(1.0f, 1.0f, 1.0f, 0.6f, 0.6f, 0.6f);

	 // create a 2D scene for sprite rendering which will be rendered on the top of 3D
    FnScene scene2D;
    sID2 = FyCreateScene(1);
    scene2D.Object(sID2);
    scene2D.SetSpriteWorldSize(1024, 768);         // 2D scene size in pixels

	FnSprite sp;
    spID0 = scene2D.CreateObject(SPRITE);
    sp.Object(spID0);
	sp.SetSize(sight_w, sight_h);
    sp.SetImage("C:\\Fly2Data\\Image\\spiner", 0, NULL, FALSE, NULL, 2, TRUE, FILTER_LINEAR);
	sp.SetPosition(window_w/2-sight_w/2, window_h/2-sight_h/2, 0);

	FnScene scene2Dmenu;
	sID2menu = FyCreateScene(1);
    scene2Dmenu.Object(sID2menu);
    scene2Dmenu.SetSpriteWorldSize(1024, 768);         // 2D scene size in pixels

	FnSprite spExit;
    OBJECTid spIDexit = scene2Dmenu.CreateObject(SPRITE);
    spExit.Object(spIDexit);
	spExit.SetSize(400, 70);
    spExit.SetImage("C:\\Fly2Data\\Image\\exit_button", 0, NULL, FALSE, NULL, 2, TRUE, FILTER_LINEAR);
	spExit.SetPosition(window_w/2-400/2, window_h/2-70/2, 0);
	/*
	FnSprite sp1;
    spID1 = scene2Dmenu.CreateObject(SPRITE);
    sp1.Object(spID1);
	sp1.SetSize(C:\\Fly2Data\\Image\\mouse_w, mouse_h);
    sp1.SetImage("mouse", 0, NULL, FALSE, NULL, 2, TRUE, FILTER_LINEAR);
	sp1.SetPosition(window_w/2-mouse_w/2, window_h/2-mouse_h/2, 0);
	*/
	//load the terrain
	terrainID = scene.CreateObject(OBJECT);
	FnObject terrain;
	terrain.ID(terrainID);
	terrain.Load("terrain");
	terrain.Show(FALSE);

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

	//load the character
	FySetModelPath("C:\\Fly2Data\\Characters");
	FySetTexturePath("C:\\Fly2Data\\Characters");
	FySetCharacterPath("C:\\Fly2Data\\Characters");

   // put the character on terrain
   float pos[3], fDir[3], uDir[3];
	pos[0] = 3569.0, pos[1] = -3108; pos[2] = 0;
	fDir[0] = 1, fDir[1] = 0; fDir[2] = 0;
	uDir[0] = 0, uDir[1] = 0, uDir[2] = 1;


//.........这里部分代码省略.........
开发者ID:NTU-GameProgramming,项目名称:final-project,代码行数:101,代码来源:main.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


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