Skip to content

Commit 3d97e5d

Browse files
committed
摄像机绘制重构一
1 parent 4838fdf commit 3d97e5d

4 files changed

Lines changed: 147 additions & 161 deletions

File tree

MulNXExtensions/CameraSystem/CameraDrawer/CameraDrawer.cpp

Lines changed: 127 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@ void CameraModel::Init(float CameraHigh, float CameraX, float CameraY, float Axi
1515
this->Colour = Colour;
1616
}
1717

18-
19-
void CameraDrawer::Init(float CameraHigh, float CameraX, float CameraY, float AxisLenth, ImU32 Colour) {
20-
this->CameraModel.Init(CameraHigh, CameraX, CameraY, AxisLenth, Colour);
21-
}
22-
23-
void CameraDrawer::Rotate(DirectX::XMFLOAT3 Rotation) {
18+
void CameraModel::Rotate(const DirectX::XMFLOAT3& Rotation) {
2419
this->Origin = MulNX::Base::Math::RotatePoint(this->Origin, Rotation.x, Rotation.y, Rotation.z);
2520

2621
this->Lens[0] = MulNX::Base::Math::RotatePoint(this->Lens[0], Rotation.x, Rotation.y, Rotation.z);
@@ -31,9 +26,9 @@ void CameraDrawer::Rotate(DirectX::XMFLOAT3 Rotation) {
3126
this->X = MulNX::Base::Math::RotatePoint(this->X, Rotation.x, Rotation.y, Rotation.z);
3227
this->Y = MulNX::Base::Math::RotatePoint(this->Y, Rotation.x, Rotation.y, Rotation.z);
3328
this->Z = MulNX::Base::Math::RotatePoint(this->Z, Rotation.x, Rotation.y, Rotation.z);
34-
}
29+
}
3530

36-
void CameraDrawer::Move(DirectX::XMFLOAT3 TargetPoint) {
31+
void CameraModel::Move(const DirectX::XMFLOAT3& TargetPoint) {
3732
MulNX::Base::Math::MovePoint(this->Origin, TargetPoint);
3833

3934
MulNX::Base::Math::MovePoint(this->Lens[0], TargetPoint);
@@ -46,153 +41,149 @@ void CameraDrawer::Move(DirectX::XMFLOAT3 TargetPoint) {
4641
MulNX::Base::Math::MovePoint(this->Z, TargetPoint);
4742
}
4843

49-
void CameraDrawer::ToScreen() {
50-
MulNX::Base::Math::XMWorldToScreen(this->Origin, this->Origin2D, this->pMatrixPtr, this->WinWidth, this->WinHeight);
44+
void CameraModel::ToScreen(const float* const pMatrix, const float WinWidth, const float WinHeight) {
45+
MulNX::Base::Math::XMWorldToScreen(this->Origin, this->Origin2D, pMatrix, WinWidth, WinHeight);
5146

52-
MulNX::Base::Math::XMWorldToScreen(this->Lens[0], this->Lens2D[0], this->pMatrixPtr, this->WinWidth, this->WinHeight);
53-
MulNX::Base::Math::XMWorldToScreen(this->Lens[1], this->Lens2D[1], this->pMatrixPtr, this->WinWidth, this->WinHeight);
54-
MulNX::Base::Math::XMWorldToScreen(this->Lens[2], this->Lens2D[2], this->pMatrixPtr, this->WinWidth, this->WinHeight);
55-
MulNX::Base::Math::XMWorldToScreen(this->Lens[3], this->Lens2D[3], this->pMatrixPtr, this->WinWidth, this->WinHeight);
47+
MulNX::Base::Math::XMWorldToScreen(this->Lens[0], this->Lens2D[0], pMatrix, WinWidth, WinHeight);
48+
MulNX::Base::Math::XMWorldToScreen(this->Lens[1], this->Lens2D[1], pMatrix, WinWidth, WinHeight);
49+
MulNX::Base::Math::XMWorldToScreen(this->Lens[2], this->Lens2D[2], pMatrix, WinWidth, WinHeight);
50+
MulNX::Base::Math::XMWorldToScreen(this->Lens[3], this->Lens2D[3], pMatrix, WinWidth, WinHeight);
5651

57-
MulNX::Base::Math::XMWorldToScreen(this->X, this->X2D, this->pMatrixPtr, this->WinWidth, this->WinHeight);
58-
MulNX::Base::Math::XMWorldToScreen(this->Y, this->Y2D, this->pMatrixPtr, this->WinWidth, this->WinHeight);
59-
MulNX::Base::Math::XMWorldToScreen(this->Z, this->Z2D, this->pMatrixPtr, this->WinWidth, this->WinHeight);
52+
MulNX::Base::Math::XMWorldToScreen(this->X, this->X2D, pMatrix, WinWidth, WinHeight);
53+
MulNX::Base::Math::XMWorldToScreen(this->Y, this->Y2D, pMatrix, WinWidth, WinHeight);
54+
MulNX::Base::Math::XMWorldToScreen(this->Z, this->Z2D, pMatrix, WinWidth, WinHeight);
6055
}
6156

62-
void CameraDrawer::Draw(const char* label) {
63-
if (!this->IfDraw)return;
64-
65-
this->drawList = ImGui::GetBackgroundDrawList();
66-
//绘制坐标系
67-
this->drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->X2D.x, this->X2D.y), IM_COL32(255, 0, 0, 255), 4.0f);
68-
this->drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Y2D.x, this->Y2D.y), IM_COL32(0, 255, 0, 255), 4.0f);
69-
this->drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Z2D.x, this->Z2D.y), IM_COL32(0, 0, 255, 255), 4.0f);
70-
//绘制原点到四个角的连线
71-
this->drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Lens2D[0].x, this->Lens2D[0].y), this->Colour, 4.0f);
72-
this->drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Lens2D[1].x, this->Lens2D[1].y), this->Colour, 4.0f);
73-
this->drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Lens2D[2].x, this->Lens2D[2].y), this->Colour, 4.0f);
74-
this->drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Lens2D[3].x, this->Lens2D[3].y), this->Colour, 4.0f);
75-
//绘制镜头面
76-
this->drawList->AddLine(ImVec2(this->Lens2D[0].x, this->Lens2D[0].y), ImVec2(this->Lens2D[1].x, this->Lens2D[1].y), this->Colour, 4.0f);
77-
this->drawList->AddLine(ImVec2(this->Lens2D[1].x, this->Lens2D[1].y), ImVec2(this->Lens2D[2].x, this->Lens2D[2].y), this->Colour, 4.0f);
78-
this->drawList->AddLine(ImVec2(this->Lens2D[2].x, this->Lens2D[2].y), ImVec2(this->Lens2D[3].x, this->Lens2D[3].y), this->Colour, 4.0f);
79-
this->drawList->AddLine(ImVec2(this->Lens2D[3].x, this->Lens2D[3].y), ImVec2(this->Lens2D[0].x, this->Lens2D[0].y), this->Colour, 4.0f);
80-
//添加文本
81-
this->drawList->AddCircleFilled(ImVec2(this->Origin2D.x, this->Origin2D.y), 3.0f, IM_COL32(0, 0, 0, 255));
82-
if (label) {
83-
this->drawList->AddText(ImVec2(this->Origin2D.x, this->Origin2D.y - 20), IM_COL32(0, 0, 0, 255), label);
57+
void CameraModel::Draw(const char* Label) {
58+
auto* drawList = ImGui::GetBackgroundDrawList();
59+
// 绘制坐标系
60+
drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->X2D.x, this->X2D.y), IM_COL32(255, 0, 0, 255), 4.0f);
61+
drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Y2D.x, this->Y2D.y), IM_COL32(0, 255, 0, 255), 4.0f);
62+
drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Z2D.x, this->Z2D.y), IM_COL32(0, 0, 255, 255), 4.0f);
63+
// 绘制原点到四个角的连线
64+
drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Lens2D[0].x, this->Lens2D[0].y), this->Colour, 4.0f);
65+
drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Lens2D[1].x, this->Lens2D[1].y), this->Colour, 4.0f);
66+
drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Lens2D[2].x, this->Lens2D[2].y), this->Colour, 4.0f);
67+
drawList->AddLine(ImVec2(this->Origin2D.x, this->Origin2D.y), ImVec2(this->Lens2D[3].x, this->Lens2D[3].y), this->Colour, 4.0f);
68+
// 绘制镜头面
69+
drawList->AddLine(ImVec2(this->Lens2D[0].x, this->Lens2D[0].y), ImVec2(this->Lens2D[1].x, this->Lens2D[1].y), this->Colour, 4.0f);
70+
drawList->AddLine(ImVec2(this->Lens2D[1].x, this->Lens2D[1].y), ImVec2(this->Lens2D[2].x, this->Lens2D[2].y), this->Colour, 4.0f);
71+
drawList->AddLine(ImVec2(this->Lens2D[2].x, this->Lens2D[2].y), ImVec2(this->Lens2D[3].x, this->Lens2D[3].y), this->Colour, 4.0f);
72+
drawList->AddLine(ImVec2(this->Lens2D[3].x, this->Lens2D[3].y), ImVec2(this->Lens2D[0].x, this->Lens2D[0].y), this->Colour, 4.0f);
73+
// 添加文本
74+
drawList->AddCircleFilled(ImVec2(this->Origin2D.x, this->Origin2D.y), 3.0f, IM_COL32(0, 0, 0, 255));
75+
if (Label) {
76+
drawList->AddText(ImVec2(this->Origin2D.x, this->Origin2D.y - 20), IM_COL32(0, 0, 0, 255), Label);
8477
}
8578
}
8679

87-
void CameraDrawer::Update(float* pMatrixPtr, float pWinWidth, float pWinHeight) {
88-
this->pMatrixPtr = pMatrixPtr;
89-
this->WinWidth = pWinWidth;
90-
this->WinHeight = pWinHeight;
80+
void CameraModel::DrawCamera(const DirectX::XMFLOAT3& Position, const DirectX::XMFLOAT3& Rotation, const char* label,
81+
const float* const pMatrix, const float WinWidth, const float WinHeight) {
82+
CameraModel Model = *this;
83+
Model.Rotate(Rotation);
84+
Model.Move(Position);
85+
Model.ToScreen(pMatrix, WinWidth, WinHeight);
86+
Model.Draw(nullptr);
9187
}
9288

93-
void CameraDrawer::DrawCamera(DirectX::XMFLOAT3 Position, DirectX::XMFLOAT3 Rotation, const char* label) {
94-
//if(!)
95-
this->Origin = this->CameraModel.Origin;
9689

97-
this->Lens[0] = this->CameraModel.Lens[0];
98-
this->Lens[1] = this->CameraModel.Lens[1];
99-
this->Lens[2] = this->CameraModel.Lens[2];
100-
this->Lens[3] = this->CameraModel.Lens[3];
10190

102-
this->Colour = this->CameraModel.Colour;
10391

104-
this->X = this->CameraModel.X;
105-
this->Y = this->CameraModel.Y;
106-
this->Z = this->CameraModel.Z;
10792

108-
this->Rotate(Rotation);
109-
this->Move(Position);
110-
this->ToScreen();
111-
this->Draw(label);
112-
}
11393

114-
void CameraDrawer::DrawFrameCamera(const MulNX::Base::Math::Frame& frame, const char* label) {
115-
//if(!)
116-
this->Origin = this->CameraModel.Origin;
11794

118-
this->Lens[0] = this->CameraModel.Lens[0];
119-
this->Lens[1] = this->CameraModel.Lens[1];
120-
this->Lens[2] = this->CameraModel.Lens[2];
121-
this->Lens[3] = this->CameraModel.Lens[3];
12295

123-
this->Colour = this->CameraModel.Colour;
12496

125-
this->X = this->CameraModel.X;
126-
this->Y = this->CameraModel.Y;
127-
this->Z = this->CameraModel.Z;
12897

129-
this->Rotate(frame.SpatialState.GetRotationEuler());
130-
this->Move(frame.SpatialState.GetPosition());
131-
this->ToScreen();
132-
this->Draw(label);
98+
99+
100+
101+
102+
103+
104+
105+
106+
void CameraDrawer::Init(float CameraHigh, float CameraX, float CameraY, float AxisLenth, ImU32 Colour) {
107+
this->CameraModel.Init(CameraHigh, CameraX, CameraY, AxisLenth, Colour);
133108
}
134109

135-
void CameraDrawer::DrawFirstPersonCamera(const char* label) {
136-
if (!this->IfDraw) return;
137-
138-
this->drawList = ImGui::GetBackgroundDrawList();
139-
140-
// 使用固定的屏幕坐标绘制第一人称视角的摄像机镜面
141-
// 假设镜面位于屏幕中央,大小为屏幕的1/4
142-
float screenCenterX = this->WinWidth / 2.0f;
143-
float screenCenterY = this->WinHeight / 2.0f;
144-
float lensWidth = this->WinWidth / 4.0f;
145-
float lensHeight = this->WinHeight / 4.0f;
146-
147-
// 计算镜面矩形的四个角点(屏幕坐标)
148-
ImVec2 lensCorners[4];
149-
lensCorners[0] = ImVec2(screenCenterX - lensWidth / 2, screenCenterY - lensHeight / 2); // 左上
150-
lensCorners[1] = ImVec2(screenCenterX - lensWidth / 2, screenCenterY + lensHeight / 2); // 左下
151-
lensCorners[2] = ImVec2(screenCenterX + lensWidth / 2, screenCenterY + lensHeight / 2); // 右下
152-
lensCorners[3] = ImVec2(screenCenterX + lensWidth / 2, screenCenterY - lensHeight / 2); // 右上
153-
154-
// 使用固定的视图投影矩阵(单位矩阵)直接将模型投影到屏幕
155-
DirectX::XMMATRIX identityMatrix = DirectX::XMMatrixIdentity();
156-
157-
// 定义第一人称镜面模型(相对于屏幕中心)
158-
DirectX::XMFLOAT3 fpLens[4];
159-
fpLens[0] = { -lensWidth / 2, lensHeight / 2, 0 }; // 左上
160-
fpLens[1] = { -lensWidth / 2, -lensHeight / 2, 0 }; // 左下
161-
fpLens[2] = { lensWidth / 2, -lensHeight / 2, 0 }; // 右下
162-
fpLens[3] = { lensWidth / 2, lensHeight / 2, 0 }; // 右上
163-
164-
DirectX::XMFLOAT3 fpOrigin = { 0, 0, 0 };
165-
166-
// 将模型直接投影到屏幕(使用固定矩阵)
167-
DirectX::XMFLOAT2 origin2D, lens2D[4];
168-
MulNX::Base::Math::XMWorldToScreen(fpOrigin, origin2D, (float*)&identityMatrix, this->WinWidth, this->WinHeight);
169-
for (int i = 0; i < 4; i++) {
170-
MulNX::Base::Math::XMWorldToScreen(fpLens[i], lens2D[i], (float*)&identityMatrix, this->WinWidth, this->WinHeight);
171-
}
110+
void CameraDrawer::Update(float* pMatrixPtr, float pWinWidth, float pWinHeight) {
111+
this->pMatrixPtr = pMatrixPtr;
112+
this->WinWidth = pWinWidth;
113+
this->WinHeight = pWinHeight;
114+
}
172115

173-
// 调整到屏幕中心
174-
origin2D.x += screenCenterX;
175-
origin2D.y += screenCenterY;
176-
for (int i = 0; i < 4; i++) {
177-
lens2D[i].x += screenCenterX;
178-
lens2D[i].y += screenCenterY;
179-
}
116+
void CameraDrawer::DrawCamera(DirectX::XMFLOAT3 Position, DirectX::XMFLOAT3 Rotation, const char* label) {
117+
this->CameraModel.DrawCamera(Position, Rotation, label, this->pMatrixPtr, this->WinWidth, this->WinHeight);
118+
}
180119

181-
// 绘制镜面矩形
182-
this->drawList->AddLine(ImVec2(lens2D[0].x, lens2D[0].y), ImVec2(lens2D[1].x, lens2D[1].y), this->Colour, 2.0f);
183-
this->drawList->AddLine(ImVec2(lens2D[1].x, lens2D[1].y), ImVec2(lens2D[2].x, lens2D[2].y), this->Colour, 2.0f);
184-
this->drawList->AddLine(ImVec2(lens2D[2].x, lens2D[2].y), ImVec2(lens2D[3].x, lens2D[3].y), this->Colour, 2.0f);
185-
this->drawList->AddLine(ImVec2(lens2D[3].x, lens2D[3].y), ImVec2(lens2D[0].x, lens2D[0].y), this->Colour, 2.0f);
186-
187-
// 绘制从原点到四个角的连线(可选,模拟视角锥体)
188-
this->drawList->AddLine(ImVec2(origin2D.x, origin2D.y), ImVec2(lens2D[0].x, lens2D[0].y), this->Colour, 1.0f);
189-
this->drawList->AddLine(ImVec2(origin2D.x, origin2D.y), ImVec2(lens2D[1].x, lens2D[1].y), this->Colour, 1.0f);
190-
this->drawList->AddLine(ImVec2(origin2D.x, origin2D.y), ImVec2(lens2D[2].x, lens2D[2].y), this->Colour, 1.0f);
191-
this->drawList->AddLine(ImVec2(origin2D.x, origin2D.y), ImVec2(lens2D[3].x, lens2D[3].y), this->Colour, 1.0f);
192-
193-
// 添加标签
194-
this->drawList->AddCircleFilled(ImVec2(origin2D.x, origin2D.y), 2.0f, IM_COL32(255, 255, 255, 255));
195-
if (label) {
196-
this->drawList->AddText(ImVec2(origin2D.x + 10, origin2D.y - 10), IM_COL32(255, 255, 255, 255), label);
197-
}
198-
}
120+
void CameraDrawer::DrawFrameCamera(const MulNX::Base::Math::Frame& frame, const char* label) {
121+
auto Rotation = frame.SpatialState.GetRotationEuler();
122+
auto Position = frame.SpatialState.GetPosition();
123+
this->DrawCamera(Position, Rotation, label);
124+
}
125+
126+
// void CameraDrawer::DrawFirstPersonCamera(const char* label) {
127+
// if (!this->IfDraw) return;
128+
129+
// this->drawList = ImGui::GetBackgroundDrawList();
130+
131+
// // 使用固定的屏幕坐标绘制第一人称视角的摄像机镜面
132+
// // 假设镜面位于屏幕中央,大小为屏幕的1/4
133+
// float screenCenterX = this->WinWidth / 2.0f;
134+
// float screenCenterY = this->WinHeight / 2.0f;
135+
// float lensWidth = this->WinWidth / 4.0f;
136+
// float lensHeight = this->WinHeight / 4.0f;
137+
138+
// // 计算镜面矩形的四个角点(屏幕坐标)
139+
// ImVec2 lensCorners[4];
140+
// lensCorners[0] = ImVec2(screenCenterX - lensWidth / 2, screenCenterY - lensHeight / 2); // 左上
141+
// lensCorners[1] = ImVec2(screenCenterX - lensWidth / 2, screenCenterY + lensHeight / 2); // 左下
142+
// lensCorners[2] = ImVec2(screenCenterX + lensWidth / 2, screenCenterY + lensHeight / 2); // 右下
143+
// lensCorners[3] = ImVec2(screenCenterX + lensWidth / 2, screenCenterY - lensHeight / 2); // 右上
144+
145+
// // 使用固定的视图投影矩阵(单位矩阵)直接将模型投影到屏幕
146+
// DirectX::XMMATRIX identityMatrix = DirectX::XMMatrixIdentity();
147+
148+
// // 定义第一人称镜面模型(相对于屏幕中心)
149+
// DirectX::XMFLOAT3 fpLens[4];
150+
// fpLens[0] = { -lensWidth / 2, lensHeight / 2, 0 }; // 左上
151+
// fpLens[1] = { -lensWidth / 2, -lensHeight / 2, 0 }; // 左下
152+
// fpLens[2] = { lensWidth / 2, -lensHeight / 2, 0 }; // 右下
153+
// fpLens[3] = { lensWidth / 2, lensHeight / 2, 0 }; // 右上
154+
155+
// DirectX::XMFLOAT3 fpOrigin = { 0, 0, 0 };
156+
157+
// // 将模型直接投影到屏幕(使用固定矩阵)
158+
// DirectX::XMFLOAT2 origin2D, lens2D[4];
159+
// MulNX::Base::Math::XMWorldToScreen(fpOrigin, origin2D, (float*)&identityMatrix, this->WinWidth, this->WinHeight);
160+
// for (int i = 0; i < 4; i++) {
161+
// MulNX::Base::Math::XMWorldToScreen(fpLens[i], lens2D[i], (float*)&identityMatrix, this->WinWidth, this->WinHeight);
162+
// }
163+
164+
// // 调整到屏幕中心
165+
// origin2D.x += screenCenterX;
166+
// origin2D.y += screenCenterY;
167+
// for (int i = 0; i < 4; i++) {
168+
// lens2D[i].x += screenCenterX;
169+
// lens2D[i].y += screenCenterY;
170+
// }
171+
172+
// // 绘制镜面矩形
173+
// this->drawList->AddLine(ImVec2(lens2D[0].x, lens2D[0].y), ImVec2(lens2D[1].x, lens2D[1].y), this->Colour, 2.0f);
174+
// this->drawList->AddLine(ImVec2(lens2D[1].x, lens2D[1].y), ImVec2(lens2D[2].x, lens2D[2].y), this->Colour, 2.0f);
175+
// this->drawList->AddLine(ImVec2(lens2D[2].x, lens2D[2].y), ImVec2(lens2D[3].x, lens2D[3].y), this->Colour, 2.0f);
176+
// this->drawList->AddLine(ImVec2(lens2D[3].x, lens2D[3].y), ImVec2(lens2D[0].x, lens2D[0].y), this->Colour, 2.0f);
177+
178+
// // 绘制从原点到四个角的连线(可选,模拟视角锥体)
179+
// this->drawList->AddLine(ImVec2(origin2D.x, origin2D.y), ImVec2(lens2D[0].x, lens2D[0].y), this->Colour, 1.0f);
180+
// this->drawList->AddLine(ImVec2(origin2D.x, origin2D.y), ImVec2(lens2D[1].x, lens2D[1].y), this->Colour, 1.0f);
181+
// this->drawList->AddLine(ImVec2(origin2D.x, origin2D.y), ImVec2(lens2D[2].x, lens2D[2].y), this->Colour, 1.0f);
182+
// this->drawList->AddLine(ImVec2(origin2D.x, origin2D.y), ImVec2(lens2D[3].x, lens2D[3].y), this->Colour, 1.0f);
183+
184+
// // 添加标签
185+
// this->drawList->AddCircleFilled(ImVec2(origin2D.x, origin2D.y), 2.0f, IM_COL32(255, 255, 255, 255));
186+
// if (label) {
187+
// this->drawList->AddText(ImVec2(origin2D.x + 10, origin2D.y - 10), IM_COL32(255, 255, 255, 255), label);
188+
// }
189+
// }

MulNXExtensions/CameraSystem/CameraDrawer/CameraDrawer.hpp

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,44 @@ class CameraModel {
1515

1616
ImU32 Colour{};
1717

18+
DirectX::XMFLOAT2 Origin2D{};
19+
DirectX::XMFLOAT2 Lens2D[4]{};
20+
DirectX::XMFLOAT2 X2D{};
21+
DirectX::XMFLOAT2 Y2D{};
22+
DirectX::XMFLOAT2 Z2D{};
23+
1824
void Init(float CameraHigh, float CameraX, float CameraY, float AxisLenth, ImU32 Colour);
25+
26+
void Rotate(const DirectX::XMFLOAT3& Rotation);
27+
void Move(const DirectX::XMFLOAT3& TargetPoint);
28+
void ToScreen(const float* const pMatrix, const float WinWidth, const float WinHeight);
29+
30+
void Draw(const char* Lable);
31+
32+
void DrawCamera(const DirectX::XMFLOAT3& Position, const DirectX::XMFLOAT3& Rotation, const char* label,
33+
const float* const pMatrix, const float WinWidth, const float WinHeight);
34+
35+
CameraModel() = default;
1936
};
2037

2138
class CameraDrawer {
2239
public:
2340
bool IfDraw = true;
2441
private:
2542

26-
43+
// Model源
2744
CameraModel CameraModel{};
2845

29-
DirectX::XMFLOAT3 Origin{};
30-
DirectX::XMFLOAT3 Lens[4]{};
31-
DirectX::XMFLOAT3 X{};
32-
DirectX::XMFLOAT3 Y{};
33-
DirectX::XMFLOAT3 Z{};
34-
35-
DirectX::XMFLOAT2 Origin2D{};
36-
DirectX::XMFLOAT2 Lens2D[4]{};
37-
DirectX::XMFLOAT2 X2D{};
38-
DirectX::XMFLOAT2 Y2D{};
39-
DirectX::XMFLOAT2 Z2D{};
40-
41-
ImU32 Colour{};
42-
43-
float CameraHigh;
44-
float CameraX;
45-
float CameraY;
46-
float AxisLenth;
47-
4846
ImDrawList* drawList{};
4947

5048
float* pMatrixPtr{};
5149
float WinWidth{};
5250
float WinHeight{};
5351
public:
5452
void Init(float CameraHigh, float CameraX, float CameraY, float AxisLenth, ImU32 Colour);
55-
void Rotate(DirectX::XMFLOAT3 Rotation);
56-
void Move(DirectX::XMFLOAT3 TargetPoint);
57-
void ToScreen();
58-
void Draw(const char* label);
53+
5954
void Update(float* pMatrixPtr, float pWinWidth, float pWinHeight);
6055
void DrawCamera(DirectX::XMFLOAT3 Position, DirectX::XMFLOAT3 Rotation, const char* label);
6156
void DrawFrameCamera(const MulNX::Base::Math::Frame& frame, const char* label);
62-
void DrawFirstPersonCamera(const char* label);
57+
//void DrawFirstPersonCamera(const char* label);
6358
};

bin/MulNX/MulNX/CS2Injector.exe

0 Bytes
Binary file not shown.
-1.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)