Beispiel #1
0
HRESULT CameraMoveTool::GetViewWidthAndHeight(__in IViewController *pView, __out UINT &width, __out UINT &height)
{
	HRESULT hr;

	SmartPtr<IViewControllerScene> spViewSceneController;
	hr = pView->QueryInterface(&spViewSceneController);

	if (SUCCEEDED(hr))
	{
		SmartPtr<IRenderer> spRenderer;
		hr = spViewSceneController->GetRenderer(&spRenderer);
		if (SUCCEEDED(hr))
		{
			spRenderer->GetWindowWidthAndHeight(width, height);
		}
	}
	return hr;
}
Beispiel #2
0
HRESULT CameraMoveTool::GetCameraFromViewController(__in IViewController *pView, __deref_out_opt ISceneObjectCamera **ppCamera)
{
	HRESULT hr;

	SmartPtr<IViewControllerScene> spViewSceneController;
	hr = pView->QueryInterface(&spViewSceneController);

	if (SUCCEEDED(hr))
	{
		SmartPtr<IRenderer> spRenderer;
		hr = spViewSceneController->GetRenderer(&spRenderer);
		if (SUCCEEDED(hr))
		{
			SmartPtr<ISceneObjectCamera> spCamera;
			hr = spRenderer->GetCamera(&spCamera);

			if (SUCCEEDED(hr))
			{
				hr = spCamera.CopyToOpt(ppCamera);
			}
		}
	}
	return hr;
}