AUI_ERRCODE ctp2_Button::DrawThis(aui_Surface *surface, sint32 x, sint32 y) { if(IsHidden()) return AUI_ERRCODE_OK; if(!surface) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); DrawLayers(surface, &rect); DrawThisText(surface, &rect); if(surface == m_window->TheSurface()) m_window->AddDirtyRect(&rect); if(m_window->GetFocusControl() == this) { primitives_FrameThickRect16(surface, &rect, g_colorSet->GetColor(COLOR_UI_BOX), 3); } return AUI_ERRCODE_OK; }
AUI_ERRCODE aui_Control::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if(m_numberOfLayers > 0) DrawLayers(surface, &rect); else DrawThisStateImage(0, surface, &rect); DrawThisText( surface, &rect ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
void MainForwardRenderPass::Draw(RenderSystem * renderSystem, uint32 clearBuffers) { Camera *mainCamera = renderSystem->GetMainCamera(); Camera *drawCamera = renderSystem->GetDrawCamera(); DVASSERT(mainCamera); DVASSERT(drawCamera); drawCamera->SetupDynamicParameters(); if (mainCamera!=drawCamera) mainCamera->PrepareDynamicParameters(); if (needWaterPrepass) { /*water presence is cached from previous frame in optimization purpose*/ /*if on previous frame there was water - reflection and refraction textures are rendered first (it helps to avoid excessive renderPassBatchArray->PrepareVisibilityArray)*/ /* if there was no water on previous frame, and it appears on this frame - reflection and refractions textures are still to be rendered*/ PrepareReflectionRefractionTextures(renderSystem); } //important: FoliageSystem also using main camera for cliping vegetation cells PrepareVisibilityArrays(mainCamera, renderSystem); RenderLayerBatchArray *waterLayer = renderPassBatchArray->Get(RenderLayerManager::Instance()->GetLayerIDByName(LAYER_WATER)); uint32 waterBatchesCount = waterLayer->GetRenderBatchCount(); if (waterBatchesCount) { waterBox.Empty(); for (uint32 i=0; i<waterBatchesCount; ++i) { RenderBatch *batch = waterLayer->Get(i); waterBox.AddAABBox(batch->GetRenderObject()->GetWorldBoundingBox()); } } if (!needWaterPrepass&&waterBatchesCount) { PrepareReflectionRefractionTextures(renderSystem); /*as PrepareReflectionRefractionTextures builds render batches according to reflection/refraction camera - render batches in main pass list are not valid anymore*/ /*to avoid this happening every frame water visibility is cached from previous frame (needWaterPrepass)*/ /*however if there was no water on previous frame and there is water on this frame visibilityArray should be re-prepared*/ renderPassBatchArray->Clear(); renderPassBatchArray->PrepareVisibilityArray(&visibilityArray, mainCamera); } needWaterPrepass = (waterBatchesCount!=0); //for next frame; ClearBuffers(clearBuffers); DrawLayers(mainCamera); }
LRESULT CALLBACK WndLayersProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; HDC hdc; RECT rect; switch (message) { case WM_PAINT: hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &rect); DrawLayers(hdc, MARGIN, MARGIN, rect.right - BUTTON_WIDTH, rect.bottom - MARGIN, SendDlgItemMessage(GetDlgItem(GetParent(hWnd), IDC_GRAPH_WINDOW), IDC_RADIO_1, BM_GETCHECK, NULL, NULL)); EndPaint(hWnd, &ps); break; case WM_LBUTTONDOWN: { short y; y = HIWORD(lParam); double snowHeight = CSnow::current()->getSnowHeight(); GetClientRect(hWnd, &rect); double winHeight = rect.bottom; double dy = (winHeight - y)*snowHeight/(winHeight - MARGIN); double h = 0; for (int l = 0; l < CSnow::current()->getLayersNum(); l++) { if (dy < (h = h + CSnow::current()->getLayer(l)->GetHeight())) { CSnow::current()->setSelection(l); //ListView_SetItemState(GetDlgItem(GetParent(hWnd), IDC_LAYERS_LIST), l, ); //ListView_SetSelectionMark(GetDlgItem(GetParent(hWnd), IDC_LAYERS_LIST), l); HWND hListview = GetDlgItem(GetParent(hWnd), IDC_LAYERS_LIST); ListView_SetItemState(hListview, ListView_GetItemCount(hListview) - l - 1, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); break; } } UpdateCurrentLayer(); break; } case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hWnd, message, wParam, lParam); } return 0; }
void RenderPass::Draw(RenderSystem * renderSystem, uint32 clearBuffers) { Camera *mainCamera = renderSystem->GetMainCamera(); Camera *drawCamera = renderSystem->GetDrawCamera(); DVASSERT(drawCamera); DVASSERT(mainCamera); drawCamera->SetupDynamicParameters(); if (mainCamera!=drawCamera) mainCamera->PrepareDynamicParameters(); PrepareVisibilityArrays(mainCamera, renderSystem); ClearBuffers(clearBuffers); DrawLayers(mainCamera); }
void WaterReflectionRenderPass::Draw(RenderSystem * renderSystem, uint32 clearBuffers) { Camera *mainCamera = renderSystem->GetMainCamera(); Camera *drawCamera = renderSystem->GetDrawCamera(); if (!passDrawCamera) { passMainCamera = new Camera(); passDrawCamera = new Camera(); } passMainCamera->CopyMathOnly(*mainCamera); UpdateCamera(passMainCamera); Vector4 clipPlane(0,0,1, -(waterLevel-0.1f)); Camera* currMainCamera = passMainCamera; Camera* currDrawCamera; if (drawCamera==mainCamera) { currDrawCamera = currMainCamera; } else { passDrawCamera->CopyMathOnly(*drawCamera); UpdateCamera(passDrawCamera); currDrawCamera = passDrawCamera; currMainCamera->PrepareDynamicParameters(&clipPlane); } currDrawCamera->SetupDynamicParameters(&clipPlane); //add clipping plane visibilityArray.Clear(); renderSystem->GetRenderHierarchy()->Clip(currMainCamera, &visibilityArray, RenderObject::CLIPPING_VISIBILITY_CRITERIA | RenderObject::VISIBLE_REFLECTION); renderPassBatchArray->Clear(); renderPassBatchArray->PrepareVisibilityArray(&visibilityArray, currMainCamera); ClearBuffers(clearBuffers); DrawLayers(currMainCamera); }