mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-15 06:56:15 +08:00
Added Near/Far clip plane adjustments on WorldForm, made ModelForm and VehicleForm auto adjust clip planes to object being viewed
This commit is contained in:
+24
-1
@@ -381,12 +381,15 @@ namespace CodeWalker.Forms
|
||||
{
|
||||
//move the camera to a default place where the given sphere is fully visible.
|
||||
|
||||
rad = Math.Max(0.5f, rad);
|
||||
rad = Math.Max(0.01f, rad);
|
||||
|
||||
camera.FollowEntity.Position = pos;
|
||||
camera.TargetDistance = rad * 1.6f;
|
||||
camera.CurrentDistance = rad * 1.6f;
|
||||
|
||||
camera.ZFar = Math.Min(rad * 200.0f, 12000.0f);
|
||||
camera.ZNear = Math.Min(camera.ZFar * 5e-5f, 0.5f);
|
||||
camera.UpdateProj = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -590,6 +593,16 @@ namespace CodeWalker.Forms
|
||||
Ydd = ydd;
|
||||
rpfFileEntry = Ydd.RpfFileEntry;
|
||||
|
||||
if (Ydd.Drawables != null)
|
||||
{
|
||||
float maxrad = 0.01f;
|
||||
foreach (var d in Ydd.Drawables)
|
||||
{
|
||||
maxrad = Math.Max(maxrad, d.BoundingSphereRadius);
|
||||
}
|
||||
MoveCameraToView(Vector3.Zero, maxrad);
|
||||
}
|
||||
|
||||
UpdateModelsUI(ydd.Dict);
|
||||
|
||||
DetailsPropertyGrid.SelectedObject = ydd;
|
||||
@@ -633,6 +646,16 @@ namespace CodeWalker.Forms
|
||||
Ypt = ypt;
|
||||
rpfFileEntry = Ypt.RpfFileEntry;
|
||||
|
||||
if (ypt.DrawableDict != null)
|
||||
{
|
||||
float maxrad = 0.01f;
|
||||
foreach (var d in ypt.DrawableDict.Values)
|
||||
{
|
||||
maxrad = Math.Max(maxrad, d.BoundingSphereRadius);
|
||||
}
|
||||
MoveCameraToView(Vector3.Zero, maxrad);
|
||||
}
|
||||
|
||||
UpdateModelsUI(ypt.DrawableDict);
|
||||
|
||||
DetailsPropertyGrid.SelectedObject = ypt;//.PtfxList;
|
||||
|
||||
Reference in New Issue
Block a user