private void init() { if (cameraObject == null) { cameraObject = new GameObject("TRReflectionCamera"); reflectionCamera = cameraObject.AddComponent <Camera>(); eveCameraFix = cameraObject.AddComponent <CameraAlphaFix>(); reflectionCamera.enabled = false; } if (skyboxShader == null) { skyboxShader = KSPShaderTools.TexturesUnlimitedLoader.getShader("SSTU/Skybox/Cubemap"); if (skyboxShader == null) { MonoBehaviour.print("ERROR: SSTUReflectionManager - Could not find skybox shader."); } } probeData = createProbe(); if (HighLogic.LoadedSceneIsEditor) { probeData.reflectionSphere.transform.position = new Vector3(0, 10, 0); } else if (HighLogic.LoadedSceneIsFlight) { //probe position updated during Update() } }
private void init() { MonoBehaviour.print("SSTUReflectionManager init()"); if (cameraObject == null) { cameraObject = new GameObject("TRReflectionCamera"); reflectionCamera = cameraObject.AddComponent <Camera>(); eveCameraFix = cameraObject.AddComponent <CameraAlphaFix>(); reflectionCamera.enabled = false; MonoBehaviour.print("SSTUReflectionManager created camera: " + reflectionCamera); } if (skyboxShader == null) { skyboxShader = KSPShaderTools.KSPShaderLoader.getShader("SSTU/Skybox/Cubemap"); if (skyboxShader == null) { MonoBehaviour.print("ERROR: SSTUReflectionManager - Could not find skybox shader."); } } if (HighLogic.LoadedSceneIsEditor) { ReflectionProbeData data = createProbe(); data.reflectionSphere.transform.position = new Vector3(0, 10, 0); editorReflectionData = new EditorReflectionData(data); MonoBehaviour.print("SSTUReflectionManager created editor reflection data: " + data + " :: " + editorReflectionData); } else if (HighLogic.LoadedSceneIsFlight) { //vessels are added thorugh an event as they are loaded } //TODO -- replace with custom baked skybox... //use in areas where other reflection probes don't make sense (space?) //RenderSettings.customReflection = customCubemap; //TODO -- pre-bake cubemap to use as the custom skybox in the reflection probe camera; this can be higher res and updated far less often (every couple of seconds?) }