Move camera to a separate file.

This commit is contained in:
kovacsv 2022-01-18 19:51:07 +01:00
parent 7fc09c1ca1
commit 968f336a98
4 changed files with 30 additions and 27 deletions

View File

@ -1,6 +1,6 @@
import { Coord3D } from '../geometry/coord3d.js';
import { Color } from '../model/color.js';
import { Camera } from '../viewer/navigation.js';
import { Camera } from '../viewer/camera.js';
export let ParameterConverter =
{

View File

@ -0,0 +1,25 @@
import { CoordIsEqual3D } from '../geometry/coord3d.js';
export class Camera
{
constructor (eye, center, up)
{
this.eye = eye;
this.center = center;
this.up = up;
}
Clone ()
{
return new Camera (
this.eye.Clone (),
this.center.Clone (),
this.up.Clone ()
);
}
}
export function CameraIsEqual3D (a, b)
{
return CoordIsEqual3D (a.eye, b.eye) && CoordIsEqual3D (a.center, b.center) && CoordIsEqual3D (a.up, b.up);
}

View File

@ -1,33 +1,10 @@
import { Coord2D, CoordDistance2D, SubCoord2D } from '../geometry/coord2d.js';
import { CoordDistance3D, CoordIsEqual3D, CrossVector3D, SubCoord3D, VectorAngle3D } from '../geometry/coord3d.js';
import { CoordDistance3D, CrossVector3D, SubCoord3D, VectorAngle3D } from '../geometry/coord3d.js';
import { DegRad, IsGreater, IsLower, IsZero } from '../geometry/geometry.js';
import { ParabolicTweenFunction, TweenCoord3D } from '../geometry/tween.js';
import { CameraIsEqual3D } from './camera.js';
import { GetDomElementClientCoordinates } from './domutils.js';
export class Camera
{
constructor (eye, center, up)
{
this.eye = eye;
this.center = center;
this.up = up;
}
Clone ()
{
return new Camera (
this.eye.Clone (),
this.center.Clone (),
this.up.Clone ()
);
}
}
export function CameraIsEqual3D (a, b)
{
return CoordIsEqual3D (a.eye, b.eye) && CoordIsEqual3D (a.center, b.center) && CoordIsEqual3D (a.up, b.up);
}
export class MouseInteraction
{
constructor ()

View File

@ -2,8 +2,9 @@ import { Coord3D, CoordDistance3D, SubCoord3D } from '../geometry/coord3d.js';
import { Direction } from '../geometry/geometry.js';
import { ColorToHexString } from '../model/color.js';
import { ShadingType } from '../threejs/threeutils.js';
import { Camera } from './camera.js';
import { GetDomElementInnerDimensions } from './domutils.js';
import { Camera, Navigation } from './navigation.js';
import { Navigation } from './navigation.js';
import { ViewerExtraGeometry, ViewerGeometry } from './viewergeometry.js';
export function GetDefaultCamera (direction)