diff --git a/jni/main_code.cpp b/jni/main_code.cpp index e704120..5ddc3fd 100644 --- a/jni/main_code.cpp +++ b/jni/main_code.cpp @@ -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(Renderer->CameraMover).CamVec; + PrevCamVec = boost::get(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(Renderer->CameraMover).CamVec; + vec3 camVec = boost::get(Renderer->Camera).CamVec; - vec4 camQuat = boost::get(Renderer->CameraMover).CameraQuat; + vec4 camQuat = boost::get(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(Renderer->CameraMover).CamShift; + vec3 camShift = boost::get(Renderer->Camera).CamShift; - vec3 camVec = boost::get(Renderer->CameraMover).CamVec; + vec3 camVec = boost::get(Renderer->Camera).CamVec; camShift += camVec * (static_cast(dt)*Velocity); @@ -226,13 +227,13 @@ void TMyApplication::InnerUpdate(cardinal dt) }*/ } - boost::get(Renderer->CameraMover).CamShift = camShift; + boost::get(Renderer->Camera).CamShift = camShift; if (Velocity != 0) { - vec3 a = boost::get(Renderer->CameraMover).CamShift; - vec3 b = a + 100.f * boost::get(Renderer->CameraMover).CamVec; + vec3 a = boost::get(Renderer->Camera).CamShift; + vec3 b = a + 100.f * boost::get(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(Renderer->CameraMover).RotateByQuat(quat); + boost::get(Renderer->Camera).RotateByQuat(quat); - boost::get(Renderer->CameraMover).CalcCamVec(); + boost::get(Renderer->Camera).CalcCamVec(); } @@ -283,7 +284,7 @@ void TMyApplication::InnerOnMove(vec2 shift) vec3 z = vec3(0,0,-1); - vec4 startQuat = boost::get(Renderer->CameraMover).CameraQuat; + vec4 startQuat = boost::get(Renderer->Camera).CameraQuat; RotateAxis = Normalize(CrossProduct(rotation, z)); @@ -312,7 +313,7 @@ void TMyApplication::OnMouseWheel(short int delta) { Velocity = 4.f; - boost::get(Renderer->CameraMover).CamShift = ZeroVec3; + boost::get(Renderer->Camera).CamShift = ZeroVec3; } @@ -320,7 +321,7 @@ void TMyApplication::UpdatePitVector(cardinal dt) { //Update pit vector - vec3 camVec = boost::get(Renderer->CameraMover).CamVec; + vec3 camVec = boost::get(Renderer->Camera).CamVec; vec4 q;