Example #1
0
void CDirectory::WriteDirectoryFinishSummary()
{
    WriteSummary(GetDirectoryName(), IsBaseline(), NumVariations, NumDiffs, NumFailures);

    if (Timing & TIME_DIR)
    {
        Message("RL: Directory elapsed time (%s): %02d:%02d", GetDirectoryName(), elapsed_dir / 60, elapsed_dir % 60);
    }

    if (FSyncDir)
    {
       FlushOutput();
    }
}
int main(int argc, char** argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif

	FBX2MDL::FBXImporter importer;
	FBX2MDL::FBXExporter exporter;

	FbxManager* sdkManager = FbxManager::Create();
	FbxIOSettings* ios = FbxIOSettings::Create(sdkManager, IOSROOT);
	sdkManager->SetIOSettings(ios);

	fbxsdk_2015_1::FbxImporter* fbxImporter = fbxsdk_2015_1::FbxImporter::Create(sdkManager, "");
	if (!fbxImporter->Initialize("box3.fbx", -1, sdkManager->GetIOSettings()))
	{
		printf("Call to FbxImporter::Initialize() failed.\n");
		printf("Error returned: %s\n\n", fbxImporter->GetStatus().GetErrorString());
		system("PAUSE");
		exit(-1);
	}

	FbxScene* fbxScene = FbxScene::Create(sdkManager, "myScene");
	fbxImporter->Import(fbxScene);
	
	auto scene = importer.LoadScene(fbxScene, sdkManager);
	auto writer = exporter.Export(scene);

	fbxScene->Destroy();
	fbxImporter->Destroy();
	sdkManager->Destroy();

	writer->WriteOut("box2.mdl");

	
	auto buf = writer->Get();
	auto buf_ = std::vector<uint8_t>();

	for (size_t i = 0; i < buf.size(); i++)
	{
		auto b = ((uint8_t*) buf.data())[i];
		buf_.push_back(b);
	}

	ace::Model_IO model_io;
	model_io.Load(buf_, ace::ToAString("./").c_str());
	

	/*
	MDLExporter *exporter = new MDLExporter("Data/Model/AnimationTest.fbx", "Data/Model/AnimationTest.mdl");
	exporter->Convert();
	delete exporter;
	*/

	return 0;
}
Example #3
0
BOOL CDiskObject::CreateFile( const CString& file )
/* ============================================================
	Function :		CDiskObject::CreateFile
	Description :	Creates the file "file", as well as the 
					directories necessary
	Access :		Public

	Return :		BOOL			-	"TRUE" if OK
	Parameters :	CString file	-	file to create

	Usage :			Call to create a file.

   ============================================================*/
{
	ClearError( );

	BOOL result = TRUE;

	if( file.GetLength( ) )
	{

		CString infile( file );
		QualifyFile( infile );

		// Split into directory and file
		CString directory = GetDirectoryName( infile );
		CString filename = GetFileName( infile );

		if( ( result = CreateDirectory( directory ) ) )
		{
			Trigger( file );
			HANDLE filehandle = ::CreateFile( 
									infile,
									GENERIC_WRITE,
									0,
									NULL,
									CREATE_ALWAYS,
									FILE_ATTRIBUTE_NORMAL,
									NULL
								);

			if( filehandle == INVALID_HANDLE_VALUE )
				result = FALSE;
			else
				CloseHandle( filehandle );
		}
	}
	else
	{
		SetInternalErrorMessage( );
		result = FALSE;
	}

	return result;
}
Example #4
0
	std::string FileSystem::GetStartupDirectory()
	{
#ifdef _WIN32
		static std::string startup = "";
		if (startup == "") {
			char name[FN_SIZE];
			GetModuleFileName(0, name, sizeof(name));
			startup = GetDirectoryName(name);
		}
		return startup;
#else
		return GetCurrentDir();
#endif
	}
Example #5
0
// 获取应用程序执行路径
tstring CPath::GetAppPath()
{
	static TCHAR szPath[MAX_PATH] = {0};

	if (szPath[0] == _T('\0'))
	{
		::GetModuleFileName(NULL, szPath, MAX_PATH);

		tstring strPath = GetDirectoryName(szPath);
		_tcsncpy(szPath, strPath.c_str(), MAX_PATH);
	}

	return szPath;
}
Example #6
0
void CDirectory::WriteDirectoryBeginSummary()
{
    Message("Running %s %s in directory %s",
        ModeNames[Mode],
        (Mode == RM_ASM)
        ? (IsBaseline() ? "baselines" : "diffs")
        : "tests",
        GetDirectoryName());

    if (FSyncTest || FSyncVariation)
    {
        FlushOutput();
    }
}
Example #7
0
int main(int argc, char** argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif

	std::vector<SampleInfo> samples =
	{
		INFO(Empty),
		INFO(EmptyExternal),
		INFO(Keyboard),
		INFO(Mouse),
		INFO(Joystick),

		INFO(Sound),

		INFO(Object2DComponent),
		INFO(Transition),

		INFO(CameraObject2D),
		INFO(EffectObject2D),

		INFO(TextObject2D_Simple),
		INFO(TextObject2D_Rotate),
		INFO(TextObject2D_Filtered),


		INFO(TextureObject2D_Simple),
		INFO(TextureObject2D_Transform),
		INFO(TextureObject2D_Turn),
		INFO(TextureObject2D_Src),

		INFO(MapObject2D_Simple),
		INFO(MapObject2D_Camera),

		INFO(ImagePackage),

		INFO(PostEffect),

	};

	auto cui = SampleGuide(samples);
	cui.Show();

	return 0;
}
Example #8
0
AnsiString PathUtil::GetSafeLogFileName() {
	AnsiString logFileName = GetUserDirectory();

#ifdef __WIN32__
	char moduleName[MAX_PATH];
	::GetModuleFileName(NULL, moduleName, MAX_PATH);

	AnsiString fileName = GetFileNameWithoutExtension(moduleName) + ".log";
	fileName = Combine("/Wintermute Engine/Logs/", fileName);
	logFileName = Combine(logFileName, fileName);

#else
	// !PORTME
	logFileName = Combine(logFileName, "/Wintermute Engine/wme.log");
#endif

	CreateDirectory(GetDirectoryName(logFileName));
	return logFileName;
}
Example #9
0
//Check whether this specific file needs to be hidden
BOOLEAN ShouldHideFile(UNICODE_STRING filename, PFLT_CALLBACK_DATA Data)
{
    BOOLEAN hideFile = FALSE;

    UNICODE_STRING directory;   
    NTSTATUS status = GetDirectoryName(Data, &directory);

    if (NT_SUCCESS(status))
    {
        DBG_PRINT("SecretStash!ShouldHideFile: Directory is %wZ, Filename is %wZ", &directory, &filename);

        hideFile = CheckFileToHideAgainstFolderVector(&directory, &filename);

        DestroyUnicodeString(&directory);
    }
    else
        NT_ASSERT(FALSE); ////////////////////////////////////handle this better somehow

    return hideFile;
}
Example #10
0
/**
	@brief	単体テストを実行する。
	@note
	現在、単体テスト内でEngineを使用した場合の動作は保証していない。
	テスト内でCoreを直接生成する。
*/
int main(int argc, char **argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif

	//Graphics_Empty(false);
	//return 0;

	//Profiler_Profiling();
	//return 0;

	::testing::InitGoogleTest(&argc, argv);

	auto result = RUN_ALL_TESTS();
	getchar();
	return result;
}
Example #11
0
BOOLEAN FolderContainsFilesToHide(PFLT_CALLBACK_DATA Data)
{
    BOOLEAN filesToHide = FALSE;

    UNICODE_STRING directory;

    GetDirectoryName(Data, &directory);

    for (size_t i = 0; filesToHide == FALSE && i < secretStashConfig.FolderVector.size; i++)
    {
        Folder* folder = FolderVectorGet(&secretStashConfig.FolderVector, i);

        if (RtlEqualUnicodeString(&directory, &folder->VolumeDirPath, FALSE))
        {
            filesToHide = TRUE;
        }
    }

    DestroyUnicodeString(&directory);

    return filesToHide;
}
Example #12
0
BOOL CDiskObject::MoveFile( const CString& sourceFile, const CString& destFile )
/* ============================================================
	Function :		CDiskObject::MoveFile
	Description :	Move the file "sourceFile" to "destFile". 
					Creates the destination directory if 
					necessary

	Access :		Public

	Return :		BOOL						- "TRUE" if renamed OK
	Parameters :	const CString& sourceFile	- File to move
					const CString& desFile		- New name/location

	Usage :			Call to move a file.

   ============================================================*/
{

	ClearError( );

	BOOL result = FALSE;

	if( sourceFile.GetLength() && destFile.GetLength() )
	{
		CString insourcefile( sourceFile );
		QualifyFile( insourcefile );
		CString indestdir = GetDirectoryName( destFile );
		CString indestfilename = GetFileName( destFile );

		if( CopyFile( insourcefile, indestdir, indestfilename ) )
		{
			result = RemoveFile( sourceFile );
		}

	}

	return result;

}
Example #13
0
BOOL CDiskObject::RenameFile( const CString& sourceFile, const CString& destFile )
/* ============================================================
	Function :		CDiskObject::RenameFile
	Description :	Renames the file "sourceFile" to "destFile". 
					"destFile" is assumed to be a filename rather 
					than a fully qualified path.

	Access :		Public

	Return :		BOOL						- "TRUE" if renamed OK
	Parameters :	const CString& sourceFile	- file to rename
					const CString& desFile		- New name

	Usage :			Call to rename a file.

   ============================================================*/
{

	ClearError( );

	BOOL result = FALSE;

	if( sourceFile.GetLength() && destFile.GetLength() )
	{
		CString insourcefile( sourceFile );
		QualifyFile( insourcefile );
		CString insourcedir = GetDirectoryName( insourcefile );
		if( CopyFile( sourceFile, insourcedir, destFile ) )
		{
			result = RemoveFile( sourceFile );
		}
	}

	return result;

}
Example #14
0
/**
	@brief	単体テストを実行する。
	@note
	現在、単体テスト内でEngineを使用した場合の動作は保証していない。
	テスト内でCoreを直接生成する。
*/
int main(int argc, char **argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif
	//Graphics_CubemapTexture(true);
	//Graphics_CubemapTexture(false);
	//return 0;

	//Font_AffLoader();
	//getchar();
	//return 0;

	//Graphics_TextureFormat(false);
	//return 0;

	::testing::InitGoogleTest(&argc, argv);

	auto result = RUN_ALL_TESTS();
	getchar();
	return result;
}
Example #15
0
File: main.c Project: dflay/NMR-DAQ
int main(int argc, char* argv[]){

   int i=0;

   // import debug mode options 
   ImportUtilityData(); 

   // get output directory 
   const int MAX    = 2000; 
   char *output_dir = (char*)malloc( sizeof(char)*(MAX+1) );  

   struct run myRun; 

   if(gIsTest==0 || gIsTest==5){ 
      output_dir = GetDirectoryName(&myRun);
      printf("[NMRDAQ]: --------------------------- STARTING RUN %05d ---------------------------  \n",myRun.fRunNumber);
      printf("[NMRDAQ]: The date is: %02d %02d %d \n",myRun.fMonth,myRun.fDay,myRun.fYear);
      printf("[NMRDAQ]: The time is: %02d:%02d:%02d \n",myRun.fHour_start,myRun.fMinute_start,myRun.fSecond_start);
      printf("[NMRDAQ]: Output directory: %s \n" ,output_dir);  
   }

   // import comments about the run 
   const int cSIZE = 1000; 
   char **comment; 
   comment = (char**)malloc( sizeof(char*)*cSIZE );
   int NumComment = ImportComments(comment); 

   // time stamp for each pulse
   const int NPULSE = 2000; // arbitrary large number 
   const int NDATA  = 6;    // 6 entries for date info 
   unsigned long **timestamp = (unsigned long **)malloc( sizeof(unsigned long *)*NPULSE ); 
   for(i=0;i<NPULSE;i++) timestamp[i] = (unsigned long *)malloc( sizeof(unsigned long)*NDATA );

   int *MECH = (int *)malloc( sizeof(int)*NPULSE );
   for(i=0;i<NPULSE;i++){
      MECH[i] = 0;
   }

   // set up the SG-382 function generator 
   int ret_val_fg=0;
   struct FuncGen myFuncGen; 
   ret_val_fg = InitFuncGen(&myFuncGen);       // pass by reference to modify contents of myFuncGen 

   if(ret_val_fg!=0){
      printf("[NMRDAQ]: SG382 initialization FAILED.  Exiting... \n"); 
      exit(1);
   }

   if(gIsTest<2 || gIsTest==4 || gIsTest==5){
      ret_val_fg = ProgramFuncGen(myFuncGen); 
   }

   if(ret_val_fg!=0){
      printf("[NMRDAQ]: SG382 programming FAILED.  Do you need to reattach the connection to the SG382? \n"); 
      printf("[NMRDAQ]: Run the following: sudo chmod 666 /dev/ttyUSB0 \n"); 
      printf("[NMRDAQ]: Exiting... \n"); 
      printf("============================================================ \n"); 
      exit(1);
   }

   usleep(100000); // wait for 100 ms to let SG382 settle in

   // open the VME connection 
   int p = OpenVME(argc,argv); 

   // set up the FPGA 
   int ret_val_fpga=0;
   struct fpga myFPGA;
   struct fpgaPulseSequence myPulseSequence; 
   // initialize and program the FPGA 
   ret_val_fpga = InitFPGA(p,&myFPGA,&myPulseSequence);             // pass by reference to modify contents of myFPGA 
   if(ret_val_fpga!=0){
      printf("[NMRDAQ]: Acromag FPGA initialization FAILED.  Exiting... \n"); 
      exit(1);
   }

   // SIS ADC struct 
   struct adc myADC; 
   int ret_val_adc = 0;
   ret_val_adc = SISLoad(&myADC);    // load in data from input file 

   // return codes 
   int ret_val_daq = 0;
  
   if(gIsTest==2 || gIsTest==3){
      // just want to read the I/O space of the ADC 
      ret_val_adc = SISInit(p,&myADC,0);
   }

   // initialize all the stuff that won't change on the ADC 
   // ret_val_adc = SISInit(p,&myADC,1);
   ret_val_adc = SISBaseInit(p,&myADC); 
   // double rf_rec_pulse = 60E-3; 
   // ReconfigADCStruct(rf_rec_pulse,&myADC);
   // ret_val_adc = SISReInit(p,&myADC,0); 

   // this actually works. 
   // SISInit(p,&myADC,1); 

   if(ret_val_adc!=0){ 
      printf("[NMRDAQ]: ADC initialization FAILED.  Stopping the run. \n");
      return 1;
   }

   const int NEvents = myADC.fNumberOfEvents;   // total number of pulses 
   int *SwList = (int *)malloc( sizeof(int)*NEvents ); 
   for(i=0;i<NEvents;i++){
      SwList[i] = 0;
   }

   GetMechSwitchList(myPulseSequence,NEvents,SwList);    

   if(gIsTest==0){
      // regular operation  
      ret_val_daq = AcquireDataNew(p,myPulseSequence,&myADC,timestamp,output_dir,MECH); 
      // shut down the system and print data to file  
      ShutDownSystemNew(p,&myFuncGen,&myPulseSequence); 
      // print data to file(s) 
      if(ret_val_daq==0){
         GetTime(0,&myRun);  // get end time  
	 printf("[NMRDAQ]: Printing diagnostic data to file(s)... \n");  
	 PrintDiagnosticsNew(output_dir,NumComment,comment,myRun,myFuncGen,myPulseSequence,myADC);
	 PrintRunSummaryNew(output_dir,myRun,myFuncGen,myADC);
	 PrintTimeStampMicroSec(output_dir,myADC,timestamp); 
	 PrintMechSwIndex(output_dir,myRun,myADC,MECH); 
	 close(p);
      }else{
	 printf("[NMRDAQ]: Something is wrong with the software or the system!"); 
	 printf("  No data recorded to files. \n"); 
	 close(p);
      }
   }else if(gIsTest==1){
      // assumes output of system is sent to a scope; nothing is done with the ADC! 
      for(i=0;i<NEvents;i++){
	 ProgramSignalsToFPGANew(p,SwList[i],myPulseSequence);
      }
      ShutDownSystemNew(p,&myFuncGen,&myPulseSequence);
   }else if(gIsTest==2){
      // ADC test 
      ret_val_adc = SISInit(p,&myADC,0); 
   }

   printf("============================================================ \n"); 
   
   free(output_dir);
   free(MECH); 
   free(SwList); 

   for(i=0;i<cSIZE;i++){
      free(comment[i]); 
   }
   free(comment); 

   free(gDATA); 

   return 0; 
}
Example #16
0
int main(int argc, char** argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif

	std::vector<SampleInfo> samples =
	{
		INFO(Basic_Empty, "Altseedの基本", "空のウィンドウを表示するサンプル。"),
		//INFO(Basic_FullScreen, "フルスクリーンモード", "アプリケーションをフルスクリーンで起動するサンプル。"),

		INFO(TextureObject2D_Basic, "画像の表示", "画像を表示する基本的なサンプルです。"),
		INFO(TextureObject2D_Turn, "画像の上下反転", "画像の上下を反転して描画するサンプルです。"),
		INFO(TextureObject2D_Src, "画像の切り抜き", "画像の一部を切り出して描画するサンプルです。"),
		INFO(TextureObject2D_Transform, "画像の変形", "画像を回転させたり、拡大縮小して描画するサンプルです。"),

		INFO(Mouse_Position, "マウス座標の取得", "マウスの座標を取得し、その位置を表示するサンプルです。"),
		INFO(Mouse_Click, "マウスのクリック検知", "マウスの左クリックを検知するサンプルです。"),
		INFO(Mouse_State, "マウスボタンの状態", "マウスの中ボタンの状態を調べ、状態を表示するサンプルです。"),
		INFO(Mouse_Wheel, "マウスホイール", "マウスホイールの回転の度合いを調べ、表示するサンプルです。"),

		INFO(Keyboard_Basic, "キーボード入力の基本", "Zキーを押しているかどうかを調べ、結果を表示するサンプルです。"),
		INFO(Keyboard_SingularKey, "キーボードの入力状態", "キーボードのキー入力状態を詳しく調べ、状態を表示するサンプルです。"),
		INFO(Keyboard_PuralKeys, "複数のキーの入力状態", "キーボードの複数のキーの入力状態を調べ、表示するサンプルです。"),

		INFO(Joystick_Basic, "ジョイスティックのボタン入力", "ジョイスティックのボタンの入力状態を調べ、表示するサンプルです。"),
		INFO(Joystick_Axis, "アナログスティック入力", "ジョイスティックのアナログスティックの入力状態を調べ、表示するサンプルです。"),
		INFO(Joystick_GamePad, "ゲームパッド入力", "一部のゲームパッドの入力状態を調べ、表示するサンプルです。"),

		INFO(Sound_SE, "効果音の再生", "効果音(Sound Effect)を再生するサンプルです。"),
		INFO(Sound_BGM, "BGMの再生", "BGMを再生するサンプルです。"),
		INFO(Sound_Loop, "BGMのループ再生", "BGMをループ再生するサンプルです。"),

		INFO(TextObject2D_Basic, "文字列の描画", "文字列を描画するサンプルです。"),
		INFO(TextObject2D_DynamicFont, "フォントの動的生成", "フォントをプログラム実行中にに準備して、そのフォントで文字列を描画するサンプルです。"),
		INFO(TextObject2D_Rotate, "文字列の回転", "文字列を回転させて描画するサンプルです。"),
		INFO(TextObject2D_Filtered, "回転した文字列の滑らかな描画", "文字列の回転をしたときにギザギザが発生するのを防ぐ機能を使ったサンプルです。"),
		INFO(TextObject2D_Centering, "文字列の中央揃え", "文字列を中央揃えで描画するサンプルです。"),

		INFO(CameraObject2D_Basic, "カメラの基本", "カメラを用いて描画空間の一部を切り取って描画するサンプルです。"),
		INFO(CameraObject2D_Magnify, "カメラによる拡大描画", "カメラを用いて描画空間の一部を虫眼鏡のように拡大して描画するサンプルです。"),
		INFO(CameraObject2D_Group, "", ""),
		INFO(CameraObject2D_Texture, "", ""),

		INFO(EffectObject2D_Basic, "", ""),

		INFO(GeometryObject2D_CircleShape, "", ""),
		INFO(GeometryObject2D_ArcShape, "", ""),
		INFO(GeometryObject2D_RectangleShape, "", ""),
		INFO(GeometryObject2D_PolygonShape, "", ""),
		INFO(GeometryObject2D_PolygonShape_Textured, "", ""),

		INFO(Object2DComponent_Custom, "", ""),

		INFO(Collision2D_Basic, "", ""),
		INFO(Collision2D_Geometries, "", ""),

		INFO(File_PackFile, "", ""),
		INFO(File_RootDirectory, "", ""),
		INFO(File_StaticFile, "", ""),
		INFO(File_StreamFile, "", ""),

		INFO(SceneAndLayer_Basic, "", ""),
		INFO(SceneAndLayer_CustomLayer, "", ""),
		INFO(SceneAndLayer_CustomScene, "", ""),

		INFO(Transition_Fade, "フェードイン・フェードアウト", "画像を回転させたり、拡大縮小して描画するサンプルです。"),

		INFO(Dispose_Object2D, "", ""),
		INFO(Dispose_Layer2D, "", ""),

		INFO(PostEffect_GrayScale, "", ""),
		INFO(PostEffect_Sepia, "", ""),
		INFO(PostEffect_GaussianBlur, "", ""),
		INFO(PostEffect_LightBloom, "", ""),

		INFO(EngineMisc_ShowFps, "", ""),

		INFO(Texture_Basic, "", ""),
		INFO(Texture_Edit, "", ""),

		INFO(Log_Basic, "ログ出力", "ログファイルにログを出力するサンプルです。"),
		INFO(Log_OutputLevel, "ログの出力レベルの指定", "ログファイルにログを出力するサンプルです。\n出力レベルを指定し、低レベルのログを無視します。"),
		INFO(Log_Table, "表組みされたログ出力", "ログファイルに表組みで表現されたログを出力するサンプルです。"),

		INFO(MediaPlayer_Basic, "", ""),

	};

	auto browser = SampleBrowser(samples);
	browser.Run();

	return 0;
}
Example #17
0
String Path::ChangeExtension(RCString path, RCString ext) {
	return Combine(GetDirectoryName(path), GetFileNameWithoutExtension(path) + ext);
}
BOOL CCyberToolBoxApp::InitInstance()
{
	// 標準的な初期化処理
	// もしこれらの機能を使用せず、実行ファイルのサイズを小さく
	//  したければ以下の特定の初期化ルーチンの中から不必要なもの
	//  を削除してください。

#ifndef _DEBUG
#ifndef INSTALL_BIN_DIR
	char moduleFileName[_MAX_PATH];
	HMODULE module = GetModuleHandle(AfxGetAppName());
	GetModuleFileName(module, moduleFileName, sizeof(moduleFileName)-1);
	SetCurrentDirectory(GetDirectoryName(moduleFileName));
//	MessageBox(NULL, GetDirectoryName(moduleFileName), "Current Directory", IDOK);
#endif
#endif

	WorldInit();

#ifdef _AFXDLL
	Enable3dControls();			// 共有 DLL の中で MFC を使用する場合にはここを呼び出してください。
#else
	Enable3dControlsStatic();	// MFC と静的にリンクしている場合にはここを呼び出してください。
#endif

	LoadStdProfileSettings();  // 標準の INI ファイルのオプションをロードします (MRU を含む)

	// アプリケーション用のドキュメント テンプレートを登録します。ドキュメント テンプレート
	//  はドキュメント、フレーム ウィンドウとビューを結合するために機能します。

	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CCyberToolBoxDoc),
		RUNTIME_CLASS(CMainFrame),       // メイン SDI フレーム ウィンドウ
		RUNTIME_CLASS(CCyberToolBoxView));
	AddDocTemplate(pDocTemplate);

	// DDE、file open など標準のシェル コマンドのコマンドラインを解析します。
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// コマンドラインでディスパッチ コマンドを指定します。
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	mDgmDocTemplate = new CMultiDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CDiagramDoc),
		RUNTIME_CLASS(CDiagramFrame),       // メイン SDI フレーム ウィンドウ
		RUNTIME_CLASS(CDiagramView));
	AddDocTemplate(mDgmDocTemplate);

	mpPerspectiveDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(PerspectiveDoc),
		RUNTIME_CLASS(PerspectiveFrame),       // メイン SDI フレーム ウィンドウ
		RUNTIME_CLASS(PerspectiveView));
	AddDocTemplate(mpPerspectiveDocTemplate);
	mpPerspectiveDocument = mpPerspectiveDocTemplate->OpenDocumentFile(NULL);

	mpOrthoDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(OrthoDoc),
		RUNTIME_CLASS(OrthoFrame),       // メイン SDI フレーム ウィンドウ
		RUNTIME_CLASS(OrthoView));
	AddDocTemplate(mpOrthoDocTemplate);
	mpOrthoDocument = mpOrthoDocTemplate->OpenDocumentFile(NULL);

/*
	setSceneGraphView(view);
*/
//	GetWorld()->createJavaConsole();

	m_pMainWnd->SetWindowText(_T("CyberToolbox"));

	assert(SetPriorityClass(GetCurrentProcess(),HIGH_PRIORITY_CLASS) == TRUE);

	return TRUE;
}
Example #19
0
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
int main(int argc, char **argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif

	InitWindow();
	
	// 描画用インスタンスの生成
	g_renderer = ::EffekseerRendererDX9::Renderer::Create( g_d3d_device, 2000 );
	
	// エフェクト管理用インスタンスの生成(自動フリップは行わない)
	g_manager = ::Effekseer::Manager::Create( 2000, false );

	// 描画用インスタンスから描画機能を設定
	g_manager->SetSpriteRenderer( g_renderer->CreateSpriteRenderer() );
	g_manager->SetRibbonRenderer( g_renderer->CreateRibbonRenderer() );
	g_manager->SetRingRenderer( g_renderer->CreateRingRenderer() );
	g_manager->SetModelRenderer( g_renderer->CreateModelRenderer() );

	// 描画用インスタンスからテクスチャの読込機能を設定
	// 独自拡張可能、現在はファイルから読み込んでいる。
	g_manager->SetTextureLoader( g_renderer->CreateTextureLoader() );
	g_manager->SetModelLoader( g_renderer->CreateModelLoader() );

	// 音再生用インスタンスの生成
	g_sound = ::EffekseerSound::Sound::Create( g_xa2, 16, 16 );

	// 音再生用インスタンスから再生機能を指定
	g_manager->SetSoundPlayer( g_sound->CreateSoundPlayer() );
	
	// 音再生用インスタンスからサウンドデータの読込機能を設定
	// 独自拡張可能、現在はファイルから読み込んでいる。
	g_manager->SetSoundLoader( g_sound->CreateSoundLoader() );

	// 投影行列を設定
	g_renderer->SetProjectionMatrix(
		::Effekseer::Matrix44().PerspectiveFovRH( 90.0f / 180.0f * 3.14f, (float)g_window_width / (float)g_window_height, 1.0f, 50.0f ) );

	// カメラ行列を設定
	g_renderer->SetCameraMatrix(
		::Effekseer::Matrix44().LookAtRH( ::Effekseer::Vector3D( 10.0f, 5.0f, 20.0f ), ::Effekseer::Vector3D( 0.0f, 0.0f, 0.0f ), ::Effekseer::Vector3D( 0.0f, 1.0f, 0.0f ) ) );
	
	// エフェクトの読込
	g_effect = Effekseer::Effect::Create( g_manager, (const EFK_CHAR*)L"test.efk" );

	// スレッド生成
	g_thread = std::thread([]() -> void { UpdateAsync(nullptr); });
			
	MainLoop();
	
	// スレッド破棄
	g_esc = true;
	g_thread.join();

	// エフェクトの破棄
	ES_SAFE_RELEASE( g_effect );

	// 先にエフェクト管理用インスタンスを破棄
	g_manager->Destroy();

	// 次に音再生用インスタンスを破棄
	g_sound->Destroy();

	// 次に描画用インスタンスを破棄
	g_renderer->Destroy();

	// XAudio2の解放
	if( g_xa2_master != NULL )
	{
		g_xa2_master->DestroyVoice();
		g_xa2_master = NULL;
	}
	ES_SAFE_RELEASE( g_xa2 );

	// DirectXの解放
	ES_SAFE_RELEASE( g_d3d_device );
	ES_SAFE_RELEASE( g_d3d );

	// COMの終了処理
	CoUninitialize();

	return 0;
}
Example #20
0
int main(int argc, char** argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif

	InitWindow();

	// Create an instance for drawing
	// 描画用インスタンスを生成する
	g_renderer = ::EffekseerRendererGL::Renderer::Create(2000);

	// Create an instance for managing effects
	// エフェクト管理用インスタンスを生成する
	g_manager = ::Effekseer::Manager::Create(2000);

	// Extend a format which can be loaded
	// 読み込めるフォーマットを拡張する
	g_manager->GetSetting()->AddEffectFactory(new glmEffectFactory());

	// Specify functions to draw from the instance
	// 描画用インスタンスから描画機能を設定する
	g_manager->SetSpriteRenderer(g_renderer->CreateSpriteRenderer());
	g_manager->SetRibbonRenderer(g_renderer->CreateRibbonRenderer());
	g_manager->SetRingRenderer(g_renderer->CreateRingRenderer());
	g_manager->SetModelRenderer(g_renderer->CreateModelRenderer());

	// Specify methods to load textures from the instance
	// You can extend this methods. it loads from only files in this time.
	// 描画用インスタンスからテクスチャの読込機能を設定する
	// この機能は拡張できる。現在はファイルのみから読み込んでいる。
	g_manager->SetTextureLoader(g_renderer->CreateTextureLoader());
	g_manager->SetModelLoader(g_renderer->CreateModelLoader());

	// Specify a position of eye
	// 視点位置を設定する
	g_position = ::Effekseer::Vector3D(10.0f, 5.0f, 20.0f);

	// Specify a projection matrix
	// 投影行列を設定する
	g_renderer->SetProjectionMatrix(::Effekseer::Matrix44().PerspectiveFovRH_OpenGL(
		90.0f / 180.0f * 3.14f, (float)g_window_width / (float)g_window_height, 1.0f, 50.0f));

	// Specify a camera matrix
	// カメラ行列を設定する
	g_renderer->SetCameraMatrix(
		::Effekseer::Matrix44().LookAtRH(g_position, ::Effekseer::Vector3D(0.0f, 0.0f, 0.0f), ::Effekseer::Vector3D(0.0f, 1.0f, 0.0f)));

	// Load an effect
	// エフェクトを読み込む
	g_effect = Effekseer::Effect::Create(g_manager, u"laser.glb");

	// Playback an effect
	// エフェクトを再生する
	g_handle = g_manager->Play(g_effect, 0, 0, 0);

	MainLoop();

	// Stop to playback the effect
	// エフェクトの再生を停止する
	g_manager->StopEffect(g_handle);

	// To finalize OpenGL, make context enabled
	// OpenGLを終了するために、コンテキストを有効にする
	wglMakeCurrent(g_hDC, g_hGLRC);

	// Dispose the effect
	// エフェクトを破棄する
	ES_SAFE_RELEASE(g_effect);

	// First dispose the instance for managing effects
	// 先にエフェクト管理用インスタンスを破棄する
	g_manager->Destroy();

	// Next dispose the instance for drawing effects
	// 次に描画用インスタンスを破棄する
	g_renderer->Destroy();

	// Finish OpenGL
	// OpenGLを終了させる
	wglMakeCurrent(0, 0);
	wglDeleteContext(g_hGLRC);
	timeEndPeriod(1);

	// COMを終了させる
	// Finish COM
	CoUninitialize();

	return 0;
}
Example #21
0
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
int main(int argc, char **argv)
{
#if _WIN32
	char current_path[MAX_PATH + 1];
	GetDirectoryName(current_path, argv[0]);
	SetCurrentDirectoryA(current_path);
#endif

	InitWindow();

	// 描画用インスタンスの生成
	g_renderer = ::EffekseerRendererDX9::Renderer::Create( g_d3d_device, 2000 );
	
	// Specify a distortion function
	// 歪み機能を設定

	// If you'd like to distort background and particles by rendering, it need to specify it.
	// It is a bit heavy
	// もし、描画するごとに背景とパーティクルを歪ませたい場合、設定する必要がある
	// やや重い
	g_renderer->SetDistortingCallback(new DistortingCallback());

	// 背景バッファの生成
	g_d3d_device->CreateTexture(
		640,
		480,
		1,
		D3DUSAGE_RENDERTARGET,
		D3DFMT_A8R8G8B8,
		D3DPOOL_DEFAULT,
		&g_backgroundTexture,
		NULL
		);

	g_backgroundTexture->GetSurfaceLevel(0, &g_backgroundSurface);

	// エフェクト管理用インスタンスの生成
	g_manager = ::Effekseer::Manager::Create( 2000 );

	// 描画用インスタンスから描画機能を設定
	g_manager->SetSpriteRenderer( g_renderer->CreateSpriteRenderer() );
	g_manager->SetRibbonRenderer( g_renderer->CreateRibbonRenderer() );
	g_manager->SetRingRenderer( g_renderer->CreateRingRenderer() );
	g_manager->SetTrackRenderer(g_renderer->CreateTrackRenderer());
	g_manager->SetModelRenderer( g_renderer->CreateModelRenderer() );
	
	// 描画用インスタンスからテクスチャの読込機能を設定
	// 独自拡張可能、現在はファイルから読み込んでいる。
	g_manager->SetTextureLoader( g_renderer->CreateTextureLoader() );
	g_manager->SetModelLoader( g_renderer->CreateModelLoader() );

	// 音再生用インスタンスの生成
	g_sound = ::EffekseerSound::Sound::Create( g_xa2, 16, 16 );

	// 音再生用インスタンスから再生機能を指定
	g_manager->SetSoundPlayer( g_sound->CreateSoundPlayer() );
	
	// 音再生用インスタンスからサウンドデータの読込機能を設定
	// 独自拡張可能、現在はファイルから読み込んでいる。
	g_manager->SetSoundLoader( g_sound->CreateSoundLoader() );

	// 視点位置を確定
	g_position = ::Effekseer::Vector3D(10.0f, 5.0f, 20.0f) * 0.25;

	// 投影行列を設定
	g_renderer->SetProjectionMatrix(
		::Effekseer::Matrix44().PerspectiveFovRH(90.0f / 180.0f * 3.14f, (float)g_window_width / (float)g_window_height, 1.0f, 50.0f));

	// カメラ行列を設定
	g_renderer->SetCameraMatrix(
		::Effekseer::Matrix44().LookAtRH(g_position, ::Effekseer::Vector3D(0.0f, 0.0f, 0.0f), ::Effekseer::Vector3D(0.0f, 1.0f, 0.0f)));

	// エフェクトの読込
	g_effect = Effekseer::Effect::Create(g_manager, (const EFK_CHAR*)L"distortion.efk");

	// エフェクトの再生
	g_handle = g_manager->Play(g_effect, 0, 0, 0);
	
	MainLoop();

	// エフェクトの停止
	g_manager->StopEffect(g_handle);

	// エフェクトの破棄
	ES_SAFE_RELEASE(g_effect);

	// 先にエフェクト管理用インスタンスを破棄
	g_manager->Destroy();

	// 次に音再生用インスタンスを破棄
	g_sound->Destroy();

	// 次に描画用インスタンスを破棄
	g_renderer->Destroy();

	// XAudio2の解放
	if( g_xa2_master != NULL )
	{
		g_xa2_master->DestroyVoice();
		g_xa2_master = NULL;
	}
	ES_SAFE_RELEASE( g_xa2 );

	// バックバッファの破棄
	ES_SAFE_RELEASE( g_backgroundTexture );
	ES_SAFE_RELEASE( g_backgroundSurface );

	// DirectXの解放
	ES_SAFE_RELEASE( g_d3d_device );
	ES_SAFE_RELEASE( g_d3d );

	// COMの終了処理
	CoUninitialize();

	return 0;
}
/**
 * Read textures associated with all materials and load images to GL
 */
bool AssimpLoader::LoadTexturesToGL(std::string modelFilename) {

    // read names of textures associated with all materials
    textureNameMap.clear();

    for (unsigned int m = 0; m < scene->mNumMaterials; ++m) {

        int textureIndex = 0;
        aiString textureFilename;
        aiReturn isTexturePresent = scene->mMaterials[m]->GetTexture(aiTextureType_DIFFUSE,
                                                                     textureIndex,
                                                                     &textureFilename);
        while (isTexturePresent == AI_SUCCESS) {
            //fill map with textures, OpenGL image ids set to 0
            textureNameMap.insert(std::pair<std::string, GLuint>(textureFilename.data, 0));

            // more textures? more than one texture could be associated with a material
            textureIndex++;
            isTexturePresent = scene->mMaterials[m]->GetTexture(aiTextureType_DIFFUSE,
                                                                textureIndex, &textureFilename);
        }
    }

    int numTextures = (int) textureNameMap.size();
    MyLOGI("Total number of textures is %d ", numTextures);

    // create and fill array with texture names in GL
    GLuint * textureGLNames = new GLuint[numTextures];
    glGenTextures(numTextures, textureGLNames);

    // Extract the directory part from the file name
    // will be used to read the texture
    std::string modelDirectoryName = GetDirectoryName(modelFilename);

    // iterate over the textures, read them using OpenCV, load into GL
    std::map<std::string, GLuint>::iterator textureIterator = textureNameMap.begin();
    int i = 0;
    for (; textureIterator != textureNameMap.end(); ++i, ++textureIterator) {

        std::string textureFilename = (*textureIterator).first;  // get filename
        std::string textureFullPath = modelDirectoryName + "/" + textureFilename;
        (*textureIterator).second = textureGLNames[i];	  // save texture id for filename in map

        // load the texture using OpenCV
        MyLOGI("Loading texture %s", textureFullPath.c_str());
        cv::Mat textureImage = cv::imread(textureFullPath);
        if (!textureImage.empty()) {

            // opencv reads textures in BGR format, change to RGB for GL
            cv::cvtColor(textureImage, textureImage, CV_BGR2RGB);
            // opencv reads image from top-left, while GL expects it from bottom-left
            // vertically flip the image
            cv::flip(textureImage, textureImage, 0);

            // bind the texture
            glBindTexture(GL_TEXTURE_2D, textureGLNames[i]);
            // specify linear filtering
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
            // load the OpenCV Mat into GLES
            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, textureImage.cols,
                         textureImage.rows, 0, GL_RGB, GL_UNSIGNED_BYTE,
                         textureImage.data);
            CheckGLError("AssimpLoader::loadGLTexGen");

        } else {

            MyLOGE("Couldn't load texture %s", textureFilename.c_str());

            //Cleanup and return
            delete[] textureGLNames;
            return false;

        }
    }

    //Cleanup and return
    delete[] textureGLNames;
    return true;
}