From 9924ba2a04192bced34353b00ce929d500f1cbce Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Wed, 6 May 2020 22:41:16 +1000 Subject: [PATCH] Get rid of VertexStructs.h and fixup some includes --- src/AxisLinesRenderer.c | 1 + src/Builder.c | 2 +- src/ClassiCube.vcxproj | 1 - src/ClassiCube.vcxproj.filters | 3 --- src/Drawer.c | 1 + src/Drawer.h | 3 ++- src/Drawer2D.c | 1 + src/Entity.c | 1 + src/EntityComponents.c | 1 - src/EnvRenderer.c | 1 + src/Game.c | 1 + src/Graphics.h | 10 +++++++--- src/Gui.c | 1 + src/Gui.h | 3 ++- src/IsometricDrawer.h | 3 ++- src/MapRenderer.c | 1 + src/Model.c | 1 + src/Model.h | 2 +- src/Particle.h | 3 ++- src/PickedPosRenderer.c | 2 +- src/Screens.h | 2 +- src/SelectionBox.c | 1 + src/SelectionBox.h | 2 +- src/TexturePack.c | 1 + src/VertexStructs.h | 12 ------------ 25 files changed, 31 insertions(+), 29 deletions(-) delete mode 100644 src/VertexStructs.h diff --git a/src/AxisLinesRenderer.c b/src/AxisLinesRenderer.c index dbd86cec8..aedb70ef1 100644 --- a/src/AxisLinesRenderer.c +++ b/src/AxisLinesRenderer.c @@ -6,6 +6,7 @@ #include "Camera.h" #include "Event.h" #include "Entity.h" +#include "GameStructs.h" cc_bool AxisLinesRenderer_Enabled; static GfxResourceID axisLines_vb; diff --git a/src/Builder.c b/src/Builder.c index 2753ed708..e81af0c91 100644 --- a/src/Builder.c +++ b/src/Builder.c @@ -12,9 +12,9 @@ #include "Block.h" #include "PackedCol.h" #include "TexturePack.h" -#include "VertexStructs.h" #include "Game.h" #include "Options.h" +#include "GameStructs.h" int Builder_SidesLevel, Builder_EdgeLevel; /* Packs an index into the 16x16x16 count array. Coordinates range from 0 to 15. */ diff --git a/src/ClassiCube.vcxproj b/src/ClassiCube.vcxproj index c231a01b4..0a464b778 100644 --- a/src/ClassiCube.vcxproj +++ b/src/ClassiCube.vcxproj @@ -245,7 +245,6 @@ - diff --git a/src/ClassiCube.vcxproj.filters b/src/ClassiCube.vcxproj.filters index 94788dfd0..1cc25b77d 100644 --- a/src/ClassiCube.vcxproj.filters +++ b/src/ClassiCube.vcxproj.filters @@ -147,9 +147,6 @@ Header Files\Math - - Header Files\Graphics - Header Files\Map diff --git a/src/Drawer.c b/src/Drawer.c index 961e5a7bd..487dac0a7 100644 --- a/src/Drawer.c +++ b/src/Drawer.c @@ -1,6 +1,7 @@ #include "Drawer.h" #include "TexturePack.h" #include "Constants.h" +#include "Graphics.h" struct _DrawerData Drawer; void Drawer_XMin(int count, PackedCol col, TextureLoc texLoc, struct VertexTextured** vertices) { diff --git a/src/Drawer.h b/src/Drawer.h index 0ba36883c..8935c6830 100644 --- a/src/Drawer.h +++ b/src/Drawer.h @@ -1,10 +1,11 @@ #ifndef CC_DRAWER_H #define CC_DRAWER_H -#include "VertexStructs.h" +#include "PackedCol.h" #include "Vectors.h" /* Draws the vertices for a cuboid region. Copyright 2014-2019 ClassiCube | Licensed under BSD-3 */ +struct VertexTextured; CC_VAR extern struct _DrawerData { /* Whether a colour tinting effect should be applied to all faces. */ diff --git a/src/Drawer2D.c b/src/Drawer2D.c index 636dcbe1b..3f76c8e10 100644 --- a/src/Drawer2D.c +++ b/src/Drawer2D.c @@ -12,6 +12,7 @@ #include "Errors.h" #include "Window.h" #include "Options.h" +#include "GameStructs.h" cc_bool Drawer2D_BitmappedText; cc_bool Drawer2D_BlackTextShadows; diff --git a/src/Entity.c b/src/Entity.c index 9a9c9b3c4..3b5514705 100644 --- a/src/Entity.c +++ b/src/Entity.c @@ -21,6 +21,7 @@ #include "Logger.h" #include "Options.h" #include "Errors.h" +#include "GameStructs.h" const char* const NameMode_Names[NAME_MODE_COUNT] = { "None", "Hovered", "All", "AllHovered", "AllUnscaled" }; const char* const ShadowMode_Names[SHADOW_MODE_COUNT] = { "None", "SnapToBlock", "Circle", "CircleAll" }; diff --git a/src/EntityComponents.c b/src/EntityComponents.c index aed603b72..afdea0200 100644 --- a/src/EntityComponents.c +++ b/src/EntityComponents.c @@ -8,7 +8,6 @@ #include "Platform.h" #include "Camera.h" #include "Funcs.h" -#include "VertexStructs.h" #include "Graphics.h" #include "Physics.h" #include "Model.h" diff --git a/src/EnvRenderer.c b/src/EnvRenderer.c index 4d97622ff..36a3bb61b 100644 --- a/src/EnvRenderer.c +++ b/src/EnvRenderer.c @@ -18,6 +18,7 @@ #include "Camera.h" #include "Particle.h" #include "Options.h" +#include "GameStructs.h" cc_bool EnvRenderer_Legacy, EnvRenderer_Minimal; diff --git a/src/Game.c b/src/Game.c index d753c829d..bf3707c00 100644 --- a/src/Game.c +++ b/src/Game.c @@ -33,6 +33,7 @@ #include "Audio.h" #include "Stream.h" #include "Builder.h" +#include "GameStructs.h" struct _GameData Game; int Game_Port; diff --git a/src/Graphics.h b/src/Graphics.h index b0ce463a9..fab137b25 100644 --- a/src/Graphics.h +++ b/src/Graphics.h @@ -1,9 +1,8 @@ #ifndef CC_GFXAPI_H #define CC_GFXAPI_H #include "Vectors.h" -#include "GameStructs.h" #include "Bitmap.h" -#include "VertexStructs.h" +#include "PackedCol.h" /* Abstracts a 3D graphics rendering API. Copyright 2014-2019 ClassiCube | Licensed under BSD-3 @@ -20,8 +19,13 @@ typedef enum MatrixType_ { MATRIX_PROJECTION, MATRIX_VIEW, MATRIX_TEXTURE } MatrixType; -#define SIZEOF_VERTEX_TEXTURED 24 #define SIZEOF_VERTEX_COLOURED 16 +#define SIZEOF_VERTEX_TEXTURED 24 + +/* 3 floats for position (XYZ), 4 bytes for colour. */ +typedef struct VertexColoured { float X, Y, Z; PackedCol Col; } VertexP3fC4b; +/* 3 floats for position (XYZ), 2 floats for texture coordinates (UV), 4 bytes for colour. */ +typedef struct VertexTextured { float X, Y, Z; PackedCol Col; float U, V; } VertexP3fT2fC4b; void Gfx_Init(void); void Gfx_Free(void); diff --git a/src/Gui.c b/src/Gui.c index 3a20422e9..3f0b975a5 100644 --- a/src/Gui.c +++ b/src/Gui.c @@ -12,6 +12,7 @@ #include "Platform.h" #include "Bitmap.h" #include "Options.h" +#include "GameStructs.h" cc_bool Gui_ClassicTexture, Gui_ClassicTabList, Gui_ClassicMenu, Gui_ClassicChat; int Gui_Chatlines; diff --git a/src/Gui.h b/src/Gui.h index d0635a99c..31c6a15ae 100644 --- a/src/Gui.h +++ b/src/Gui.h @@ -1,6 +1,6 @@ #ifndef CC_GUI_H #define CC_GUI_H -#include "VertexStructs.h" +#include "String.h" /* Describes and manages 2D GUI elements on screen. Copyright 2014-2019 ClassiCube | Licensed under BSD-3 */ @@ -14,6 +14,7 @@ enum GuiAnchor { }; struct IGameComponent; +struct VertexTextured; struct FontDesc; struct Widget; extern struct IGameComponent Gui_Component; diff --git a/src/IsometricDrawer.h b/src/IsometricDrawer.h index 09cfc9379..3be44b065 100644 --- a/src/IsometricDrawer.h +++ b/src/IsometricDrawer.h @@ -1,9 +1,10 @@ #ifndef CC_ISOMETRICDRAWER_H #define CC_ISOMETRICDRAWER_H -#include "VertexStructs.h" +#include "Core.h" /* Draws 2D isometric blocks for the hotbar and inventory UIs. Copyright 2014-2019 ClassiCube | Licensed under BSD-3 */ +struct VertexTextured; /* Maximum number of vertices used to draw a block in isometric way. */ #define ISOMETRICDRAWER_MAXVERTICES 16 diff --git a/src/MapRenderer.c b/src/MapRenderer.c index ec974f16d..8db77f17a 100644 --- a/src/MapRenderer.c +++ b/src/MapRenderer.c @@ -14,6 +14,7 @@ #include "Utils.h" #include "World.h" #include "Options.h" +#include "GameStructs.h" int MapRenderer_ChunksX, MapRenderer_ChunksY, MapRenderer_ChunksZ; int MapRenderer_1DUsedCount, MapRenderer_ChunksCount; diff --git a/src/Model.c b/src/Model.c index 964081b3f..c8b01f4cf 100644 --- a/src/Model.c +++ b/src/Model.c @@ -13,6 +13,7 @@ #include "Stream.h" #include "Funcs.h" #include "Options.h" +#include "GameStructs.h" struct _ModelsData Models; diff --git a/src/Model.h b/src/Model.h index 1911dcd73..542f0a10d 100644 --- a/src/Model.h +++ b/src/Model.h @@ -3,7 +3,6 @@ #include "Vectors.h" #include "PackedCol.h" #include "Constants.h" -#include "VertexStructs.h" /* Contains various structs and methods for an entity model. Also contains a list of models and default textures for those models. Copyright 2014-2019 ClassiCube | Licensed under BSD-3 @@ -11,6 +10,7 @@ struct Entity; struct AABB; struct IGameComponent; +struct VertexTextured; extern struct IGameComponent Models_Component; #define MODEL_QUAD_VERTICES 4 diff --git a/src/Particle.h b/src/Particle.h index 94ee7224e..70c7d618c 100644 --- a/src/Particle.h +++ b/src/Particle.h @@ -1,12 +1,13 @@ #ifndef CC_PARTICLE_H #define CC_PARTICLE_H #include "Vectors.h" -#include "VertexStructs.h" +#include "PackedCol.h" /* Represents particle effects, and manages rendering and spawning particles. Copyright 2014-2019 ClassiCube | Licensed under BSD-3 */ struct IGameComponent; +struct VertexTextured; struct ScheduledTask; extern struct IGameComponent Particles_Component; diff --git a/src/PickedPosRenderer.c b/src/PickedPosRenderer.c index 81a685374..85a320e6d 100644 --- a/src/PickedPosRenderer.c +++ b/src/PickedPosRenderer.c @@ -1,12 +1,12 @@ #include "PickedPosRenderer.h" #include "PackedCol.h" -#include "VertexStructs.h" #include "Graphics.h" #include "Game.h" #include "Event.h" #include "Picking.h" #include "Funcs.h" #include "Camera.h" +#include "GameStructs.h" static GfxResourceID pickedPos_vb; #define PICKEDPOS_NUM_VERTICES (16 * 6) diff --git a/src/Screens.h b/src/Screens.h index 9ffad6890..b16331d12 100644 --- a/src/Screens.h +++ b/src/Screens.h @@ -1,6 +1,6 @@ #ifndef CC_SCREENS_H #define CC_SCREENS_H -#include "VertexStructs.h" +#include "String.h" /* Contains all 2D non-menu screen implementations. Copyright 2014-2019 ClassiCube | Licensed under BSD-3 */ diff --git a/src/SelectionBox.c b/src/SelectionBox.c index 9347e2fde..e0454063f 100644 --- a/src/SelectionBox.c +++ b/src/SelectionBox.c @@ -5,6 +5,7 @@ #include "Funcs.h" #include "Game.h" #include "Camera.h" +#include "GameStructs.h" /* Data for a selection box. */ struct SelectionBox { diff --git a/src/SelectionBox.h b/src/SelectionBox.h index 9622439b3..bf7715e32 100644 --- a/src/SelectionBox.h +++ b/src/SelectionBox.h @@ -1,7 +1,7 @@ #ifndef CC_SELECTIONBOX_H #define CC_SELECTIONBOX_H -#include "VertexStructs.h" #include "Vectors.h" +#include "PackedCol.h" /* Describes a selection box, and contains methods related to the selection box. Copyright 2014-2019 ClassiCube | Licensed under BSD-3 */ diff --git a/src/TexturePack.c b/src/TexturePack.c index b14427812..62515f075 100644 --- a/src/TexturePack.c +++ b/src/TexturePack.c @@ -17,6 +17,7 @@ #include "Chat.h" #include "Options.h" #include "Logger.h" +#include "GameStructs.h" #define LIQUID_ANIM_MAX 64 #define WATER_TEX_LOC 14 diff --git a/src/VertexStructs.h b/src/VertexStructs.h deleted file mode 100644 index 753fda923..000000000 --- a/src/VertexStructs.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef CC_VERTEXSTRUCTS_H -#define CC_VERTEXSTRUCTS_H -#include "PackedCol.h" -/* Represents simple vertex formats. - Copyright 2014-2019 ClassiCube | Licensed under BSD-3 -*/ - -/* 3 floats for position (XYZ), 4 bytes for colour. */ -typedef struct VertexColoured { float X, Y, Z; PackedCol Col; } VertexP3fC4b; -/* 3 floats for position (XYZ), 2 floats for texture coordinates (UV), 4 bytes for colour. */ -typedef struct VertexTextured { float X, Y, Z; PackedCol Col; float U, V; } VertexP3fT2fC4b; -#endif