0027105: Make code ISO-compliant [-Wpedantic fixes]
[occt.git] / src / Graphic3d / Graphic3d_Camera.hxx
CommitLineData
b5ac8292 1// Created on: 2013-05-29
2// Created by: Anton POLETAEV
3// Copyright (c) 1999-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
b5ac8292 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _Graphic3d_Camera_HeaderFile
17#define _Graphic3d_Camera_HeaderFile
18
197ac94e 19#include <Graphic3d_Mat4d.hxx>
b5ac8292 20#include <Graphic3d_Mat4.hxx>
21#include <Graphic3d_Vec3.hxx>
825aa485 22#include <Graphic3d_WorldViewProjState.hxx>
b5ac8292 23
197ac94e 24#include <NCollection_Handle.hxx>
25
b5ac8292 26#include <gp_Dir.hxx>
27#include <gp_Pnt.hxx>
28
29#include <Standard_Macro.hxx>
30#include <Standard_TypeDef.hxx>
31
6bc6a6fc 32#include <Bnd_Box.hxx>
33
494782f6 34//! Forward declaration
825aa485 35class Graphic3d_WorldViewProjState;
b5ac8292 36
37//! Camera class provides object-oriented approach to setting up projection
38//! and orientation properties of 3D view.
39class Graphic3d_Camera : public Standard_Transient
40{
197ac94e 41private:
42
43 //! Template container for cached matrices or Real/ShortReal types.
44 template<typename Elem_t>
45 struct TransformMatrices
46 {
47 void InitOrientation()
48 {
49 Orientation = new NCollection_Mat4<Elem_t>();
50 }
51
52 void InitProjection()
53 {
54 MProjection = new NCollection_Mat4<Elem_t>();
55 LProjection = new NCollection_Mat4<Elem_t>();
56 RProjection = new NCollection_Mat4<Elem_t>();
57 }
58
59 void ResetOrientation()
60 {
61 Orientation.Nullify();
62 }
63
64 void ResetProjection()
65 {
66 MProjection.Nullify();
67 LProjection.Nullify();
68 RProjection.Nullify();
69 }
70
71 Standard_Boolean IsOrientationValid()
72 {
73 return !Orientation.IsNull();
74 }
75
76 Standard_Boolean IsProjectionValid()
77 {
78 return !MProjection.IsNull() &&
79 !LProjection.IsNull() &&
80 !RProjection.IsNull();
81 }
82
83 NCollection_Handle< NCollection_Mat4<Elem_t> > Orientation;
84 NCollection_Handle< NCollection_Mat4<Elem_t> > MProjection;
85 NCollection_Handle< NCollection_Mat4<Elem_t> > LProjection;
86 NCollection_Handle< NCollection_Mat4<Elem_t> > RProjection;
87 };
b5ac8292 88
89public:
90
91 //! Enumerates supported monographic projections.
92 //! - Projection_Orthographic : orthographic projection.
93 //! - Projection_Perspective : perspective projection.
38a0206f 94 //! - Projection_Stereo : stereographic projection.
b5ac8292 95 //! - Projection_MonoLeftEye : mono projection for stereo left eye.
96 //! - Projection_MonoRightEye : mono projection for stereo right eye.
97 enum Projection
98 {
99 Projection_Orthographic,
100 Projection_Perspective,
101 Projection_Stereo,
102 Projection_MonoLeftEye,
103 Projection_MonoRightEye
104 };
105
106 //! Enumerates approaches to define stereographic focus.
107 //! - FocusType_Absolute : focus is specified as absolute value.
108 //! - FocusType_Relative : focus is specified relative to
109 //! (as coefficient of) camera focal length.
110 enum FocusType
111 {
112 FocusType_Absolute,
113 FocusType_Relative
114 };
115
116 //! Enumerates approaches to define Intraocular distance.
117 //! - IODType_Absolute : Intraocular distance is defined as absolute value.
118 //! - IODType_Relative : Intraocular distance is defined relative to
119 //! (as coefficient of) camera focal length.
120 enum IODType
121 {
122 IODType_Absolute,
123 IODType_Relative
124 };
125
126public:
127
128 //! Default constructor.
129 //! Initializes camera with the following properties:
130 //! Eye (0, 0, -2); Center (0, 0, 0); Up (0, 1, 0);
131 //! Type (Orthographic); FOVy (45); Scale (1000); IsStereo(false);
197ac94e 132 //! ZNear (0.001); ZFar (3000.0); Aspect(1);
b5ac8292 133 //! ZFocus(1.0); ZFocusType(Relative); IOD(0.05); IODType(Relative)
134 Standard_EXPORT Graphic3d_Camera();
135
136 //! Copy constructor.
137 //! @param theOther [in] the camera to copy from.
138 Standard_EXPORT Graphic3d_Camera (const Handle(Graphic3d_Camera)& theOther);
139
140 //! Initialize mapping related parameters from other camera handle.
141 Standard_EXPORT void CopyMappingData (const Handle(Graphic3d_Camera)& theOtherCamera);
142
143 //! Initialize orientation related parameters from other camera handle.
144 Standard_EXPORT void CopyOrientationData (const Handle(Graphic3d_Camera)& theOtherCamera);
145
146 //! Copy properties of another camera.
147 //! @param theOther [in] the camera to copy from.
148 Standard_EXPORT void Copy (const Handle(Graphic3d_Camera)& theOther);
149
197ac94e 150//! @name Public camera properties
151public:
b5ac8292 152
153 //! Sets camera Eye position.
154 //! @param theEye [in] the location of camera's Eye.
155 Standard_EXPORT void SetEye (const gp_Pnt& theEye);
156
157 //! Get camera Eye position.
158 //! @return camera eye location.
159 const gp_Pnt& Eye() const
160 {
161 return myEye;
162 }
163
164 //! Sets Center of the camera.
165 //! @param theCenter [in] the point where the camera looks at.
166 Standard_EXPORT void SetCenter (const gp_Pnt& theCenter);
167
168 //! Get Center of the camera.
169 //! @return the point where the camera looks at.
170 const gp_Pnt& Center() const
171 {
172 return myCenter;
173 }
174
197ac94e 175 //! Sets camera Up direction vector, orthogonal to camera direction.
b5ac8292 176 //! @param theUp [in] the Up direction vector.
177 Standard_EXPORT void SetUp (const gp_Dir& theUp);
178
197ac94e 179 //! Orthogonalize up direction vector.
180 Standard_EXPORT void OrthogonalizeUp();
181
182 //! Return a copy of orthogonalized up direction vector.
183 Standard_EXPORT gp_Dir OrthogonalizedUp() const;
184
b5ac8292 185 //! Get camera Up direction vector.
186 //! @return Camera's Up direction vector.
187 const gp_Dir& Up() const
188 {
189 return myUp;
190 }
191
ebc93ae7 192 //! Set camera axial scale.
b5ac8292 193 //! @param theAxialScale [in] the axial scale vector.
197ac94e 194 Standard_EXPORT void SetAxialScale (const gp_XYZ& theAxialScale);
b5ac8292 195
196 //! Get camera axial scale.
197 //! @return Camera's axial scale.
197ac94e 198 const gp_XYZ& AxialScale() const
b5ac8292 199 {
200 return myAxialScale;
201 }
202
203 //! Set distance of Eye from camera Center.
204 //! @param theDistance [in] the distance.
205 Standard_EXPORT void SetDistance (const Standard_Real theDistance);
206
207 //! Get distance of Eye from camera Center.
208 //! @return the distance.
209 Standard_EXPORT Standard_Real Distance() const;
210
211 //! Sets camera look direction.
212 //! @param theDir [in] the direction.
213 Standard_EXPORT void SetDirection (const gp_Dir& theDir);
214
215 //! Get camera look direction.
216 //! @return camera look direction.
217 Standard_EXPORT gp_Dir Direction() const;
218
219 //! Sets camera scale. For orthographic projection the scale factor
220 //! corresponds to parallel scale of view mapping (i.e. size
221 //! of viewport). For perspective camera scale is converted to
3dfe95cd 222 //! distance. The scale specifies equal size of the view projection in
223 //! both dimensions assuming that the aspect is 1.0. The projection height
224 //! and width are specified with the scale and correspondingly multiplied
225 //! by the aspect.
b5ac8292 226 //! @param theScale [in] the scale factor.
227 Standard_EXPORT void SetScale (const Standard_Real theScale);
228
229 //! Get camera scale.
230 //! @return camera scale factor.
231 Standard_EXPORT Standard_Real Scale() const;
232
233 //! Change camera projection type.
197ac94e 234 //! When switching to perspective projection from orthographic one,
235 //! the ZNear and ZFar are reset to default values (0.001, 3000.0)
236 //! if less than 0.0.
b5ac8292 237 //! @param theProjectionType [in] the camera projection type.
238 Standard_EXPORT void SetProjectionType (const Projection theProjection);
239
240 //! @return camera projection type.
241 Projection ProjectionType() const
242 {
243 return myProjType;
244 }
245
246 //! Check that the camera projection is orthographic.
247 //! @return boolean flag that indicates whether the camera's projection is
248 //! orthographic or not.
249 Standard_Boolean IsOrthographic() const
250 {
251 return (myProjType == Projection_Orthographic);
252 }
253
254 //! Check whether the camera projection is stereo.
255 //! Please note that stereo rendering is now implemented with support of
256 //! Quad buffering.
257 //! @return boolean flag indicating whether the stereographic L/R projection
258 //! is chosen.
259 Standard_Boolean IsStereo() const
260 {
261 return (myProjType == Projection_Stereo);
262 }
263
264 //! Set Field Of View (FOV) in y axis for perspective projection.
265 //! @param theFOVy [in] the FOV in degrees.
266 Standard_EXPORT void SetFOVy (const Standard_Real theFOVy);
267
268 //! Get Field Of View (FOV) in y axis.
269 //! @return the FOV value in degrees.
270 Standard_Real FOVy() const
271 {
272 return myFOVy;
273 }
274
10dbdf34 275 //! Estimate Z-min and Z-max planes of projection volume to match the
6bc6a6fc 276 //! displayed objects. The methods ensures that view volume will
277 //! be close by depth range to the displayed objects. Fitting assumes that
278 //! for orthogonal projection the view volume contains the displayed objects
279 //! completely. For zoomed perspective view, the view volume is adjusted such
280 //! that it contains the objects or their parts, located in front of the camera.
281 //! @param theScaleFactor [in] the scale factor for Z-range.
282 //! The range between Z-min, Z-max projection volume planes
283 //! evaluated by z fitting method will be scaled using this coefficient.
284 //! Program error exception is thrown if negative or zero value is passed.
285 //! @param theMinMax [in] applicative min max boundaries.
286 //! @param theScaleFactor [in] real graphical boundaries (not accounting infinite flag).
10dbdf34 287 Standard_EXPORT bool ZFitAll (const Standard_Real theScaleFactor,
288 const Bnd_Box& theMinMax,
289 const Bnd_Box& theGraphicBB,
290 Standard_Real& theZNear,
291 Standard_Real& theZFar) const;
292
293 //! Change Z-min and Z-max planes of projection volume to match the displayed objects.
294 void ZFitAll (const Standard_Real theScaleFactor, const Bnd_Box& theMinMax, const Bnd_Box& theGraphicBB)
295 {
296 Standard_Real aZNear = 0.0, aZFar = 1.0;
297 ZFitAll (theScaleFactor, theMinMax, theGraphicBB, aZNear, aZFar);
298 SetZRange (aZNear, aZFar);
299 }
6bc6a6fc 300
197ac94e 301 //! Change the Near and Far Z-clipping plane positions.
302 //! For orthographic projection, theZNear, theZFar can be negative or positive.
303 //! For perspective projection, only positive values are allowed.
304 //! Program error exception is raised if non-positive values are
305 //! specified for perspective projection or theZNear >= theZFar.
b5ac8292 306 //! @param theZNear [in] the distance of the plane from the Eye.
197ac94e 307 //! @param theZFar [in] the distance of the plane from the Eye.
308 Standard_EXPORT void SetZRange (const Standard_Real theZNear, const Standard_Real theZFar);
b5ac8292 309
310 //! Get the Near Z-clipping plane position.
311 //! @return the distance of the plane from the Eye.
312 Standard_Real ZNear() const
313 {
314 return myZNear;
315 }
316
b5ac8292 317 //! Get the Far Z-clipping plane position.
318 //! @return the distance of the plane from the Eye.
319 Standard_Real ZFar() const
320 {
321 return myZFar;
322 }
323
3dfe95cd 324 //! Changes width / height display ratio.
b5ac8292 325 //! @param theAspect [in] the display ratio.
326 Standard_EXPORT void SetAspect (const Standard_Real theAspect);
327
328 //! Get camera display ratio.
329 //! @return display ratio.
330 Standard_Real Aspect() const
331 {
332 return myAspect;
333 }
334
335 //! Sets stereographic focus distance.
336 //! @param theType [in] the focus definition type. Focus can be defined
337 //! as absolute value or relatively to (as coefficient of) coefficient of
338 //! camera focal length.
339 //! @param theZFocus [in] the focus absolute value or coefficient depending
340 //! on the passed definition type.
341 Standard_EXPORT void SetZFocus (const FocusType theType, const Standard_Real theZFocus);
342
343 //! Get stereographic focus value.
344 //! @return absolute or relative stereographic focus value
345 //! depending on its definition type.
346 Standard_Real ZFocus() const
347 {
348 return myZFocus;
349 }
350
351 //! Get stereographic focus definition type.
352 //! @return definition type used for stereographic focus.
353 FocusType ZFocusType() const
354 {
355 return myZFocusType;
356 }
357
358 //! Sets Intraocular distance.
359 //! @param theType [in] the IOD definition type. IOD can be defined as
360 //! absolute value or relatively to (as coefficient of) camera focal length.
361 //! @param theIOD [in] the Intraocular distance.
362 Standard_EXPORT void SetIOD (const IODType theType, const Standard_Real theIOD);
363
364 //! Get Intraocular distance value.
365 //! @return absolute or relative IOD value depending on its definition type.
366 Standard_Real IOD() const
367 {
368 return myIOD;
369 }
370
371 //! Get Intraocular distance definition type.
372 //! @return definition type used for Intraocular distance.
373 IODType GetIODType() const
374 {
375 return myIODType;
376 }
377
197ac94e 378//! @name Basic camera operations
b5ac8292 379public:
380
381 //! Transform orientation components of the camera:
382 //! Eye, Up and Center points.
383 //! @param theTrsf [in] the transformation to apply.
384 Standard_EXPORT void Transform (const gp_Trsf& theTrsf);
385
386 //! Calculate view plane size at center (target) point
387 //! and distance between ZFar and ZNear planes.
388 //! @return values in form of gp_Pnt (Width, Height, Depth).
197ac94e 389 Standard_EXPORT gp_XYZ ViewDimensions() const;
390
391 //! Calculate WCS frustum planes for the camera projection volume.
392 //! Frustum is a convex volume determined by six planes directing
393 //! inwards.
394 //! The frustum planes are usually used as inputs for camera algorithms.
395 //! Thus, if any changes to projection matrix calculation are necessary,
396 //! the frustum planes calculation should be also touched.
397 //! @param theLeft [out] the frustum plane for left side of view.
398 //! @param theRight [out] the frustum plane for right side of view.
399 //! @param theBottom [out] the frustum plane for bottom side of view.
400 //! @param theTop [out] the frustum plane for top side of view.
401 //! @param theNear [out] the frustum plane for near side of view.
402 //! @param theFar [out] the frustum plane for far side of view.
403 Standard_EXPORT void Frustum (gp_Pln& theLeft,
404 gp_Pln& theRight,
405 gp_Pln& theBottom,
406 gp_Pln& theTop,
407 gp_Pln& theNear,
408 gp_Pln& theFar) const;
409
410//! @name Projection methods
b5ac8292 411public:
412
413 //! Project point from world coordinate space to
414 //! normalized device coordinates (mapping).
415 //! @param thePnt [in] the 3D point in WCS.
416 //! @return mapped point in NDC.
417 Standard_EXPORT gp_Pnt Project (const gp_Pnt& thePnt) const;
418
419 //! Unproject point from normalized device coordinates
420 //! to world coordinate space.
421 //! @param thePnt [in] the NDC point.
422 //! @return 3D point in WCS.
423 Standard_EXPORT gp_Pnt UnProject (const gp_Pnt& thePnt) const;
424
425 //! Convert point from view coordinate space to
426 //! projection coordinate space.
427 //! @param thePnt [in] the point in VCS.
428 //! @return point in NDC.
429 Standard_EXPORT gp_Pnt ConvertView2Proj (const gp_Pnt& thePnt) const;
430
431 //! Convert point from projection coordinate space
432 //! to view coordinate space.
433 //! @param thePnt [in] the point in NDC.
434 //! @return point in VCS.
435 Standard_EXPORT gp_Pnt ConvertProj2View (const gp_Pnt& thePnt) const;
436
437 //! Convert point from world coordinate space to
438 //! view coordinate space.
439 //! @param thePnt [in] the 3D point in WCS.
440 //! @return point in VCS.
441 Standard_EXPORT gp_Pnt ConvertWorld2View (const gp_Pnt& thePnt) const;
442
443 //! Convert point from view coordinate space to
444 //! world coordinates.
445 //! @param thePnt [in] the 3D point in VCS.
446 //! @return point in WCS.
447 Standard_EXPORT gp_Pnt ConvertView2World (const gp_Pnt& thePnt) const;
448
197ac94e 449//! @name Camera modification state
b5ac8292 450public:
451
825aa485 452 //! @return projection modification state of the camera.
453 const Graphic3d_WorldViewProjState& WorldViewProjState() const
454 {
455 return myWorldViewProjState;
456 }
457
458
197ac94e 459 //! Returns modification state of camera projection matrix
460 Standard_Size ProjectionState() const
461 {
825aa485 462 return myWorldViewProjState.ProjectionState();
197ac94e 463 }
464
825aa485 465 //! Returns modification state of camera world view transformation matrix.
466 Standard_Size WorldViewState() const
197ac94e 467 {
825aa485 468 return myWorldViewProjState.WorldViewState();
197ac94e 469 }
470
471//! @name Lazily-computed orientation and projection matrices derived from camera parameters
472public:
b5ac8292 473
197ac94e 474 //! Get orientation matrix.
475 //! @return camera orientation matrix.
476 Standard_EXPORT const Graphic3d_Mat4d& OrientationMatrix() const;
477
478 //! Get orientation matrix of Standard_ShortReal precision.
479 //! @return camera orientation matrix.
480 Standard_EXPORT const Graphic3d_Mat4& OrientationMatrixF() const;
481
482 //! Get monographic or middle point projection matrix used for monographic
483 //! rendering and for point projection / unprojection.
484 //! @return monographic projection matrix.
485 Standard_EXPORT const Graphic3d_Mat4d& ProjectionMatrix() const;
486
487 //! Get monographic or middle point projection matrix of Standard_ShortReal precision used for monographic
488 //! rendering and for point projection / unprojection.
489 //! @return monographic projection matrix.
490 Standard_EXPORT const Graphic3d_Mat4& ProjectionMatrixF() const;
491
492 //! @return stereographic matrix computed for left eye. Please note
493 //! that this method is used for rendering for <i>Projection_Stereo</i>.
494 Standard_EXPORT const Graphic3d_Mat4d& ProjectionStereoLeft() const;
495
496 //! @return stereographic matrix of Standard_ShortReal precision computed for left eye.
497 //! Please note that this method is used for rendering for <i>Projection_Stereo</i>.
498 Standard_EXPORT const Graphic3d_Mat4& ProjectionStereoLeftF() const;
499
500 //! @return stereographic matrix computed for right eye. Please note
501 //! that this method is used for rendering for <i>Projection_Stereo</i>.
502 Standard_EXPORT const Graphic3d_Mat4d& ProjectionStereoRight() const;
503
504 //! @return stereographic matrix of Standard_ShortReal precision computed for right eye.
505 //! Please note that this method is used for rendering for <i>Projection_Stereo</i>.
506 Standard_EXPORT const Graphic3d_Mat4& ProjectionStereoRightF() const;
507
05e2200b 508 //! Invalidate state of projection matrix.
509 //! The matrix will be updated on request.
510 Standard_EXPORT void InvalidateProjection();
511
512 //! Invalidate orientation matrix.
513 //! The matrix will be updated on request.
514 Standard_EXPORT void InvalidateOrientation();
515
197ac94e 516//! @name Managing projection and orientation cache
517private:
518
519 //! Compute projection matrices.
520 //! @param theMatrices [in] the matrices data container.
521 template <typename Elem_t>
522 Standard_EXPORT
523 TransformMatrices<Elem_t>& UpdateProjection (TransformMatrices<Elem_t>& theMatrices) const;
524
525 //! Compute orientation matrix.
526 //! @param theMatrices [in] the matrices data container.
527 template <typename Elem_t>
528 Standard_EXPORT
529 TransformMatrices<Elem_t>& UpdateOrientation (TransformMatrices<Elem_t>& theMatrices) const;
530
b5ac8292 531private:
532
533 //! Compose orthographic projection matrix for
534 //! the passed camera volume mapping.
535 //! @param theLeft [in] the left mapping (clipping) coordinate.
536 //! @param theRight [in] the right mapping (clipping) coordinate.
537 //! @param theBottom [in] the bottom mapping (clipping) coordinate.
538 //! @param theTop [in] the top mapping (clipping) coordinate.
539 //! @param theNear [in] the near mapping (clipping) coordinate.
540 //! @param theFar [in] the far mapping (clipping) coordinate.
b5ac8292 541 //! @param theOutMx [out] the projection matrix.
197ac94e 542 template <typename Elem_t>
b5ac8292 543 static void
197ac94e 544 OrthoProj (const Elem_t theLeft,
545 const Elem_t theRight,
546 const Elem_t theBottom,
547 const Elem_t theTop,
548 const Elem_t theNear,
549 const Elem_t theFar,
550 NCollection_Mat4<Elem_t>& theOutMx);
b5ac8292 551
552 //! Compose perspective projection matrix for
553 //! the passed camera volume mapping.
554 //! @param theLeft [in] the left mapping (clipping) coordinate.
555 //! @param theRight [in] the right mapping (clipping) coordinate.
556 //! @param theBottom [in] the bottom mapping (clipping) coordinate.
557 //! @param theTop [in] the top mapping (clipping) coordinate.
558 //! @param theNear [in] the near mapping (clipping) coordinate.
559 //! @param theFar [in] the far mapping (clipping) coordinate.
b5ac8292 560 //! @param theOutMx [out] the projection matrix.
197ac94e 561 template <typename Elem_t>
b5ac8292 562 static void
197ac94e 563 PerspectiveProj (const Elem_t theLeft,
564 const Elem_t theRight,
565 const Elem_t theBottom,
566 const Elem_t theTop,
567 const Elem_t theNear,
568 const Elem_t theFar,
569 NCollection_Mat4<Elem_t>& theOutMx);
b5ac8292 570
571 //! Compose projection matrix for L/R stereo eyes.
572 //! @param theLeft [in] the left mapping (clipping) coordinate.
573 //! @param theRight [in] the right mapping (clipping) coordinate.
574 //! @param theBottom [in] the bottom mapping (clipping) coordinate.
575 //! @param theTop [in] the top mapping (clipping) coordinate.
576 //! @param theNear [in] the near mapping (clipping) coordinate.
577 //! @param theFar [in] the far mapping (clipping) coordinate.
578 //! @param theIOD [in] the Intraocular distance.
579 //! @param theZFocus [in] the z coordinate of off-axis
580 //! projection plane with zero parallax.
b5ac8292 581 //! @param theIsLeft [in] boolean flag to choose between L/R eyes.
582 //! @param theOutMx [out] the projection matrix.
197ac94e 583 template <typename Elem_t>
b5ac8292 584 static void
197ac94e 585 StereoEyeProj (const Elem_t theLeft,
586 const Elem_t theRight,
587 const Elem_t theBottom,
588 const Elem_t theTop,
589 const Elem_t theNear,
590 const Elem_t theFar,
591 const Elem_t theIOD,
592 const Elem_t theZFocus,
593 const Standard_Boolean theIsLeft,
594 NCollection_Mat4<Elem_t>& theOutMx);
b5ac8292 595
596 //! Construct "look at" orientation transformation.
597 //! Reference point differs for perspective and ortho modes
598 //! (made for compatibility, to be improved..).
599 //! @param theEye [in] the eye coordinates in 3D space.
600 //! @param theLookAt [in] the point the camera looks at.
601 //! @param theUpDir [in] the up direction vector.
602 //! @param theAxialScale [in] the axial scale vector.
603 //! @param theOutMx [in/out] the orientation matrix.
197ac94e 604 template <typename Elem_t>
b5ac8292 605 static void
197ac94e 606 LookOrientation (const NCollection_Vec3<Elem_t>& theEye,
607 const NCollection_Vec3<Elem_t>& theLookAt,
608 const NCollection_Vec3<Elem_t>& theUpDir,
609 const NCollection_Vec3<Elem_t>& theAxialScale,
610 NCollection_Mat4<Elem_t>& theOutMx);
b5ac8292 611
612private:
613
614 gp_Dir myUp; //!< Camera up direction vector.
615 gp_Pnt myEye; //!< Camera eye position.
616 gp_Pnt myCenter; //!< Camera center.
617
197ac94e 618 gp_XYZ myAxialScale; //!< World axial scale.
b5ac8292 619
197ac94e 620 Projection myProjType; //!< Projection type used for rendering.
621 Standard_Real myFOVy; //!< Field Of View in y axis.
622 Standard_Real myZNear; //!< Distance to near clipping plane.
623 Standard_Real myZFar; //!< Distance to far clipping plane.
624 Standard_Real myAspect; //!< Width to height display ratio.
b5ac8292 625
626 Standard_Real myScale; //!< Specifies parallel scale for orthographic projection.
627 Standard_Real myZFocus; //!< Stereographic focus value.
628 FocusType myZFocusType; //!< Stereographic focus definition type.
629
630 Standard_Real myIOD; //!< Intraocular distance value.
631 IODType myIODType; //!< Intraocular distance definition type.
632
197ac94e 633 mutable TransformMatrices<Standard_Real> myMatricesD;
634 mutable TransformMatrices<Standard_ShortReal> myMatricesF;
b5ac8292 635
825aa485 636 mutable Graphic3d_WorldViewProjState myWorldViewProjState;
b5ac8292 637
638public:
639
a3f6f591 640 DEFINE_STANDARD_RTTIEXT(Graphic3d_Camera,Standard_Transient)
b5ac8292 641};
642
494782f6 643DEFINE_STANDARD_HANDLE (Graphic3d_Camera, Standard_Transient)
644
b5ac8292 645#endif