Example #1
0
BOOL SceneBuilder::MakeGame( )
{
	AnsiString error_text="";
	UI->ResetBreak();
	if(UI->ContainEState(esBuildLevel)) return false;
	ELog.Msg( mtInformation, "Making started..." );

    UI->BeginEState(esBuildLevel);
    try{
        do{
	        // clear error
            Tools->ClearDebugDraw();
	        // validate scene
    	    VERIFY_COMPILE(Scene->Validate(false,false,false,false,false,false),	"Validation failed.","Invalid scene.");
        	// build
            VERIFY_COMPILE(PreparePath(),				"Failed to prepare level path.","");
            VERIFY_COMPILE(GetBounding(),				"Failed to acquire level bounding volume.","");
            VERIFY_COMPILE(RenumerateSectors(), 		"Failed to renumerate sectors","");
            VERIFY_COMPILE(BuildLTX(),					"Failed to build level description.","");
            VERIFY_COMPILE(BuildGame(),					"Failed to build game.","");
        } while(0);

        if (!error_text.IsEmpty()) 	ELog.DlgMsg(mtError,error_text.c_str());
        else if (UI->NeedAbort())	ELog.DlgMsg(mtInformation,"Making terminated.");
        else						ELog.DlgMsg(mtInformation,"Making finished.");
    }catch(...){
    	ELog.DlgMsg(mtError,"Error has occured in builder routine. Editor aborted.");
        abort();
    }
    UI->EndEState();

	return error_text.IsEmpty();
}
Example #2
0
BOOL SceneBuilder::MakeSOM( )
{
	AnsiString error_text="";
	UI->ResetBreak();
	if(UI->ContainEState(esBuildLevel)) return false;
	ELog.Msg( mtInformation, "Making started..." );

    UI->BeginEState(esBuildLevel);
    try{
        do{
        	// build
            VERIFY_COMPILE(PreparePath(),				"Failed to prepare level path.","");
            VERIFY_COMPILE(BuildSOMModel(),				"Failed to build SOM model.","");
        } while(0);

        if (!error_text.IsEmpty()) 	ELog.DlgMsg(mtError,error_text.c_str());
        else if (UI->NeedAbort())	ELog.DlgMsg(mtInformation,"Building terminated...");
        else						ELog.DlgMsg(mtInformation,"Building OK...");
    }catch(...){
    	ELog.DlgMsg(mtError,"Error has occured in builder routine. Editor aborted.");
        abort();
    }
    UI->EndEState();

	return error_text.IsEmpty();
}
Example #3
0
//------------------------------------------------------------------------------
BOOL SceneBuilder::Compile()
{
	AnsiString error_text="";
	UI->ResetBreak();
	if(UI->ContainEState(esBuildLevel)) return false;
	ELog.Msg( mtInformation, "Building started..." );

    UI->BeginEState(esBuildLevel);
    try{
        do{
//.			ExecCommand( COMMAND_RESET_ANIMATION );
	        // check debug
            bool bTestPortal = Scene->ObjCount(OBJCLASS_SECTOR)||Scene->ObjCount(OBJCLASS_PORTAL);
	        // validate scene
    	    VERIFY_COMPILE(Scene->Validate(false,bTestPortal,true,true,true,true),"Validation failed.","Invalid scene.");
			// fill simple hemi
            simple_hemi.clear	();
	        xrHemisphereBuild	(1,2.f,simple_hemi_callback,&simple_hemi);
        	// build
            VERIFY_COMPILE		(PreparePath(),				"Failed to prepare level path","");
            VERIFY_COMPILE		(PrepareFolders(),			"Failed to prepare level folders","");
            VERIFY_COMPILE		(EvictResource(),	  		"Failed to evict resource","");
            VERIFY_COMPILE		(GetBounding(),				"Failed to acquire level bounding volume","");
            VERIFY_COMPILE		(RenumerateSectors(), 		"Failed to renumerate sectors","");
            VERIFY_COMPILE		(CompileStatic(),	  		"Failed static remote build","");
            VERIFY_COMPILE		(EvictResource(),	  		"Failed to evict resource","");
            VERIFY_COMPILE		(BuildLTX(),		  		"Failed to build level description","");
            VERIFY_COMPILE		(BuildGame(),		  		"Failed to build game","");
            VERIFY_COMPILE		(BuildSceneStat(),			"Failed to build scene statistic","");
            BuildHOMModel		();
            BuildSOMModel		();
    	    // build tools
            SceneToolsMapPairIt _I 	= Scene->FirstTools();
            SceneToolsMapPairIt _E	= Scene->LastTools();
            for (; _I!=_E; _I++){
            	if (_I->first!=OBJCLASS_DUMMY){
                    if (_I->second->Valid()){                                  
                        VERIFY_COMPILE(_I->second->Export(m_LevelPath),_I->second->ClassDesc(),"export failed.");
                        ELog.Msg(mtInformation,"Process %s - done.",_I->second->ClassDesc());
                    }else{
                        ELog.Msg(mtError,"Process %s - failed.",_I->second->ClassDesc());
                    }
                }
            }
		    Clear			();
        } while(0);

        if (!error_text.IsEmpty()) 	ELog.DlgMsg(mtError,error_text.c_str());
        else if (UI->NeedAbort())	ELog.DlgMsg(mtInformation,"Building terminated.");
        else						ELog.DlgMsg(mtInformation,"Building OK.");
    }catch(...){
    	ELog.DlgMsg(mtError,"Error has occured in builder routine. Editor aborted.");
        abort();
    }
    UI->EndEState();

	return error_text.IsEmpty();
}
Example #4
0
BOOL SceneBuilder::MakeAIMap()
{
	AnsiString error_text;
    do{
		VERIFY_COMPILE(PreparePath(),				"Failed to prepare level path.","");
		VERIFY_COMPILE(BuildAIMap(),				"Failed to build AI-Map.","");
    }while(0);
    if (!error_text.IsEmpty()) 	ELog.DlgMsg(mtError,error_text.c_str());
    else if (UI->NeedAbort())	ELog.DlgMsg(mtInformation,"Building terminated.");
    else						ELog.DlgMsg(mtInformation,"AI-Map succesfully exported.");

	return error_text.IsEmpty();
}
Example #5
0
BOOL SceneBuilder::MakeDetails()
{
	AnsiString error_text;
    do{
		VERIFY_COMPILE(PreparePath(),				"Failed to prepare level path.","");
        // save details
		VERIFY_COMPILE(Scene->GetTool(OBJCLASS_DO)->Export(m_LevelPath), "Export failed.","");
    }while(0);
    if (!error_text.IsEmpty()) 	ELog.DlgMsg(mtError,error_text.c_str());
    else if (UI->NeedAbort())	ELog.DlgMsg(mtInformation,"Building terminated.");
    else						ELog.DlgMsg(mtInformation,"Details succesfully exported.");

	return error_text.IsEmpty();
}
Example #6
0
void CRouter::MoveOn(D3DXVECTOR3 *vCurPos, float *angle, const float fSpeed, float fTime)
{
	if (m_pCurDest != NULL)
	{
		D3DXMATRIX mat;
		D3DXMATRIX mTrans;
		D3DXMatrixRotationY(&mat, *angle);
		D3DXMatrixTranslation(&mTrans, vCurPos->x, vCurPos->y, vCurPos->z);
		D3DXMatrixMultiply(&mat,&mat,&mTrans);

		if (m_pCurDest->pPrev->mode2Next == linear_mode)
		{
			MoveLinearly(vCurPos, &mat, fSpeed, fTime);
			if (IsPassBeyondPt(m_pCurDest->pPos, &mat))
			{
				m_pCurDest = m_pCurDest->pNext;
				PreparePath(TRUE, &mat, fSpeed);
			}

		}
		else
		{
			MoveCurvely(vCurPos, &mat, fSpeed, fTime);
			if(fabs(m_fAgl2Ajust) < 1e-4)
			{
				m_pCurDest = m_pCurDest->pNext;
				PreparePath(FALSE, &mat, fSpeed);
			}
		}

		D3DXVECTOR3 vLook(0,0,1);
		D3DXVec3TransformNormal(&vLook, &vLook, &mat);
		*angle = CaculateYaw(&vLook);
	}

}
Example #7
0
void Test::LoadResources()
{
	time = 0.f;
	isFinished = false;
	skipFrames = 100;

	Scene *scene = new Scene();
	scene->AddNode(scene->GetRootNode(fullName));
	DVASSERT_MSG(scene, "Could not load the scene");

	Camera* cam = new Camera();
	scene->AddCamera(cam);

	Core* core = DAVA::Core::Instance();
	float32 aspect = core->GetVirtualScreenHeight() / core->GetVirtualScreenWidth();

	cam->Setup(70.f, aspect, 1.f, 5000.f);
	cam->SetLeft(Vector3(1, 0, 0));
	cam->SetUp(Vector3(0, 0, 1));
    
    scene->SetCurrentCamera(cam);
	SafeRelease(cam);

	UI3DView *sceneView = new UI3DView(Rect(0, 0, GetSize().x, GetSize().y));
	sceneView->SetScene(scene);
	AddControl(sceneView);
	SafeRelease(sceneView);

	Landscape* landscape = GetLandscape();
	DVASSERT_MSG(scene, "There is no landscape in a scene");
	landscape->SetTiledShaderMode(Landscape::TILED_MODE_TEXTURE);

	uint32 textureMemory = TextureHelper::GetSceneTextureMemory(scene, GetFilePath());
	testData.SetTextureMemorySize(textureMemory);

	File* file = File::Create(fullName, File::OPEN | File::READ);
	DVASSERT_MSG(file, "Could not open file scene file");
	testData.SetSceneFileSize(file->GetSize());
	SafeRelease(file);

	PreparePath();
    PrepareFpsStat();
    PrepareCameraAnimation();
    ZeroCurFpsStat();
    MoveToNextPoint();

    SafeRelease(scene);
}
Example #8
0
char* CDropbox::PreparePath(const TCHAR *oldPath, char *newPath)
{
	return PreparePath(ptrA(mir_utf8encodeW(oldPath)), newPath);
}