refactor(physics): removed remaining references to glmToRp
This commit is contained in:
parent
089fd02899
commit
cba770c4af
6 changed files with 2 additions and 45 deletions
|
@ -1,6 +1,5 @@
|
||||||
#include "part.h"
|
#include "part.h"
|
||||||
#include "enum/part.h"
|
#include "enum/part.h"
|
||||||
#include "physics/util.h"
|
|
||||||
#include <glm/common.hpp>
|
#include <glm/common.hpp>
|
||||||
|
|
||||||
Part::Part(): BasePart(&TYPE) {
|
Part::Part(): BasePart(&TYPE) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "wedgepart.h"
|
#include "wedgepart.h"
|
||||||
// #include "physics/util.h"
|
|
||||||
// #include <reactphysics3d/collision/ConvexMesh.h>
|
// #include <reactphysics3d/collision/ConvexMesh.h>
|
||||||
// #include <reactphysics3d/collision/shapes/ConvexMeshShape.h>
|
// #include <reactphysics3d/collision/shapes/ConvexMeshShape.h>
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "objects/service/jointsservice.h"
|
#include "objects/service/jointsservice.h"
|
||||||
#include "objects/joint/jointinstance.h"
|
#include "objects/joint/jointinstance.h"
|
||||||
#include "objects/datamodel.h"
|
#include "objects/datamodel.h"
|
||||||
#include "physics/util.h"
|
|
||||||
#include "timeutil.h"
|
#include "timeutil.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
#pragma once
|
|
||||||
#include <glm/ext/vector_float3.hpp>
|
|
||||||
#include <memory>
|
|
||||||
#include <reactphysics3d/body/Body.h>
|
|
||||||
#include <reactphysics3d/mathematics/Matrix3x3.h>
|
|
||||||
#include <reactphysics3d/mathematics/Quaternion.h>
|
|
||||||
#include <reactphysics3d/mathematics/Vector3.h>
|
|
||||||
#include <reactphysics3d/mathematics/mathematics.h>
|
|
||||||
#include <glm/ext.hpp>
|
|
||||||
#include "objects/part/part.h"
|
|
||||||
|
|
||||||
namespace rp = reactphysics3d;
|
|
||||||
|
|
||||||
inline rp::Vector3 glmToRp(glm::vec3 vec) {
|
|
||||||
return rp::Vector3(vec.x, vec.y, vec.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline rp::Quaternion glmToRp(glm::quat quat) {
|
|
||||||
return rp::Quaternion(quat.w, rp::Vector3(quat.x, quat.y, quat.z));
|
|
||||||
}
|
|
||||||
|
|
||||||
// inline rp::Matrix3x3 glmToRp(glm::mat3 mat) {
|
|
||||||
// return (rp::Quaternion)glmToRp((glm::quat)mat);
|
|
||||||
// }
|
|
||||||
|
|
||||||
inline glm::vec3 rpToGlm(rp::Vector3 vec) {
|
|
||||||
return glm::vec3(vec.x, vec.y, vec.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline glm::quat rpToGlm(rp::Quaternion quat) {
|
|
||||||
return glm::quat(quat.w, quat.x, quat.y, quat.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make this std::optional
|
|
||||||
inline std::shared_ptr<BasePart> partFromBody(rp::Body* body) {
|
|
||||||
BasePart* raw = reinterpret_cast<BasePart*>(body->getUserData());
|
|
||||||
std::shared_ptr<BasePart> shared = std::dynamic_pointer_cast<BasePart>(raw->shared_from_this());
|
|
||||||
return shared;
|
|
||||||
}
|
|
|
@ -3,8 +3,8 @@
|
||||||
#include "datatypes/vector.h"
|
#include "datatypes/vector.h"
|
||||||
#include "objects/joint/jointinstance.h"
|
#include "objects/joint/jointinstance.h"
|
||||||
#include "objects/part/basepart.h"
|
#include "objects/part/basepart.h"
|
||||||
|
#include "objects/part/part.h"
|
||||||
#include "physics/convert.h"
|
#include "physics/convert.h"
|
||||||
#include "physics/util.h"
|
|
||||||
#include <reactphysics3d/constraint/FixedJoint.h>
|
#include <reactphysics3d/constraint/FixedJoint.h>
|
||||||
#include <reactphysics3d/constraint/HingeJoint.h>
|
#include <reactphysics3d/constraint/HingeJoint.h>
|
||||||
#include <reactphysics3d/body/RigidBody.h>
|
#include <reactphysics3d/body/RigidBody.h>
|
||||||
|
@ -176,7 +176,7 @@ class NearestRayHit : public rp::RaycastCallback {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<BasePart> part = partFromBody(raycastInfo.body);
|
std::shared_ptr<BasePart> part = (raycastInfo.body && raycastInfo.body->getUserData() != nullptr) ? reinterpret_cast<BasePart*>(raycastInfo.body->getUserData())->shared<BasePart>() : nullptr;
|
||||||
FilterResult result = filter.value()(part);
|
FilterResult result = filter.value()(part);
|
||||||
if (result == FilterResult::BLOCK) {
|
if (result == FilterResult::BLOCK) {
|
||||||
nearestHit = std::nullopt;
|
nearestHit = std::nullopt;
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "objects/pvinstance.h"
|
#include "objects/pvinstance.h"
|
||||||
#include "objects/service/selection.h"
|
#include "objects/service/selection.h"
|
||||||
#include "partassembly.h"
|
#include "partassembly.h"
|
||||||
#include "physics/util.h"
|
|
||||||
#include "rendering/renderer.h"
|
#include "rendering/renderer.h"
|
||||||
#include "rendering/shader.h"
|
#include "rendering/shader.h"
|
||||||
#include "datatypes/variant.h"
|
#include "datatypes/variant.h"
|
||||||
|
|
Loading…
Add table
Reference in a new issue