From 1b99d7554353f6570c551a927d007fc4a9a3f7c5 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Mon, 23 Dec 2024 09:25:23 -0700 Subject: [PATCH] Refactor `geom` library into `geom` and `shape` (#1263) * Refactor `geom` library into `geom` and `util` * Rename to `shape` --- CMakeLists.txt | 34 +++++++++++++++---- LEGO1/lego/sources/roi/legolod.cpp | 2 +- LEGO1/lego/sources/roi/legoroi.cpp | 4 +-- .../lego/sources/{geom => shape}/legobox.cpp | 1 + LEGO1/lego/sources/{geom => shape}/legobox.h | 0 .../sources/{misc => shape}/legocolor.cpp | 2 +- .../lego/sources/{misc => shape}/legocolor.h | 2 +- .../lego/sources/{geom => shape}/legomesh.cpp | 0 LEGO1/lego/sources/{geom => shape}/legomesh.h | 2 +- .../sources/{geom => shape}/legosphere.cpp | 0 .../lego/sources/{geom => shape}/legosphere.h | 0 .../sources/{geom => shape}/legovertex.cpp | 0 .../lego/sources/{geom => shape}/legovertex.h | 0 13 files changed, 35 insertions(+), 12 deletions(-) rename LEGO1/lego/sources/{geom => shape}/legobox.cpp (92%) rename LEGO1/lego/sources/{geom => shape}/legobox.h (100%) rename LEGO1/lego/sources/{misc => shape}/legocolor.cpp (94%) rename LEGO1/lego/sources/{misc => shape}/legocolor.h (95%) rename LEGO1/lego/sources/{geom => shape}/legomesh.cpp (100%) rename LEGO1/lego/sources/{geom => shape}/legomesh.h (98%) rename LEGO1/lego/sources/{geom => shape}/legosphere.cpp (100%) rename LEGO1/lego/sources/{geom => shape}/legosphere.h (100%) rename LEGO1/lego/sources/{geom => shape}/legovertex.cpp (100%) rename LEGO1/lego/sources/{geom => shape}/legovertex.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6415d39d..fddedcab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,12 +153,8 @@ function(add_lego_libraries NAME) target_link_libraries(roi${ARG_SUFFIX} PRIVATE viewmanager${ARG_SUFFIX} Vec::Vec) add_library(geom${ARG_SUFFIX} STATIC - LEGO1/lego/sources/geom/legobox.cpp LEGO1/lego/sources/geom/legoedge.cpp - LEGO1/lego/sources/geom/legomesh.cpp - LEGO1/lego/sources/geom/legosphere.cpp LEGO1/lego/sources/geom/legounkown100db7f4.cpp - LEGO1/lego/sources/geom/legovertex.cpp LEGO1/lego/sources/geom/legoweedge.cpp LEGO1/lego/sources/geom/legowegedge.cpp ) @@ -167,6 +163,18 @@ function(add_lego_libraries NAME) target_include_directories(geom${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") target_link_libraries(geom${ARG_SUFFIX} PRIVATE) + add_library(shape${ARG_SUFFIX} STATIC + LEGO1/lego/sources/shape/legocolor.cpp + LEGO1/lego/sources/shape/legobox.cpp + LEGO1/lego/sources/shape/legomesh.cpp + LEGO1/lego/sources/shape/legosphere.cpp + LEGO1/lego/sources/shape/legovertex.cpp + ) + list(APPEND list_targets shape${ARG_SUFFIX}) + set_property(TARGET shape${ARG_SUFFIX} PROPERTY ARCHIVE_OUTPUT_NAME "shape$<$:d>${ARG_SUFFIX}") + target_include_directories(shape${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") + target_link_libraries(shape${ARG_SUFFIX} PRIVATE) + add_library(anim${ARG_SUFFIX} STATIC LEGO1/lego/sources/anim/legoanim.cpp ) @@ -175,7 +183,6 @@ function(add_lego_libraries NAME) target_include_directories(anim${ARG_SUFFIX} PRIVATE "${PROJECT_SOURCE_DIR}/LEGO1/omni/include" "${PROJECT_SOURCE_DIR}/LEGO1" "${PROJECT_SOURCE_DIR}/LEGO1/lego/sources" "${PROJECT_SOURCE_DIR}/util") add_library(misc${ARG_SUFFIX} STATIC - LEGO1/lego/sources/misc/legocolor.cpp LEGO1/lego/sources/misc/legocontainer.cpp LEGO1/lego/sources/misc/legoimage.cpp LEGO1/lego/sources/misc/legostorage.cpp @@ -422,7 +429,22 @@ function(add_lego_libraries NAME) target_include_directories(${NAME} PUBLIC "${PROJECT_SOURCE_DIR}/LEGO1/lego/legoomni/include/actions") # Link libraries - target_link_libraries(${NAME} PRIVATE tglrl${ARG_SUFFIX} viewmanager${ARG_SUFFIX} realtime${ARG_SUFFIX} mxdirectx${ARG_SUFFIX} roi${ARG_SUFFIX} geom${ARG_SUFFIX} anim${ARG_SUFFIX} Vec::Vec dinput dxguid misc${ARG_SUFFIX} 3dmanager${ARG_SUFFIX} omni${ARG_SUFFIX}) + target_link_libraries(${NAME} PRIVATE + tglrl${ARG_SUFFIX} + viewmanager${ARG_SUFFIX} + realtime${ARG_SUFFIX} + mxdirectx${ARG_SUFFIX} + roi${ARG_SUFFIX} + geom${ARG_SUFFIX} + anim${ARG_SUFFIX} + Vec::Vec + dinput + dxguid + misc${ARG_SUFFIX} + 3dmanager${ARG_SUFFIX} + omni${ARG_SUFFIX} + shape${ARG_SUFFIX} + ) foreach(tgt IN LISTS list_targets) target_link_libraries(${tgt} PRIVATE ${ARG_LINK_LIBRARIES}) diff --git a/LEGO1/lego/sources/roi/legolod.cpp b/LEGO1/lego/sources/roi/legolod.cpp index 45f0f864..7db2a0a9 100644 --- a/LEGO1/lego/sources/roi/legolod.cpp +++ b/LEGO1/lego/sources/roi/legolod.cpp @@ -1,10 +1,10 @@ #include "legolod.h" -#include "geom/legomesh.h" #include "legoroi.h" #include "misc/legocontainer.h" #include "misc/legostorage.h" +#include "shape/legomesh.h" #include "tgl/d3drm/impl.h" DECOMP_SIZE_ASSERT(LODObject, 0x04) diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index f9a8549b..50a26113 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -1,12 +1,12 @@ #include "legoroi.h" #include "anim/legoanim.h" -#include "geom/legobox.h" -#include "geom/legosphere.h" #include "legolod.h" #include "misc/legocontainer.h" #include "misc/legostorage.h" #include "realtime/realtime.h" +#include "shape/legobox.h" +#include "shape/legosphere.h" #include #include diff --git a/LEGO1/lego/sources/geom/legobox.cpp b/LEGO1/lego/sources/shape/legobox.cpp similarity index 92% rename from LEGO1/lego/sources/geom/legobox.cpp rename to LEGO1/lego/sources/shape/legobox.cpp index 0a5f2bdb..0f7654d6 100644 --- a/LEGO1/lego/sources/geom/legobox.cpp +++ b/LEGO1/lego/sources/shape/legobox.cpp @@ -6,6 +6,7 @@ DECOMP_SIZE_ASSERT(LegoBox, 0x18) // FUNCTION: LEGO1 0x100d3740 +// FUNCTION: BETA10 0x1018f83c LegoResult LegoBox::Read(LegoStorage* p_storage) { LegoResult result; diff --git a/LEGO1/lego/sources/geom/legobox.h b/LEGO1/lego/sources/shape/legobox.h similarity index 100% rename from LEGO1/lego/sources/geom/legobox.h rename to LEGO1/lego/sources/shape/legobox.h diff --git a/LEGO1/lego/sources/misc/legocolor.cpp b/LEGO1/lego/sources/shape/legocolor.cpp similarity index 94% rename from LEGO1/lego/sources/misc/legocolor.cpp rename to LEGO1/lego/sources/shape/legocolor.cpp index 1dc1dce4..146e8818 100644 --- a/LEGO1/lego/sources/misc/legocolor.cpp +++ b/LEGO1/lego/sources/shape/legocolor.cpp @@ -1,7 +1,7 @@ #include "legocolor.h" #include "decomp.h" -#include "legostorage.h" +#include "misc/legostorage.h" DECOMP_SIZE_ASSERT(LegoColor, 0x03) diff --git a/LEGO1/lego/sources/misc/legocolor.h b/LEGO1/lego/sources/shape/legocolor.h similarity index 95% rename from LEGO1/lego/sources/misc/legocolor.h rename to LEGO1/lego/sources/shape/legocolor.h index 027362ce..ac0f2ec0 100644 --- a/LEGO1/lego/sources/misc/legocolor.h +++ b/LEGO1/lego/sources/shape/legocolor.h @@ -1,7 +1,7 @@ #ifndef __LEGOCOLOR_H #define __LEGOCOLOR_H -#include "legotypes.h" +#include "misc/legotypes.h" class LegoStorage; diff --git a/LEGO1/lego/sources/geom/legomesh.cpp b/LEGO1/lego/sources/shape/legomesh.cpp similarity index 100% rename from LEGO1/lego/sources/geom/legomesh.cpp rename to LEGO1/lego/sources/shape/legomesh.cpp diff --git a/LEGO1/lego/sources/geom/legomesh.h b/LEGO1/lego/sources/shape/legomesh.h similarity index 98% rename from LEGO1/lego/sources/geom/legomesh.h rename to LEGO1/lego/sources/shape/legomesh.h index 1832ae7b..da1b1a27 100644 --- a/LEGO1/lego/sources/geom/legomesh.h +++ b/LEGO1/lego/sources/shape/legomesh.h @@ -2,7 +2,7 @@ #define __LEGOMESH_H #include "decomp.h" -#include "misc/legocolor.h" +#include "legocolor.h" #include "misc/legotypes.h" class LegoStorage; diff --git a/LEGO1/lego/sources/geom/legosphere.cpp b/LEGO1/lego/sources/shape/legosphere.cpp similarity index 100% rename from LEGO1/lego/sources/geom/legosphere.cpp rename to LEGO1/lego/sources/shape/legosphere.cpp diff --git a/LEGO1/lego/sources/geom/legosphere.h b/LEGO1/lego/sources/shape/legosphere.h similarity index 100% rename from LEGO1/lego/sources/geom/legosphere.h rename to LEGO1/lego/sources/shape/legosphere.h diff --git a/LEGO1/lego/sources/geom/legovertex.cpp b/LEGO1/lego/sources/shape/legovertex.cpp similarity index 100% rename from LEGO1/lego/sources/geom/legovertex.cpp rename to LEGO1/lego/sources/shape/legovertex.cpp diff --git a/LEGO1/lego/sources/geom/legovertex.h b/LEGO1/lego/sources/shape/legovertex.h similarity index 100% rename from LEGO1/lego/sources/geom/legovertex.h rename to LEGO1/lego/sources/shape/legovertex.h