Skip to content

Commit

Permalink
Merge pull request OpenEnroth#1356 from captainurist/macos_fixes_409
Browse files Browse the repository at this point in the history
Moved Geometry to Library
  • Loading branch information
captainurist authored Nov 5, 2023
2 parents e7d83ee + e7c2b9a commit e2233e7
Show file tree
Hide file tree
Showing 51 changed files with 89 additions and 81 deletions.
4 changes: 2 additions & 2 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ Code Organization
OpenEnroth code is broken up as follows:
* `thirdparty` – this is where all external libraries go.
* `Utility` – generic utility classes and functions go here. Utility classes should be domain-independent (e.g. should make sense in a context of some other project) and should depend only on `thirdparty` libraries.
* `Platform`our platform abstraction layer on top of SDL. Platform classes should also be reasonably domain-independent and should depend only on `Utility`.
* `Library` – collection of independent libraries that the engine is built on top of. Code here can depend on `Utility`, `Platform`, and other libraries in `Library`.
* `Library`collection of independent libraries that the engine is built on top of. Code here can depend on `Utility` and other libraries in `Library`. However, there should be no cyclical dependencies between libraries here.
* `Library/Platform` is our platform abstraction layer on top of SDL.
* The rest of the code is currently pretty tangled with each part depending on each other. This document will be updated once we have some progress there.

Our basic guidelines for code organization are:
Expand Down
2 changes: 1 addition & 1 deletion src/Application/GameWindowHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Library/Platform/Interface/PlatformEnums.h"
#include "Library/Platform/Filters/PlatformEventFilter.h"
#include "Library/Platform/Application/PlatformApplicationAware.h"
#include "Utility/Geometry/Size.h"
#include "Library/Geometry/Size.h"

namespace Io {
class Mouse;
Expand Down
4 changes: 2 additions & 2 deletions src/Arcomage/Arcomage.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include "Engine/Graphics/FrameLimiter.h"

#include "Utility/Geometry/Point.h"
#include "Utility/Geometry/Rect.h"
#include "Library/Geometry/Point.h"
#include "Library/Geometry/Rect.h"

#include "Library/Platform/Interface/PlatformEnums.h"

Expand Down
2 changes: 1 addition & 1 deletion src/Engine/AttackList.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Engine/Objects/ActorEnums.h"
#include "Engine/Pid.h"

#include "Utility/Geometry/Vec.h"
#include "Library/Geometry/Vec.h"

struct AttackDescription {
Pid pid;
Expand Down
4 changes: 2 additions & 2 deletions src/Engine/Graphics/BSPModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <vector>
#include <string>

#include "Utility/Geometry/Plane.h"
#include "Utility/Geometry/BBox.h"
#include "Library/Geometry/Plane.h"
#include "Library/Geometry/BBox.h"

#include "FaceEnums.h"

Expand Down
4 changes: 2 additions & 2 deletions src/Engine/Graphics/BspRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include <array>

#include "Utility/Geometry/Plane.h"

#include "Engine/Graphics/Camera.h"

#include "Library/Geometry/Plane.h"

struct BspRenderer_ViewportNode {
int uSectorID = 0; // sector that this node shows
int uFaceID = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Graphics/Camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "Engine/Graphics/RenderEntities.h"

#include "Utility/Geometry/Plane.h"
#include "Library/Geometry/Plane.h"

struct Camera3D {
void ViewTransform(int x, int y, int z, int *transformed_x, int *transformed_y, int *transformed_z);
Expand Down
5 changes: 3 additions & 2 deletions src/Engine/Graphics/ClippingFunctions.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#pragma once

#include "Utility/Geometry/Plane.h"

#include "Engine/Graphics/RenderEntities.h"

#include "Library/Geometry/Plane.h"
#include "Library/Geometry/Vec.h"

struct VertexBuffer {
std::array<RenderVertexSoft, 64> pVertices = {{}};
int uNumVertices;
Expand Down
4 changes: 2 additions & 2 deletions src/Engine/Graphics/Collisions.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "Engine/Pid.h"

#include "Utility/Geometry/Vec.h"
#include "Utility/Geometry/BBox.h"
#include "Library/Geometry/Vec.h"
#include "Library/Geometry/BBox.h"

struct BLVFace;
class Actor;
Expand Down
3 changes: 1 addition & 2 deletions src/Engine/Graphics/IRender.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "Library/Image/Image.h"
#include "Library/Color/Color.h"
#include "Library/Color/ColorTable.h"

#include "Utility/Geometry/Rect.h"
#include "Library/Geometry/Rect.h"

#include "TextureRenderId.h"
#include "RenderEntities.h"
Expand Down
6 changes: 3 additions & 3 deletions src/Engine/Graphics/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#include <string>
#include <memory>

#include "Utility/Geometry/Size.h"
#include "Utility/Types.h"

#include "Library/Geometry/Size.h"
#include "Library/Image/Image.h"
#include "Library/Image/Palette.h"

#include "Utility/Types.h"

#include "TextureRenderId.h"

class ImageLoader;
Expand Down
3 changes: 2 additions & 1 deletion src/Engine/Graphics/Level/Decoration.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#include <vector>
#include <cstdint>

#include "Utility/Geometry/Vec.h"
#include "Library/Geometry/Vec.h"

#include "Utility/Flags.h"

enum class LevelDecorationFlag : uint16_t {
Expand Down
3 changes: 1 addition & 2 deletions src/Engine/Graphics/LightsStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#include <array>

#include "Library/Color/Color.h"

#include "Utility/Geometry/Vec.h"
#include "Library/Geometry/Vec.h"

struct StationaryLight {
Vec3f vPosition {};
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Graphics/OpenGL/RenderOpenGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
#include "Library/Image/ImageFunctions.h"
#include "Library/Color/Colorf.h"
#include "Library/Logger/Logger.h"
#include "Library/Geometry/Size.h"

#include "Utility/Geometry/Size.h"
#include "Utility/Format.h"
#include "Utility/Memory/MemSet.h"

Expand Down
4 changes: 2 additions & 2 deletions src/Engine/Graphics/PortalFunctions.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include "Utility/Geometry/Vec.h"
#include "Utility/Geometry/Plane.h"
#include "Library/Geometry/Vec.h"
#include "Library/Geometry/Plane.h"

struct stru10 {
stru10();
Expand Down
3 changes: 1 addition & 2 deletions src/Engine/Graphics/RenderEntities.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include "Engine/Pid.h"

#include "Library/Color/Color.h"

#include "Utility/Geometry/Vec.h"
#include "Library/Geometry/Vec.h"

class Sprite;
class SpriteFrame;
Expand Down
7 changes: 4 additions & 3 deletions src/Engine/Graphics/Vis.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#pragma once

#include "Utility/Flags.h"
#include "Utility/Geometry/Plane.h"

#include "Engine/Graphics/RenderEntities.h"
#include "Engine/Objects/ActorEnums.h"
#include "Engine/Pid.h"

#include "Library/Geometry/Plane.h"

#include "Utility/Flags.h"

class BSPModel;
struct ODMFace;
struct BLVFace;
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Graphics/Weather.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <array>

#include "Utility/Geometry/Point.h"
#include "Library/Geometry/Point.h"

class Weather {
public:
Expand Down
3 changes: 2 additions & 1 deletion src/Engine/Objects/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#include "Engine/Objects/CombinedSkillValue.h"
#include "Engine/Pid.h"

#include "Utility/Geometry/Vec.h"
#include "Library/Geometry/Vec.h"

#include "Utility/IndexedArray.h"

#include "ActorEnums.h"
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Objects/Character.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include "GUI/GUIEnums.h"

#include "Library/Color/Color.h"
#include "Library/Geometry/Vec.h"

#include "Utility/Geometry/Vec.h"
#include "Utility/IndexedArray.h"
#include "Utility/IndexedBitset.h"

Expand Down
3 changes: 2 additions & 1 deletion src/Engine/Objects/Chest.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#include "Engine/Objects/Items.h"
#include "Engine/Pid.h"

#include "Utility/Geometry/Vec.h"
#include "Library/Geometry/Vec.h"

#include "Utility/Memory/Blob.h"

#include "ChestEnums.h"
Expand Down
3 changes: 1 addition & 2 deletions src/Engine/Objects/SpriteObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "Engine/Pid.h"

#include "Library/Color/Color.h"

#include "Utility/Geometry/Vec.h"
#include "Library/Geometry/Vec.h"

class SpriteFrame;

Expand Down
6 changes: 3 additions & 3 deletions src/Engine/Snapshots/EntitySnapshots.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <array>

#include "Utility/Geometry/Vec.h"
#include "Utility/Geometry/Plane.h"
#include "Utility/Geometry/BBox.h" // TODO(captainurist): Don't depend on BBox binary layout.
#include "Library/Geometry/Vec.h"
#include "Library/Geometry/Plane.h"
#include "Library/Geometry/BBox.h" // TODO(captainurist): Don't depend on BBox binary layout.

#include "Library/Binary/BinarySerialization.h"

Expand Down
2 changes: 1 addition & 1 deletion src/Engine/SpawnPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Engine/Objects/ItemEnums.h"
#include "Engine/Pid.h"

#include "Utility/Geometry/Vec.h"
#include "Library/Geometry/Vec.h"

struct SpawnPoint {
Vec3i vPosition;
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/TeleportPoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <string>

#include "Utility/Geometry/Vec.h"
#include "Library/Geometry/Vec.h"

/**
* Describes target teleportation point of the party.
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/mm7_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include "GUI/GUIDialogues.h"

#include "Library/Color/Color.h"
#include "Library/Geometry/Vec.h"

#include "Utility/IndexedArray.h"
#include "Utility/Geometry/Vec.h"

class GUIButton;
class Actor;
Expand Down
3 changes: 1 addition & 2 deletions src/GUI/GUIFont.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

#include "Library/Color/Color.h"
#include "Library/Image/Palette.h"

#include "Utility/Geometry/Point.h"
#include "Library/Geometry/Point.h"

struct GUICharMetric {
int32_t uLeftSpacing;
Expand Down
5 changes: 2 additions & 3 deletions src/GUI/GUIWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
#include "Io/KeyboardInputHandler.h"

#include "Library/Platform/Interface/PlatformEnums.h"

#include "Library/Color/ColorTable.h"
#include "Library/Geometry/Size.h"
#include "Library/Geometry/Point.h"

#include "Utility/Geometry/Size.h"
#include "Utility/Geometry/Point.h"
#include "Utility/IndexedArray.h"

namespace Io {
Expand Down
3 changes: 1 addition & 2 deletions src/GUI/UI/Books/TownPortalBook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "Engine/Spells/Spells.h"
#include "Engine/MapInfo.h"

#include "GUI/GUIFont.h"
#include "GUI/UI/Books/TownPortalBook.h"
#include "GUI/UI/UIStatusBar.h"
#include "GUI/UI/UIGame.h"
Expand All @@ -20,7 +19,7 @@

#include "Io/Mouse.h"

#include "Utility/Geometry/Rect.h"
#include "Library/Geometry/Rect.h"

struct TownPortalData {
Vec3i pos;
Expand Down
3 changes: 2 additions & 1 deletion src/GUI/UI/NPCTopics.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
#include <string>
#include <vector>

#include "Utility/Geometry/Vec.h"
#include "Engine/Tables/AwardTable.h"
#include "Engine/Tables/NPCTable.h"
#include "Engine/Objects/CharacterEnums.h"
#include "GUI/GUIDialogues.h"
#include "GUI/UI/UIHouseEnums.h"

#include "Library/Geometry/Vec.h"

std::string npcDialogueOptionString(DIALOGUE_TYPE topic, NPCData *npcData);

std::vector<DIALOGUE_TYPE> prepareScriptedNPCDialogueTopics(NPCData *npcData);
Expand Down
2 changes: 1 addition & 1 deletion src/Io/Mouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "Engine/Objects/ItemEnums.h"
#include "Engine/Pid.h"

#include "Utility/Geometry/Point.h"
#include "Library/Geometry/Point.h"

class GraphicsImage;

Expand Down
1 change: 1 addition & 0 deletions src/Library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ add_subdirectory(Cli)
add_subdirectory(Color)
add_subdirectory(Compression)
add_subdirectory(Config)
add_subdirectory(Geometry)
add_subdirectory(Image)
add_subdirectory(Json)
add_subdirectory(Lod)
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions src/Library/Geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)

set(LIBRARY_GEOMETRY_SOURCES)

set(LIBRARY_GEOMETRY_HEADERS
BBox.h
Margins.h
Plane.h
Point.h
Rect.h
Size.h
Vec.h)

add_library(library_geometry INTERFACE ${LIBRARY_GEOMETRY_SOURCES} ${LIBRARY_GEOMETRY_HEADERS})
target_link_libraries(library_geometry INTERFACE utility)
target_check_style(library_geometry)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/Library/Image/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ set(LIBRARY_IMAGE_HEADERS
PCX.h)

add_library(library_image STATIC ${LIBRARY_IMAGE_SOURCES} ${LIBRARY_IMAGE_HEADERS})
target_link_libraries(library_image PUBLIC library_color utility)
target_link_libraries(library_image PUBLIC library_color library_geometry utility)
target_check_style(library_image)
3 changes: 2 additions & 1 deletion src/Library/Image/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#include <utility>

#include "Library/Color/Color.h"
#include "Utility/Geometry/Size.h"
#include "Library/Geometry/Size.h"

#include "Utility/Memory/FreeDeleter.h"
#include "Utility/Types.h"

Expand Down
2 changes: 1 addition & 1 deletion src/Library/Platform/Interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ set(LIBRARY_PLATFORM_INTERFACE_HEADERS

add_library(library_platform_interface STATIC ${LIBRARY_PLATFORM_INTERFACE_SOURCES} ${LIBRARY_PLATFORM_INTERFACE_HEADERS})
target_check_style(library_platform_interface)
target_link_libraries(library_platform_interface PUBLIC utility library_logger)
target_link_libraries(library_platform_interface PUBLIC utility library_logger library_geometry)
Loading

0 comments on commit e2233e7

Please sign in to comment.