|
|
@ -138,6 +138,7 @@ private: |
|
|
|
|
|
|
|
|
|
|
|
float fTheta=0; |
|
|
|
float fTheta=0; |
|
|
|
float fYaw=0; |
|
|
|
float fYaw=0; |
|
|
|
|
|
|
|
float pitch=-M_PI/6; |
|
|
|
|
|
|
|
|
|
|
|
vec3d
|
|
|
|
vec3d
|
|
|
|
Matrix_MultiplyVector(mat4x4 &m, vec3d &i) |
|
|
|
Matrix_MultiplyVector(mat4x4 &m, vec3d &i) |
|
|
@ -471,16 +472,10 @@ public: |
|
|
|
bool OnUserUpdate(float fElapsedTime) override |
|
|
|
bool OnUserUpdate(float fElapsedTime) override |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (GetKey(olc::DOWN).bHeld) { |
|
|
|
if (GetKey(olc::DOWN).bHeld) { |
|
|
|
vCamera.y-=8*fElapsedTime; |
|
|
|
pitch-=1*fElapsedTime; |
|
|
|
} |
|
|
|
} |
|
|
|
if (GetKey(olc::UP).bHeld) { |
|
|
|
if (GetKey(olc::UP).bHeld) { |
|
|
|
vCamera.y+=8*fElapsedTime; |
|
|
|
pitch+=1*fElapsedTime; |
|
|
|
} |
|
|
|
|
|
|
|
if (GetKey(olc::RIGHT).bHeld) { |
|
|
|
|
|
|
|
vCamera.x+=8*fElapsedTime; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (GetKey(olc::LEFT).bHeld) { |
|
|
|
|
|
|
|
vCamera.x-=8*fElapsedTime; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
vec3d vForward=Vector_Mul(vLookDir,8*fElapsedTime); |
|
|
|
vec3d vForward=Vector_Mul(vLookDir,8*fElapsedTime); |
|
|
|
if (GetKey(olc::W).bHeld) { |
|
|
|
if (GetKey(olc::W).bHeld) { |
|
|
@ -508,7 +503,7 @@ public: |
|
|
|
matWorld=Matrix_MultiplyMatrix(matWorld,matTrans); |
|
|
|
matWorld=Matrix_MultiplyMatrix(matWorld,matTrans); |
|
|
|
|
|
|
|
|
|
|
|
vec3d vUp={0,1,0}; |
|
|
|
vec3d vUp={0,1,0}; |
|
|
|
vec3d vTarget={0,0,1}; |
|
|
|
vec3d vTarget={0,sinf(pitch),cosf(pitch)}; |
|
|
|
mat4x4 matCameraRot=Matrix_MakeRotationY(fYaw); |
|
|
|
mat4x4 matCameraRot=Matrix_MakeRotationY(fYaw); |
|
|
|
vLookDir=Matrix_MultiplyVector(matCameraRot,vTarget); |
|
|
|
vLookDir=Matrix_MultiplyVector(matCameraRot,vTarget); |
|
|
|
vTarget=Vector_Add(vCamera,vLookDir); |
|
|
|
vTarget=Vector_Add(vCamera,vLookDir); |
|
|
|