From efe39a61e1291f8e1c02f23a4b885034c51b521c Mon Sep 17 00:00:00 2001 From: jarmonik Date: Tue, 9 Jan 2024 16:28:16 +0200 Subject: [PATCH 1/5] Standardize TerrainToolKit naming --- OVP/D3D9Client/CMakeLists.txt | 4 ++-- .../Basics.cpp | 2 +- .../CMakeLists.txt | 18 +++++++++--------- .../ExportImport.cpp | 4 ++-- .../Layer.cpp | 2 +- .../QTree.cpp | 14 +++++++------- .../{TerrainToolBox => TerrainToolKit}/QTree.h | 0 .../ToolBox.cpp => TerrainToolKit/ToolKit.cpp} | 4 ++-- .../ToolBox.h => TerrainToolKit/ToolKit.h} | 2 +- .../ToolBox.rc => TerrainToolKit/ToolKit.rc} | 10 +++++----- .../gcPropertyTree.h | 0 .../gcTableView.cpp | 0 .../resource.h | 0 13 files changed, 30 insertions(+), 30 deletions(-) rename OVP/D3D9Client/samples/{TerrainToolBox => TerrainToolKit}/Basics.cpp (96%) rename OVP/D3D9Client/samples/{TerrainToolBox => TerrainToolKit}/CMakeLists.txt (61%) rename OVP/D3D9Client/samples/{TerrainToolBox => TerrainToolKit}/ExportImport.cpp (95%) rename OVP/D3D9Client/samples/{TerrainToolBox => TerrainToolKit}/Layer.cpp (96%) rename OVP/D3D9Client/samples/{TerrainToolBox => TerrainToolKit}/QTree.cpp (93%) rename OVP/D3D9Client/samples/{TerrainToolBox => TerrainToolKit}/QTree.h (100%) rename OVP/D3D9Client/samples/{TerrainToolBox/ToolBox.cpp => TerrainToolKit/ToolKit.cpp} (96%) rename OVP/D3D9Client/samples/{TerrainToolBox/ToolBox.h => TerrainToolKit/ToolKit.h} (98%) rename OVP/D3D9Client/samples/{TerrainToolBox/ToolBox.rc => TerrainToolKit/ToolKit.rc} (95%) rename OVP/D3D9Client/samples/{TerrainToolBox => TerrainToolKit}/gcPropertyTree.h (100%) rename OVP/D3D9Client/samples/{TerrainToolBox => TerrainToolKit}/gcTableView.cpp (100%) rename OVP/D3D9Client/samples/{TerrainToolBox => TerrainToolKit}/resource.h (100%) diff --git a/OVP/D3D9Client/CMakeLists.txt b/OVP/D3D9Client/CMakeLists.txt index 84dc3b890..ea58d27ed 100644 --- a/OVP/D3D9Client/CMakeLists.txt +++ b/OVP/D3D9Client/CMakeLists.txt @@ -238,13 +238,13 @@ install(TARGETS D3D9Client add_subdirectory(samples/DrawOrbits) add_subdirectory(samples/DX9ExtMFD) add_subdirectory(samples/GenericCamera) -add_subdirectory(samples/TerrainToolBox) +add_subdirectory(samples/TerrainToolKit) install(DIRECTORY ${D3D9_SOURCE_DIR}/shaders/ DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Modules/D3D9Client) install(DIRECTORY ${D3D9_SOURCE_DIR}/samples/DrawOrbits/ DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Orbitersdk/samples/DrawOrbits) install(DIRECTORY ${D3D9_SOURCE_DIR}/samples/DX9ExtMFD/ DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Orbitersdk/samples/DX9ExtMFD) install(DIRECTORY ${D3D9_SOURCE_DIR}/samples/GenericCamera/ DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Orbitersdk/samples/GenericCamera) -install(DIRECTORY ${D3D9_SOURCE_DIR}/samples/TerrainToolBox/ DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Orbitersdk/samples/TerrainToolBox) +install(DIRECTORY ${D3D9_SOURCE_DIR}/samples/TerrainToolKit/ DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Orbitersdk/samples/TerrainToolKit) install(FILES ${INCLUDE_TARGET_DIR}/gcCoreAPI.h DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Orbitersdk/include) install(FILES ${INCLUDE_TARGET_DIR}/gcGUI.h DESTINATION ${ORBITER_INSTALL_ROOT_DIR}/Orbitersdk/include) install(FILES ${ORBITER_SOURCE_SDK_DIR}/doc/Orbiter2DGraphics.pdf DESTINATION ${ORBITER_INSTALL_SDK_DIR}/doc) diff --git a/OVP/D3D9Client/samples/TerrainToolBox/Basics.cpp b/OVP/D3D9Client/samples/TerrainToolKit/Basics.cpp similarity index 96% rename from OVP/D3D9Client/samples/TerrainToolBox/Basics.cpp rename to OVP/D3D9Client/samples/TerrainToolKit/Basics.cpp index c404116d8..54257ad66 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/Basics.cpp +++ b/OVP/D3D9Client/samples/TerrainToolKit/Basics.cpp @@ -10,7 +10,7 @@ #include "VesselAPI.h" #include "ModuleAPI.h" #include "DrawAPI.h" -#include "ToolBox.h" +#include "ToolKit.h" #include "resource.h" #include "gcPropertyTree.h" #include "QTree.h" diff --git a/OVP/D3D9Client/samples/TerrainToolBox/CMakeLists.txt b/OVP/D3D9Client/samples/TerrainToolKit/CMakeLists.txt similarity index 61% rename from OVP/D3D9Client/samples/TerrainToolBox/CMakeLists.txt rename to OVP/D3D9Client/samples/TerrainToolKit/CMakeLists.txt index 4b5c92910..10f74ff69 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/CMakeLists.txt +++ b/OVP/D3D9Client/samples/TerrainToolKit/CMakeLists.txt @@ -1,42 +1,42 @@ # Licensed under the MIT License -add_library(TerrainToolBox MODULE +add_library(TerrainToolKit MODULE gcPropertyTree.h gcTableView.cpp QTree.h QTree.cpp - ToolBox.h - ToolBox.cpp - ToolBox.rc + ToolKit.h + ToolKit.cpp + ToolKit.rc ExportImport.cpp Basics.cpp Layer.cpp resource.h ) -add_dependencies(TerrainToolBox +add_dependencies(TerrainToolKit D3D9Client ) -target_link_libraries(TerrainToolBox +target_link_libraries(TerrainToolKit ${OrbiterTgt} Orbitersdk Msimg32.lib Comctl32.lib ) -target_include_directories(TerrainToolBox +target_include_directories(TerrainToolKit PUBLIC ${INCLUDE_TARGET_DIR} ) -set_target_properties(TerrainToolBox +set_target_properties(TerrainToolKit PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Modules/Plugin LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Modules/Plugin FOLDER OVP ) -install(TARGETS TerrainToolBox +install(TARGETS TerrainToolKit LIBRARY DESTINATION ${ORBITER_INSTALL_PLUGIN_DIR} ) diff --git a/OVP/D3D9Client/samples/TerrainToolBox/ExportImport.cpp b/OVP/D3D9Client/samples/TerrainToolKit/ExportImport.cpp similarity index 95% rename from OVP/D3D9Client/samples/TerrainToolBox/ExportImport.cpp rename to OVP/D3D9Client/samples/TerrainToolKit/ExportImport.cpp index 2b707428c..c936cc8ab 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/ExportImport.cpp +++ b/OVP/D3D9Client/samples/TerrainToolKit/ExportImport.cpp @@ -10,7 +10,7 @@ #include "ModuleAPI.h" #include "DrawAPI.h" #include "gcCoreAPI.h" -#include "ToolBox.h" +#include "ToolKit.h" #include "resource.h" #include "gcPropertyTree.h" #include "QTree.h" @@ -151,7 +151,7 @@ void ToolKit::ExportElev() void ToolKit::BakeImport() { - if (MessageBox(pCore->GetRenderWindow(), "Bake and Write the tiles in 'OrbiterRoot/TerrainToolBox/' Folder ?", "Are you sure", MB_YESNO | MB_ICONEXCLAMATION) != IDYES) return; + if (MessageBox(pCore->GetRenderWindow(), "Bake and Write the tiles in 'OrbiterRoot/TerrainToolKit/' Folder ?", "Are you sure", MB_YESNO | MB_ICONEXCLAMATION) != IDYES) return; bool bWater = IsLayerValid(Layer::LayerType::WATER); bool bNight = IsLayerValid(Layer::LayerType::NIGHT); diff --git a/OVP/D3D9Client/samples/TerrainToolBox/Layer.cpp b/OVP/D3D9Client/samples/TerrainToolKit/Layer.cpp similarity index 96% rename from OVP/D3D9Client/samples/TerrainToolBox/Layer.cpp rename to OVP/D3D9Client/samples/TerrainToolKit/Layer.cpp index 9e0c962b1..657c2af34 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/Layer.cpp +++ b/OVP/D3D9Client/samples/TerrainToolKit/Layer.cpp @@ -10,7 +10,7 @@ #include "VesselAPI.h" #include "ModuleAPI.h" #include "DrawAPI.h" -#include "ToolBox.h" +#include "ToolKit.h" #include "resource.h" #include "gcPropertyTree.h" #include "QTree.h" diff --git a/OVP/D3D9Client/samples/TerrainToolBox/QTree.cpp b/OVP/D3D9Client/samples/TerrainToolKit/QTree.cpp similarity index 93% rename from OVP/D3D9Client/samples/TerrainToolBox/QTree.cpp rename to OVP/D3D9Client/samples/TerrainToolKit/QTree.cpp index aea36389a..aba6524bd 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/QTree.cpp +++ b/OVP/D3D9Client/samples/TerrainToolKit/QTree.cpp @@ -5,7 +5,7 @@ #include "OrbiterAPI.h" #include "QTree.h" -#include "ToolBox.h" +#include "ToolKit.h" #include "gcCoreAPI.h" #include @@ -340,27 +340,27 @@ int QTree::SaveTile(int flags, SURFHANDLE hSurf, SURFHANDLE hTemp, DRECT bounds, // --------------------------------------------------------- - DWORD fa = GetFileAttributesA("TerrainToolBox"); - if (fa == INVALID_FILE_ATTRIBUTES) CreateDirectoryA("TerrainToolBox", NULL); + DWORD fa = GetFileAttributesA("TerrainToolKit"); + if (fa == INVALID_FILE_ATTRIBUTES) CreateDirectoryA("TerrainToolKit", NULL); else if ((fa & FILE_ATTRIBUTE_DIRECTORY) == 0) return -1; // --------------------------------------------------------- - sprintf_s(name, 63, "TerrainToolBox\\%s", dir); + sprintf_s(name, 63, "TerrainToolKit\\%s", dir); fa = GetFileAttributesA(name); if (fa == INVALID_FILE_ATTRIBUTES) CreateDirectoryA(name, NULL); else if ((fa & FILE_ATTRIBUTE_DIRECTORY) == 0) return -2; // --------------------------------------------------------- - sprintf_s(name, 63, "TerrainToolBox\\%s\\%02d", dir, level + 4); + sprintf_s(name, 63, "TerrainToolKit\\%s\\%02d", dir, level + 4); fa = GetFileAttributesA(name); if (fa == INVALID_FILE_ATTRIBUTES) CreateDirectoryA(name, NULL); else if ((fa & FILE_ATTRIBUTE_DIRECTORY) == 0) return -3; // --------------------------------------------------------- - sprintf_s(name, 63, "TerrainToolBox\\%s\\%02d\\%06d", dir, level +4, ilat); + sprintf_s(name, 63, "TerrainToolKit\\%s\\%02d\\%06d", dir, level +4, ilat); fa = GetFileAttributesA(name); if (fa == INVALID_FILE_ATTRIBUTES) CreateDirectoryA(name, NULL); else if ((fa & FILE_ATTRIBUTE_DIRECTORY) == 0) return -4; @@ -368,7 +368,7 @@ int QTree::SaveTile(int flags, SURFHANDLE hSurf, SURFHANDLE hTemp, DRECT bounds, //---------------------------------------------------------- - sprintf_s(name, 63, "TerrainToolBox\\%s\\%02d\\%06d\\%06d.dds", dir, level + 4, ilat, ilng); + sprintf_s(name, 63, "TerrainToolKit\\%s\\%02d\\%06d\\%06d.dds", dir, level + 4, ilat, ilng); Sketchpad *pSkp = oapiGetSketchpad(hTemp); diff --git a/OVP/D3D9Client/samples/TerrainToolBox/QTree.h b/OVP/D3D9Client/samples/TerrainToolKit/QTree.h similarity index 100% rename from OVP/D3D9Client/samples/TerrainToolBox/QTree.h rename to OVP/D3D9Client/samples/TerrainToolKit/QTree.h diff --git a/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.cpp b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp similarity index 96% rename from OVP/D3D9Client/samples/TerrainToolBox/ToolBox.cpp rename to OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp index a4acf364f..c1d556803 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.cpp +++ b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp @@ -15,7 +15,7 @@ #include "ModuleAPI.h" #include "DrawAPI.h" #include "gcCoreAPI.h" -#include "ToolBox.h" +#include "ToolKit.h" #include "resource.h" #include "gcPropertyTree.h" #include "QTree.h" @@ -251,7 +251,7 @@ ToolKit::ToolKit(HINSTANCE hInst) : gcGUIApp(), Module(hInst) bGo = false; // Can do very little here since graphics servises are not yet running - dwCmd = oapiRegisterCustomCmd((char*)"TerrainToolBox", (char*)"ToolBox for terrain and base editing", OpenToolsClbk, this); + dwCmd = oapiRegisterCustomCmd((char*)"TerrainToolKit", (char*)"ToolKit for terrain and base editing", OpenToolsClbk, this); gcPropertyTreeInitialize(hInst); mIdent.Ident(); diff --git a/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.h b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.h similarity index 98% rename from OVP/D3D9Client/samples/TerrainToolBox/ToolBox.h rename to OVP/D3D9Client/samples/TerrainToolKit/ToolKit.h index 617f17252..e9d519a18 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.h +++ b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.h @@ -74,7 +74,7 @@ class Layer FVECTOR4 GetColor(); FVECTOR4 GetAdjustments(); double Max(double a, double b, double c, double d); - double Min(double a, double b, double c, double d); + double Min(double a, double b, double c, double d); SURFHANDLE hSource; string name; diff --git a/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.rc b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.rc similarity index 95% rename from OVP/D3D9Client/samples/TerrainToolBox/ToolBox.rc rename to OVP/D3D9Client/samples/TerrainToolKit/ToolKit.rc index 6479ca62f..fd3d2ecfc 100644 --- a/OVP/D3D9Client/samples/TerrainToolBox/ToolBox.rc +++ b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.rc @@ -88,7 +88,7 @@ FONT 8, "Ms Shell Dlg" LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK STRINGTABLE { - IDS_INFO "Terrain and Base Development ToolBox" + IDS_INFO "Terrain and Base Development ToolKit" IDS_TYPE "Developer resources and samples" } @@ -111,12 +111,12 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK { BLOCK "080904E4" { - VALUE "FileDescription", "Terrain and Base Development ToolBox" + VALUE "FileDescription", "Terrain and Base Development ToolKit" VALUE "FileVersion", "1.0.0.0" - VALUE "InternalName", "TerrainToolBox" + VALUE "InternalName", "TerrainToolKit" VALUE "LegalCopyright", "Copyright © 2019" - VALUE "OriginalFilename", "TerrainToolBox.dll" - VALUE "ProductName", "TerrainToolBox" + VALUE "OriginalFilename", "TerrainToolKit.dll" + VALUE "ProductName", "TerrainToolKit" VALUE "ProductVersion", "1.0.0.0" } } diff --git a/OVP/D3D9Client/samples/TerrainToolBox/gcPropertyTree.h b/OVP/D3D9Client/samples/TerrainToolKit/gcPropertyTree.h similarity index 100% rename from OVP/D3D9Client/samples/TerrainToolBox/gcPropertyTree.h rename to OVP/D3D9Client/samples/TerrainToolKit/gcPropertyTree.h diff --git a/OVP/D3D9Client/samples/TerrainToolBox/gcTableView.cpp b/OVP/D3D9Client/samples/TerrainToolKit/gcTableView.cpp similarity index 100% rename from OVP/D3D9Client/samples/TerrainToolBox/gcTableView.cpp rename to OVP/D3D9Client/samples/TerrainToolKit/gcTableView.cpp diff --git a/OVP/D3D9Client/samples/TerrainToolBox/resource.h b/OVP/D3D9Client/samples/TerrainToolKit/resource.h similarity index 100% rename from OVP/D3D9Client/samples/TerrainToolBox/resource.h rename to OVP/D3D9Client/samples/TerrainToolKit/resource.h From 259e1bdb6a7e5b5933d25ff622edb18e0f1439d2 Mon Sep 17 00:00:00 2001 From: jarmonik Date: Wed, 10 Jan 2024 16:57:18 +0200 Subject: [PATCH 2/5] Increased max tile level, fixed tile bounds check bug. --- OVP/D3D9Client/Surfmgr2.cpp | 8 ++++---- OVP/D3D9Client/VPlanet.cpp | 14 +++++++++----- OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/OVP/D3D9Client/Surfmgr2.cpp b/OVP/D3D9Client/Surfmgr2.cpp index 9042552de..fba7b244f 100644 --- a/OVP/D3D9Client/Surfmgr2.cpp +++ b/OVP/D3D9Client/Surfmgr2.cpp @@ -917,11 +917,11 @@ void SurfTile::Render () // DevTools: Render with overlay image // ---------------------------------------------------------------------- - FVECTOR4 texcoord; - const vPlanet::sOverlay *oLay = vPlanet->IntersectOverlay(bnd.vec, &texcoord); - - if (pShader->bDevtools) + if (pShader->bDevtools && scene->GetRenderPass() == RENDERPASS_MAINSCENE) { + FVECTOR4 texcoord; + const vPlanet::sOverlay* oLay = vPlanet->IntersectOverlay(bnd.vec, &texcoord); + if (oLay) { bool bOlayEnable = false; for (auto x : oLay->pSurf) if (x) bOlayEnable = true; diff --git a/OVP/D3D9Client/VPlanet.cpp b/OVP/D3D9Client/VPlanet.cpp index 0f092afb3..70260fb17 100644 --- a/OVP/D3D9Client/VPlanet.cpp +++ b/OVP/D3D9Client/VPlanet.cpp @@ -1340,13 +1340,17 @@ vPlanet::sOverlay * vPlanet::IntersectOverlay(VECTOR4 q, FVECTOR4 *texcoord) con { for (auto olay : overlays) { - if (q.x > olay->lnglat.z) continue; - if (q.z < olay->lnglat.x) continue; - if (q.y < olay->lnglat.w) continue; - if (q.w > olay->lnglat.y) continue; - double ow = fabs(olay->lnglat.x - olay->lnglat.z); double oh = fabs(olay->lnglat.y - olay->lnglat.w); + double ew = ow * 0.001; + double eh = oh * 0.001; + + if (q.x > (olay->lnglat.z - ew)) continue; + if (q.z < (olay->lnglat.x + ew)) continue; + if (q.y < (olay->lnglat.w + eh)) continue; + if (q.w > (olay->lnglat.y - eh)) continue; + + double tw = fabs(q.x - q.z); double th = fabs(q.y - q.w); diff --git a/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp index c1d556803..f02cfa886 100644 --- a/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp +++ b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp @@ -418,7 +418,7 @@ bool ToolKit::Initialize() SendDlgItemMessage(hCtrlDlg, IDC_SELECT, CB_ADDSTRING, 0, (LPARAM)"Heighest Existing"); // 1 SendDlgItemMessage(hCtrlDlg, IDC_SELECT, CB_SETCURSEL, 1, 0); - for (int i = 5; i < 20; i++) { + for (int i = 5; i < 22; i++) { char Lbl[32]; sprintf_s(Lbl, 32, "Level %d", i); SendDlgItemMessageA(hCtrlDlg, IDC_SELECT, CB_ADDSTRING, 0, (LPARAM)Lbl); } From 6672a950389c16160ba1ce2bbe5756c2f2565b72 Mon Sep 17 00:00:00 2001 From: jarmonik Date: Thu, 11 Jan 2024 10:04:18 +0200 Subject: [PATCH 3/5] Fixed overlay clipping problem. --- OVP/D3D9Client/D3D9Client.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OVP/D3D9Client/D3D9Client.cpp b/OVP/D3D9Client/D3D9Client.cpp index 5c384fdc0..798088501 100644 --- a/OVP/D3D9Client/D3D9Client.cpp +++ b/OVP/D3D9Client/D3D9Client.cpp @@ -1031,7 +1031,8 @@ void D3D9Client::PushRenderTarget(LPDIRECT3DSURFACE9 pColor, LPDIRECT3DSURFACE9 pDevice->SetViewport(&vp); } - if (pDepthStencil) if (pDevice->SetDepthStencilSurface(pDepthStencil) != S_OK) assert(false); + // If pDepthStencil is NULL set NULL + if (pDevice->SetDepthStencilSurface(pDepthStencil) != S_OK) assert(false); if (pColor) if (pDevice->SetRenderTarget(0, pColor) != S_OK) assert(false); RenderStack.push_front(data); From c72ff7529f3f1c72950424bd732769e06297e824 Mon Sep 17 00:00:00 2001 From: jarmonik Date: Thu, 11 Jan 2024 10:49:44 +0200 Subject: [PATCH 4/5] Fixed "cancel" CTD, disable unused GUI buttons. --- .../samples/TerrainToolKit/ExportImport.cpp | 6 ++++-- OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp | 7 ------- OVP/D3D9Client/samples/TerrainToolKit/ToolKit.rc | 15 +++++++-------- OVP/D3D9Client/samples/TerrainToolKit/resource.h | 5 ++--- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/OVP/D3D9Client/samples/TerrainToolKit/ExportImport.cpp b/OVP/D3D9Client/samples/TerrainToolKit/ExportImport.cpp index c936cc8ab..03e4b3414 100644 --- a/OVP/D3D9Client/samples/TerrainToolKit/ExportImport.cpp +++ b/OVP/D3D9Client/samples/TerrainToolKit/ExportImport.cpp @@ -30,8 +30,10 @@ BOOL CALLBACK gDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); void ToolKit::StopImport() { for (auto x : pLr) { - if (x->hSource) oapiReleaseTexture(x->hSource); - x->hSource = NULL; + if (x) { + if (x->hSource) oapiReleaseTexture(x->hSource); + x->hSource = NULL; + } } if (hOverlay) pCore->AddGlobalOverlay(hMgr, _V(0, 0, 0, 0), gcCore::OlayType::RELEASE_ALL, NULL, hOverlay); diff --git a/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp index f02cfa886..c3a3f61fd 100644 --- a/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp +++ b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.cpp @@ -176,13 +176,6 @@ BOOL ToolKit::DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return true; } - case IDC_UPDATECLIP: - { - if (selection.area.size() != 0) oldsel = selection; - selection.area.clear(); - break; - } - case IDC_DATAVIEW: { break; diff --git a/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.rc b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.rc index fd3d2ecfc..919316054 100644 --- a/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.rc +++ b/OVP/D3D9Client/samples/TerrainToolKit/ToolKit.rc @@ -44,17 +44,16 @@ IDD_IMPORT DIALOG 0, 0, 180, 120 STYLE DS_CENTER | DS_SHELLFONT | WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS FONT 8, "Ms Shell Dlg" { - PUSHBUTTON "Open Elevation", IDC_OPENELEV, 95, 20, 75, 14, 0, WS_EX_LEFT - PUSHBUTTON "Open Nightlights", IDC_OPENNIGHT, 95, 5, 75, 14, 0, WS_EX_LEFT - PUSHBUTTON "Open Mesh", IDC_OPENMESH, 5, 45, 75, 14, 0, WS_EX_LEFT + PUSHBUTTON "Open Elevation", IDC_OPENELEV, 95, 5, 75, 14, WS_DISABLED, WS_EX_LEFT + PUSHBUTTON "Open Nightlights", IDC_OPENNIGHT, 5, 36, 75, 14, 0, WS_EX_LEFT + PUSHBUTTON "Open Mesh", IDC_OPENMESH, 96, 21, 75, 14, WS_DISABLED, WS_EX_LEFT PUSHBUTTON "Open Surface", IDC_OPENIMAGE, 5, 5, 75, 14, 0, WS_EX_LEFT PUSHBUTTON "Bake", IDC_BAKE, 95, 100, 75, 14, 0, WS_EX_LEFT - PUSHBUTTON "Reset Corners", IDC_CORNERS, 95, 60, 75, 14, 0, WS_EX_LEFT - PUSHBUTTON "Reselect Region", IDC_UPDATECLIP, 95, 45, 75, 14, 0, WS_EX_LEFT - PUSHBUTTON "Cancel Import", IDC_STOP, 95, 75, 75, 14, 0, WS_EX_LEFT - PUSHBUTTON "Edit Elevation", IDC_EDITELEV, 5, 100, 75, 14, 0, WS_EX_LEFT + PUSHBUTTON "Reset Corners", IDC_CORNERS, 95, 83, 75, 14, 0, WS_EX_LEFT + PUSHBUTTON "Cancel Import", IDC_STOP, 5, 100, 75, 14, 0, WS_EX_LEFT + PUSHBUTTON "Edit Elevation", IDC_EDITELEV, 95, 36, 75, 14, WS_DISABLED, WS_EX_LEFT PUSHBUTTON "Open Water", IDC_OPENWATER, 5, 20, 75, 14, 0, WS_EX_LEFT - PUSHBUTTON "Start Import", IDC_STARTIMPORT, 5, 75, 75, 14, 0, WS_EX_LEFT + PUSHBUTTON "Start Import", IDC_STARTIMPORT, 5, 83, 75, 14, 0, WS_EX_LEFT } diff --git a/OVP/D3D9Client/samples/TerrainToolKit/resource.h b/OVP/D3D9Client/samples/TerrainToolKit/resource.h index 6b36c01af..3c986a563 100644 --- a/OVP/D3D9Client/samples/TerrainToolKit/resource.h +++ b/OVP/D3D9Client/samples/TerrainToolKit/resource.h @@ -2,6 +2,8 @@ #define IDC_STATIC (-1) #endif +#define IDS_INFO 1000 // never change these! +#define IDS_TYPE 1001 // " " " #define IDD_DATA 102 #define IDD_IMPORT 103 #define IDD_EXPORT 104 @@ -15,16 +17,13 @@ #define IDC_BAKE 1012 #define IDC_OPENIMAGE 1014 #define IDC_STOP 1015 -#define IDC_UPDATECLIP 1018 #define IDC_CORNERS 1020 #define IDC_PROGBAR 1021 #define IDC_LOAD 4000 #define IDC_OPENNIGHT 4001 -#define IDS_INFO 4002 #define IDC_DISPSEL 4003 #define IDC_OPENELEV 4004 #define IDC_SAVE 4005 -#define IDS_TYPE 4006 #define IDC_OPENMESH 4007 #define IDC_EDITELEV 4008 #define IDC_OPENWATER 4009 From 634a878e70820b4ff0ba070734571059d1777db9 Mon Sep 17 00:00:00 2001 From: jarmonik Date: Thu, 11 Jan 2024 16:45:24 +0200 Subject: [PATCH 5/5] Enabled tile mipmaps for all tile levels. Default = All --- OVP/D3D9Client/D3D9Config.cpp | 2 +- OVP/D3D9Client/VideoTab.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/OVP/D3D9Client/D3D9Config.cpp b/OVP/D3D9Client/D3D9Config.cpp index a3aa95d27..782b7889f 100644 --- a/OVP/D3D9Client/D3D9Config.cpp +++ b/OVP/D3D9Client/D3D9Config.cpp @@ -69,7 +69,7 @@ void D3D9Config::Reset () FrameRate = 200.0; EnableLimiter = 0; CustomCamMode = 1; - TileMipmaps = 1; + TileMipmaps = 2; TextureMips = 1; LODBias = 0.0; MeshRes = 1; diff --git a/OVP/D3D9Client/VideoTab.cpp b/OVP/D3D9Client/VideoTab.cpp index 265dc2dcc..07a1c5523 100644 --- a/OVP/D3D9Client/VideoTab.cpp +++ b/OVP/D3D9Client/VideoTab.cpp @@ -672,6 +672,7 @@ void VideoTab::InitSetupDialog(HWND hWnd) SendDlgItemMessage(hWnd, IDC_MIPMAPS, CB_RESETCONTENT, 0, 0); SendDlgItemMessageA(hWnd, IDC_MIPMAPS, CB_ADDSTRING, 0, (LPARAM)"None"); SendDlgItemMessageA(hWnd, IDC_MIPMAPS, CB_ADDSTRING, 0, (LPARAM)"Low level only"); + SendDlgItemMessageA(hWnd, IDC_MIPMAPS, CB_ADDSTRING, 0, (LPARAM)"All levels"); SendDlgItemMessage(hWnd, IDC_MIPMAPS, CB_SETCURSEL, 0, 0); // ARCHIVE METHOD ------------------------------------------