本文整理汇总了C++中FnScene::CreateRoom方法的典型用法代码示例。如果您正苦于以下问题:C++ FnScene::CreateRoom方法的具体用法?C++ FnScene::CreateRoom怎么用?C++ FnScene::CreateRoom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FnScene
的用法示例。
在下文中一共展示了FnScene::CreateRoom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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");
// 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");
npc1ID = scene.LoadCharacter("Donzo2");
npc2ID = scene.LoadCharacter("Robber02");
// put the character on terrain
float apos[3], cpos[3], fDir[3], uDir[3];
FnCharacter actor, npc1, npc2;
actor.ID(actorID);
npc1.ID(npc1ID);
npc2.ID(npc2ID);
apos[0] = 3569.0f; apos[1] = -3208.0f; apos[2] = 1000.0f;
fDir[0] = 1.0f; fDir[1] = 0.0f; fDir[2] = 0.0f;
uDir[0] = 0.0f; uDir[1] = 0.0f; uDir[2] = 1.0f;
actor.SetDirection(fDir, uDir);
fDir[0] = -1.0f; fDir[1] = -1.0f;
npc1.SetDirection(fDir, uDir);
fDir[0] = 1.0f;
npc2.SetDirection(fDir, uDir);
actor.SetTerrainRoom(terrainRoomID, 10.0f);
npc1.SetTerrainRoom(terrainRoomID, 10.0f);
npc2.SetTerrainRoom(terrainRoomID, 10.0f);
beOK = actor.PutOnTerrain(apos);
apos[1] -= 150.0f;
beOK = npc1.PutOnTerrain(apos);
apos[1] -= 50.0f;
beOK = npc2.PutOnTerrain(apos);
// Get two character actions pre-defined at Lyubu2
idleID = actor.GetBodyAction(NULL, "Idle");
runID = actor.GetBodyAction(NULL, "Run");
attackID = actor.GetBodyAction(NULL, "NormalAttack1");
idle1ID = npc1.GetBodyAction(NULL, "Idle");
damage1ID = npc1.GetBodyAction(NULL, "DamageL");
die1ID = npc1.GetBodyAction(NULL, "Die");
idle2ID = npc2.GetBodyAction(NULL, "CombatIdle");
damage2ID = npc2.GetBodyAction(NULL, "Damage1");
die2ID = npc2.GetBodyAction(NULL, "DEAD");
// set the character to idle action
curPoseID = idleID;
actor.SetCurrentAction(NULL, 0, curPoseID);
actor.Play(START, 0.0f, FALSE, TRUE);
actor.TurnRight(90.0f);
npc1.SetCurrentAction(NULL, 0, idle1ID);
npc1.Play(START, 0.0f, FALSE, TRUE);
npc2.SetCurrentAction(NULL, 0, idle2ID);
npc2.Play(START, 0.0f, FALSE, TRUE);
// translate the camera
cID = scene.CreateObject(CAMERA);
FnCamera camera;
//.........这里部分代码省略.........
示例2: 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);
//.........这里部分代码省略.........
示例3: 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);
//.........这里部分代码省略.........