VR-Vantage 2.7 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) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
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:
124  static DtVector2<T> project(const DtVector3<T>& vPosition
125  , const DtMatrix4<T>& view_projection_matrix
126  , bool clip = true);
127 
132  static Vector2_int project(const DtVector3<T>& vPosition
133  , const DtMatrix4<T>& view_projection_matrix
134  , const Vector2_uint32& viewPortSize
135  , bool clip = true);
136 
140  , const DtMatrix4<T>& view_projection_matrix
141  , const Vector2_uint32& viewPortSize
142  , bool clip = true);
143  };
144 
145 
148  template <class T>
149  class Frustum
150  {
151  public:
153  Frustum();
154 
156  virtual ~Frustum();
157 
159  template <class RHS>
160  Frustum(const Frustum<RHS>& rhs);
161 
163  template <class RHS>
164  Frustum& operator=(const Frustum<RHS>& rhs);
165  public:
167  virtual void setPlane(FrustumPlane plane, T d, const DtVector3<T>& vNormal);
168 
170  virtual const DtPlane<T>& plane(FrustumPlane plane) const;
171 
173  virtual DtVector4<T> planeAsVector(FrustumPlane plane) const;
174 
176  virtual bool isVisible(const DtAxisAlignedBoundingBox<T>& box) const;
177 
179  virtual VisibilityFromCamera visibility(const DtAxisAlignedBoundingBox<T>& box, bool ignoreNearFar = false) const;
180 
182  virtual void setFromModelViewProjectionMatrix(const DtMatrix4<T>& mvp);
183 
185  virtual bool operator==(const Frustum<T>& rhs) const;
186 
188  virtual bool operator!=(const Frustum<T>& rhs) const;
189  protected:
190  std::vector< DtPlane<T> > myFrustumPlanes;
191  };
192 
193 } //namespace makVrv
194 
195 #include "DtCamera.inl"


Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)