cleanup: detangled many includes
This commit is contained in:
parent
12ef549a12
commit
621ae30464
36 changed files with 71 additions and 107 deletions
|
@ -417,6 +417,7 @@ void data::writeCodeForClass(std::ofstream& out, std::string headerPath, ClassAn
|
|||
out << "#define __AUTOGEN_EXTRA_INCLUDES__\n";
|
||||
out << "#include \"" << headerPath << "\"\n\n";
|
||||
out << "#include \"datatypes/meta.h\"\n";
|
||||
out << "#include <pugixml.hpp>\n";
|
||||
out << "#include \"lua.h\"\n\n";
|
||||
out << "const Data::TypeInfo " << fqn << "::TYPE = {\n"
|
||||
<< " .name = \"" << state.serializedName << "\",\n"
|
||||
|
|
|
@ -223,6 +223,7 @@ void object::writeCodeForClass(std::ofstream& out, std::string headerPath, Class
|
|||
|
||||
out << "#define __AUTOGEN_EXTRA_INCLUDES__\n";
|
||||
out << "#include \"" << state.headerPath << "\"\n\n";
|
||||
out << "#include \"datatypes/meta.h\"\n\n";
|
||||
out << "const InstanceType " << state.name << "::TYPE = {\n"
|
||||
<< " .super = &" << state.baseClass << "::TYPE,\n"
|
||||
<< " .className = \"" << state.name << "\",\n"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// TEMPORARY COMMON DATA FOR DIFFERENT INTERNAL COMPONENTS
|
||||
|
||||
#include "objects/datamodel.h"
|
||||
#include "datatypes/meta.h"
|
||||
#include "common.h"
|
||||
#include <memory>
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "objects/base/instance.h"
|
||||
#include "objects/handles.h"
|
||||
#include "objects/workspace.h"
|
||||
#include "objects/datamodel.h"
|
||||
#include "camera.h"
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "meta.h"
|
||||
#include <ios>
|
||||
#include <sstream>
|
||||
#include <pugixml.hpp>
|
||||
#include "lua.h"
|
||||
|
||||
#define IMPL_WRAPPER_CLASS(CLASS_NAME, WRAPPED_TYPE, TYPE_NAME) Data::CLASS_NAME::CLASS_NAME(WRAPPED_TYPE in) : value(in) {} \
|
||||
|
|
|
@ -3,12 +3,13 @@
|
|||
#include <string>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <pugixml.hpp>
|
||||
#include "error/result.h"
|
||||
#include "error/data.h"
|
||||
|
||||
extern "C" { typedef struct lua_State lua_State; }
|
||||
|
||||
namespace pugi { class xml_node; };
|
||||
|
||||
#define DEF_WRAPPER_CLASS(CLASS_NAME, WRAPPED_TYPE) class CLASS_NAME : public Data::Base { \
|
||||
WRAPPED_TYPE value; \
|
||||
public: \
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/matrix.hpp>
|
||||
#include <reactphysics3d/mathematics/Transform.h>
|
||||
#include "datatypes/meta.h"
|
||||
#include <pugixml.hpp>
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/gtx/euler_angles.hpp>
|
||||
// #include "meta.h" // IWYU pragma: keep
|
||||
|
|
|
@ -6,10 +6,8 @@
|
|||
#include <glm/ext/quaternion_float.hpp>
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <glm/matrix.hpp>
|
||||
#include <reactphysics3d/mathematics/Transform.h>
|
||||
#include <reactphysics3d/reactphysics3d.h>
|
||||
|
||||
namespace rp = reactphysics3d;
|
||||
namespace reactphysics3d { class Transform; };
|
||||
|
||||
namespace Data {
|
||||
class DEF_DATA_(name="CoordinateFrame") CFrame : public Base {
|
||||
|
@ -26,7 +24,7 @@ namespace Data {
|
|||
DEF_DATA_CTOR CFrame();
|
||||
DEF_DATA_CTOR CFrame(float x, float y, float z, float R00, float R01, float R02, float R10, float R11, float R12, float R20, float R21, float R22);
|
||||
DEF_DATA_CTOR CFrame(Vector3 , Vector3 lookAt, Vector3 up = Vector3(0, 1, 0));
|
||||
CFrame(const rp::Transform&);
|
||||
CFrame(const reactphysics3d::Transform&);
|
||||
CFrame(Vector3 position, glm::quat quat);
|
||||
~CFrame();
|
||||
|
||||
|
@ -43,7 +41,7 @@ namespace Data {
|
|||
static void PushLuaLibrary(lua_State*);
|
||||
|
||||
operator glm::mat4() const;
|
||||
operator rp::Transform() const;
|
||||
operator reactphysics3d::Transform() const;
|
||||
|
||||
//inline static CFrame identity() { }
|
||||
DEF_DATA_PROP inline Vector3 Position() const { return translation; }
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "color3.h"
|
||||
#include "meta.h" // IWYU pragma: keep
|
||||
#include "panic.h"
|
||||
#include "datatypes/meta.h"
|
||||
#include <pugixml.hpp>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
Data::Color3::Color3(float r, float g, float b) : r(std::clamp(r, 0.f, 1.f)), g(std::clamp(g, 0.f, 1.f)), b(std::clamp(b, 0.f, 1.f)) {};
|
||||
Data::Color3::Color3(const glm::vec3& vec) : r(std::clamp(vec.x, 0.f, 1.f)), g(std::clamp(vec.y, 0.f, 1.f)), b(std::clamp(vec.z, 0.f, 1.f)) {};
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
#include "base.h"
|
||||
#include "datatypes/annotation.h"
|
||||
#include <glm/ext/quaternion_geometric.hpp>
|
||||
#include <glm/ext/vector_float3.hpp>
|
||||
#include <reactphysics3d/reactphysics3d.h>
|
||||
|
||||
namespace Data {
|
||||
class DEF_DATA Color3 : public Base {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "datatypes/ref.h"
|
||||
#include "logger.h"
|
||||
#include "panic.h"
|
||||
#include <pugixml.hpp>
|
||||
#include <variant>
|
||||
|
||||
Data::String Data::Variant::ToString() const {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "objects/base/instance.h"
|
||||
#include "lua.h"
|
||||
#include "objects/base/member.h"
|
||||
#include <pugixml.hpp>
|
||||
|
||||
Data::InstanceRef::InstanceRef() {};
|
||||
Data::InstanceRef::InstanceRef(std::weak_ptr<Instance> instance) : ref(instance) {};
|
||||
|
|
|
@ -2,9 +2,15 @@
|
|||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <glm/ext/quaternion_geometric.hpp>
|
||||
#include <iomanip>
|
||||
#include <reactphysics3d/mathematics/Vector3.h>
|
||||
#include <string>
|
||||
#include <pugixml.hpp>
|
||||
#include "datatypes/base.h"
|
||||
#include "meta.h" // IWYU pragma: keep
|
||||
#include "datatypes/meta.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace rp = reactphysics3d;
|
||||
|
||||
Data::Vector3::Vector3() : vector(glm::vec3(0, 0, 0)) {};
|
||||
Data::Vector3::Vector3(const glm::vec3& src) : vector(src) {};
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
#include "base.h"
|
||||
#include "datatypes/annotation.h"
|
||||
#include <glm/ext/quaternion_geometric.hpp>
|
||||
#include <glm/ext/vector_float3.hpp>
|
||||
#include <reactphysics3d/reactphysics3d.h>
|
||||
#include <glm/geometric.hpp>
|
||||
|
||||
namespace rp = reactphysics3d;
|
||||
namespace reactphysics3d { class Vector3; };
|
||||
|
||||
namespace Data {
|
||||
class DEF_DATA_(from_string) Vector3 : public Base {
|
||||
|
@ -17,7 +16,7 @@ namespace Data {
|
|||
DEF_DATA_CTOR Vector3();
|
||||
DEF_DATA_CTOR Vector3(float x, float y, float z);
|
||||
Vector3(const glm::vec3&);
|
||||
Vector3(const rp::Vector3&);
|
||||
Vector3(const reactphysics3d::Vector3&);
|
||||
~Vector3();
|
||||
|
||||
DEF_DATA_PROP static Data::Vector3 ZERO;
|
||||
|
@ -32,7 +31,7 @@ namespace Data {
|
|||
static void PushLuaLibrary(lua_State*);
|
||||
|
||||
operator glm::vec3() const;
|
||||
operator rp::Vector3() const;
|
||||
operator reactphysics3d::Vector3() const;
|
||||
|
||||
DEF_DATA_PROP inline float X() const { return vector.x; }
|
||||
DEF_DATA_PROP inline float Y() const { return vector.y; }
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "error/instance.h"
|
||||
#include "objects/base/member.h"
|
||||
#include "objects/base/refstate.h"
|
||||
#include "objects/datamodel.h"
|
||||
#include "objects/meta.h"
|
||||
#include "logger.h"
|
||||
#include "panic.h"
|
||||
|
@ -17,6 +18,7 @@
|
|||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <pugixml.hpp>
|
||||
#include "ptr_helpers.h"
|
||||
|
||||
// Static so that this variable name is "local" to this source file
|
||||
|
@ -32,15 +34,6 @@ const InstanceType Instance::TYPE = {
|
|||
// return &TYPE_;
|
||||
// }
|
||||
|
||||
constexpr FieldCodec classNameCodec() {
|
||||
return FieldCodec {
|
||||
.write = nullptr,
|
||||
.read = [](void* source) -> Data::Variant {
|
||||
return Data::String(((const InstanceType*)source)->className);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Instance::Instance(const InstanceType* type) {
|
||||
this->name = type->className;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
#include "error/instance.h"
|
||||
#include "error/result.h"
|
||||
|
@ -23,6 +22,8 @@ typedef std::shared_ptr<Instance>(*InstanceConstructor)();
|
|||
class DataModel;
|
||||
class Workspace;
|
||||
|
||||
namespace pugi { class xml_node; };
|
||||
|
||||
typedef int InstanceFlags;
|
||||
// This instance should only be instantiated in special circumstances (i.e. by DataModel) and should be creatable directly via any API
|
||||
const InstanceFlags INSTANCE_NOTCREATABLE = (InstanceFlags)1<<0;
|
||||
|
|
|
@ -1,48 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "../../datatypes/base.h"
|
||||
#include "datatypes/meta.h"
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include "datatypes/base.h"
|
||||
#include <variant>
|
||||
|
||||
class Instance;
|
||||
|
||||
struct FieldCodec {
|
||||
void (*write)(Data::Variant source, void* destination);
|
||||
Data::Variant (*read)(void* source);
|
||||
};
|
||||
|
||||
template <typename T, typename U>
|
||||
constexpr FieldCodec fieldCodecOf() {
|
||||
return FieldCodec {
|
||||
.write = [](Data::Variant source, void* destination) {
|
||||
*(U*)destination = (U)source.get<T>();
|
||||
},
|
||||
.read = [](void* source) -> Data::Variant {
|
||||
return T(*(U*)source);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
constexpr FieldCodec fieldCodecOf() {
|
||||
return FieldCodec {
|
||||
.write = [](Data::Variant source, void* destination) {
|
||||
*(T*)destination = source.get<T>();
|
||||
},
|
||||
.read = [](void* source) -> Data::Variant {
|
||||
return *(T*)source;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::function<void(std::string name)> memberFunctionOf(void(T::*func)(std::string), T* obj) {
|
||||
return std::bind(func, obj, std::placeholders::_1);
|
||||
}
|
||||
|
||||
typedef int PropertyFlags;
|
||||
const PropertyFlags PROP_HIDDEN = 1 << 0; // Hidden from the editor
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "service.h"
|
||||
#include "objects/datamodel.h"
|
||||
#include "logger.h"
|
||||
#include "panic.h"
|
||||
#include <memory>
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
|
||||
// Services are top-level singletons and belong to a specific DataModel
|
||||
// They serve one specific task and can be accessed using game:GetService
|
||||
#include "objects/datamodel.h"
|
||||
#include "objects/base/instance.h"
|
||||
#include <memory>
|
||||
|
||||
class DataModel;
|
||||
|
||||
class Service : public Instance {
|
||||
protected:
|
||||
Service(const InstanceType* type);
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
#include "objects/base/service.h"
|
||||
#include "objects/meta.h"
|
||||
#include "objects/script/serverscriptservice.h"
|
||||
#include "datatypes/meta.h"
|
||||
#include "workspace.h"
|
||||
#include "logger.h"
|
||||
#include "panic.h"
|
||||
#include <pugixml.hpp>
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../annotation.h"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <reactphysics3d/engine/PhysicsWorld.h>
|
||||
#include "datatypes/cframe.h"
|
||||
|
||||
//this is necessary ebcause we use std::weak_ptr<Part> without including it in this file
|
||||
#ifdef __AUTOGEN_EXTRA_INCLUDES__
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
#include "objects/joint/jointinstance.h"
|
||||
#include <memory>
|
||||
|
||||
namespace reactphysics3d { class HingeJoint; }
|
||||
|
||||
class DEF_INST Rotate : public JointInstance {
|
||||
AUTOGEN_PREAMBLE
|
||||
|
||||
rp::HingeJoint* joint = nullptr;
|
||||
reactphysics3d::HingeJoint* joint = nullptr;
|
||||
|
||||
virtual void buildJoint() override;
|
||||
virtual void breakJoint() override;
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
#include "objects/base/instance.h"
|
||||
#include "objects/joint/jointinstance.h"
|
||||
#include <memory>
|
||||
namespace reactphysics3d { class HingeJoint; }
|
||||
|
||||
class DEF_INST RotateV : public JointInstance {
|
||||
AUTOGEN_PREAMBLE
|
||||
|
||||
rp::HingeJoint* joint = nullptr;
|
||||
reactphysics3d::HingeJoint* joint = nullptr;
|
||||
|
||||
virtual void buildJoint() override;
|
||||
virtual void breakJoint() override;
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
#include "objects/joint/jointinstance.h"
|
||||
#include <memory>
|
||||
|
||||
namespace reactphysics3d { class FixedJoint; }
|
||||
|
||||
class DEF_INST Snap : public JointInstance {
|
||||
AUTOGEN_PREAMBLE
|
||||
|
||||
rp::FixedJoint* joint = nullptr;
|
||||
reactphysics3d::FixedJoint* joint = nullptr;
|
||||
|
||||
virtual void buildJoint() override;
|
||||
virtual void breakJoint() override;
|
||||
|
|
|
@ -5,10 +5,12 @@
|
|||
#include "objects/joint/jointinstance.h"
|
||||
#include <memory>
|
||||
|
||||
namespace reactphysics3d { class FixedJoint; }
|
||||
|
||||
class DEF_INST Weld : public JointInstance {
|
||||
AUTOGEN_PREAMBLE
|
||||
|
||||
rp::FixedJoint* joint = nullptr;
|
||||
reactphysics3d::FixedJoint* joint = nullptr;
|
||||
|
||||
virtual void buildJoint() override;
|
||||
virtual void breakJoint() override;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "jointsservice.h"
|
||||
#include "workspace.h"
|
||||
#include "datamodel.h"
|
||||
#include <memory>
|
||||
|
||||
JointsService::JointsService(): Service(&TYPE) {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "objects/script/scriptcontext.h"
|
||||
#include "objects/script/serverscriptservice.h"
|
||||
#include "objects/workspace.h"
|
||||
#include "objects/datamodel.h"
|
||||
|
||||
std::map<std::string, const InstanceType*> INSTANCE_MAP = {
|
||||
{ "Instance", &Instance::TYPE },
|
||||
|
|
|
@ -19,42 +19,6 @@
|
|||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
// template <typename T, typename U>
|
||||
// constexpr FieldCodec fieldCodecOf() {
|
||||
// return FieldCodec {
|
||||
// .write = [](Data::Variant source, void* destination) {
|
||||
// *(U*)destination = (U)source.get<T>();
|
||||
// },
|
||||
// .read = [](void* source) -> Data::Variant {
|
||||
// return T(*(U*)source);
|
||||
// },
|
||||
// };
|
||||
// }
|
||||
|
||||
constexpr FieldCodec cframePositionCodec() {
|
||||
return FieldCodec {
|
||||
.write = [](Data::Variant source, void* destination) {
|
||||
CFrame* cframe = static_cast<CFrame*>(destination);
|
||||
*cframe = cframe->Rotation() + source.get<Vector3>();
|
||||
},
|
||||
.read = [](void* source) -> Data::Variant {
|
||||
return static_cast<CFrame*>(source)->Position();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
constexpr FieldCodec cframeRotationCodec() {
|
||||
return FieldCodec {
|
||||
.write = [](Data::Variant source, void* destination) {
|
||||
CFrame* cframe = static_cast<CFrame*>(destination);
|
||||
*cframe = CFrame::FromEulerAnglesXYZ(source.get<Vector3>()) + cframe->Position();
|
||||
},
|
||||
.read = [](void* source) -> Data::Variant {
|
||||
return static_cast<CFrame*>(source)->ToEulerAnglesXYZ();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Part::Part(): Part(PartConstructParams { .size = glm::vec3(2, 1.2, 4), .color = Color3(0.639216f, 0.635294f, 0.647059f) }) {
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "objects/base/member.h"
|
||||
#include "objects/script/scriptcontext.h"
|
||||
#include "objects/workspace.h"
|
||||
#include "objects/datamodel.h"
|
||||
#include "datatypes/ref.h"
|
||||
#include "lua.h"
|
||||
|
||||
Script::Script(): Instance(&TYPE) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "serverscriptservice.h"
|
||||
#include "objects/script.h"
|
||||
#include "objects/workspace.h"
|
||||
#include "objects/datamodel.h"
|
||||
|
||||
ServerScriptService::ServerScriptService(): Service(&TYPE) {
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "objects/base/instance.h"
|
||||
#include "objects/jointsservice.h"
|
||||
#include "objects/joint/jointinstance.h"
|
||||
#include "objects/datamodel.h"
|
||||
#include "physics/util.h"
|
||||
#include <memory>
|
||||
#include <reactphysics3d/engine/PhysicsCommon.h>
|
||||
|
|
|
@ -2,11 +2,14 @@
|
|||
|
||||
#include "objects/annotation.h"
|
||||
#include "objects/base/service.h"
|
||||
#include <glm/ext/vector_float3.hpp>
|
||||
#include <memory>
|
||||
#include <reactphysics3d/body/RigidBody.h>
|
||||
#include <reactphysics3d/engine/PhysicsCommon.h>
|
||||
#include <reactphysics3d/engine/PhysicsWorld.h>
|
||||
|
||||
namespace rp = reactphysics3d;
|
||||
|
||||
struct RaycastResult {
|
||||
rp::Vector3 worldPoint;
|
||||
rp::Vector3 worldNormal;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "physics/util.h"
|
||||
#include "rendering/renderer.h"
|
||||
#include "rendering/shader.h"
|
||||
#include "datatypes/meta.h"
|
||||
|
||||
#define PI 3.14159
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <qstylefactory.h>
|
||||
#include <qstylehints.h>
|
||||
#include <qmdisubwindow.h>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
#ifdef _NDEBUG
|
||||
#define NDEBUG
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "panes/propertiesview.h"
|
||||
#include "common.h"
|
||||
#include "datatypes/base.h"
|
||||
#include "datatypes/meta.h"
|
||||
#include "objects/base/member.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
|
|
5
tools/incltree.sh
Executable file
5
tools/incltree.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
(cd core/src; cinclude2dot --paths > /tmp/tree.dot)
|
||||
dot -Tsvg /tmp/tree.dot -o /tmp/tree.svg
|
||||
inkscape /tmp/tree.svg &
|
Loading…
Add table
Reference in a new issue