/// <summary> /// Remove a point field small multiple /// </summary> /// <param name="sm">The Small multiple to remove</param> public void RemovePointFieldSmallMultiple(VTKUnitySmallMultiple sm) { //Search for the small multiples in our array int id = -1; for (int i = 0; i < m_smallMultiples.Count; i++) { if (m_smallMultiples[i] == sm) { id = i; break; } } //If found, mark the UVID as available and reset the mesh. if (id >= 0) { m_availableUVIDs.Add(sm.UVID); m_smallMultiples.RemoveAt(id); //Free graphical memory if (m_mesh.isReadable) { m_mesh.SetUVs(sm.UVID, new List <Vector3>()); m_mesh.UploadMeshData(false); } Destroy(sm); } }
private void Update() { string debugMsg = ""; //>>>>>>>>>>>>>>>>>>>>added by Mao LIN>>>>>>>>>>>>>>>>>>>>>>>>> for (int i = 0; i < m_smallMultiples.Count; i++) { VTKUnitySmallMultiple sm = m_smallMultiples[i]; if (sm.PlaneEnabled && ClippingPlane.IsPlaneActive()) { sm.PlanePosition = ClippingPlane.GetPlanePosition(); //- sm.transform.position; sm.PlaneNormal = -1 * ClippingPlane.GetPlaneNormal(); Debug.DrawRay(ClippingPlane.GetPlanePosition(), ClippingPlane.GetPlaneNormal(), Color.green); debugMsg += "SM " + i + ": [Plane] Position=" + sm.PlanePosition + ", Normal=" + sm.PlaneNormal + "\n"; } /*if(sm.SphereEnabled) * { * sm.SpherePosition = SphereControl.Instance.GetSpherePosition();// - sm.transform.position; * sm.SphereRadius = 0.1f; * * debugMsg += "SM " + i + ": [Sphere] Position=" + sm.SpherePosition + ", Radius=" + sm.SphereRadius + "\n"; * }*/ } //GameObject.FindGameObjectWithTag("DebugText").GetComponent<Text>().text = debugMsg; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< }
/// <summary> /// Create a small multiple object /// </summary> /// <param name="dataID">The parameter ID to use. Use Parser.GetPointFieldValueDescriptors(); to get the field ID</param> /// <returns>A VTKUnitySmallMultiple object.</returns> public VTKUnitySmallMultiple CreatePointFieldSmallMultiple(Int32 dataID) { VTKStructuredPoints ptsDesc = m_parser.GetStructuredPointsDescriptor(); VTKUnitySmallMultiple sm = GameObject.Instantiate(SmallMultiplePrefab); Vector3Int density = Density; unsafe { if (sm.InitFromPointField(m_parser, m_mesh, m_availableUVIDs[m_availableUVIDs.Count - 1], dataID, new Vector3Int((int)(ptsDesc.Size[0] / density.x), (int)(ptsDesc.Size[1] / density.y * ptsDesc.Size[0]), (int)(ptsDesc.Size[2] / density.z * ptsDesc.Size[1] * ptsDesc.Size[0])), density, m_mask)) { m_smallMultiples.Add(sm); m_availableUVIDs.RemoveAt(m_availableUVIDs.Count - 1); return(sm); } } Destroy(sm); return(null); }