mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-25 16:32:55 +08:00
Cutscene viewer using znear/zfar when animating camera
This commit is contained in:
parent
9ba2e288ed
commit
ac4d1a4b19
@ -61,6 +61,11 @@ namespace CodeWalker.World
|
|||||||
|
|
||||||
WorldForm.SetCameraTransform(pos, rot);
|
WorldForm.SetCameraTransform(pos, rot);
|
||||||
|
|
||||||
|
if (Cutscene.CameraClipUpdate)
|
||||||
|
{
|
||||||
|
WorldForm.SetCameraClipPlanes(Cutscene.CameraNearClip, Cutscene.CameraFarClip);
|
||||||
|
Cutscene.CameraClipUpdate = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -254,6 +259,18 @@ namespace CodeWalker.World
|
|||||||
private void AnimateCameraCheckBox_CheckedChanged(object sender, EventArgs e)
|
private void AnimateCameraCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
AnimateCamera = AnimateCameraCheckBox.Checked;
|
AnimateCamera = AnimateCameraCheckBox.Checked;
|
||||||
|
|
||||||
|
if (!AnimateCamera)
|
||||||
|
{
|
||||||
|
WorldForm?.ResetCameraClipPlanes();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Cutscene != null)
|
||||||
|
{
|
||||||
|
Cutscene.CameraClipUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlayStopButton_Click(object sender, EventArgs e)
|
private void PlayStopButton_Click(object sender, EventArgs e)
|
||||||
@ -316,7 +333,9 @@ namespace CodeWalker.World
|
|||||||
|
|
||||||
|
|
||||||
public CutsceneObject CameraObject = null;
|
public CutsceneObject CameraObject = null;
|
||||||
|
public float CameraNearClip { get; set; } = 0.5f;
|
||||||
|
public float CameraFarClip { get; set; } = 12000.0f;
|
||||||
|
public bool CameraClipUpdate = false;//signal to the form to update the camera clip planes
|
||||||
public Quaternion CameraRotationOffset = Quaternion.RotationAxis(Vector3.UnitX, -1.57079632679f) * Quaternion.RotationAxis(Vector3.UnitZ, 3.141592653f);
|
public Quaternion CameraRotationOffset = Quaternion.RotationAxis(Vector3.UnitX, -1.57079632679f) * Quaternion.RotationAxis(Vector3.UnitZ, 3.141592653f);
|
||||||
|
|
||||||
|
|
||||||
@ -962,6 +981,9 @@ namespace CodeWalker.World
|
|||||||
obj.Position = pos + rot.Multiply(args.vPosition);
|
obj.Position = pos + rot.Multiply(args.vPosition);
|
||||||
obj.Rotation = rot * args.vRotationQuaternion;
|
obj.Rotation = rot * args.vRotationQuaternion;
|
||||||
|
|
||||||
|
CameraNearClip = (args.fNearDrawDistance > 0) ? Math.Min(args.fNearDrawDistance, 0.5f) : 0.5f;
|
||||||
|
CameraFarClip = (args.fFarDrawDistance > 0) ? Math.Max(args.fFarDrawDistance, 1000.0f) : 12000.0f;
|
||||||
|
CameraClipUpdate = true;
|
||||||
CameraObject = obj;
|
CameraObject = obj;
|
||||||
}
|
}
|
||||||
private void CameraShadowCascade(CutEvent e)
|
private void CameraShadowCascade(CutEvent e)
|
||||||
|
14
WorldForm.cs
14
WorldForm.cs
@ -1892,6 +1892,20 @@ namespace CodeWalker
|
|||||||
camera.TargetRotation = Vector3.Zero;
|
camera.TargetRotation = Vector3.Zero;
|
||||||
camera.TargetDistance = 0.01f;
|
camera.TargetDistance = 0.01f;
|
||||||
}
|
}
|
||||||
|
public void SetCameraClipPlanes(float znear, float zfar)
|
||||||
|
{
|
||||||
|
//sets the camera clip planes to the specified values, for use in eg cutscenes
|
||||||
|
camera.ZNear = znear;
|
||||||
|
camera.ZFar = zfar;
|
||||||
|
camera.UpdateProj = true;
|
||||||
|
}
|
||||||
|
public void ResetCameraClipPlanes()
|
||||||
|
{
|
||||||
|
//resets the camera clip planes to the values in the UI controls.
|
||||||
|
camera.ZNear = (float)NearClipUpDown.Value;
|
||||||
|
camera.ZFar = (float)FarClipUpDown.Value;
|
||||||
|
camera.UpdateProj = true;
|
||||||
|
}
|
||||||
|
|
||||||
public Vector3 GetCameraPosition()
|
public Vector3 GetCameraPosition()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user