GteCamera.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
10 #include <Graphics/GteViewVolume.h>
11 
12 namespace gte
13 {
14 
16 {
17 public:
18  // Construction. The depth range for DirectX is [0,1] and for OpenGL is
19  // [-1,1]. For DirectX, set isDepthRangeZeroToOne to true. For OpenGL,
20  // set isDepthRangeZeroOne to false.
21  Camera(bool isPerspective, bool isDepthRangeZeroOne);
22 
23  // Support for parallax projection. You specify a convex quadrilateral
24  // viewport. The points must be in camera coordinates and are ordered
25  // counterclockwise as viewed from the eyepoint. The plane of the
26  // quadrilateral is the view plane and has an "extrude" value of 1. The
27  // nearExtrude value is in (0,infinity); this specifies the fraction from
28  // the eyepoint to the view plane containing the near-face of the cuboidal
29  // view volume. The farExtrude value is in (nearExtrude,infinity); this
30  // specifies the fraction from the eyepoint at which to place the far-face
31  // of the cuboidal view volume.
32  void SetParallaxProjectionMatrix(Vector4<float> const& p00,
33  Vector4<float> const& p10, Vector4<float> const& p11,
34  Vector4<float> const& p01, float nearExtrude, float farExtrude);
35 
36  // The preview matrix is applied after the model-to-world but before the
37  // view matrix. It is used for transformations such as reflections of
38  // world objects. The default value is the identity matrix.
39  void SetPreViewMatrix(Matrix4x4<float> const& preViewMatrix);
40  inline Matrix4x4<float> const& GetPreViewMatrix() const;
41  inline bool PreViewIsIdentity() const;
42 
43  // The postprojection matrix is used for screen-space transformations such
44  // as reflection of the rendered image. The default value is the identity
45  // matrix.
46  void SetPostProjectionMatrix(Matrix4x4<float> const& postProjMatrix);
47  inline Matrix4x4<float> const& GetPostProjectionMatrix() const;
48  inline bool PostProjectionIsIdentity() const;
49 
50  // Compute a picking line from the left-handed screen coordinates (x,y),
51  // the viewport, and the camera. The output 'origin' is the camera
52  // position and the 'direction' is a unit-length vector, both in world
53  // coordinates. The return value is 'true' iff (x,y) is in the viewport.
54  bool GetPickLine(int viewX, int viewY, int viewW, int viewH, int x, int y,
55  Vector4<float>& origin, Vector4<float>& direction) const;
56 
57 private:
58  // After modifying the pre-view matrix or post-projection matrix, update
59  // the projection-view matrix to include these.
60  virtual void UpdatePVMatrix();
61 
62  // The preview matrix for the camera.
64 
65  // The postprojection matrix for the camera.
67 
68  // Indicates whether a user has specified a nonidentity pre-view matrix.
70 
71  // Indicates whether a user has specified a nonidentity post-projection
72  // matrix.
74 };
75 
76 
78 {
79  return mPreViewMatrix;
80 }
81 
82 inline bool Camera::PreViewIsIdentity() const
83 {
84  return mPreViewIsIdentity;
85 }
86 
88 {
89  return mPostProjectionMatrix;
90 }
91 
93 {
94  return mPostProjectionIsIdentity;
95 }
96 
97 }
GLint GLenum GLint x
Definition: glcorearb.h:404
bool PreViewIsIdentity() const
Definition: GteCamera.h:82
Matrix4x4< float > const & GetPreViewMatrix() const
Definition: GteCamera.h:77
bool PostProjectionIsIdentity() const
Definition: GteCamera.h:92
Matrix4x4< float > mPostProjectionMatrix
Definition: GteCamera.h:66
bool mPreViewIsIdentity
Definition: GteCamera.h:69
Matrix4x4< float > const & GetPostProjectionMatrix() const
Definition: GteCamera.h:87
Matrix4x4< float > mPreViewMatrix
Definition: GteCamera.h:63
GLint y
Definition: glcorearb.h:98
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63
bool mPostProjectionIsIdentity
Definition: GteCamera.h:73


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59