public CameraProperties[] GetCameras() { ModelingHistory history = ModelingHistory.history; CameraProperties artist = null; CameraProperties bestview = null; Vec3f tar = new Vec3f(); Quatf rot = new Quatf(); float dist = 0.0f; float ortho = 0.0f; List <Vec3f> selverts = new List <Vec3f>(); Vec3f anorm = new Vec3f(); foreach (int isnapshot in snapshots) { SnapshotScene scene = history[isnapshot]; CameraProperties cam = scene.GetCamera(); tar += cam.GetTarget(); rot += cam.GetRotation(); dist += cam.GetDistance(); ortho += (cam.GetOrtho() ? 1.0f : 0.0f); foreach (SnapshotModel model in scene.GetSelectedModels()) { Vec3f[] verts = model.GetVerts(); Vec3f[] vnorms = model.GetVertNormals(); foreach (int ind in model.selinds) { selverts.Add(verts[ind]); anorm += vnorms[ind]; } } } int nsnapshots = snapshots.Count; if (nsnapshots == 0) { rot = new Quatf(0.5f, -0.5f, -0.5f, -0.5f); dist = 10.0f; System.Console.WriteLine("Cluster with no snapshots " + start + ":" + end); } else { tar /= (float)nsnapshots; rot /= (float)nsnapshots; dist /= (float)nsnapshots; ortho /= (float)nsnapshots; } artist = new CameraProperties(tar, rot, dist, (ortho >= 0.5f)) { Name = "Artist" }; bestview = artist; return(new CameraProperties[] { artist, bestview }); }
public void Set(CameraProperties camera) { Set(camera.GetTarget(), camera.GetRotation(), camera.GetDistance(), camera.GetOrtho()); }