|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
import { AmbientLight, Box3, Matrix4, Object3D, Scene, Vector2, Vector3, WebGLRenderer } from 'three';
|
|
|
|
|
import { AmbientLight, Box3, Frustum, Matrix4, Object3D, Scene, Vector2, Vector3, WebGLRenderer } from 'three';
|
|
|
|
|
import { EffectComposer } from "three/examples/jsm/postprocessing/EffectComposer";
|
|
|
|
|
import { RenderPass } from "three/examples/jsm/postprocessing/RenderPass";
|
|
|
|
|
import { SMAAPass } from "three/examples/jsm/postprocessing/SMAAPass";
|
|
|
|
@ -386,7 +386,22 @@ export class Viewer
|
|
|
|
|
if (this.OutlinePass.selectedObjects.length > 0)
|
|
|
|
|
box = GetBoxArr(this.OutlinePass.selectedObjects);
|
|
|
|
|
else
|
|
|
|
|
box = GetBoxArr(this.VisibleObjects);
|
|
|
|
|
{
|
|
|
|
|
let projScreenMatrix = new Matrix4().multiplyMatrices(this.Camera.projectionMatrix, this.Camera.matrixWorldInverse);
|
|
|
|
|
let frustum = new Frustum().setFromProjectionMatrix(projScreenMatrix);
|
|
|
|
|
box = new Box3;
|
|
|
|
|
for (let obj of this.VisibleObjects)
|
|
|
|
|
{
|
|
|
|
|
let objBox = GetBox(obj);
|
|
|
|
|
if (frustum.containsPoint(objBox.min)
|
|
|
|
|
&& frustum.containsPoint(objBox.max))
|
|
|
|
|
box.union(objBox);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (box.isEmpty())
|
|
|
|
|
box = GetBoxArr(this.VisibleObjects);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!box.isEmpty())
|
|
|
|
|
this.LookTarget = box.getCenter(new Vector3());
|
|
|
|
|
else
|
|
|
|
|