VR-Vantage 2.2 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtCamera.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #include "DtCommonTypes.h"
12 #include "DtAssert.h"
13 #include "DtMatrixUtils.h"
15 #include "DtPlane.h"
16 #include "DtScreenRect.h"
17 
18 #include "DtVector2.h"
19 #include "DtIntSize.h"
20 
21 namespace makVrv{
22 
24  {
31  };
32 
34  {
36  };
37 
40  template <class T>
41  class DtCamera
42  {
43  public:
45  DtCamera();
47  virtual ~DtCamera();
48 
49  void setNearPlane(T fNearPlane);
50  T nearPlane(void) const;
51 
52  void setFarPlane(T fFarPlane);
53  T farPlane(void) const;
54 
56  void setFieldOfView(T fFOVy);
57  T fieldOfView(void) const;
58 
59  void setPosition(const DtVector3<T>& vPosition);
60  DtVector3<T> position(void) const;
61 
62  void setDirection(const DtVector3<T>& vDirection);
63  DtVector3<T> direction(void) const;
64 
65  DtVector3<T> upVector(void) const;
66  DtVector3<T> sideVector(void) const;
67 
69  void lookAt(const DtVector3<T>& vEye,const DtVector3<T>& vLook,const DtVector3<T>& vUp);
71  const DtMatrix4<T>& ViewMatrix(void) const;
72 
74  void SetPerspective(T fFOVy, T fAspectRatio, T fNearPlane, T fFarPlane);
76  const DtMatrix4<T>& ProjectionMatrix(void) const;
77 
79  const DtMatrix4<T>& ViewProjectionMatrix(void) const;
80 
81  void setFixedUpVector(bool fixed);
82  bool isFixedUpVector(void) const;
83 
85  T aspectRatio(void) const;
86 
88  bool IsVisible(const DtAxisAlignedBoundingBox<T>& box) const;
89 
92 
95  , const Vector2_uint32& viewPortSize) const;
96  private:
101 
106 
110 
112 
114  void updateFrustumPlanes(void);
115  void updateViewProjectionMatrix(void);
116  };
117 
118  template <class T>
120  {
121  public:
123  static DtVector2<T> project(const DtVector3<T>& vPosition
124  , const DtMatrix4<T>& view_projection_matrix);
125 
129  static Vector2_uint32 project(const DtVector3<T>& vPosition
130  , const DtMatrix4<T>& view_projection_matrix
131  , const Vector2_uint32& viewPortSize);
132 
135  , const DtMatrix4<T>& view_projection_matrix
136  , const Vector2_uint32& viewPortSize);
137 
138  };
139 
140 
143  template <class T>
144  class Frustum
145  {
146  public:
147  Frustum();
148  virtual ~Frustum();
149 
150  void SetPlane(FrustumPlane plane, T d, const DtVector3<T>& vNormal);
151  const DtPlane<T>& GetPlane(FrustumPlane plane);
152 
153  bool IsVisible(const DtAxisAlignedBoundingBox<T>& box) const;
155 
156  private:
157  std::vector< DtPlane<T> > m_FrustumPlanes;
158  };
159 
160 } //namespace makVrv
161 
162 #include "DtCamera.inl"


Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)