|
|
@@ -7199,18 +7199,16 @@
|
|
|
|
|
|
有两处关键,在外和传入shader的,是一样的算法。
|
|
|
|
|
|
- 逻辑:
|
|
|
- skinnedMesh所带的skelton的bone
|
|
|
- 在shader中
|
|
|
-
|
|
|
-
|
|
|
- 传入shader的有mesh的bindMatrixInverse和骨骼上的 boneTexture(也就是keleton.boneMatrices)
|
|
|
-
|
|
|
- 而boneMatrices即bone.matrixWorld * boneInverse, 后者初始化后就不变了,前者因为随着模型位移而变得很大。
|
|
|
-
|
|
|
|
|
|
- transformed = ( bindMatrixInverse * skinned ).xyz;
|
|
|
-
|
|
|
+ 传入shader的有mesh的bindMatrixInverse和骨骼上的 boneTexture(也就是keleton.boneMatrices)
|
|
|
+
|
|
|
+ transformed = ( bindMatrixInverse * skinned ).xyz;//这里没有经过最外层的位移
|
|
|
+ 其中skinned是经过boneTexture的位移
|
|
|
+
|
|
|
+ 而boneMatrices即bone.matrixWorld * boneInverse。
|
|
|
+ boneInverse初始化后就不变了,前者因为随着模型位移而变得很大,所以我将其乘以mesh的逆矩阵
|
|
|
+ bindMatrixInverse是 matrixWorld.invert(), 我改为matrix.invert, 两者中和了,都去掉了大数字。
|
|
|
+
|
|
|
所修改处都有avoidBigNumber标识
|
|
|
|
|
|
|
|
|
@@ -45749,7 +45747,7 @@
|
|
|
}
|
|
|
getPosByIntersect(e, type) {
|
|
|
//intersect落在线上的位置,以及在哪两个点之间
|
|
|
-
|
|
|
+ var modelMatrixInvert = this.edge.matrixWorld.clone().invert();
|
|
|
if (!Potree.settings.pathSmooth) {
|
|
|
var prevIndex = Math.floor(e.hoveredElement.faceIndex / 2); //端点1(可能是最后一个)
|
|
|
var nextIndex = this.getIndex(prevIndex, 1); //端点2(可能是第一个)
|
|
|
@@ -45761,13 +45759,19 @@
|
|
|
point
|
|
|
};
|
|
|
} else {
|
|
|
+ var hoverAtGeo = e.hoveredElement.point.clone().applyMatrix4(modelMatrixInvert);
|
|
|
var prevIndex0 = Math.floor(e.hoveredElement.faceIndex / 2); //所在的mesh片段的端点1
|
|
|
var nextIndex0 = prevIndex0 + 1; //所在的mesh片段的端点2
|
|
|
|
|
|
- var _point = math.getFootPoint(e.hoveredElement.point, this.geoPoints[prevIndex0], this.geoPoints[nextIndex0]); //新点位置
|
|
|
- if (type == 'onlyPoint') return {
|
|
|
- point: _point
|
|
|
- };
|
|
|
+ var _point = math.getFootPoint(hoverAtGeo, this.geoPoints[prevIndex0], this.geoPoints[nextIndex0]); //新点位置
|
|
|
+ //console.log('point',point)
|
|
|
+
|
|
|
+ if (type == 'onlyPoint') {
|
|
|
+ _point.applyMatrix4(this.edge.matrixWorld);
|
|
|
+ return {
|
|
|
+ point: _point
|
|
|
+ };
|
|
|
+ }
|
|
|
var _prevIndex, _nextIndex;
|
|
|
var count = this.points.length - 1;
|
|
|
for (var i = 0; i < count; i++) {
|
|
|
@@ -45811,6 +45815,8 @@
|
|
|
_nextIndex = _prevIndex + 1;
|
|
|
//console.log(prevIndex, nextIndex)
|
|
|
var _index = _prevIndex + 1; //新点在端点1后
|
|
|
+
|
|
|
+ _point.applyMatrix4(this.edge.matrixWorld);
|
|
|
return {
|
|
|
index: _index,
|
|
|
prevIndex: _prevIndex,
|
|
|
@@ -80334,10 +80340,12 @@
|
|
|
var pathQua, quaternion;
|
|
|
if (percent2 <= 1) {
|
|
|
var position2 = curve.getPointAt(percent2);
|
|
|
+ position2.add(key.path.edge.position);
|
|
|
pathQua = math.getQuaFromPosAim(position2, position);
|
|
|
} else {
|
|
|
percent2 = percent - delta;
|
|
|
var _position = curve.getPointAt(percent2);
|
|
|
+ _position.add(key.path.edge.position);
|
|
|
pathQua = math.getQuaFromPosAim(position, _position);
|
|
|
}
|
|
|
pathQua.multiplyQuaternions(pathQua, rot90Qua); //这是当模型导进来就旋转正确时的quaternion
|