add more stuff
This commit is contained in:
100
src/Chocolate.h
Normal file
100
src/Chocolate.h
Normal file
@@ -0,0 +1,100 @@
|
||||
#ifndef CHOCOLATE_CHOCOLATE_H
|
||||
#define CHOCOLATE_CHOCOLATE_H
|
||||
|
||||
#include <Corrade/Containers/Optional.h>
|
||||
#include <Corrade/Containers/Pair.h>
|
||||
#include <Corrade/PluginManager/Manager.h>
|
||||
#include <Corrade/Utility/Arguments.h>
|
||||
|
||||
#include <Magnum/GL/Framebuffer.h>
|
||||
#include <Magnum/ImageView.h>
|
||||
#include <Magnum/Math/Time.h>
|
||||
#include <Magnum/Mesh.h>
|
||||
#include <Magnum/GL/DefaultFramebuffer.h>
|
||||
#include <Magnum/GL/Mesh.h>
|
||||
#include <Magnum/GL/Renderer.h>
|
||||
#include <Magnum/Math/Color.h>
|
||||
#include <Magnum/MeshTools/Compile.h>
|
||||
#include <Magnum/Platform/Sdl2Application.h>
|
||||
#include <Magnum/SceneGraph/Camera.h>
|
||||
#include <Magnum/SceneGraph/Drawable.h>
|
||||
#include <Magnum/SceneGraph/MatrixTransformation3D.h>
|
||||
#include <Magnum/SceneGraph/Scene.h>
|
||||
#include <Magnum/Shaders/PhongGL.h>
|
||||
#include <Magnum/Trade/AbstractImporter.h>
|
||||
#include <Magnum/Trade/MeshData.h>
|
||||
#include <Magnum/Trade/PhongMaterialData.h>
|
||||
#include <Magnum/Trade/TextureData.h>
|
||||
|
||||
|
||||
#include <entt/entt.hpp>
|
||||
|
||||
#include <imgui.h>
|
||||
#include <Magnum/ImGuiIntegration/Context.hpp>
|
||||
|
||||
#include "Camera.h"
|
||||
|
||||
#include "Materials.h"
|
||||
#include "UI.h"
|
||||
|
||||
using namespace Magnum;
|
||||
using namespace Math::Literals;
|
||||
|
||||
class Chocolate: public Platform::Application {
|
||||
public:
|
||||
virtual ~Chocolate() = default;
|
||||
explicit Chocolate(const Arguments& arguments);
|
||||
|
||||
private:
|
||||
//SDL 2 events
|
||||
void drawEvent() override;
|
||||
void tickEvent() override;
|
||||
void viewportEvent(ViewportEvent& event) override;
|
||||
void pointerPressEvent(PointerEvent& event) override;
|
||||
void pointerReleaseEvent(PointerEvent& event) override;
|
||||
void pointerMoveEvent(PointerMoveEvent& event) override;
|
||||
void keyPressEvent(KeyEvent& event) override;
|
||||
void keyReleaseEvent(KeyEvent& event) override;
|
||||
void textInputEvent(TextInputEvent& event) override;
|
||||
|
||||
// Render
|
||||
void RenderToFramebuffer(GL::Framebuffer& framebuffer);
|
||||
|
||||
// UI
|
||||
void DrawUI();
|
||||
void ResizeUI(Vector2i windowSize);
|
||||
|
||||
//Systems
|
||||
void UpdateMagnumObjects();
|
||||
|
||||
// Callbacks
|
||||
void Import(const std::string& file);
|
||||
void EntitySelected(entt::entity entity);
|
||||
|
||||
//Scene
|
||||
Scene3D _scene;
|
||||
SceneGraph::DrawableGroup3D _drawables;
|
||||
Camera _camera;
|
||||
|
||||
// Resources
|
||||
std::vector<std::unique_ptr<GL::Mesh>> _meshes;
|
||||
std::vector<std::unique_ptr<GL::Texture2D>> _textures;
|
||||
std::unordered_map<std::string, PhongMaterialConfig> _materials;
|
||||
|
||||
Shaders::PhongGL _phongShader;
|
||||
|
||||
entt::registry _registry;
|
||||
|
||||
entt::entity selectedEntityToEdit = entt::null;
|
||||
bool showEntityEditorWindow = false;
|
||||
ImGuiIntegration::Context _imgui{NoCreate};
|
||||
float _sidebarWidth = 0.17f;
|
||||
|
||||
std::vector<UI::Component*> _uiComponents;
|
||||
UI::RenderWindow _uiSceneRenderer;
|
||||
UI::EntityListPanel _uiEntityListPanel;
|
||||
UI::EntityEditorWindow _uiEntityEditorWindow;
|
||||
};
|
||||
|
||||
|
||||
#endif //CHOCOLATE_CHOCOLATE_H
|
||||
Reference in New Issue
Block a user