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


C++ CScene::SetActiveCamera方法代码示例

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


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

示例1: winproc

LRESULT CALLBACK winproc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	MENUITEMINFO	mii;
	HMENU		hMenu = GetMenu(hWnd);
	OPENFILENAME	ofn;
	char		path[MAX_PATH];
	HCURSOR		hcur;

	switch (uMsg) {

	case WM_COMMAND:
		switch (LOWORD(wParam)) {

		case ID_MENU_FILE_OPEN:		// wczytywanie pliku
			memset(&ofn, 0, sizeof(ofn));
			memset(path, 0, MAX_PATH);
			ofn.lStructSize = sizeof(ofn);
			ofn.hwndOwner = hWnd;
			ofn.lpstrFile = path;
			ofn.nMaxFile = MAX_PATH;
			ofn.lpstrFilter = "3D Studio R4 (*.3ds)\0*.3ds\0\0";
			ofn.lpstrTitle = NULL;
			ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
			ofn.lpstrInitialDir = ".\\";

			if (::GetOpenFileName(&ofn)) {
				CLoader3DS	load_3ds(g_Scene);

				hcur = ::SetCursor(LoadCursor(NULL, IDC_WAIT)); 

				load_3ds.Load(path);
				if (!g_Scene.SetActiveCamera("Camera01"))
					g_Scene.SetFirstCamera();

				::SetCursor(hcur);

				/// ustaw odpowiednio menu systemowe:
				::ZeroMemory(&mii, sizeof(mii));
				mii.cbSize = sizeof(mii);
				mii.fMask = MIIM_STATE;
				mii.fState = MFS_ENABLED;
				::SetMenuItemInfo(hMenu, ID_MENU_VIEW_ANIMATION, FALSE, &mii);
				::SetMenuItemInfo(hMenu, ID_MENU_FILE_CLOSE, FALSE, &mii);

				/// dopisz do titlebar'u nazwê otwartego pliku:
				char *foo = new char [strlen(g_lpszNoFileProgName) + strlen(path + ofn.nFileOffset) + 4];
				strcpy(foo, g_lpszNoFileProgName);
				strcat(foo, " - ");
				strcat(foo, path + ofn.nFileOffset);
				DELETE_ARRAY(g_lpszProgName);
				g_lpszProgName = foo;
				::SetWindowText(hWnd, g_lpszProgName);
				
				/// tutaj poœrednio ustawienie odpowiednie nazwu dla okienka z animacj¹:
				DELETE_ARRAY(g_WindowParams.szTitle);
				g_WindowParams.szTitle = strdup(path + ofn.nFileOffset);
			}

			break;

		case ID_MENU_FILE_CLOSE: {
			g_Scene.Release();

			/// wygaœ odpowiednie opcje w menu:
			ZeroMemory(&mii, sizeof(mii));
			mii.cbSize = sizeof(mii);
			mii.fMask = MIIM_STATE;
			mii.fState = MFS_GRAYED;
			::SetMenuItemInfo(hMenu, ID_MENU_VIEW_ANIMATION, FALSE, &mii);
			::SetMenuItemInfo(hMenu, ID_MENU_FILE_CLOSE, FALSE, &mii);

			/// umieœæ w titlebarze sam¹ nazwê aplikacji:
			DELETE_ARRAY(g_lpszProgName);
			g_lpszProgName = strdup(g_lpszNoFileProgName);
			::SetWindowText(hWnd, g_lpszProgName);
			} 
			break;

		case ID_MENU_FILE_EXIT:
			g_Scene.Release();
			::SendMessage(hWnd, WM_CLOSE, 0, 0);
			break;

		case ID_MENU_VIEW_ANIMATION: {

			if (!DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DIALOG1), MainhWnd, (DLGPROC)SetupDlgProc))
				return 0;

			if (g_WindowParams.szTitle == NULL)
				g_WindowParams.szTitle = strdup("test");
			g_WindowParams.lpfnProc = MainWndProc;
			g_WindowParams.hInst = g_hInstance;

			try {
				if (!g_Scene.SetActiveCamera("Camera01"))
					g_Scene.SetFirstCamera();

				::EnableWindow(hWnd, FALSE);

				InitOpenGL(g_WindowParams, hWnd);
//.........这里部分代码省略.........
开发者ID:lukasz-baran,项目名称:engine3d,代码行数:101,代码来源:animmain.cpp


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