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:
dexy
2019-11-01 22:51:39 +11:00
Unverified
parent ec6eefe0e1
commit fe4ff6300e
5 changed files with 184 additions and 54 deletions
+5 -1
View File
@@ -436,12 +436,16 @@ namespace CodeWalker.Vehicles
{
//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;
}