VR-Forces 4.6 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
vrvGraphicsUtils
DtCamera.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 2017 MAK Technologies, Inc.
3
** All rights reserved.
4
******************************************************************************/
5
9
#pragma once
10
11
#include <
vrvGraphicsUtils/DtCommonTypes.h
>
12
#include <
vrvGraphicsUtils/DtAssert.h
>
13
#include <
vrvGraphicsUtils/DtMatrixUtils.h
>
14
#include <
vrvGraphicsUtils/DtAxisAlignedBoundingBox.h
>
15
#include <
vrvGraphicsUtils/DtPlane.h
>
16
#include <
vrvGraphicsUtils/DtScreenRect.h
>
17
#include <
vrvGraphicsUtils/DtVector2.h
>
18
#include <
vrvGraphicsUtils/DtIntSize.h
>
19
20
namespace
makVrv{
21
22
enum
FrustumPlane
23
{
24
FRUSTUM_PLANE_NEAR
= 0,
25
FRUSTUM_PLANE_FAR
= 1,
26
FRUSTUM_PLANE_LEFT
= 2,
27
FRUSTUM_PLANE_RIGHT
= 3,
28
FRUSTUM_PLANE_TOP
= 4,
29
FRUSTUM_PLANE_BOTTOM
= 5
30
};
31
32
enum
VisibilityFromCamera
33
{
34
VISIBILITY_NONE
= 0,
VISIBILITY_PARTIAL
= 1,
VISIBILITY_FULL
= 2
35
};
36
39
template
<
class
T>
40
class
DtCamera
41
{
42
public
:
44
DtCamera
();
46
virtual
~DtCamera
();
47
48
void
setNearPlane
(T fNearPlane);
49
T
nearPlane
(
void
)
const
;
50
51
void
setFarPlane
(T fFarPlane);
52
T
farPlane
(
void
)
const
;
53
55
void
setFieldOfView
(T fFOVy);
56
T
fieldOfView
(
void
)
const
;
57
58
void
setPosition
(
const
DtVector3<T>
& vPosition);
59
DtVector3<T>
position
(
void
)
const
;
60
61
void
setDirection
(
const
DtVector3<T>
& vDirection);
62
DtVector3<T>
direction
(
void
)
const
;
63
64
DtVector3<T>
upVector
(
void
)
const
;
65
DtVector3<T>
sideVector
(
void
)
const
;
66
68
void
lookAt
(
const
DtVector3<T>
& vEye,
const
DtVector3<T>
& vLook,
const
DtVector3<T>
& vUp);
70
const
DtMatrix4<T>
&
ViewMatrix
(
void
)
const
;
71
73
void
SetPerspective
(T fFOVy, T fAspectRatio, T fNearPlane, T fFarPlane);
75
const
DtMatrix4<T>
&
ProjectionMatrix
(
void
)
const
;
76
78
const
DtMatrix4<T>
&
ViewProjectionMatrix
(
void
)
const
;
79
80
void
setFixedUpVector
(
bool
fixed);
81
bool
isFixedUpVector
(
void
)
const
;
82
84
T
aspectRatio
(
void
)
const
;
85
87
bool
IsVisible
(
const
DtAxisAlignedBoundingBox<T>
& box)
const
;
88
90
VisibilityFromCamera
getVisibility
(
const
DtAxisAlignedBoundingBox<T>
& box)
const
;
91
93
DtScreenRect
screenAABB
(
const
DtAxisAlignedBoundingBox<T>
& worldBox
94
,
const
Vector2_uint32
& viewPortSize)
const
;
95
private
:
96
DtVector3<T>
myVecPosition
;
97
DtVector3<T>
myVecDirection
;
98
DtVector3<T>
myVecUpVector
;
99
DtVector3<T>
myVecSideVector
;
100
101
T
myfNearPlane
;
102
T
myfFarPlane
;
103
T
myfFieldOfViewY
;
104
T
myfAspectRatio
;
105
106
DtMatrix4<T>
myViewMatrix
;
107
DtMatrix4<T>
myProjectionMatrix
;
108
DtMatrix4<T>
myViewProjectionMatrix
;
109
110
bool
mybFixedUpVector
;
111
112
DtPlane<T>
myFrustumPlanes
[6];
113
void
updateFrustumPlanes
(
void
);
114
void
updateViewProjectionMatrix
(
void
);
115
};
116
117
template
<
class
T>
118
class
ProjectionUtils
119
{
120
public
:
122
static
DtVector2<T>
project
(
const
DtVector3<T>
& vPosition
123
,
const
DtMatrix4<T>
& view_projection_matrix);
124
128
static
Vector2_uint32
project
(
const
DtVector3<T>
& vPosition
129
,
const
DtMatrix4<T>
& view_projection_matrix
130
,
const
Vector2_uint32
& viewPortSize);
131
133
static
DtScreenRect
getScreenAABB
(
const
DtAxisAlignedBoundingBox<T>
& worldBox
134
,
const
DtMatrix4<T>
& view_projection_matrix
135
,
const
Vector2_uint32
& viewPortSize);
136
137
};
138
139
142
template
<
class
T>
143
class
Frustum
144
{
145
public
:
146
Frustum
();
147
virtual
~Frustum
();
148
149
void
SetPlane
(
FrustumPlane
plane, T d,
const
DtVector3<T>
& vNormal);
150
const
DtPlane<T>
&
GetPlane
(
FrustumPlane
plane);
151
152
bool
IsVisible
(
const
DtAxisAlignedBoundingBox<T>
& box)
const
;
153
VisibilityFromCamera
GetVisibility
(
const
DtAxisAlignedBoundingBox<T>
& box)
const
;
154
155
private
:
156
std::vector< DtPlane<T> >
m_FrustumPlanes
;
157
};
158
159
}
//namespace makVrv
160
161
#include "DtCamera.inl"
Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (
www.mak.com
)