-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCDXMatrix.cpp
96 lines (76 loc) · 1.64 KB
/
CDXMatrix.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// CDXMatrix.cpp
//
// CDXMatrix class
// Copyright (c) 2015 by Kronosaur Productions, LLC. All Rights Reserved.
#include <windows.h>
#include <dsound.h>
#include "Alchemy.h"
#include "DirectXUtil.h"
#include "DX3DImpl.h"
CDXMatrix::CDXMatrix (void)
// CDXMatrix constructor
{
m_Matrix._11 = 0.0;
m_Matrix._12 = 0.0;
m_Matrix._13 = 0.0;
m_Matrix._14 = 0.0;
m_Matrix._21 = 0.0;
m_Matrix._22 = 0.0;
m_Matrix._23 = 0.0;
m_Matrix._24 = 0.0;
m_Matrix._31 = 0.0;
m_Matrix._32 = 0.0;
m_Matrix._33 = 0.0;
m_Matrix._34 = 0.0;
m_Matrix._41 = 0.0;
m_Matrix._42 = 0.0;
m_Matrix._43 = 0.0;
m_Matrix._44 = 0.0;
}
void CDXMatrix::SetIdentity (void)
// SetIdentity
//
// Initializes to identity matrix
{
m_Matrix._11 = 1.0f;
m_Matrix._12 = 0.0;
m_Matrix._13 = 0.0;
m_Matrix._14 = 0.0;
m_Matrix._21 = 0.0;
m_Matrix._22 = 1.0f;
m_Matrix._23 = 0.0;
m_Matrix._24 = 0.0;
m_Matrix._31 = 0.0;
m_Matrix._32 = 0.0;
m_Matrix._33 = 1.0f;
m_Matrix._34 = 0.0;
m_Matrix._41 = 0.0;
m_Matrix._42 = 0.0;
m_Matrix._43 = 0.0;
m_Matrix._44 = 1.0f;
}
void CDXMatrix::SetOrthoLH (FLOAT rWidth, FLOAT rHeight, FLOAT rNear, FLOAT rFar)
// SetOrthoLH
//
// Initializes to ortho projection
{
ASSERT(rWidth >= 0.0);
ASSERT(rHeight >= 0.0);
ASSERT(rNear != rFar);
m_Matrix._11 = 2.0f / rWidth;
m_Matrix._12 = 0.0;
m_Matrix._13 = 0.0;
m_Matrix._14 = 0.0;
m_Matrix._21 = 0.0;
m_Matrix._22 = 2.0f / rHeight;
m_Matrix._23 = 0.0;
m_Matrix._24 = 0.0;
m_Matrix._31 = 0.0;
m_Matrix._32 = 0.0;
m_Matrix._33 = 1.0f / (rFar - rNear);
m_Matrix._34 = 0.0;
m_Matrix._41 = 0.0;
m_Matrix._42 = 0.0;
m_Matrix._43 = rNear / (rNear - rFar);
m_Matrix._44 = 1.0f;
}