//the preview cam, if it exists can be used to display to a user if we have no calibration / no volume detected at all //then a coherent scene at least is shown on the monitor void usePreviewCam(bool onOff) { if (!preview) { preview = hypercubePreview.preview; } if (!preview) { preview = GameObject.FindObjectOfType <hypercubePreview>(); } if (!preview) { GetComponent <Camera>().enabled = true; return; } if (onOff && preview.allowIntroView) //use preview cam { GetComponent <Camera>().enabled = false; preview.previewCamera.SetActive(true); } else //normal behavior { GetComponent <Camera>().enabled = true; preview.previewCamera.SetActive(false); } }
void OnValidate() { if (!localCastMesh) { localCastMesh = hypercube.castMesh.canvas; } if (localCastMesh) { localCastMesh.setTone(brightness); localCastMesh.updateMesh(); hypercube.sliceModifier.updateSliceModifiers(localCastMesh.getSliceCount(), sliceModifiers); } Shader.SetGlobalFloat("_hypercubeBrightnessMod", brightness); Shader.SetGlobalColor("_blackPoint", blackPoint); updateOverlap(); if (!preview) { preview = GameObject.FindObjectOfType <hypercube.hypercubePreview>(); } if (preview) { preview.updateMesh(); } render(); }
void Start() { if (!localCastMesh) { localCastMesh = hypercube.castMesh.canvas; if (!localCastMesh) { localCastMesh = GameObject.FindObjectOfType <hypercube.castMesh>(); } if (!localCastMesh) { //if no canvas exists. we need to have one or the hypercube is useless. #if UNITY_EDITOR Cursor.visible = true; localCastMesh = UnityEditor.PrefabUtility.InstantiatePrefab(castMeshPrefab) as hypercube.castMesh; //try to keep the prefab connection, if possible #else Cursor.visible = false; localCastMesh = Instantiate(castMeshPrefab); //normal instantiation, lost the prefab connection #endif } } if (!preview) { preview = GameObject.FindObjectOfType <hypercube.hypercubePreview>(); } resetSettings(); Shader.SetGlobalFloat("_hypercubeBrightnessMod", brightness); //ensure we start with correct settings Shader.SetGlobalColor("_blackPoint", blackPoint); }
void Start() { if (!preview) { preview = GameObject.FindObjectOfType <hypercubePreview>(); } loadSettings(); }
void OnEnable() { preview = this; }