|
@@ -3386,24 +3386,86 @@ window.Modernizr = function(n, e, t) {
|
|
|
this.currentScale = this.absoluteScale
|
|
|
}
|
|
|
,
|
|
|
- n.prototype.getDefaultAbsoluteScale = function(modelSize) {
|
|
|
- var t = Math.max(modelSize.x, modelSize.z)
|
|
|
- , i = Math.min(modelSize.x, modelSize.z)
|
|
|
- , n = Math.max(t, i * this.camera.aspect)
|
|
|
- , r = Math.max(i, t * this.camera.aspect);
|
|
|
- var absoluteScale = (h.aspectRatio() < 1 ? r : n) / 2 / o.orthoBase * 1.2
|
|
|
+ n.prototype.getDefaultAbsoluteScale = function(modelSize, ratio) {
|
|
|
+ let defaultRatio = 1.2 , absoluteScale
|
|
|
+
|
|
|
+
|
|
|
+ if(_settings.floorPlanAngle){//指定了角度的话,就和browser.aspectRatio()无关,总使用纵向
|
|
|
+ var angle = parseFloat(_settings.floorPlanAngle)
|
|
|
+
|
|
|
+
|
|
|
+ modelSize = modelSize.clone().applyEuler(new THREE.Euler(0, angle, 0))
|
|
|
+
|
|
|
+ var n = Math.max(Math.abs(modelSize.x), Math.abs(modelSize.z) * this.camera.aspect) //视口宽高比 >= 1 情况下,模型所占最大视口尺寸
|
|
|
+
|
|
|
+ var screenSize = Math.min($("#player").width(), $("#player").height())
|
|
|
+ var maxSize = 800;//模型最大占据像素
|
|
|
+ ratio = ratio != void 0 ? ratio : Math.max(screenSize * defaultRatio / maxSize, defaultRatio) ;
|
|
|
+
|
|
|
+ absoluteScale = n / 2 / o.orthoBase * ratio; //根据模型所占最大视口尺寸调整缩放
|
|
|
+ }else{
|
|
|
+ var t = Math.max(modelSize.x, modelSize.z)
|
|
|
+ , i = Math.min(modelSize.x, modelSize.z)
|
|
|
+ , n = Math.max(t, i * this.camera.aspect)
|
|
|
+ , r = Math.max(i, t * this.camera.aspect);
|
|
|
+ absoluteScale = (h.aspectRatio() < 1 ? r : n) / 2 / o.orthoBase * defaultRatio
|
|
|
+ }
|
|
|
return absoluteScale
|
|
|
},
|
|
|
|
|
|
|
|
|
- n.prototype.rotateToView = function(e, t) {
|
|
|
+ /* n.prototype.rotateToView = function(e, t) {
|
|
|
var i = 0
|
|
|
, n = h.aspectRatio() < 1
|
|
|
, r = e.x < e.z;
|
|
|
n === r ? t.z > 0 && (i = Math.PI) : i = t.x > 0 ? Math.PI / 2 : -Math.PI / 2,
|
|
|
this.rotateLeft(i),
|
|
|
this.update(0)
|
|
|
+ },
|
|
|
+ */
|
|
|
+ n.prototype.rotateToView = function(modelSize, direction) {
|
|
|
+ let i = 0, n = h.aspectRatio() < 1 //是否模型尺寸显“细长”
|
|
|
+
|
|
|
+ if(_settings.floorPlanAngle ){//规定了cadImage旋转值的话 (0是无效的,将不设置)
|
|
|
+ i = parseFloat(_settings.floorPlanAngle)
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
+ let r = modelSize.x < modelSize.z; //是否视口为“窄屏”
|
|
|
+
|
|
|
+ if(n === r) //“细长” 且 “窄屏”,说明模型尺寸比例与视口比例匹配,相机坐标只需要调转“前”“后”
|
|
|
+ {
|
|
|
+ if(direction.z > 0) //(第一种情况)相机是否位于背面。 注:在默认情况下webgl的相机朝向-z, direction.z > 0 说明相机视野已经偏向+z,说明相机位于模型“背面”
|
|
|
+ {
|
|
|
+ i = Math.PI; //经度上做180度轨道角位移,使相机移到静止模型的“前面”
|
|
|
+ }
|
|
|
+ //(第二种情况) 不做处理
|
|
|
+
|
|
|
+ }
|
|
|
+ else if(direction.x > 0)
|
|
|
+ {
|
|
|
+ i = Math.PI / 2;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ i = -Math.PI / 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.rotateLeft(i);
|
|
|
+ this.update(0);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ ,
|
|
|
+ n.prototype.rotateToAngle = function(angle){//add 旋转到特定角度
|
|
|
+ this.rotateLeft(angle + this.lon);
|
|
|
+ this.update(0);
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
,
|
|
|
n.prototype.pan = function(e, t) {
|
|
|
this.camera.updateMatrix(),
|
|
@@ -3619,9 +3681,10 @@ window.Modernizr = function(n, e, t) {
|
|
|
, n = Math.atan2(Math.sqrt(this.offset.x * this.offset.x + this.offset.z * this.offset.z), this.offset.y);
|
|
|
this.autoRotate && this.rotateLeft(this.getAutoRotationAngle()),
|
|
|
i += this.thetaDelta,
|
|
|
- n += this.phiDelta,
|
|
|
+ n += this.phiDelta,
|
|
|
n = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, n)),
|
|
|
n = Math.max(f, Math.min(Math.PI - f, n));
|
|
|
+ this.lon = i, this.lat = n//add
|
|
|
var r = this.updateZoom();
|
|
|
r = Math.max(this.minDistance, Math.min(this.maxDistance, r)),
|
|
|
this.target.add(this.panVector),
|
|
@@ -14437,7 +14500,9 @@ window.Modernizr = function(n, e, t) {
|
|
|
DATA.tourRotTime = settings.tourRotTime; //默认停留2秒
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ {//其他
|
|
|
+ _settings.floorPlanAngle = DATA.floorPlanAngle || 0
|
|
|
+ }
|
|
|
}).fail(e=>{
|
|
|
alert("缺少someData文件,请检查场景码是否正确。")
|
|
|
})
|