diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/backend/triangleboundingvolume.cpp | 8 | ||||
-rw-r--r-- | src/render/geometry/gltfskeletonloader.cpp | 2 | ||||
-rw-r--r-- | src/render/jobs/pickboundingvolumejob.cpp | 2 | ||||
-rw-r--r-- | src/render/jobs/pickboundingvolumeutils.cpp | 12 | ||||
-rw-r--r-- | src/render/jobs/raycastingjob.cpp | 2 | ||||
-rw-r--r-- | src/render/jobs/updatelevelofdetailjob.cpp | 8 | ||||
-rw-r--r-- | src/render/materialsystem/shaderdata.cpp | 4 | ||||
-rw-r--r-- | src/render/picking/pickeventfilter.cpp | 1 | ||||
-rw-r--r-- | src/render/raycasting/qray3d.cpp | 4 |
9 files changed, 22 insertions, 21 deletions
diff --git a/src/render/backend/triangleboundingvolume.cpp b/src/render/backend/triangleboundingvolume.cpp index c30b41920..77fbe7fd9 100644 --- a/src/render/backend/triangleboundingvolume.cpp +++ b/src/render/backend/triangleboundingvolume.cpp @@ -116,7 +116,7 @@ bool TriangleBoundingVolume::intersects(const RayCasting::QRay3D &ray, Vector3D { float t = 0.0f; Vector3D uvwr; - const float intersected = intersectsSegmentTriangle(ray, m_c, m_b, m_a, uvwr, t); + const bool intersected = intersectsSegmentTriangle(ray, m_c, m_b, m_a, uvwr, t); if (intersected) { if (q != nullptr) @@ -164,9 +164,9 @@ void TriangleBoundingVolume::setC(const Vector3D &c) TriangleBoundingVolume TriangleBoundingVolume::transformed(const Matrix4x4 &mat) const { - const Vector3D tA = mat * m_a; - const Vector3D tB = mat * m_b; - const Vector3D tC = mat * m_c; + const Vector3D tA = mat.map(m_a); + const Vector3D tB = mat.map(m_b); + const Vector3D tC = mat.map(m_c); return TriangleBoundingVolume(id(), tA, tB, tC); } diff --git a/src/render/geometry/gltfskeletonloader.cpp b/src/render/geometry/gltfskeletonloader.cpp index b006d76b2..b60977dc2 100644 --- a/src/render/geometry/gltfskeletonloader.cpp +++ b/src/render/geometry/gltfskeletonloader.cpp @@ -560,7 +560,7 @@ void GLTFSkeletonLoader::setupNodeParentLinks() const Node &node = m_nodes[i]; const std::vector<int> &childNodeIndices = node.childNodeIndices; for (const auto childNodeIndex : childNodeIndices) { - Q_ASSERT(childNodeIndex < m_nodes.size()); + Q_ASSERT(childNodeIndex < int(m_nodes.size())); Node &childNode = m_nodes[size_t(childNodeIndex)]; Q_ASSERT(childNode.parentNodeIndex == -1); childNode.parentNodeIndex = int(i); diff --git a/src/render/jobs/pickboundingvolumejob.cpp b/src/render/jobs/pickboundingvolumejob.cpp index c3e3cb9bf..5ec6dbb39 100644 --- a/src/render/jobs/pickboundingvolumejob.cpp +++ b/src/render/jobs/pickboundingvolumejob.cpp @@ -416,7 +416,7 @@ void PickBoundingVolumeJob::dispatchPickEvents(const QMouseEvent *event, // Send the corresponding event Vector3D localIntersection = hit.m_intersection; if (entity && entity->worldTransform()) - localIntersection = entity->worldTransform()->inverted() * hit.m_intersection; + localIntersection = entity->worldTransform()->inverted().map(hit.m_intersection); QPickEventPtr pickEvent; #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) diff --git a/src/render/jobs/pickboundingvolumeutils.cpp b/src/render/jobs/pickboundingvolumeutils.cpp index 10536c3c2..855cb9ccb 100644 --- a/src/render/jobs/pickboundingvolumeutils.cpp +++ b/src/render/jobs/pickboundingvolumeutils.cpp @@ -209,9 +209,9 @@ private: void TriangleCollisionVisitor::visit(uint andx, const Vector3D &a, uint bndx, const Vector3D &b, uint cndx, const Vector3D &c) { const Matrix4x4 &mat = *m_root->worldTransform(); - const Vector3D tA = mat * a; - const Vector3D tB = mat * b; - const Vector3D tC = mat * c; + const Vector3D tA = mat.map(a); + const Vector3D tB = mat.map(b); + const Vector3D tC = mat.map(c); bool intersected = m_frontFaceRequested && intersectsSegmentTriangle(cndx, tC, bndx, tB, andx, tA); // front facing @@ -273,8 +273,8 @@ private: void LineCollisionVisitor::visit(uint andx, const Vector3D &a, uint bndx, const Vector3D &b) { const Matrix4x4 &mat = *m_root->worldTransform(); - const Vector3D tA = mat * a; - const Vector3D tB = mat * b; + const Vector3D tA = mat.map(a); + const Vector3D tB = mat.map(b); intersectsSegmentSegment(andx, tA, bndx, tB); @@ -398,7 +398,7 @@ private: void PointCollisionVisitor::visit(uint ndx, const Vector3D &p) { const Matrix4x4 &mat = *m_root->worldTransform(); - const Vector3D tP = mat * p; + const Vector3D tP = mat.map(p); Vector3D intersection; float d = pointToRayDistance(tP, intersection); diff --git a/src/render/jobs/raycastingjob.cpp b/src/render/jobs/raycastingjob.cpp index b6ebdad99..8757b68f3 100644 --- a/src/render/jobs/raycastingjob.cpp +++ b/src/render/jobs/raycastingjob.cpp @@ -293,7 +293,7 @@ void RayCastingJob::dispatchHits(RayCaster *rayCaster, const PickingUtils::HitLi Entity *entity = m_manager->renderNodesManager()->lookupResource(sphereHit.m_entityId); Vector3D localIntersection = sphereHit.m_intersection; if (entity && entity->worldTransform()) - localIntersection = entity->worldTransform()->inverted() * localIntersection; + localIntersection = entity->worldTransform()->inverted().map(localIntersection); QRayCasterHit::HitType hitType = QRayCasterHit::EntityHit; switch (sphereHit.m_type) { diff --git a/src/render/jobs/updatelevelofdetailjob.cpp b/src/render/jobs/updatelevelofdetailjob.cpp index b5033a6b7..d4f09cb01 100644 --- a/src/render/jobs/updatelevelofdetailjob.cpp +++ b/src/render/jobs/updatelevelofdetailjob.cpp @@ -120,13 +120,13 @@ private: const QList<qreal> thresholds = lod->thresholds(); Vector3D center(lod->center()); if (lod->hasBoundingVolumeOverride() || entity->worldBoundingVolume() == nullptr) { - center = *entity->worldTransform() * center; + center = entity->worldTransform()->map(center); } else { center = entity->worldBoundingVolume()->center(); } - const Vector3D tcenter = viewMatrix * center; - const float dist = tcenter.length(); + const Vector3D tcenter = viewMatrix.map(center); + const double dist = double(tcenter.length()); const int n = thresholds.size(); for (int i=0; i<n; ++i) { if (dist <= thresholds[i] || i == n -1) { @@ -171,7 +171,7 @@ private: float area = vca.viewport.width() * sideLength * vca.viewport.height() * sideLength; const QRect r = windowViewport(vca.area, vca.viewport); - area = std::sqrt(area * r.width() * r.height()); + area = std::sqrt(area * float(r.width()) * float(r.height())); const int n = thresholds.size(); for (int i = 0; i < n; ++i) { diff --git a/src/render/materialsystem/shaderdata.cpp b/src/render/materialsystem/shaderdata.cpp index f5e194697..30ea64752 100644 --- a/src/render/materialsystem/shaderdata.cpp +++ b/src/render/materialsystem/shaderdata.cpp @@ -224,9 +224,9 @@ QVariant ShaderData::getTransformedProperty(const PropertyValue *v, const Matrix const TransformType transformType = static_cast<TransformType>(transformedValue.value.toInt()); switch (transformType) { case ModelToEye: - return QVariant::fromValue(viewMatrix * m_worldMatrix * Vector3D(v->value.value<QVector3D>())); + return QVariant::fromValue(viewMatrix.map(m_worldMatrix.map(Vector3D(v->value.value<QVector3D>())))); case ModelToWorld: - return QVariant::fromValue(m_worldMatrix * Vector3D(v->value.value<QVector3D>())); + return QVariant::fromValue(m_worldMatrix.map(Vector3D(v->value.value<QVector3D>()))); case ModelToWorldDirection: return QVariant::fromValue(Vector3D(m_worldMatrix * Vector4D(v->value.value<QVector3D>(), 0.0f))); case NoTransform: diff --git a/src/render/picking/pickeventfilter.cpp b/src/render/picking/pickeventfilter.cpp index a41ed6c1e..91aa4206b 100644 --- a/src/render/picking/pickeventfilter.cpp +++ b/src/render/picking/pickeventfilter.cpp @@ -74,6 +74,7 @@ bool PickEventFilter::eventFilter(QObject *obj, QEvent *e) auto mouseEvent = QMouseEvent(QEvent::MouseMove, #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) he->position(), + he->globalPosition(), #else he->pos(), #endif diff --git a/src/render/raycasting/qray3d.cpp b/src/render/raycasting/qray3d.cpp index 18dd9a40a..0d3f839f6 100644 --- a/src/render/raycasting/qray3d.cpp +++ b/src/render/raycasting/qray3d.cpp @@ -177,7 +177,7 @@ Vector3D QRay3D::point(float t) const QRay3D &QRay3D::transform(const Matrix4x4 &matrix) { - m_origin = matrix * m_origin; + m_origin = matrix.map(m_origin); m_direction = matrix.mapVector(m_direction).normalized(); return *this; @@ -185,7 +185,7 @@ QRay3D &QRay3D::transform(const Matrix4x4 &matrix) QRay3D QRay3D::transformed(const Matrix4x4 &matrix) const { - return QRay3D(matrix * m_origin, matrix.mapVector(m_direction).normalized()); + return QRay3D(matrix.map(m_origin), matrix.mapVector(m_direction).normalized()); } bool QRay3D::operator==(const QRay3D &other) const |