private static void SpawnCrossSectionPlane(VolumeRenderedObject volobj) { GameObject quad = GameObject.CreatePrimitive(PrimitiveType.Quad); quad.transform.rotation = Quaternion.Euler(270.0f, 0.0f, 0.0f); SlicingPlaneAnyDirection csplane = quad.gameObject.AddComponent <SlicingPlaneAnyDirection>(); csplane.mat = volobj.GetComponent <MeshRenderer>().sharedMaterial; csplane.volumeTransform = volobj.transform; quad.transform.position = volobj.transform.position; Selection.objects = new Object[] { quad }; }
public override void OnInspectorGUI() { VolumeRenderedObject volrendObj = (VolumeRenderedObject)target; RenderMode oldRenderMode = volrendObj.GetRenderMode(); RenderMode newRenderMode = (RenderMode)EditorGUILayout.EnumPopup("Render mode", oldRenderMode); if (newRenderMode == RenderMode.IsosurfaceRendering) { Material mat = volrendObj.GetComponent <MeshRenderer>().sharedMaterial; // TODO float minVal = mat.GetFloat("_MinVal"); float maxVal = mat.GetFloat("_MaxVal"); EditorGUILayout.MinMaxSlider("Visible value range", ref minVal, ref maxVal, 0.0f, 1.0f); mat.SetFloat("_MinVal", minVal); mat.SetFloat("_MaxVal", maxVal); } if (newRenderMode != oldRenderMode) { volrendObj.SetRenderMode(newRenderMode); } }