void FForwardShadingSceneRenderer::RenderForwardShadingBasePass() { SCOPED_DRAW_EVENT(BasePass, DEC_SCENE_ITEMS); SCOPE_CYCLE_COUNTER(STAT_BasePassDrawTime); EBasePassSort::Type SortMode = GetSortMode(); int32 MaxDraws = GMaxBasePassDraws.GetValueOnRenderThread(); if (MaxDraws <= 0) { MaxDraws = MAX_int32; } if (SortMode == EBasePassSort::SortStateBuckets) { SCOPE_CYCLE_COUNTER(STAT_SortStaticDrawLists); for (int32 DrawType = 0; DrawType < FScene::EBasePass_MAX; DrawType++) { Scene->BasePassForForwardShadingLowQualityLightMapDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation); Scene->BasePassForForwardShadingDistanceFieldShadowMapLightMapDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation); Scene->BasePassForForwardShadingDirectionalLightAndSHIndirectDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation); Scene->BasePassForForwardShadingNoLightMapDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation); } } // Draw the scene's emissive and light-map color. for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++) { SCOPED_CONDITIONAL_DRAW_EVENTF(EventView, Views.Num() > 1, DEC_SCENE_ITEMS, TEXT("View%d"), ViewIndex); FViewInfo& View = Views[ViewIndex]; // Opaque blending RHISetBlendState(TStaticBlendStateWriteMask<CW_RGBA>::GetRHI()); // Note, this is a reversed Z depth surface, using CF_GreaterEqual. RHISetDepthStencilState(TStaticDepthStencilState<true, CF_GreaterEqual>::GetRHI()); RHISetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1); // Render the base pass static data if (SortMode == EBasePassSort::SortPerMesh) { SCOPE_CYCLE_COUNTER(STAT_StaticDrawListDrawTime); MaxDraws -= Scene->BasePassForForwardShadingLowQualityLightMapDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility,MaxDraws); MaxDraws -= Scene->BasePassForForwardShadingDistanceFieldShadowMapLightMapDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility,MaxDraws); MaxDraws -= Scene->BasePassForForwardShadingDirectionalLightAndSHIndirectDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility,MaxDraws); MaxDraws -= Scene->BasePassForForwardShadingNoLightMapDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility,MaxDraws); } else { SCOPE_CYCLE_COUNTER(STAT_StaticDrawListDrawTime); Scene->BasePassForForwardShadingLowQualityLightMapDrawList[FScene::EBasePass_Default].DrawVisible(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility); Scene->BasePassForForwardShadingDistanceFieldShadowMapLightMapDrawList[FScene::EBasePass_Default].DrawVisible(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility); Scene->BasePassForForwardShadingDirectionalLightAndSHIndirectDrawList[FScene::EBasePass_Default].DrawVisible(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility); Scene->BasePassForForwardShadingNoLightMapDrawList[FScene::EBasePass_Default].DrawVisible(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility); } { SCOPE_CYCLE_COUNTER(STAT_DynamicPrimitiveDrawTime); SCOPED_DRAW_EVENT(Dynamic, DEC_SCENE_ITEMS); if (View.VisibleDynamicPrimitives.Num() > 0) { // Draw the dynamic non-occluded primitives using a base pass drawing policy. TDynamicPrimitiveDrawer<FBasePassForwardOpaqueDrawingPolicyFactory> Drawer(&View, FBasePassForwardOpaqueDrawingPolicyFactory::ContextType(ESceneRenderTargetsMode::DontSet), true); for (int32 PrimitiveIndex = 0; PrimitiveIndex < View.VisibleDynamicPrimitives.Num(); PrimitiveIndex++) { const FPrimitiveSceneInfo* PrimitiveSceneInfo = View.VisibleDynamicPrimitives[PrimitiveIndex]; int32 PrimitiveId = PrimitiveSceneInfo->GetIndex(); const FPrimitiveViewRelevance& PrimitiveViewRelevance = View.PrimitiveViewRelevanceMap[PrimitiveId]; const bool bVisible = View.PrimitiveVisibilityMap[PrimitiveId]; // Only draw the primitive if it's visible if (bVisible && // only draw opaque and masked primitives if wireframe is disabled (PrimitiveViewRelevance.bOpaqueRelevance || ViewFamily.EngineShowFlags.Wireframe)) { FScopeCycleCounter Context(PrimitiveSceneInfo->Proxy->GetStatId()); Drawer.SetPrimitive(PrimitiveSceneInfo->Proxy); PrimitiveSceneInfo->Proxy->DrawDynamicElements(&Drawer, &View); } } } const bool bNeedToSwitchVerticalAxis = IsES2Platform(GRHIShaderPlatform) && !IsPCPlatform(GRHIShaderPlatform); // Draw the base pass for the view's batched mesh elements. DrawViewElements<FBasePassForwardOpaqueDrawingPolicyFactory>(View,FBasePassForwardOpaqueDrawingPolicyFactory::ContextType(ESceneRenderTargetsMode::DontSet), SDPG_World, true); // Draw the view's batched simple elements(lines, sprites, etc). View.BatchedViewElements.Draw(bNeedToSwitchVerticalAxis, View.ViewProjectionMatrix, View.ViewRect.Width(), View.ViewRect.Height(), false); // Draw foreground objects last DrawViewElements<FBasePassForwardOpaqueDrawingPolicyFactory>(View,FBasePassForwardOpaqueDrawingPolicyFactory::ContextType(ESceneRenderTargetsMode::DontSet), SDPG_Foreground, true); // Draw the view's batched simple elements(lines, sprites, etc). View.TopBatchedViewElements.Draw(bNeedToSwitchVerticalAxis, View.ViewProjectionMatrix, View.ViewRect.Width(), View.ViewRect.Height(), false); } // Issue static draw list masked draw calls last, as PVR wants it if (SortMode == EBasePassSort::SortPerMesh) { SCOPE_CYCLE_COUNTER(STAT_StaticDrawListDrawTime); MaxDraws -= Scene->BasePassForForwardShadingNoLightMapDrawList[FScene::EBasePass_Masked].DrawVisibleFrontToBack(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility,MaxDraws); MaxDraws -= Scene->BasePassForForwardShadingLowQualityLightMapDrawList[FScene::EBasePass_Masked].DrawVisibleFrontToBack(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility,MaxDraws); MaxDraws -= Scene->BasePassForForwardShadingDistanceFieldShadowMapLightMapDrawList[FScene::EBasePass_Masked].DrawVisibleFrontToBack(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility,MaxDraws); MaxDraws -= Scene->BasePassForForwardShadingDirectionalLightAndSHIndirectDrawList[FScene::EBasePass_Masked].DrawVisibleFrontToBack(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility,MaxDraws); } else { SCOPE_CYCLE_COUNTER(STAT_StaticDrawListDrawTime); Scene->BasePassForForwardShadingNoLightMapDrawList[FScene::EBasePass_Masked].DrawVisible(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility); Scene->BasePassForForwardShadingLowQualityLightMapDrawList[FScene::EBasePass_Masked].DrawVisible(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility); Scene->BasePassForForwardShadingDistanceFieldShadowMapLightMapDrawList[FScene::EBasePass_Masked].DrawVisible(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility); Scene->BasePassForForwardShadingDirectionalLightAndSHIndirectDrawList[FScene::EBasePass_Masked].DrawVisible(View,View.StaticMeshVisibilityMap,View.StaticMeshBatchVisibility); } } }
int Panel::SetPluginCommand(int Command,int Param1,void* Param2) { _ALGO(CleverSysLog clv(L"Panel::SetPluginCommand")); _ALGO(SysLog(L"(Command=%s, Param1=[%d/0x%08X], Param2=[%d/0x%08X])",_FCTL_ToName(Command),(int)Param1,Param1,(int)Param2,Param2)); int Result=FALSE; ProcessingPluginCommand++; switch (Command) { case FCTL_SETVIEWMODE: Result = Parent()->ChangePanelViewMode(shared_from_this(), Param1, Parent()->IsTopWindow()); break; case FCTL_SETSORTMODE: { int Mode=Param1; if ((Mode>SM_DEFAULT) && (Mode < SM_COUNT)) { SetSortMode(panel_sort(Mode - 1)); // Уменьшим на 1 из-за SM_DEFAULT Result=TRUE; } break; } case FCTL_SETSORTORDER: { ChangeSortOrder(Param1 != 0); Result=TRUE; break; } case FCTL_SETDIRECTORIESFIRST: { ChangeDirectoriesFirst(Param1 != 0); Result=TRUE; break; } case FCTL_CLOSEPANEL: if (m_PanelMode == panel_mode::PLUGIN_PANEL) { string folder=NullToEmpty((const wchar_t *)Param2); SetCurDir(folder,true); if (folder.empty()) Update(UPDATE_KEEP_SELECTION); Redraw(); } Result=TRUE; break; case FCTL_GETPANELINFO: { PanelInfo *Info=(PanelInfo *)Param2; if(!CheckStructSize(Info)) break; *Info = {}; Info->StructSize = sizeof(PanelInfo); UpdateIfRequired(); Info->OwnerGuid=FarGuid; Info->PluginHandle=nullptr; switch (GetType()) { case panel_type::FILE_PANEL: Info->PanelType=PTYPE_FILEPANEL; break; case panel_type::TREE_PANEL: Info->PanelType=PTYPE_TREEPANEL; break; case panel_type::QVIEW_PANEL: Info->PanelType=PTYPE_QVIEWPANEL; break; case panel_type::INFO_PANEL: Info->PanelType=PTYPE_INFOPANEL; break; } int X1,Y1,X2,Y2; GetPosition(X1,Y1,X2,Y2); Info->PanelRect.left=X1; Info->PanelRect.top=Y1; Info->PanelRect.right=X2; Info->PanelRect.bottom=Y2; Info->ViewMode=GetViewMode(); Info->SortMode = static_cast<OPENPANELINFO_SORTMODES>((GetSortMode() < panel_sort::COUNT? SM_UNSORTED - static_cast<int>(panel_sort::UNSORTED) : 0) + static_cast<int>(GetSortMode())); Info->Flags |= Global->Opt->ShowHidden? PFLAGS_SHOWHIDDEN : 0; Info->Flags |= Global->Opt->Highlight? PFLAGS_HIGHLIGHT : 0; Info->Flags |= GetSortOrder()? PFLAGS_REVERSESORTORDER : 0; Info->Flags |= GetSortGroups()? PFLAGS_USESORTGROUPS : 0; Info->Flags |= GetSelectedFirstMode()? PFLAGS_SELECTEDFIRST : 0; Info->Flags |= GetDirectoriesFirst()? PFLAGS_DIRECTORIESFIRST : 0; Info->Flags |= (GetMode() == panel_mode::PLUGIN_PANEL)? PFLAGS_PLUGIN : 0; Info->Flags |= IsVisible()? PFLAGS_VISIBLE : 0; Info->Flags |= IsFocused()? PFLAGS_FOCUS : 0; Info->Flags |= Parent()->IsLeft(this)? PFLAGS_PANELLEFT : 0; if (GetType() == panel_type::FILE_PANEL) { FileList *DestFilePanel=(FileList *)this; if (Info->Flags&PFLAGS_PLUGIN) { Info->OwnerGuid = DestFilePanel->GetPluginHandle()->plugin()->Id(); Info->PluginHandle = DestFilePanel->GetPluginHandle()->panel(); static int Reenter=0; if (!Reenter) { Reenter++; OpenPanelInfo PInfo; DestFilePanel->GetOpenPanelInfo(&PInfo); if (PInfo.Flags & OPIF_REALNAMES) Info->Flags |= PFLAGS_REALNAMES; if (PInfo.Flags & OPIF_DISABLEHIGHLIGHTING) Info->Flags &= ~PFLAGS_HIGHLIGHT; if (PInfo.Flags & OPIF_USECRC32) Info->Flags |= PFLAGS_USECRC32; if (PInfo.Flags & OPIF_SHORTCUT) Info->Flags |= PFLAGS_SHORTCUT; Reenter--; } } DestFilePanel->PluginGetPanelInfo(*Info); } if (!(Info->Flags&PFLAGS_PLUGIN)) // $ 12.12.2001 DJ - на неплагиновой панели - всегда реальные имена Info->Flags |= PFLAGS_REALNAMES; Result=TRUE; break; } case FCTL_GETPANELPREFIX: { string strTemp; if (GetType() == panel_type::FILE_PANEL && GetMode() == panel_mode::PLUGIN_PANEL) { PluginInfo PInfo = {sizeof(PInfo)}; FileList *DestPanel = ((FileList*)this); if (DestPanel->GetPluginInfo(&PInfo)) strTemp = NullToEmpty(PInfo.CommandPrefix); } if (Param1&&Param2) xwcsncpy((wchar_t*)Param2, strTemp.c_str(), Param1); Result=(int)strTemp.size()+1; break; } case FCTL_GETPANELHOSTFILE: case FCTL_GETPANELFORMAT: { string strTemp; if (GetType() == panel_type::FILE_PANEL) { FileList *DestFilePanel=(FileList *)this; static int Reenter=0; if (!Reenter && GetMode() == panel_mode::PLUGIN_PANEL) { Reenter++; OpenPanelInfo PInfo; DestFilePanel->GetOpenPanelInfo(&PInfo); switch (Command) { case FCTL_GETPANELHOSTFILE: strTemp=NullToEmpty(PInfo.HostFile); break; case FCTL_GETPANELFORMAT: strTemp=NullToEmpty(PInfo.Format); break; } Reenter--; } } if (Param1&&Param2) xwcsncpy((wchar_t*)Param2, strTemp.c_str(), Param1); Result=(int)strTemp.size()+1; break; } case FCTL_GETPANELDIRECTORY: { static int Reenter=0; if(!Reenter) { Reenter++; ShortcutInfo Info; GetShortcutInfo(Info); Result = static_cast<int>(aligned_sizeof<FarPanelDirectory>()); const auto folderOffset = Result; Result+=static_cast<int>(sizeof(wchar_t)*(Info.ShortcutFolder.size()+1)); const auto pluginFileOffset = Result; Result+=static_cast<int>(sizeof(wchar_t)*(Info.PluginFile.size()+1)); const auto pluginDataOffset = Result; Result+=static_cast<int>(sizeof(wchar_t)*(Info.PluginData.size()+1)); const auto dirInfo = static_cast<FarPanelDirectory*>(Param2); if(Param1>=Result && CheckStructSize(dirInfo)) { dirInfo->StructSize=sizeof(FarPanelDirectory); dirInfo->PluginId=Info.PluginGuid; dirInfo->Name = static_cast<wchar_t*>(static_cast<void*>(static_cast<char*>(Param2) + folderOffset)); dirInfo->Param = static_cast<wchar_t*>(static_cast<void*>(static_cast<char*>(Param2) + pluginDataOffset)); dirInfo->File = static_cast<wchar_t*>(static_cast<void*>(static_cast<char*>(Param2) + pluginFileOffset)); *std::copy(ALL_CONST_RANGE(Info.ShortcutFolder), const_cast<wchar_t*>(dirInfo->Name)) = L'\0'; *std::copy(ALL_CONST_RANGE(Info.PluginData), const_cast<wchar_t*>(dirInfo->Param)) = L'\0'; *std::copy(ALL_CONST_RANGE(Info.PluginFile), const_cast<wchar_t*>(dirInfo->File)) = L'\0'; } Reenter--; } break; } case FCTL_GETCOLUMNTYPES: case FCTL_GETCOLUMNWIDTHS: if (GetType() == panel_type::FILE_PANEL) { string strColumnTypes,strColumnWidths; ((FileList *)this)->PluginGetColumnTypesAndWidths(strColumnTypes,strColumnWidths); if (Command==FCTL_GETCOLUMNTYPES) { if (Param1&&Param2) xwcsncpy((wchar_t*)Param2,strColumnTypes.c_str(),Param1); Result=(int)strColumnTypes.size()+1; } else { if (Param1&&Param2) xwcsncpy((wchar_t*)Param2,strColumnWidths.c_str(),Param1); Result=(int)strColumnWidths.size()+1; } } break; case FCTL_GETPANELITEM: { if (GetType() == panel_type::FILE_PANEL && CheckNullOrStructSize(static_cast<FarGetPluginPanelItem*>(Param2))) Result = static_cast<int>(static_cast<FileList*>(this)->PluginGetPanelItem(Param1, static_cast<FarGetPluginPanelItem*>(Param2))); break; } case FCTL_GETSELECTEDPANELITEM: { if (GetType() == panel_type::FILE_PANEL && CheckNullOrStructSize(static_cast<FarGetPluginPanelItem*>(Param2))) Result = static_cast<int>(static_cast<FileList*>(this)->PluginGetSelectedPanelItem(Param1, static_cast<FarGetPluginPanelItem*>(Param2))); break; } case FCTL_GETCURRENTPANELITEM: { if (GetType() == panel_type::FILE_PANEL && CheckNullOrStructSize(static_cast<FarGetPluginPanelItem*>(Param2))) { PanelInfo Info; const auto DestPanel = static_cast<FileList*>(this); DestPanel->PluginGetPanelInfo(Info); Result = static_cast<int>(DestPanel->PluginGetPanelItem(static_cast<int>(Info.CurrentItem), static_cast<FarGetPluginPanelItem*>(Param2))); } break; } case FCTL_BEGINSELECTION: { if (GetType() == panel_type::FILE_PANEL) { ((FileList *)this)->PluginBeginSelection(); Result=TRUE; } break; } case FCTL_SETSELECTION: { if (GetType() == panel_type::FILE_PANEL) { ((FileList *)this)->PluginSetSelection(Param1, Param2 != nullptr); Result=TRUE; } break; } case FCTL_CLEARSELECTION: { if (GetType() == panel_type::FILE_PANEL) { static_cast<FileList*>(this)->PluginClearSelection(Param1); Result=TRUE; } break; } case FCTL_ENDSELECTION: { if (GetType() == panel_type::FILE_PANEL) { ((FileList *)this)->PluginEndSelection(); Result=TRUE; } break; } case FCTL_UPDATEPANEL: Update(Param1?UPDATE_KEEP_SELECTION:0); if (GetType() == panel_type::QVIEW_PANEL) UpdateViewPanel(); Result=TRUE; break; case FCTL_REDRAWPANEL: { PanelRedrawInfo *Info=(PanelRedrawInfo *)Param2; if (CheckStructSize(Info)) { m_CurFile=static_cast<int>(Info->CurrentItem); m_CurTopFile=static_cast<int>(Info->TopPanelItem); } // $ 12.05.2001 DJ перерисовываемся только в том случае, если мы - текущее окно if (Parent()->IsTopWindow()) Redraw(); Result=TRUE; break; } case FCTL_SETPANELDIRECTORY: { const auto dirInfo = static_cast<const FarPanelDirectory*>(Param2); if (CheckStructSize(dirInfo)) { Result = ExecShortcutFolder(NullToEmpty(dirInfo->Name), dirInfo->PluginId, NullToEmpty(dirInfo->File), NullToEmpty(dirInfo->Param), false, false, true); // restore current directory to active panel path if (!IsFocused()) { Parent()->ActivePanel()->SetCurPath(); } } break; } case FCTL_SETACTIVEPANEL: { if (IsVisible()) { Parent()->SetActivePanel(this); Result=TRUE; } break; } } ProcessingPluginCommand--; return Result; }