This commit is contained in:
Vladislav Khorev 2013-01-28 10:40:51 +00:00
parent dca24f25e3
commit fb8257d1d0

View File

@ -71,7 +71,7 @@ void TMyApplication::InnerInit()
//Renderer->MovePhi(pi/6);
Renderer->CameraMover = TPitCamera();
Renderer->Camera = TPitCamera();
ResourceManager->LightManager.SetLightDirection(vec3(-1,0,-1));
ResourceManager->LightManager.SetLightColor(vec4(1,0,0,1));
@ -120,7 +120,7 @@ void TMyApplication::InnerInit()
Velocity = 4.f;
PrevCamVec = boost::get<TPitCamera>(Renderer->CameraMover).CamVec;
PrevCamVec = boost::get<TPitCamera>(Renderer->Camera).CamVec;
RotateShift = vec2(0.f, 0.f);
@ -157,7 +157,7 @@ void TMyApplication::InnerDraw()
Renderer->PopMatrix();
Renderer->PopProjectionMatrix();
//Renderer->PopProjectionMatrix();
glClear(GL_DEPTH_BUFFER_BIT);
@ -165,9 +165,9 @@ void TMyApplication::InnerDraw()
vec4 q;
vec3 camVec = boost::get<TPitCamera>(Renderer->CameraMover).CamVec;
vec3 camVec = boost::get<TPitCamera>(Renderer->Camera).CamVec;
vec4 camQuat = boost::get<TPitCamera>(Renderer->CameraMover).CameraQuat;
vec4 camQuat = boost::get<TPitCamera>(Renderer->Camera).CameraQuat;
vec3 n = Normalize(CrossProduct(camVec, PrevCamVec));
@ -186,6 +186,7 @@ void TMyApplication::InnerDraw()
Renderer->PopMatrix();
Renderer->PopProjectionMatrix();
}
@ -193,9 +194,9 @@ void TMyApplication::InnerDraw()
void TMyApplication::InnerUpdate(cardinal dt)
{
vec3 camShift = boost::get<TPitCamera>(Renderer->CameraMover).CamShift;
vec3 camShift = boost::get<TPitCamera>(Renderer->Camera).CamShift;
vec3 camVec = boost::get<TPitCamera>(Renderer->CameraMover).CamVec;
vec3 camVec = boost::get<TPitCamera>(Renderer->Camera).CamVec;
camShift += camVec * (static_cast<float>(dt)*Velocity);
@ -226,13 +227,13 @@ void TMyApplication::InnerUpdate(cardinal dt)
}*/
}
boost::get<TPitCamera>(Renderer->CameraMover).CamShift = camShift;
boost::get<TPitCamera>(Renderer->Camera).CamShift = camShift;
if (Velocity != 0)
{
vec3 a = boost::get<TPitCamera>(Renderer->CameraMover).CamShift;
vec3 b = a + 100.f * boost::get<TPitCamera>(Renderer->CameraMover).CamVec;
vec3 a = boost::get<TPitCamera>(Renderer->Camera).CamShift;
vec3 b = a + 100.f * boost::get<TPitCamera>(Renderer->Camera).CamVec;
if (a != b)
{
@ -262,9 +263,9 @@ void TMyApplication::InnerUpdate(cardinal dt)
vec4 quat = vec4(RotateAxis.v[0] * sin(rotateShift*dt*CONST_ROTATE_SPEED), RotateAxis.v[1] * sin(rotateShift*dt*CONST_ROTATE_SPEED), RotateAxis.v[2] * sin(rotateShift*dt*CONST_ROTATE_SPEED), cos(rotateShift*dt*CONST_ROTATE_SPEED));
boost::get<TPitCamera>(Renderer->CameraMover).RotateByQuat(quat);
boost::get<TPitCamera>(Renderer->Camera).RotateByQuat(quat);
boost::get<TPitCamera>(Renderer->CameraMover).CalcCamVec();
boost::get<TPitCamera>(Renderer->Camera).CalcCamVec();
}
@ -283,7 +284,7 @@ void TMyApplication::InnerOnMove(vec2 shift)
vec3 z = vec3(0,0,-1);
vec4 startQuat = boost::get<TPitCamera>(Renderer->CameraMover).CameraQuat;
vec4 startQuat = boost::get<TPitCamera>(Renderer->Camera).CameraQuat;
RotateAxis = Normalize(CrossProduct(rotation, z));
@ -312,7 +313,7 @@ void TMyApplication::OnMouseWheel(short int delta)
{
Velocity = 4.f;
boost::get<TPitCamera>(Renderer->CameraMover).CamShift = ZeroVec3;
boost::get<TPitCamera>(Renderer->Camera).CamShift = ZeroVec3;
}
@ -320,7 +321,7 @@ void TMyApplication::UpdatePitVector(cardinal dt)
{
//Update pit vector
vec3 camVec = boost::get<TPitCamera>(Renderer->CameraMover).CamVec;
vec3 camVec = boost::get<TPitCamera>(Renderer->Camera).CamVec;
vec4 q;