@@ -28,21 +28,22 @@ public class TP_SliceRenderer : MonoBehaviour
2828 // Start is called before the first frame update
2929 void Start ( )
3030 {
31- annotationDataset = tpmanager . GetAnnotationDataset ( ) ;
32-
3331 sagittalTex = new Texture2D ( baseSize [ 0 ] , baseSize [ 1 ] ) ;
3432 sagittalTex . filterMode = FilterMode . Point ;
3533 mlIdx = Mathf . RoundToInt ( baseSize [ 2 ] / 2 ) ;
36-
3734 sagittalSliceGO . GetComponent < Renderer > ( ) . material . mainTexture = sagittalTex ;
3835
3936 coronalTex = new Texture2D ( baseSize [ 2 ] , baseSize [ 1 ] ) ;
4037 coronalTex . filterMode = FilterMode . Point ;
4138 apIdx = Mathf . RoundToInt ( baseSize [ 0 ] / 2 ) ;
42-
4339 coronalSliceGO . GetComponent < Renderer > ( ) . material . mainTexture = coronalTex ;
4440 }
4541
42+ public void AsyncStart ( )
43+ {
44+ annotationDataset = tpmanager . GetAnnotationDataset ( ) ;
45+ }
46+
4647 private void Update ( )
4748 {
4849 if ( localPrefs . GetSlice3D ( ) )
@@ -60,7 +61,10 @@ private void Update()
6061 if ( needToRender ) RenderAnnotationLayer ( ) ;
6162 }
6263 }
63-
64+
65+ /// <summary>
66+ /// Shift the position of the sagittal and coronal slices to match the tip of the active probe
67+ /// </summary>
6468 private void UpdateSlicePosition ( )
6569 {
6670 ProbeController activeProbeController = tpmanager . GetActiveProbeController ( ) ;
@@ -75,6 +79,11 @@ private void UpdateSlicePosition()
7579 apIdx = Mathf . RoundToInt ( ( apPosition + 6.6f ) * 40 ) ;
7680 }
7781
82+ /// <summary>
83+ /// When the camera swtiches from looking from the "left" or "right" of a slice, flip the direction we are rendering
84+ /// [TODO: this would be better to solve with a two-sided shader, the current approach causes a lot of lag]
85+ /// </summary>
86+ /// <returns></returns>
7887 private bool UpdateCameraPosition ( )
7988 {
8089 Vector3 camPosition = Camera . main . transform . position ;
@@ -118,6 +127,9 @@ private bool UpdateCameraPosition()
118127 return false ;
119128 }
120129
130+ /// <summary>
131+ /// Draw onto the sagittal and coronal slices the annotations at the current slice position in the CCF
132+ /// </summary>
121133 private void RenderAnnotationLayer ( )
122134 {
123135 // Render sagittal slice
0 commit comments