void LeapController::Update()
{
    UpdateDeviceProperties();
    UpdateDevicePropertiesGM();

    UpdateFrameData();
    UpdateFrameGM();
}
Exemple #2
0
static BOOL CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch ( msg )
	{
		case WM_INITDIALOG:
		{
			TranslateDialogDefault(hwndDlg);
			SendMessage(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), EM_LIMITTEXT, 
					MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE - 1, 0);

			WNDPROC old_proc = (WNDPROC) SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), 
														GWL_WNDPROC, (LONG) StatusMsgEditSubclassProc);

			SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWL_USERDATA, (long) old_proc);

			return TRUE;
		}

		case WMU_SETDATA:
		{
			SetStatusMessageData *data = (SetStatusMessageData *) malloc(sizeof(SetStatusMessageData));
			data->status = (int)wParam;
			data->proto_num = (int)lParam;

			SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) data);

			if (data->proto_num >= 0)
			{
				Protocol proto = GetProtocolByIndex(data->proto_num);

				HICON hIcon = (HICON) proto.Call(PS_LOADICON, PLI_PROTOCOL);
				if (hIcon != NULL)
				{
					SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
					DestroyIcon(hIcon);
				}

				char title[256];
				mir_snprintf(title, sizeof(title), Translate("Set My Status Message for %s"), 
					proto.GetDescription());
				SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title);

				SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto.GetStatusMsg());
			}
			else if (data->status != 0)
			{
				SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(Status2SkinIcon(data->status)));

				char title[256];
				mir_snprintf(title, sizeof(title), Translate("Set My Status Message for %s"), 
					CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, data->status, 0));
				SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title);

				SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg(data->status));
			}
			else
			{
				SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));

				SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg());
			}

			return TRUE;
		}
		case WM_COMMAND:
			switch(wParam)
			{
				case IDOK:
				{
					char tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE];
					GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, sizeof(tmp));

					SetStatusMessageData *data = (SetStatusMessageData *) GetWindowLong(hwndDlg, GWL_USERDATA);

					if (data->proto_num >= 0)
						GetProtocolByIndex(data->proto_num).SetStatusMsg(tmp);
					else if (data->status == 0)
						protocols->SetStatusMsgs(tmp);
					else
						protocols->SetStatusMsgs(data->status, tmp);

					// To force a refresh
					UpdateFrameData();

					DestroyWindow(hwndDlg);
					break;
				}
				case IDCANCEL:
				{
 					DestroyWindow(hwndDlg);
					break;
				}
			}
			break;

		case WM_CLOSE:
			DestroyWindow(hwndDlg);
			break;

		case WM_DESTROY:
			SetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWL_WNDPROC, 
						  GetWindowLong(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWL_USERDATA));
			free((SetStatusMessageData *) GetWindowLong(hwndDlg, GWL_USERDATA));
			InterlockedExchange(&status_msg_dialog_open, 0);
			break;
	}
	
	return FALSE;
}
void FForwardPlusRenderer::DrawScene(const FCamera& Camera, class IScene* Scene)
{
	FProfiler::Get().PushSection("Rendering", "Forward+");

	FMaterialParameters::FlushShaderResources(GraphicsContext->GetImmediateContext());

	CurrentViewport = Camera.GetViewport();

	// Setup buffers
	UpdateFrameData(Camera, Scene);

	{
		FProfiler::Get().PushSection("Rendering", "Depth-Normal PrePass");
		// We use the result of this pass for both SSAO and Light Culling (we need depth information for that).
		DoDepthNormalPrePass(Camera, Scene);
		if (SSAOEnabled.AsBoolean())
		{
			AmbientOcclusion->Apply(CurrentViewport, DepthTarget.Get(), NormalTarget.Get(), OcclusionTarget.Get());
			MaterialManager->SetGlobalResourceView(FScreenSpaceAmbientOcclusion::kAmbientOcclusionMap, OcclusionTarget->GetRenderResource());
		}
		FProfiler::Get().PopSection();
	}

	{
		FProfiler::Get().PushSection("Rendering", "Shadow Maps Pass");
		// Render shadow maps
		if (ShadowMappingEnabled.AsBoolean())
			ShadowMapping->GatherShadowMaps(Scene);
		FProfiler::Get().PopSection();
	}

	{
		FProfiler::Get().PushSection("Rendering", "Light Culling Pass");
		// Perform light culling and upload light buffers
		LightPass->Apply(this, ShadowMapping.Get(), DepthTarget.Get(), Scene, Camera);
		FProfiler::Get().PopSection();
	}

	{
		FProfiler::Get().PushSection("Rendering", "Scene Pass");
		// Render the scene in forward fashion
		DoScenePass(Camera, Scene);
		FProfiler::Get().PopSection();
	}

	{
		FProfiler::Get().PushSection("Rendering", "HDR Post Process Pass");
		HighDynamicRangeTarget->ResolveFrom(GraphicsContext->GetImmediateContext(), HighDynamicRangeMSAATarget.Get());
		HighDynamicRange->Apply(CurrentViewport, HighDynamicRangeTarget.Get(), GraphicsContext->GetBackBuffer());
		FProfiler::Get().PopSection();
	}

	FProfiler::Get().PopSection();
#if DEBUG
	FViewport Fullscreen(0, 0, GraphicsContext->GetWidth(), GraphicsContext->GetHeight());
	D3D11_VIEWPORT Viewport = Fullscreen.CreateRenderViewport();
	ID3D11RenderTargetView* RenderTarget = GraphicsContext->GetBackBuffer();
	GraphicsContext->GetImmediateContext()->RSSetViewports(1, &Viewport);
	GraphicsContext->GetImmediateContext()->ClearDepthStencilView(GraphicsContext->GetDepthStencil(), D3D11_CLEAR_STENCIL | D3D11_CLEAR_DEPTH, 1.0f, 0);
	GraphicsContext->GetImmediateContext()->OMSetRenderTargets(1, &RenderTarget, GraphicsContext->GetDepthStencil());
	if (ShowHdrDebug.AsBoolean())
	{
		HighDynamicRange->DebugHdr(SpriteBatch.Get());
		FInstanceBuffer InstanceBuffer = FInstanceBuffer::Identity;
		FDrawCall DrawCall(GraphicsContext->GetImmediateContext(), &InstanceBuffer, nullptr);
		SpriteBatch->Render(DrawCall);
	}
#endif
}