Archived
1
Fork 0

Remove even more includes

This commit is contained in:
redstrate 2020-09-21 09:37:52 -04:00
parent 29633020c9
commit 2ffd1a421e
22 changed files with 90 additions and 54 deletions

View file

@ -10,6 +10,10 @@
#include "json_conversions.hpp" #include "json_conversions.hpp"
#include "gfx_commandbuffer.hpp" #include "gfx_commandbuffer.hpp"
#include "assertions.hpp" #include "assertions.hpp"
#include "renderer.hpp"
#include "input.hpp"
#include "physics.hpp"
#include "imguilayer.hpp"
std::unique_ptr<Mesh> load_mesh(const file::Path path) { std::unique_ptr<Mesh> load_mesh(const file::Path path) {
Expects(!path.empty()); Expects(!path.empty());

View file

@ -1,11 +1,6 @@
#pragma once #pragma once
#include <fstream> #include "path.hpp"
#include <string>
#include <vector>
#include <string_view>
#include "file.hpp"
/* /*
* Audio API * Audio API

View file

@ -48,9 +48,10 @@ target_link_libraries(Core PUBLIC
Renderer Renderer
nlohmann_json nlohmann_json
magic_enum magic_enum
${BULLET_LIBRARIES}
imgui imgui
Log Log
${EXTRA_LIBRARIES} ${EXTRA_LIBRARIES}
Asset) Asset
PRIVATE
${BULLET_LIBRARIES})
set_engine_properties(Core) set_engine_properties(Core)

View file

@ -5,6 +5,7 @@
#include "vector.hpp" #include "vector.hpp"
#include "quaternion.hpp" #include "quaternion.hpp"
#include "math.hpp" #include "math.hpp"
#include "object.hpp"
struct PositionKeyFrame { struct PositionKeyFrame {
float time; float time;
@ -49,6 +50,8 @@ struct Animation {
std::vector<AnimationChannel> channels; std::vector<AnimationChannel> channels;
}; };
class Scene;
struct Shot { struct Shot {
int begin, length; int begin, length;

View file

@ -1,27 +1,13 @@
#pragma once #pragma once
#include <vector> #include <nlohmann/json_fwd.hpp>
#include <nlohmann/json.hpp>
#include <iosfwd>
#include <map>
#include <memory>
#include <string>
#include <string_view>
#include "scene.hpp"
#include "renderer.hpp"
#include "input.hpp"
#include "cutscene.hpp"
#include "physics.hpp"
#include "file.hpp"
#include "object.hpp" #include "object.hpp"
#include "imguilayer.hpp" #include "cutscene.hpp"
#include "shadowpass.hpp"
#include "scenecapture.hpp"
#include "smaapass.hpp"
#include "gaussianhelper.hpp"
#include "common.hpp" #include "common.hpp"
#include "asset_types.hpp" #include "asset_types.hpp"
#include "platform.hpp"
#include "path.hpp"
class GFX; class GFX;
@ -30,6 +16,11 @@ namespace ui {
} }
class App; class App;
class Scene;
class Input;
class Renderer;
class Physics;
class ImGuiLayer;
struct Timer; struct Timer;
struct AnimationTarget { struct AnimationTarget {
@ -52,6 +43,11 @@ public:
*/ */
Engine(const int argc, char* argv[]); Engine(const int argc, char* argv[]);
Engine(const Engine& other) = delete;
Engine(Engine&& other) = delete;
~Engine();
/// Command line arguments, can be empty. /// Command line arguments, can be empty.
std::vector<std::string_view> command_line_arguments; std::vector<std::string_view> command_line_arguments;
@ -344,7 +340,7 @@ private:
prism::Extent extent; prism::Extent extent;
bool quitRequested = false; bool quitRequested = false;
std::unique_ptr<Renderer> renderer = nullptr; std::unique_ptr<Renderer> renderer;
}; };
std::vector<Window> _windows; std::vector<Window> _windows;
@ -370,8 +366,8 @@ private:
App* _app = nullptr; App* _app = nullptr;
GFX* _gfx = nullptr; GFX* _gfx = nullptr;
std::unique_ptr<Input> _input = nullptr; std::unique_ptr<Input> _input;
std::unique_ptr<Physics> _physics = nullptr; std::unique_ptr<Physics> _physics;
std::vector<Timer*> _timers, _timersToRemove; std::vector<Timer*> _timers, _timersToRemove;
@ -379,7 +375,7 @@ private:
std::vector<AnimationTarget> _animation_targets; std::vector<AnimationTarget> _animation_targets;
std::unique_ptr<ImGuiLayer> _imgui = nullptr; std::unique_ptr<ImGuiLayer> _imgui;
const InputButton debug_button = InputButton::Q; const InputButton debug_button = InputButton::Q;
}; };

View file

@ -9,6 +9,7 @@
#include "log.hpp" #include "log.hpp"
#include "file_utils.hpp" #include "file_utils.hpp"
#include "path.hpp"
namespace file { namespace file {
enum class Domain { enum class Domain {
@ -133,5 +134,4 @@ namespace file {
inline Path internal_domain = "/internal", app_domain = "/app"; inline Path internal_domain = "/internal", app_domain = "/app";
} }
inline std::array<std::string, 3> domain_data; inline std::array<std::string, 3> domain_data;

View file

@ -1,14 +1,20 @@
#pragma once #pragma once
#include <btBulletDynamicsCommon.h>
#include <memory> #include <memory>
#include "vector.hpp" #include "vector.hpp"
#include "object.hpp" #include "object.hpp"
class btBroadphaseInterface;
class btDefaultCollisionConfiguration;
class btCollisionDispatcher;
class btSequentialImpulseConstraintSolver;
class btDiscreteDynamicsWorld;
class Physics { class Physics {
public: public:
Physics(); Physics();
~Physics();
void update(float deltaTime); void update(float deltaTime);

View file

@ -9,6 +9,8 @@
#include "gfx.hpp" #include "gfx.hpp"
#include "asset.hpp" #include "asset.hpp"
#include "imgui_utility.hpp" #include "imgui_utility.hpp"
#include "scene.hpp"
#include "renderer.hpp"
void draw_general() { void draw_general() {
ImGui::Text("Platform: %s", platform::get_name()); ImGui::Text("Platform: %s", platform::get_name());

View file

@ -2,22 +2,25 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "timer.hpp" #include "scene.hpp"
#include "gfx.hpp"
#include "renderer.hpp"
#include "screen.hpp"
#include "file.hpp"
#include "transform.hpp"
#include "math.hpp"
#include "cutscene.hpp"
#include "log.hpp"
#include "imguilayer.hpp"
#include "app.hpp"
#include "json_conversions.hpp"
#include "debug.hpp"
#include "assertions.hpp"
#include "console.hpp" #include "console.hpp"
#include "log.hpp"
#include "asset.hpp" #include "asset.hpp"
#include "json_conversions.hpp"
#include "app.hpp"
#include "assertions.hpp"
#include "screen.hpp"
#include "renderer.hpp"
#include "gfx.hpp"
#include "imguilayer.hpp"
#include "debug.hpp"
#include "timer.hpp"
#include "physics.hpp"
#include "input.hpp"
// TODO: remove these in the future
#include "shadowpass.hpp"
#include "scenecapture.hpp"
Engine::Engine(const int argc, char* argv[]) { Engine::Engine(const int argc, char* argv[]) {
console::info(System::Core, "Prism Engine loading..."); console::info(System::Core, "Prism Engine loading...");
@ -37,6 +40,8 @@ Engine::Engine(const int argc, char* argv[]) {
assetm = std::make_unique<AssetManager>(); assetm = std::make_unique<AssetManager>();
} }
Engine::~Engine() {}
void Engine::set_app(App* app) { void Engine::set_app(App* app) {
Expects(app != nullptr); Expects(app != nullptr);
@ -400,7 +405,7 @@ void Engine::add_window(void* native_handle, const int identifier, const prism::
_gfx->initialize_view(native_handle, identifier, drawable_extent.width, drawable_extent.height); _gfx->initialize_view(native_handle, identifier, drawable_extent.width, drawable_extent.height);
Window window; Window& window = _windows.emplace_back();
window.identifier = identifier; window.identifier = identifier;
window.extent = extent; window.extent = extent;
window.renderer = std::make_unique<Renderer>(_gfx); window.renderer = std::make_unique<Renderer>(_gfx);
@ -408,7 +413,6 @@ void Engine::add_window(void* native_handle, const int identifier, const prism::
window.renderer->resize(drawable_extent); window.renderer->resize(drawable_extent);
render_ready = true; render_ready = true;
_windows.push_back(std::move(window));
} }
void Engine::remove_window(const int identifier) { void Engine::remove_window(const int identifier) {

View file

@ -1,11 +1,16 @@
#include "physics.hpp" #include "physics.hpp"
#include <btBulletDynamicsCommon.h>
#include "engine.hpp" #include "engine.hpp"
#include "scene.hpp"
Physics::Physics() { Physics::Physics() {
reset(); reset();
} }
Physics::~Physics() {}
void Physics::update(float deltaTime) { void Physics::update(float deltaTime) {
if(engine->get_scene() == nullptr) if(engine->get_scene() == nullptr)
return; return;

View file

@ -31,10 +31,10 @@ target_link_libraries(Renderer
stb stb
Math Math
Utility Utility
Core
imgui imgui
SMAA::SMAA SMAA::SMAA
ShaderCompiler) ShaderCompiler
Core)
target_include_directories(Renderer PUBLIC include) target_include_directories(Renderer PUBLIC include)
set_engine_properties(Renderer) set_engine_properties(Renderer)

View file

@ -4,13 +4,12 @@
#include <vector> #include <vector>
#include <cmath> #include <cmath>
#include "file.hpp"
#include "pass.hpp" #include "pass.hpp"
#include "matrix.hpp" #include "matrix.hpp"
#include "object.hpp" #include "object.hpp"
#include "dofpass.hpp"
#include "common.hpp" #include "common.hpp"
#include "render_options.hpp" #include "render_options.hpp"
#include "path.hpp"
namespace ui { namespace ui {
class Screen; class Screen;
@ -45,6 +44,7 @@ class Material;
class Renderer { class Renderer {
public: public:
Renderer(GFX* gfx, const bool enable_imgui = true); Renderer(GFX* gfx, const bool enable_imgui = true);
~Renderer();
void resize(const prism::Extent extent); void resize(const prism::Extent extent);
void resize_viewport(const prism::Extent extent); void resize_viewport(const prism::Extent extent);

View file

@ -8,6 +8,7 @@
#include "gfx_commandbuffer.hpp" #include "gfx_commandbuffer.hpp"
#include "log.hpp" #include "log.hpp"
#include "assertions.hpp" #include "assertions.hpp"
#include "renderer.hpp"
void ImGuiPass::initialize() { void ImGuiPass::initialize() {
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();

View file

@ -6,6 +6,7 @@
#include "string_utils.hpp" #include "string_utils.hpp"
#include "shadercompiler.hpp" #include "shadercompiler.hpp"
#include "material_nodes.hpp" #include "material_nodes.hpp"
#include "renderer.hpp"
ShaderSource get_shader(std::string filename, bool skinned, bool cubemap) { ShaderSource get_shader(std::string filename, bool skinned, bool cubemap) {
auto shader_file = file::open(file::internal_domain / filename); auto shader_file = file::open(file::internal_domain / filename);

View file

@ -98,6 +98,8 @@ Renderer::Renderer(GFX* gfx, const bool enable_imgui) : gfx(gfx) {
createBRDF(); createBRDF();
} }
Renderer::~Renderer() {}
void Renderer::resize(const prism::Extent extent) { void Renderer::resize(const prism::Extent extent) {
this->extent = extent; this->extent = extent;

View file

@ -8,6 +8,7 @@
#include "materialcompiler.hpp" #include "materialcompiler.hpp"
#include "assertions.hpp" #include "assertions.hpp"
#include "frustum.hpp" #include "frustum.hpp"
#include "renderer.hpp"
struct PushConstant { struct PushConstant {
Matrix4x4 mvp, model; Matrix4x4 mvp, model;

View file

@ -6,6 +6,8 @@ set(SRC
include/common.hpp include/common.hpp
include/aabb.hpp include/aabb.hpp
include/file_utils.hpp include/file_utils.hpp
include/assertions.hpp
include/path.hpp
src/string_utils.cpp) src/string_utils.cpp)

View file

@ -0,0 +1,7 @@
#pragma once
#include <filesystem>
namespace file {
using Path = std::filesystem::path;
}

View file

@ -19,6 +19,8 @@
#include "assertions.hpp" #include "assertions.hpp"
#include "log.hpp" #include "log.hpp"
#include "asset.hpp" #include "asset.hpp"
#include "scene.hpp"
#include "renderer.hpp"
class TransformCommand : public Command { class TransformCommand : public Command {
public: public:

View file

@ -20,6 +20,8 @@
#include "imgui_utility.hpp" #include "imgui_utility.hpp"
#include "screen.hpp" #include "screen.hpp"
#include "console.hpp" #include "console.hpp"
#include "input.hpp"
#include "scenecapture.hpp"
const std::map<ImGuiKey, InputButton> imToPl = { const std::map<ImGuiKey, InputButton> imToPl = {
{ImGuiKey_Tab, InputButton::Tab}, {ImGuiKey_Tab, InputButton::Tab},

View file

@ -9,6 +9,7 @@
#include "asset.hpp" #include "asset.hpp"
#include "log.hpp" #include "log.hpp"
#include "materialcompiler.hpp" #include "materialcompiler.hpp"
#include "renderer.hpp"
struct BillPushConstant { struct BillPushConstant {
Matrix4x4 view, mvp; Matrix4x4 view, mvp;

View file

@ -1,5 +1,6 @@
#include "uieditor.hpp" #include "uieditor.hpp"
#include <nlohmann/json.hpp>
#include <imgui.h> #include <imgui.h>
#include <imgui_stdlib.h> #include <imgui_stdlib.h>
#include <imgui_internal.h> #include <imgui_internal.h>