Skip to content

Commit

Permalink
增加相机移动
Browse files Browse the repository at this point in the history
  • Loading branch information
gaowanlu committed May 1, 2022
1 parent 45ef446 commit 093bcf8
Show file tree
Hide file tree
Showing 10 changed files with 458 additions and 168 deletions.
9 changes: 7 additions & 2 deletions Project1.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@
<ItemGroup>
<ClCompile Include="src\camera\camera.cpp" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\model\model.cpp" />
<ClCompile Include="src\utils\window.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\camera\camera.h" />
<ClInclude Include="src\model\model.h" />
<ClInclude Include="src\utils\utils.h" />
<ClInclude Include="src\utils\window.h" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" />
Expand Down Expand Up @@ -142,14 +147,14 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>C:\Users\gaowanlu\Desktop\MyProject\3dll\include;C:\Users\gaowanlu\Desktop\MyProject\3dll\include\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)\include;$(ProjectDir)\include\eigen;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>NotSet</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\Users\gaowanlu\Desktop\MyProject\3dll\lib\x64</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)\lib\x64</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down
21 changes: 21 additions & 0 deletions Project1.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
<Filter Include="源文件\camera">
<UniqueIdentifier>{249ed63e-c5c6-46cd-9c78-fec8011a3199}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\utils">
<UniqueIdentifier>{3e26b941-7599-49ee-96b7-b6cf067bc96e}</UniqueIdentifier>
</Filter>
<Filter Include="源文件\model">
<UniqueIdentifier>{743af5dd-f422-46d1-8831-b964e7cdf4b8}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp">
Expand All @@ -24,11 +30,26 @@
<ClCompile Include="src\camera\camera.cpp">
<Filter>源文件\camera</Filter>
</ClCompile>
<ClCompile Include="src\utils\window.cpp">
<Filter>源文件\utils</Filter>
</ClCompile>
<ClCompile Include="src\model\model.cpp">
<Filter>源文件\model</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\camera\camera.h">
<Filter>源文件\camera</Filter>
</ClInclude>
<ClInclude Include="src\utils\utils.h">
<Filter>源文件\utils</Filter>
</ClInclude>
<ClInclude Include="src\utils\window.h">
<Filter>源文件\utils</Filter>
</ClInclude>
<ClInclude Include="src\model\model.h">
<Filter>源文件\model</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="README.md">
Expand Down
20 changes: 18 additions & 2 deletions src/camera/camera.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#include"camera.h"
#include<iostream>
void test() {
std::cout << "HELLO WORLD" << std::endl;
camera::camera() {
_camera << 1., 0., 0., 0., 1., 0., 0., 0., 1.;
}

Eigen::Matrix<double, 3, 3> camera::trans(double x_angle, double y_angle, double z_angle) {
return utils::roate_x(x_angle) * utils::roate_y(y_angle) * utils::roate_z(z_angle) * _camera;
}

void camera::move(double dx,double dy,double dz) {
this->dx += dx;
this->dy += dy;
this->dz += dz;
}

void camera::clear_move() {
this->dx = 0;
this->dy = 0;
this->dz = 0;
}
17 changes: 16 additions & 1 deletion src/camera/camera.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
#pragma once
void test();
#ifndef __CAMERA_H__
#define __CAMERA_H__
#include <Eigen/Dense>
#include "../utils/utils.h"
class camera {
private:
//摄像机 正交基 人在(0,0,0) 不动摄像机进行转动
Eigen::Matrix<double, 3, 3> _camera;
public:
double dx = 0, dy = 0, dz=0;
camera();
Eigen::Matrix<double, 3, 3> trans(double x_angle,double y_angle,double z_angle);
void move(double dx, double dy, double dz);
void clear_move();
};
#endif // !__CAMERA_H__
Loading

0 comments on commit 093bcf8

Please sign in to comment.