From ad6df32c974cd94e324d4c94b492b34ac5adf25b Mon Sep 17 00:00:00 2001 From: Vsevolod Kremianskii Date: Sun, 20 Jun 2021 12:41:39 +0700 Subject: [PATCH] Use forward declaration in libgraphics --- src/engine/engine.cpp | 5 ++++ src/engine/game/console.cpp | 1 + src/engine/game/cursors.cpp | 4 +++ src/engine/game/cursors.h | 17 +++++++++-- src/engine/game/d20/feats.cpp | 1 + src/engine/game/d20/skills.cpp | 2 ++ src/engine/game/game.cpp | 6 +++- src/engine/game/gui/conversation.cpp | 1 + src/engine/game/gui/hud.cpp | 1 + src/engine/game/gui/profileoverlay.cpp | 1 + src/engine/game/gui/selectoverlay.cpp | 1 + src/engine/game/map.cpp | 1 + src/engine/game/object/area.cpp | 1 + src/engine/graphics/cursor.cpp | 6 ++++ src/engine/graphics/cursor.h | 3 +- src/engine/graphics/font.cpp | 7 +++++ src/engine/graphics/font.h | 12 ++++---- src/engine/graphics/fonts.cpp | 6 ++++ src/engine/graphics/fonts.h | 10 +++---- src/engine/graphics/framebuffer.cpp | 3 ++ src/engine/graphics/framebuffer.h | 6 ++-- src/engine/graphics/lip/lipreader.cpp | 2 ++ src/engine/graphics/lip/lipreader.h | 4 +-- src/engine/graphics/lip/lips.cpp | 1 + src/engine/graphics/lip/lips.h | 7 ++++- src/engine/graphics/materials.cpp | 3 ++ src/engine/graphics/materials.h | 12 +++++--- src/engine/graphics/mesh/meshes.cpp | 2 ++ src/engine/graphics/mesh/meshes.h | 4 +-- src/engine/graphics/model/animation.cpp | 2 ++ src/engine/graphics/model/animation.h | 4 +-- src/engine/graphics/model/mdlreader.cpp | 22 +++++++------- src/engine/graphics/model/mdlreader.h | 15 ++++++---- src/engine/graphics/model/model.cpp | 5 ++++ src/engine/graphics/model/model.h | 5 ++-- src/engine/graphics/model/modelnode.cpp | 3 ++ src/engine/graphics/model/modelnode.h | 13 ++++---- src/engine/graphics/model/models.cpp | 8 +++-- src/engine/graphics/model/models.h | 10 +++++-- src/engine/graphics/pbribl.cpp | 5 ++++ src/engine/graphics/pbribl.h | 9 +++--- src/engine/graphics/services.cpp | 17 +++++++++++ src/engine/graphics/services.h | 33 ++++++++++++--------- src/engine/graphics/texture/curreader.cpp | 1 + src/engine/graphics/texture/curreader.h | 4 +-- src/engine/graphics/texture/textures.cpp | 3 ++ src/engine/graphics/texture/textures.h | 14 +++++---- src/engine/graphics/texture/tgareader.cpp | 1 + src/engine/graphics/texture/tgareader.h | 4 +-- src/engine/graphics/texture/tgawriter.cpp | 4 ++- src/engine/graphics/texture/tgawriter.h | 4 ++- src/engine/graphics/walkmesh/bwmreader.cpp | 2 ++ src/engine/graphics/walkmesh/bwmreader.h | 4 +-- src/engine/graphics/walkmesh/walkmeshes.cpp | 1 + src/engine/graphics/walkmesh/walkmeshes.h | 7 ++++- src/engine/graphics/window.h | 6 ++-- src/engine/gui/control/control.cpp | 2 ++ src/engine/gui/control/imagebutton.cpp | 2 ++ src/engine/gui/control/progressbar.cpp | 2 ++ src/engine/gui/control/scrollbar.cpp | 2 ++ src/engine/gui/gui.cpp | 2 ++ src/engine/resource/format/pereader.h | 14 +++------ src/engine/resource/types.h | 9 ++++++ src/engine/scene/node/emitter.cpp | 2 ++ src/engine/scene/node/grass.cpp | 2 ++ src/engine/scene/node/light.cpp | 2 ++ src/engine/scene/node/mesh.cpp | 3 ++ src/engine/scene/node/model.cpp | 1 + src/engine/scene/node/model_animation.cpp | 1 + src/engine/scene/pipeline/control.cpp | 2 ++ src/engine/scene/pipeline/world.cpp | 2 ++ src/engine/scene/scenegraph.cpp | 2 ++ src/engine/video/video.cpp | 2 ++ src/engine/video/video.h | 6 ++++ 74 files changed, 289 insertions(+), 105 deletions(-) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index ae8dc024..a4dd15cc 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -20,7 +20,12 @@ #include "audio/player.h" #include "audio/services.h" #include "game/game.h" +#include "graphics/context.h" +#include "graphics/features.h" +#include "graphics/lip/lips.h" +#include "graphics/model/models.h" #include "graphics/services.h" +#include "graphics/walkmesh/walkmeshes.h" #include "resource/resourceprovider.h" #include "resource/services.h" #include "scene/services.h" diff --git a/src/engine/game/console.cpp b/src/engine/game/console.cpp index ab1eb990..cac6b021 100644 --- a/src/engine/game/console.cpp +++ b/src/engine/game/console.cpp @@ -20,6 +20,7 @@ #include "../common/log.h" #include "../graphics/font.h" #include "../graphics/fonts.h" +#include "../graphics/mesh/mesh.h" #include "../graphics/mesh/meshes.h" #include "../graphics/shader/shaders.h" #include "../graphics/window.h" diff --git a/src/engine/game/cursors.cpp b/src/engine/game/cursors.cpp index 985c0120..05c6afb1 100644 --- a/src/engine/game/cursors.cpp +++ b/src/engine/game/cursors.cpp @@ -18,7 +18,11 @@ #include "cursors.h" #include "../common/streamutil.h" +#include "../graphics/cursor.h" +#include "../graphics/services.h" #include "../graphics/texture/curreader.h" +#include "../resource/resources.h" +#include "../resource/services.h" using namespace std; diff --git a/src/engine/game/cursors.h b/src/engine/game/cursors.h index 220ee005..97115c20 100644 --- a/src/engine/game/cursors.h +++ b/src/engine/game/cursors.h @@ -17,13 +17,24 @@ #pragma once -#include "../graphics/services.h" -#include "../resource/services.h" - #include "types.h" namespace reone { +namespace resource { + +class ResourceServices; + +} + +namespace graphics { + +class Cursor; +class GraphicsServices; +class Texture; + +} + namespace game { class Cursors : boost::noncopyable { diff --git a/src/engine/game/d20/feats.cpp b/src/engine/game/d20/feats.cpp index dc2abe6a..30b89c02 100644 --- a/src/engine/game/d20/feats.cpp +++ b/src/engine/game/d20/feats.cpp @@ -19,6 +19,7 @@ #include "../../common/collectionutil.h" #include "../../resource/2da.h" +#include "../../resource/resources.h" #include "../../resource/strings.h" using namespace std; diff --git a/src/engine/game/d20/skills.cpp b/src/engine/game/d20/skills.cpp index 33175f87..740d79d5 100644 --- a/src/engine/game/d20/skills.cpp +++ b/src/engine/game/d20/skills.cpp @@ -18,7 +18,9 @@ #include "skills.h" #include "../../common/collectionutil.h" +#include "../../graphics/texture/textures.h" #include "../../resource/2da.h" +#include "../../resource/resources.h" #include "../../resource/strings.h" using namespace std; diff --git a/src/engine/game/game.cpp b/src/engine/game/game.cpp index bc86bd2a..dfc9b746 100644 --- a/src/engine/game/game.cpp +++ b/src/engine/game/game.cpp @@ -17,9 +17,13 @@ #include "game.h" +#include "../audio/player.h" #include "../common/log.h" #include "../common/pathutil.h" -#include "../audio/player.h" +#include "../graphics/features.h" +#include "../graphics/lip/lips.h" +#include "../graphics/model/models.h" +#include "../graphics/walkmesh/walkmeshes.h" #include "../video/bikreader.h" using namespace std; diff --git a/src/engine/game/gui/conversation.cpp b/src/engine/game/gui/conversation.cpp index 2aacb1b6..53f19584 100644 --- a/src/engine/game/gui/conversation.cpp +++ b/src/engine/game/gui/conversation.cpp @@ -22,6 +22,7 @@ #include "../../common/log.h" #include "../../gui/control/listbox.h" #include "../../graphics/lip/lips.h" +#include "../../graphics/model/animation.h" #include "../../graphics/model/models.h" #include "../../resource/resources.h" diff --git a/src/engine/game/gui/hud.cpp b/src/engine/game/gui/hud.cpp index 9b2a3739..a13d743c 100644 --- a/src/engine/game/gui/hud.cpp +++ b/src/engine/game/gui/hud.cpp @@ -19,6 +19,7 @@ #include "../../common/log.h" #include "../../gui/control/label.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/window.h" diff --git a/src/engine/game/gui/profileoverlay.cpp b/src/engine/game/gui/profileoverlay.cpp index 528aa804..8b4478e7 100644 --- a/src/engine/game/gui/profileoverlay.cpp +++ b/src/engine/game/gui/profileoverlay.cpp @@ -19,6 +19,7 @@ #include "../../common/guardutil.h" #include "../../graphics/fonts.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/shader/shaders.h" #include "../../graphics/textutil.h" diff --git a/src/engine/game/gui/selectoverlay.cpp b/src/engine/game/gui/selectoverlay.cpp index c07f0e25..b38c743b 100644 --- a/src/engine/game/gui/selectoverlay.cpp +++ b/src/engine/game/gui/selectoverlay.cpp @@ -21,6 +21,7 @@ #include "../../graphics/context.h" #include "../../graphics/font.h" #include "../../graphics/fonts.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/shader/shaders.h" #include "../../graphics/texture/texture.h" diff --git a/src/engine/game/map.cpp b/src/engine/game/map.cpp index ccb39ee2..68feb415 100644 --- a/src/engine/game/map.cpp +++ b/src/engine/game/map.cpp @@ -20,6 +20,7 @@ #include "../common/log.h" #include "../common/guardutil.h" #include "../graphics/context.h" +#include "../graphics/mesh/mesh.h" #include "../graphics/mesh/meshes.h" #include "../graphics/texture/textures.h" #include "../graphics/window.h" diff --git a/src/engine/game/object/area.cpp b/src/engine/game/object/area.cpp index eba54396..011c3eba 100644 --- a/src/engine/game/object/area.cpp +++ b/src/engine/game/object/area.cpp @@ -22,6 +22,7 @@ #include "../../common/random.h" #include "../../common/streamutil.h" #include "../../graphics/baryutil.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/model/models.h" #include "../../graphics/texture/textures.h" diff --git a/src/engine/graphics/cursor.cpp b/src/engine/graphics/cursor.cpp index c9a4e979..1a665ad7 100644 --- a/src/engine/graphics/cursor.cpp +++ b/src/engine/graphics/cursor.cpp @@ -19,7 +19,13 @@ #include "../common/guardutil.h" +#include "context.h" +#include "mesh/mesh.h" +#include "mesh/meshes.h" +#include "shader/shaders.h" #include "services.h" +#include "texture/texture.h" +#include "window.h" using namespace std; diff --git a/src/engine/graphics/cursor.h b/src/engine/graphics/cursor.h index 333b3f81..62999c5c 100644 --- a/src/engine/graphics/cursor.h +++ b/src/engine/graphics/cursor.h @@ -17,13 +17,12 @@ #pragma once -#include "texture/texture.h" - namespace reone { namespace graphics { class GraphicsServices; +class Texture; class Cursor : boost::noncopyable { public: diff --git a/src/engine/graphics/font.cpp b/src/engine/graphics/font.cpp index c5e08fbe..c7c1ad21 100644 --- a/src/engine/graphics/font.cpp +++ b/src/engine/graphics/font.cpp @@ -19,6 +19,13 @@ #include "../common/guardutil.h" +#include "context.h" +#include "mesh/mesh.h" +#include "mesh/meshes.h" +#include "shader/shaders.h" +#include "texture/texture.h" +#include "window.h" + using namespace std; namespace reone { diff --git a/src/engine/graphics/font.h b/src/engine/graphics/font.h index 21b666a8..a8627c06 100644 --- a/src/engine/graphics/font.h +++ b/src/engine/graphics/font.h @@ -17,12 +17,6 @@ #pragma once -#include "context.h" -#include "mesh/meshes.h" -#include "shader/shaders.h" -#include "texture/texture.h" -#include "window.h" - namespace reone { namespace graphics { @@ -37,6 +31,12 @@ enum class TextGravity { RightTop }; +class Context; +class Meshes; +class Shaders; +class Texture; +class Window; + class Font { public: Font(Window &window, Context &context, Meshes &meshes, Shaders &shaders); diff --git a/src/engine/graphics/fonts.cpp b/src/engine/graphics/fonts.cpp index e252cc94..e66df5bc 100644 --- a/src/engine/graphics/fonts.cpp +++ b/src/engine/graphics/fonts.cpp @@ -17,6 +17,12 @@ #include "fonts.h" +#include "context.h" +#include "mesh/meshes.h" +#include "shader/shaders.h" +#include "texture/textures.h" +#include "window.h" + using namespace std; using namespace std::placeholders; diff --git a/src/engine/graphics/fonts.h b/src/engine/graphics/fonts.h index 6c4adf6c..b222d921 100644 --- a/src/engine/graphics/fonts.h +++ b/src/engine/graphics/fonts.h @@ -19,17 +19,17 @@ #include "../common/cache.h" -#include "context.h" #include "font.h" -#include "mesh/meshes.h" -#include "shader/shaders.h" -#include "texture/textures.h" -#include "window.h" namespace reone { namespace graphics { +class Context; +class Meshes; +class Shaders; +class Textures; + class Fonts : public MemoryCache { public: Fonts(Window &window, Context &context, Meshes &meshes, Textures &textures, Shaders &shaders); diff --git a/src/engine/graphics/framebuffer.cpp b/src/engine/graphics/framebuffer.cpp index 0baf83ed..7ae61b82 100644 --- a/src/engine/graphics/framebuffer.cpp +++ b/src/engine/graphics/framebuffer.cpp @@ -17,6 +17,9 @@ #include "framebuffer.h" +#include "renderbuffer.h" +#include "texture/texture.h" + using namespace std; namespace reone { diff --git a/src/engine/graphics/framebuffer.h b/src/engine/graphics/framebuffer.h index 61611aec..0bacb80e 100644 --- a/src/engine/graphics/framebuffer.h +++ b/src/engine/graphics/framebuffer.h @@ -17,13 +17,15 @@ #pragma once -#include "renderbuffer.h" -#include "texture/texture.h" +#include "types.h" namespace reone { namespace graphics { +class Renderbuffer; +class Texture; + /** * Abstraction over the OpenGL framebuffer used for off-screen rendering. */ diff --git a/src/engine/graphics/lip/lipreader.cpp b/src/engine/graphics/lip/lipreader.cpp index d778f251..3c90e38c 100644 --- a/src/engine/graphics/lip/lipreader.cpp +++ b/src/engine/graphics/lip/lipreader.cpp @@ -17,6 +17,8 @@ #include "lipreader.h" +#include "animation.h" + using namespace std; namespace reone { diff --git a/src/engine/graphics/lip/lipreader.h b/src/engine/graphics/lip/lipreader.h index e2be9cd8..9a9d1449 100644 --- a/src/engine/graphics/lip/lipreader.h +++ b/src/engine/graphics/lip/lipreader.h @@ -19,12 +19,12 @@ #include "../../resource/format/binreader.h" -#include "animation.h" - namespace reone { namespace graphics { +class LipAnimation; + class LipReader : public resource::BinaryReader { public: LipReader(); diff --git a/src/engine/graphics/lip/lips.cpp b/src/engine/graphics/lip/lips.cpp index 69eb1122..4e0862f3 100644 --- a/src/engine/graphics/lip/lips.cpp +++ b/src/engine/graphics/lip/lips.cpp @@ -19,6 +19,7 @@ #include "lips.h" #include "../../common/streamutil.h" +#include "../../resource/resources.h" #include "lipreader.h" diff --git a/src/engine/graphics/lip/lips.h b/src/engine/graphics/lip/lips.h index 165b902b..77129ab7 100644 --- a/src/engine/graphics/lip/lips.h +++ b/src/engine/graphics/lip/lips.h @@ -18,12 +18,17 @@ #pragma once #include "../../common/cache.h" -#include "../../resource/resources.h" #include "animation.h" namespace reone { +namespace resource { + +class Resources; + +} + namespace graphics { class Lips : public MemoryCache { diff --git a/src/engine/graphics/materials.cpp b/src/engine/graphics/materials.cpp index ab194f16..506ce918 100644 --- a/src/engine/graphics/materials.cpp +++ b/src/engine/graphics/materials.cpp @@ -19,6 +19,9 @@ #include "../common/collectionutil.h" #include "../resource/2da.h" +#include "../resource/resources.h" + +#include "material.h" using namespace std; diff --git a/src/engine/graphics/materials.h b/src/engine/graphics/materials.h index c531a769..392c94c5 100644 --- a/src/engine/graphics/materials.h +++ b/src/engine/graphics/materials.h @@ -17,14 +17,18 @@ #pragma once -#include "../resource/resources.h" - -#include "material.h" - namespace reone { +namespace resource { + +class Resources; + +} + namespace graphics { +struct Material; + class Materials : boost::noncopyable { public: Materials(resource::Resources &resources); diff --git a/src/engine/graphics/mesh/meshes.cpp b/src/engine/graphics/mesh/meshes.cpp index db6a15fb..e463e575 100644 --- a/src/engine/graphics/mesh/meshes.cpp +++ b/src/engine/graphics/mesh/meshes.cpp @@ -18,6 +18,8 @@ #include "meshes.h" +#include "mesh.h" + using namespace std; namespace reone { diff --git a/src/engine/graphics/mesh/meshes.h b/src/engine/graphics/mesh/meshes.h index aeca86d9..ab951836 100644 --- a/src/engine/graphics/mesh/meshes.h +++ b/src/engine/graphics/mesh/meshes.h @@ -17,12 +17,12 @@ #pragma once -#include "mesh.h" - namespace reone { namespace graphics { +class Mesh; + /** * Registry of common reusable meshes. */ diff --git a/src/engine/graphics/model/animation.cpp b/src/engine/graphics/model/animation.cpp index 8edead9b..44ca444f 100644 --- a/src/engine/graphics/model/animation.cpp +++ b/src/engine/graphics/model/animation.cpp @@ -19,6 +19,8 @@ #include "../../common/collectionutil.h" +#include "modelnode.h" + using namespace std; namespace reone { diff --git a/src/engine/graphics/model/animation.h b/src/engine/graphics/model/animation.h index 268cee4e..499d4b83 100644 --- a/src/engine/graphics/model/animation.h +++ b/src/engine/graphics/model/animation.h @@ -17,12 +17,12 @@ #pragma once -#include "modelnode.h" - namespace reone { namespace graphics { +class ModelNode; + class Animation : boost::noncopyable { public: struct Event { diff --git a/src/engine/graphics/model/mdlreader.cpp b/src/engine/graphics/model/mdlreader.cpp index 37c1a4f9..74163f50 100644 --- a/src/engine/graphics/model/mdlreader.cpp +++ b/src/engine/graphics/model/mdlreader.cpp @@ -18,11 +18,14 @@ #include "mdlreader.h" #include "../../common/collectionutil.h" -#include "../../common/guardutil.h" #include "../../common/log.h" +#include "../mesh/mesh.h" +#include "../mesh/vertexattributes.h" #include "../texture/textures.h" +#include "animation.h" +#include "model.h" #include "models.h" using namespace std; @@ -72,14 +75,11 @@ static Model::Classification getClassification(uint8_t ordinal) { // END Classification -MdlReader::MdlReader(Models *models, Textures *textures) : +MdlReader::MdlReader(Models &models, Textures &textures) : BinaryReader(4, "\000\000\000\000"), _models(models), _textures(textures) { - ensureNotNull(models, "models"); - ensureNotNull(textures, "textures"); - initControllerFn(); } @@ -140,7 +140,7 @@ void MdlReader::doLoad() { // Load supermodel shared_ptr superModel; if (!superModelName.empty() && superModelName != "null") { - superModel = _models->get(superModelName); + superModel = _models.get(superModelName); } // Read animations @@ -455,11 +455,11 @@ shared_ptr MdlReader::readMesh(int flags) { } shared_ptr diffuseMap; if (!texture1.empty() && texture1 != "null") { - diffuseMap = _textures->get(texture1, TextureUsage::Diffuse); + diffuseMap = _textures.get(texture1, TextureUsage::Diffuse); } shared_ptr lightmap; if (!texture2.empty()) { - lightmap = _textures->get(texture2, TextureUsage::Lightmap); + lightmap = _textures.get(texture2, TextureUsage::Lightmap); } auto nodeMesh = make_unique(); @@ -546,7 +546,7 @@ shared_ptr MdlReader::readLight() { for (int i = 0; i < numFlares; ++i) { seek(kMdlDataOffset + texNameOffsets[i]); string textureName(boost::to_lower_copy(readCString(12))); - shared_ptr texture(_textures->get(textureName)); + shared_ptr texture(_textures.get(textureName)); flareTextures.push_back(move(texture)); } @@ -635,7 +635,7 @@ shared_ptr MdlReader::readEmitter() { emitter->updateMode = parseEmitterUpdate(update); emitter->renderMode = parseEmitterRender(render); emitter->blendMode = parseEmitterBlend(blend); - emitter->texture = _textures->get(texture, TextureUsage::Diffuse); + emitter->texture = _textures.get(texture, TextureUsage::Diffuse); emitter->gridSize = glm::ivec2(glm::max(xGrid, 1u), glm::max(yGrid, 1u)); emitter->renderOrder = renderOrder; emitter->loop = static_cast(loop); @@ -650,7 +650,7 @@ shared_ptr MdlReader::readReference() { uint32_t reattachable = readUint32(); auto reference = make_shared(); - reference->model = _models->get(modelResRef); + reference->model = _models.get(modelResRef); reference->reattachable = static_cast(reattachable); return move(reference); diff --git a/src/engine/graphics/model/mdlreader.h b/src/engine/graphics/model/mdlreader.h index d2e18491..fa08c1cf 100644 --- a/src/engine/graphics/model/mdlreader.h +++ b/src/engine/graphics/model/mdlreader.h @@ -17,19 +17,22 @@ #pragma once -#include "../../graphics/model/models.h" -#include "../../graphics/texture/textures.h" #include "../../resource/format/binreader.h" -#include "model.h" +#include "modelnode.h" namespace reone { namespace graphics { +class Animation; +class Model; +class Models; +class Textures; + class MdlReader : public resource::BinaryReader { public: - MdlReader(Models *models, Textures *textures); + MdlReader(Models &models, Textures &textures); void load(const std::shared_ptr &mdl, const std::shared_ptr &mdx); @@ -67,8 +70,8 @@ private: typedef std::unordered_map> MaterialMap; typedef std::function &, ModelNode &)> ControllerFn; - Models *_models; - Textures *_textures; + Models &_models; + Textures &_textures; std::unordered_map _genericControllers; std::unordered_map _meshControllers; diff --git a/src/engine/graphics/model/model.cpp b/src/engine/graphics/model/model.cpp index 0c45a348..2ffb066b 100644 --- a/src/engine/graphics/model/model.cpp +++ b/src/engine/graphics/model/model.cpp @@ -21,6 +21,11 @@ #include "../../common/guardutil.h" #include "../../common/log.h" +#include "../mesh/mesh.h" + +#include "animation.h" +#include "modelnode.h" + using namespace std; namespace reone { diff --git a/src/engine/graphics/model/model.h b/src/engine/graphics/model/model.h index bed27f8b..917ac194 100644 --- a/src/engine/graphics/model/model.h +++ b/src/engine/graphics/model/model.h @@ -19,12 +19,13 @@ #include "../aabb.h" -#include "animation.h" - namespace reone { namespace graphics { +class Animation; +class ModelNode; + /** * 3D model, a tree-like data structure. Contains model nodes and animations. * diff --git a/src/engine/graphics/model/modelnode.cpp b/src/engine/graphics/model/modelnode.cpp index 98a7debf..41d5a62a 100644 --- a/src/engine/graphics/model/modelnode.cpp +++ b/src/engine/graphics/model/modelnode.cpp @@ -19,6 +19,9 @@ #include "../../common/log.h" +#include "../mesh/mesh.h" +#include "../texture/texture.h" + using namespace std; namespace reone { diff --git a/src/engine/graphics/model/modelnode.h b/src/engine/graphics/model/modelnode.h index 6ee3213b..6f1e1ec4 100644 --- a/src/engine/graphics/model/modelnode.h +++ b/src/engine/graphics/model/modelnode.h @@ -17,20 +17,21 @@ #pragma once -#include "../mesh/mesh.h" -#include "../texture/texture.h" +#include "../aabb.h" #include "animatedproperty.h" -namespace reone { - -namespace graphics { - #define REO_DECL_ANIMPROP(a, b, c) \ const AnimatedProperty &b() const { return c; }; \ AnimatedProperty &b() { return c; }; +namespace reone { + +namespace graphics { + +class Mesh; class Model; +class Texture; /** * Model or animation node. Can be specialized to represent a triangle mesh, a diff --git a/src/engine/graphics/model/models.cpp b/src/engine/graphics/model/models.cpp index 84cdd307..f346a472 100644 --- a/src/engine/graphics/model/models.cpp +++ b/src/engine/graphics/model/models.cpp @@ -19,8 +19,12 @@ #include "../../common/log.h" #include "../../common/streamutil.h" +#include "../../resource/resources.h" -#include "../model/mdlreader.h" +#include "../texture/textures.h" + +#include "mdlreader.h" +#include "model.h" using namespace std; @@ -55,7 +59,7 @@ shared_ptr Models::doGet(const string &resRef) { shared_ptr model; if (mdlData && mdxData) { - MdlReader mdl(this, &_textures); + MdlReader mdl(*this, _textures); mdl.load(wrap(mdlData), wrap(mdxData)); model = mdl.model(); if (model) { diff --git a/src/engine/graphics/model/models.h b/src/engine/graphics/model/models.h index c6760a57..7fd6762c 100644 --- a/src/engine/graphics/model/models.h +++ b/src/engine/graphics/model/models.h @@ -17,16 +17,20 @@ #pragma once -#include "../../resource/resources.h" - -#include "../texture/textures.h" #include "../types.h" namespace reone { +namespace resource { + +class Resources; + +} + namespace graphics { class Model; +class Textures; class Models : boost::noncopyable { public: diff --git a/src/engine/graphics/pbribl.cpp b/src/engine/graphics/pbribl.cpp index a10aa503..87c4b3c9 100644 --- a/src/engine/graphics/pbribl.cpp +++ b/src/engine/graphics/pbribl.cpp @@ -17,7 +17,12 @@ #include "pbribl.h" +#include "context.h" +#include "mesh/mesh.h" +#include "mesh/meshes.h" #include "renderbuffer.h" +#include "shader/shaders.h" +#include "texture/texture.h" #include "texture/textureutil.h" using namespace std; diff --git a/src/engine/graphics/pbribl.h b/src/engine/graphics/pbribl.h index 786312a5..c79a3378 100644 --- a/src/engine/graphics/pbribl.h +++ b/src/engine/graphics/pbribl.h @@ -17,16 +17,17 @@ #pragma once -#include "context.h" #include "framebuffer.h" -#include "mesh/meshes.h" -#include "shader/shaders.h" -#include "texture/texture.h" namespace reone { namespace graphics { +class Context; +class Meshes; +class Shaders; +class Texture; + /** * Computes and caches PBR IBL textures, i.e. irradiance maps, prefiltered * environment maps and BRDF lookup textures. diff --git a/src/engine/graphics/services.cpp b/src/engine/graphics/services.cpp index a0669f9b..54d7ed85 100644 --- a/src/engine/graphics/services.cpp +++ b/src/engine/graphics/services.cpp @@ -17,6 +17,23 @@ #include "services.h" +#include "../resource/services.h" + +#include "context.h" +#include "features.h" +#include "fonts.h" +#include "lip/lips.h" +#include "materials.h" +#include "mesh/mesh.h" +#include "mesh/meshes.h" +#include "model/models.h" +#include "options.h" +#include "pbribl.h" +#include "shader/shaders.h" +#include "texture/textures.h" +#include "walkmesh/walkmeshes.h" +#include "window.h" + using namespace std; using namespace reone::resource; diff --git a/src/engine/graphics/services.h b/src/engine/graphics/services.h index 17aea736..12c80861 100644 --- a/src/engine/graphics/services.h +++ b/src/engine/graphics/services.h @@ -17,26 +17,31 @@ #pragma once -#include "../resource/services.h" - -#include "context.h" -#include "features.h" -#include "fonts.h" -#include "lip/lips.h" -#include "materials.h" -#include "mesh/meshes.h" -#include "model/models.h" #include "options.h" -#include "pbribl.h" -#include "shader/shaders.h" -#include "texture/textures.h" -#include "walkmesh/walkmeshes.h" -#include "window.h" namespace reone { +namespace resource { + +class ResourceServices; + +} + namespace graphics { +class Context; +class Features; +class Fonts; +class Lips; +class Materials; +class Meshes; +class Models; +class PBRIBL; +class Shaders; +class Textures; +class Walkmeshes; +class Window; + class GraphicsServices : boost::noncopyable { public: GraphicsServices(GraphicsOptions options, resource::ResourceServices &resource); diff --git a/src/engine/graphics/texture/curreader.cpp b/src/engine/graphics/texture/curreader.cpp index d6d53924..6e1c80f2 100644 --- a/src/engine/graphics/texture/curreader.cpp +++ b/src/engine/graphics/texture/curreader.cpp @@ -17,6 +17,7 @@ #include "curreader.h" +#include "texture.h" #include "textureutil.h" using namespace std; diff --git a/src/engine/graphics/texture/curreader.h b/src/engine/graphics/texture/curreader.h index b4ea6ab5..4988290b 100644 --- a/src/engine/graphics/texture/curreader.h +++ b/src/engine/graphics/texture/curreader.h @@ -19,12 +19,12 @@ #include "../../resource/format/binreader.h" -#include "texture.h" - namespace reone { namespace graphics { +class Texture; + class CurReader : public resource::BinaryReader { public: CurReader(); diff --git a/src/engine/graphics/texture/textures.cpp b/src/engine/graphics/texture/textures.cpp index c8d96bfb..1b9c6a95 100644 --- a/src/engine/graphics/texture/textures.cpp +++ b/src/engine/graphics/texture/textures.cpp @@ -19,11 +19,14 @@ #include "../../common/log.h" #include "../../common/streamutil.h" +#include "../../resource/resources.h" +#include "../context.h" #include "../services.h" #include "../types.h" #include "curreader.h" +#include "texture.h" #include "textureutil.h" #include "tgareader.h" #include "tpcreader.h" diff --git a/src/engine/graphics/texture/textures.h b/src/engine/graphics/texture/textures.h index e68c1cc3..b4ffd15f 100644 --- a/src/engine/graphics/texture/textures.h +++ b/src/engine/graphics/texture/textures.h @@ -17,17 +17,21 @@ #pragma once -#include "../../resource/resources.h" - -#include "../context.h" #include "../types.h" -#include "texture.h" - namespace reone { +namespace resource { + +class Resources; + +} + namespace graphics { +class Context; +class Texture; + class Textures : boost::noncopyable { public: Textures(Context &context, resource::Resources &resources); diff --git a/src/engine/graphics/texture/tgareader.cpp b/src/engine/graphics/texture/tgareader.cpp index f37e547f..3e431381 100644 --- a/src/engine/graphics/texture/tgareader.cpp +++ b/src/engine/graphics/texture/tgareader.cpp @@ -19,6 +19,7 @@ #include "../../common/log.h" +#include "texture.h" #include "textureutil.h" using namespace std; diff --git a/src/engine/graphics/texture/tgareader.h b/src/engine/graphics/texture/tgareader.h index ae6562b2..d3cfa904 100644 --- a/src/engine/graphics/texture/tgareader.h +++ b/src/engine/graphics/texture/tgareader.h @@ -21,12 +21,12 @@ #include "../types.h" -#include "texture.h" - namespace reone { namespace graphics { +class Texture; + class TgaReader : public resource::BinaryReader { public: TgaReader(const std::string &resRef, TextureUsage usage); diff --git a/src/engine/graphics/texture/tgawriter.cpp b/src/engine/graphics/texture/tgawriter.cpp index c3606bea..882ada77 100644 --- a/src/engine/graphics/texture/tgawriter.cpp +++ b/src/engine/graphics/texture/tgawriter.cpp @@ -21,9 +21,11 @@ #include "tgawriter.h" +#include "s3tc.h" + #include "../../common/guardutil.h" -#include "s3tc.h" +#include "texture.h" using namespace std; diff --git a/src/engine/graphics/texture/tgawriter.h b/src/engine/graphics/texture/tgawriter.h index e642e8b8..d14c7c4a 100644 --- a/src/engine/graphics/texture/tgawriter.h +++ b/src/engine/graphics/texture/tgawriter.h @@ -17,12 +17,14 @@ #pragma once -#include "texture.h" +#include "../types.h" namespace reone { namespace graphics { +class Texture; + class TgaWriter { public: TgaWriter(std::shared_ptr texture); diff --git a/src/engine/graphics/walkmesh/bwmreader.cpp b/src/engine/graphics/walkmesh/bwmreader.cpp index faff4e98..87b5c47e 100644 --- a/src/engine/graphics/walkmesh/bwmreader.cpp +++ b/src/engine/graphics/walkmesh/bwmreader.cpp @@ -17,6 +17,8 @@ #include "bwmreader.h" +#include "walkmesh.h" + using namespace std; namespace reone { diff --git a/src/engine/graphics/walkmesh/bwmreader.h b/src/engine/graphics/walkmesh/bwmreader.h index 84979282..ccb63af8 100644 --- a/src/engine/graphics/walkmesh/bwmreader.h +++ b/src/engine/graphics/walkmesh/bwmreader.h @@ -19,12 +19,12 @@ #include "../../resource/format/binreader.h" -#include "walkmesh.h" - namespace reone { namespace graphics { +class Walkmesh; + class BwmReader : public resource::BinaryReader { public: BwmReader(std::set walkableSurfaces); diff --git a/src/engine/graphics/walkmesh/walkmeshes.cpp b/src/engine/graphics/walkmesh/walkmeshes.cpp index 2da64988..5613139e 100644 --- a/src/engine/graphics/walkmesh/walkmeshes.cpp +++ b/src/engine/graphics/walkmesh/walkmeshes.cpp @@ -18,6 +18,7 @@ #include "walkmeshes.h" #include "../../common/streamutil.h" +#include "../../resource/resources.h" #include "bwmreader.h" diff --git a/src/engine/graphics/walkmesh/walkmeshes.h b/src/engine/graphics/walkmesh/walkmeshes.h index 3c551664..04181a50 100644 --- a/src/engine/graphics/walkmesh/walkmeshes.h +++ b/src/engine/graphics/walkmesh/walkmeshes.h @@ -17,13 +17,18 @@ #pragma once -#include "../../resource/resources.h" #include "../../resource/types.h" #include "../types.h" namespace reone { +namespace resource { + +class Resources; + +} + namespace graphics { class Walkmesh; diff --git a/src/engine/graphics/window.h b/src/engine/graphics/window.h index d4bea130..2ccba4a7 100644 --- a/src/engine/graphics/window.h +++ b/src/engine/graphics/window.h @@ -17,16 +17,16 @@ #pragma once -#include "cursor.h" -#include "eventhandler.h" #include "options.h" -#include "texture/texture.h" #include "types.h" namespace reone { namespace graphics { +class Cursor; +class IEventHandler; + class Window : boost::noncopyable { public: Window(GraphicsOptions options); diff --git a/src/engine/gui/control/control.cpp b/src/engine/gui/control/control.cpp index dbbdd02c..613bf284 100644 --- a/src/engine/gui/control/control.cpp +++ b/src/engine/gui/control/control.cpp @@ -18,7 +18,9 @@ #include "control.h" #include "../../common/log.h" +#include "../../graphics/context.h" #include "../../graphics/fonts.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/shader/shaders.h" #include "../../graphics/texture/textures.h" diff --git a/src/engine/gui/control/imagebutton.cpp b/src/engine/gui/control/imagebutton.cpp index d25a3822..1c0f0575 100644 --- a/src/engine/gui/control/imagebutton.cpp +++ b/src/engine/gui/control/imagebutton.cpp @@ -17,7 +17,9 @@ #include "imagebutton.h" +#include "../../graphics/context.h" #include "../../graphics/fonts.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../gui.h" diff --git a/src/engine/gui/control/progressbar.cpp b/src/engine/gui/control/progressbar.cpp index ecaacceb..1053bb8d 100644 --- a/src/engine/gui/control/progressbar.cpp +++ b/src/engine/gui/control/progressbar.cpp @@ -17,6 +17,8 @@ #include "progressbar.h" +#include "../../graphics/context.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/texture/textures.h" diff --git a/src/engine/gui/control/scrollbar.cpp b/src/engine/gui/control/scrollbar.cpp index 4d1ca5fd..3236ca21 100644 --- a/src/engine/gui/control/scrollbar.cpp +++ b/src/engine/gui/control/scrollbar.cpp @@ -17,6 +17,8 @@ #include "scrollbar.h" +#include "../../graphics/context.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/shader/shaders.h" #include "../../graphics/texture/textures.h" diff --git a/src/engine/gui/gui.cpp b/src/engine/gui/gui.cpp index 8d92a055..3c0ff461 100644 --- a/src/engine/gui/gui.cpp +++ b/src/engine/gui/gui.cpp @@ -18,6 +18,8 @@ #include "gui.h" #include "../common/log.h" +#include "../graphics/context.h" +#include "../graphics/mesh/mesh.h" #include "../graphics/mesh/meshes.h" #include "../graphics/shader/shaders.h" #include "../graphics/texture/textures.h" diff --git a/src/engine/resource/format/pereader.h b/src/engine/resource/format/pereader.h index 15eca188..fe746884 100644 --- a/src/engine/resource/format/pereader.h +++ b/src/engine/resource/format/pereader.h @@ -17,21 +17,16 @@ #pragma once +#include "../../common/types.h" + +#include "../types.h" + #include "binreader.h" namespace reone { namespace resource { -enum class PEResourceType { - Cursor = 1, - Icon = 3, - CursorGroup = 12, - IconGroup = 14, - Version = 16, - Manifest = 24 -}; - class PEReader : public BinaryReader { public: PEReader(); @@ -39,7 +34,6 @@ public: std::shared_ptr find(uint32_t name, PEResourceType type); private: - struct Section { std::string name; uint32_t virtualAddress { 0 }; diff --git a/src/engine/resource/types.h b/src/engine/resource/types.h index 0db6918a..439d5bc5 100644 --- a/src/engine/resource/types.h +++ b/src/engine/resource/types.h @@ -83,6 +83,15 @@ enum class ResourceType : uint16_t { Invalid = 0xffff }; +enum class PEResourceType { + Cursor = 1, + Icon = 3, + CursorGroup = 12, + IconGroup = 14, + Version = 16, + Manifest = 24 +}; + typedef std::multimap Visibility; } // namespace resource diff --git a/src/engine/scene/node/emitter.cpp b/src/engine/scene/node/emitter.cpp index aa19f216..f3e16780 100644 --- a/src/engine/scene/node/emitter.cpp +++ b/src/engine/scene/node/emitter.cpp @@ -19,6 +19,8 @@ #include "../../common/guardutil.h" #include "../../common/random.h" +#include "../../graphics/context.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/shader/shaders.h" diff --git a/src/engine/scene/node/grass.cpp b/src/engine/scene/node/grass.cpp index ea97b1d7..ee283626 100644 --- a/src/engine/scene/node/grass.cpp +++ b/src/engine/scene/node/grass.cpp @@ -18,6 +18,8 @@ #include "grass.h" #include "../../common/guardutil.h" +#include "../../graphics/context.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/shader/shaders.h" diff --git a/src/engine/scene/node/light.cpp b/src/engine/scene/node/light.cpp index f6f11c21..fca55a88 100644 --- a/src/engine/scene/node/light.cpp +++ b/src/engine/scene/node/light.cpp @@ -18,6 +18,8 @@ #include "light.h" #include "../../common/guardutil.h" +#include "../../graphics/context.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/shader/shaders.h" #include "../../graphics/window.h" diff --git a/src/engine/scene/node/mesh.cpp b/src/engine/scene/node/mesh.cpp index dcff83d7..e1e5b87b 100644 --- a/src/engine/scene/node/mesh.cpp +++ b/src/engine/scene/node/mesh.cpp @@ -20,6 +20,9 @@ #include "../../common/log.h" #include "../../common/guardutil.h" #include "../../common/random.h" +#include "../../graphics/context.h" +#include "../../graphics/features.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/pbribl.h" #include "../scenegraph.h" diff --git a/src/engine/scene/node/model.cpp b/src/engine/scene/node/model.cpp index e60717da..283a7eed 100644 --- a/src/engine/scene/node/model.cpp +++ b/src/engine/scene/node/model.cpp @@ -18,6 +18,7 @@ #include "../../common/collectionutil.h" #include "../../common/log.h" #include "../../common/guardutil.h" +#include "../../graphics/mesh/mesh.h" #include "../scenegraph.h" #include "../types.h" diff --git a/src/engine/scene/node/model_animation.cpp b/src/engine/scene/node/model_animation.cpp index 1a13b4f6..b1045270 100644 --- a/src/engine/scene/node/model_animation.cpp +++ b/src/engine/scene/node/model_animation.cpp @@ -18,6 +18,7 @@ #include "model.h" #include "../../common/collectionutil.h" +#include "../../graphics/model/animation.h" using namespace std; diff --git a/src/engine/scene/pipeline/control.cpp b/src/engine/scene/pipeline/control.cpp index f3ec6e53..c7eebb9a 100644 --- a/src/engine/scene/pipeline/control.cpp +++ b/src/engine/scene/pipeline/control.cpp @@ -17,6 +17,8 @@ #include "control.h" +#include "../../graphics/context.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/shader/shaders.h" #include "../../graphics/texture/textures.h" diff --git a/src/engine/scene/pipeline/world.cpp b/src/engine/scene/pipeline/world.cpp index 205f6e49..e89c6efc 100644 --- a/src/engine/scene/pipeline/world.cpp +++ b/src/engine/scene/pipeline/world.cpp @@ -17,6 +17,8 @@ #include "world.h" +#include "../../graphics/context.h" +#include "../../graphics/mesh/mesh.h" #include "../../graphics/mesh/meshes.h" #include "../../graphics/pbribl.h" #include "../../graphics/shader/shaders.h" diff --git a/src/engine/scene/scenegraph.cpp b/src/engine/scene/scenegraph.cpp index 0f407a91..94c155ad 100644 --- a/src/engine/scene/scenegraph.cpp +++ b/src/engine/scene/scenegraph.cpp @@ -17,6 +17,8 @@ #include "scenegraph.h" +#include "../graphics/context.h" +#include "../graphics/mesh/mesh.h" #include "../graphics/mesh/meshes.h" #include "node/camera.h" diff --git a/src/engine/video/video.cpp b/src/engine/video/video.cpp index 2056f86e..78909110 100644 --- a/src/engine/video/video.cpp +++ b/src/engine/video/video.cpp @@ -18,6 +18,8 @@ #include "video.h" #include "../common/guardutil.h" +#include "../graphics/context.h" +#include "../graphics/mesh/mesh.h" #include "../graphics/mesh/meshes.h" #include "../graphics/shader/shaders.h" #include "../graphics/texture/textureutil.h" diff --git a/src/engine/video/video.h b/src/engine/video/video.h index 7987bac9..52d540e8 100644 --- a/src/engine/video/video.h +++ b/src/engine/video/video.h @@ -24,6 +24,12 @@ namespace reone { +namespace graphics { + +class Texture; + +} + namespace video { class BikReader;