public override void Update(float dt) { float r = (this._radius + this._deltaRadius * dt) * CCCamera.getZEye(); float za = this._radZ + this._radDeltaZ * dt; float xa = this._radX + this._radDeltaX * dt; float i = (float)Math.Sin(za) * (float)Math.Cos(xa) * r + this._centerXOrig; float j = (float)Math.Sin(za) * (float)Math.Sin(xa) * r + this._centerYOrig; float k = (float)Math.Cos(za) * r + this._centerZOrig; Target.Camera.setEyeXYZ(i, j, k); }
public override void update(float dt) { float mFRadius = (this.m_fRadius + this.m_fDeltaRadius * dt) * CCCamera.getZEye(); float mFRadZ = this.m_fRadZ + this.m_fRadDeltaZ * dt; float mFRadX = this.m_fRadX + this.m_fRadDeltaX * dt; float single = (float)Math.Sin((double)mFRadZ) * (float)Math.Cos((double)mFRadX) * mFRadius + this.m_fCenterXOrig; float single1 = (float)Math.Sin((double)mFRadZ) * (float)Math.Sin((double)mFRadX) * mFRadius + this.m_fCenterYOrig; float single2 = (float)Math.Cos((double)mFRadZ) * mFRadius + this.m_fCenterZOrig; this.m_pTarget.Camera.setEyeXYZ(single, single1, single2); }
public override void update(float dt) { float r = (m_fRadius + m_fDeltaRadius * dt) * CCCamera.getZEye(); float za = m_fRadZ + m_fRadDeltaZ * dt; float xa = m_fRadX + m_fRadDeltaX * dt; float i = (float)Math.Sin(za) * (float)Math.Cos(xa) * r + m_fCenterXOrig; float j = (float)Math.Sin(za) * (float)Math.Sin(xa) * r + m_fCenterYOrig; float k = (float)Math.Cos(za) * r + m_fCenterZOrig; m_pTarget.Camera.setEyeXYZ(i, j, k); }
public void restore() { float single = 0f; float single1 = single; this.m_fEyeY = single; this.m_fEyeX = single1; this.m_fEyeZ = CCCamera.getZEye(); float single2 = 0f; float single3 = single2; this.m_fCenterZ = single2; float single4 = single3; float single5 = single4; this.m_fCenterY = single4; this.m_fCenterX = single5; this.m_fUpX = 0f; this.m_fUpY = 1f; this.m_fUpZ = 0f; this.m_bDirty = false; }
/// <summary> /// positions the camera according to spherical coordinates /// </summary> public void sphericalRadius(out float newRadius, out float zenith, out float azimuth) { float ex, ey, ez, cx, cy, cz, x, y, z; float r; // radius float s; CCCamera camera = Target.Camera; camera.getEyeXYZ(out ex, out ey, out ez); camera.getCenterXYZ(out cx, out cy, out cz); x = ex - cx; y = ey - cy; z = ez - cz; r = (float)Math.Sqrt((float)Math.Pow(x, 2) + (float)Math.Pow(y, 2) + (float)Math.Pow(z, 2)); s = (float)Math.Sqrt((float)Math.Pow(x, 2) + (float)Math.Pow(y, 2)); if (s == 0.0f) { s = ccMacros.FLT_EPSILON; } if (r == 0.0f) { r = ccMacros.FLT_EPSILON; } zenith = (float)Math.Acos(z / r); if (x < 0) { azimuth = (float)Math.PI - (float)Math.Sin(y / s); } else { azimuth = (float)Math.Sin(y / s); } newRadius = r / CCCamera.getZEye(); }
public void sphericalRadius(out float newRadius, out float zenith, out float azimuth) { float single; float single1; float single2; float single3; float single4; float single5; CCCamera camera = this.m_pTarget.Camera; camera.getEyeXYZ(out single, out single1, out single2); camera.getCenterXYZ(out single3, out single4, out single5); float single6 = single - single3; float single7 = single1 - single4; float single8 = single2 - single5; float fLTEPSILON = (float)Math.Sqrt((double)((float)Math.Pow((double)single6, 2) + (float)Math.Pow((double)single7, 2) + (float)Math.Pow((double)single8, 2))); float fLTEPSILON1 = (float)Math.Sqrt((double)((float)Math.Pow((double)single6, 2) + (float)Math.Pow((double)single7, 2))); if (fLTEPSILON1 == 0f) { fLTEPSILON1 = ccMacros.FLT_EPSILON; } if (fLTEPSILON == 0f) { fLTEPSILON = ccMacros.FLT_EPSILON; } zenith = (float)Math.Acos((double)(single8 / fLTEPSILON)); if (single6 >= 0f) { azimuth = (float)Math.Sin((double)(single7 / fLTEPSILON1)); } else { azimuth = 3.14159274f - (float)Math.Sin((double)(single7 / fLTEPSILON1)); } newRadius = fLTEPSILON / CCCamera.getZEye(); }