private void CreateBoundMarker() { boundMarker = Marker.CreateSphere(System.Drawing.Color.FromArgb(32,System.Drawing.Color.Blue), AbsSphere.Centre, AbsSphere.Radius); }
private void UpdateBoundMarker() { // Show bounding sphere if (boundMarker == null) boundMarker = Marker.CreateSphere(System.Drawing.Color.FromArgb(16,System.Drawing.Color.Red), AbsSphere.Centre, AbsSphere.Radius); boundMarker.Scale(AbsSphere.Radius); boundMarker.Goto(AbsSphere.Centre); // show which cell is CofG // if (cgMarker==null) // cgMarker = Marker.Create(Color.Red,CGCell.Location,2); // cgMarker.Goto(CGCell.Location); }
/// <summary> /// Create a new marker /// </summary> /// <param name="color">ARGB value (use A for transparency)</param> /// <param name="size">Radius of sphere</param> /// <param name="posn">World coordinates for position</param> /// <returns></returns> public static Marker Create(Color color, float size, Vector3 posn) { Marker m = new Marker(color, size, posn); list.Add(m); return m; }
/// <summary> /// Update (called whether this is the current cameraship or not) /// </summary> public override void Update() { /// HACK: FOR TESTING ONLY - ROTATE THE SHIP ///RotateBy(0.03f, 0.05f, 0.02f); // Steer the spotlight to follow the camera if (CurrentShip==this) Fx.SetSpotlightPosition(Matrix.Invert(rootCell.GetHotspotNormalMatrix(0)) * Camera.ProjMatrix); // If there is a creature on the clamp, position/orient it so that it sticks to the clamp (hotspot 1) if (SelectedOrg != null) { // Set the selected organism's position and orientation according to the clamp's hotspot // (Organisms store their location/orientation in a vector/quaternion, so I need to convert // the hotspot matrix into this form. Luckily there's a function!) Matrix clampMatrix = rootCell.GetHotspotMatrix(1); Vector3 clampPosition = new Vector3(clampMatrix.M41, clampMatrix.M42, clampMatrix.M43); clampMatrix.M41 = clampMatrix.M42 = clampMatrix.M43 = 0; Quaternion rot = Quaternion.RotationMatrix(clampMatrix); // NOTE: Assumes there's no scaling factor to mess up the rotation matrix rot.Normalize(); // Normalization improves (but doesn't cure) an error in the rotation using SoftImage SelectedOrg.RotateTo(rot); SelectedOrg.MoveTo(clampPosition); } // If a socket is selected, make sure the socket marker is pointing at it if (SelectedSocket != null) { if (socketMarker == null) { Color c = Color.FromArgb(16, 255, 0, 255); socketMarker = Marker.CreateCone(c, new Vector3(0, 0, 0), new Orientation(), 0.1f, 32.0f); } else { socketMarker.Goto(SelectedSocket.CombinedMatrix); } } else if (socketMarker != null) { socketMarker.Delete(); socketMarker = null; } // If a link socket is selected, make sure the link marker is pointing at it if (LinkSocket != null) { if (linkMarker == null) { Color c = Color.FromArgb(64, 255, 255, 0); linkMarker = Marker.CreateCone(c, new Vector3(0, 0, 0), new Orientation(), 0.3f, 3.5f); } else { linkMarker.Goto(LinkSocket.CombinedMatrix); } } else if (linkMarker != null) { linkMarker.Delete(); linkMarker = null; } // If there's a creature being tractor beamed back to the clamp, update it if (TractorBeam != null) { // Magnetically attract org towards clamp position. If it is now close by, attach it ready for editing Matrix clampMatrix = rootCell.GetHotspotMatrix(1); if (TractorBeam.Tractor(new Vector3(clampMatrix.M41, clampMatrix.M42, clampMatrix.M43), Quaternion.RotationMatrix(clampMatrix)) == true) { Attach(TractorBeam); TractorBeam = null; } } // Pass control to the base method base.Update(); }
/// <summary> /// Create a new SPHERE marker /// </summary> /// <param name="color">ARGB value (use A for transparency)</param> /// <param name="posn">World coordinates for position</param> /// <param name="radius">Radius of sphere</param> /// <returns></returns> public static Marker CreateSphere(Color color, Vector3 posn, float radius) { Marker m = new Marker(color, posn, radius); list.Add(m); return m; }
/// <summary> /// Create a new SPHERE marker /// </summary> /// <param name="color">ARGB value (use A for transparency)</param> /// <param name="posn">World coordinates of TIP</param> /// <param name="size">Radius of base</param> /// <returns></returns> public static Marker CreateCone(Color color, Vector3 posn, Orientation orientation, float angle, float height) { Marker m = new Marker(color, posn, orientation, angle, height); list.Add(m); return m; }