public void RenderBackground(RenderTexture screen) { switch (background) { case BackgroundType.None: GL.Clear(true, true, ourMonitor.emptyColorValue); break; case BackgroundType.Camera: GL.Clear(true, true, ourMonitor.emptyColorValue); if (!cameraObject.Render()) { if (ourMonitor.noSignalTexture != null) { Graphics.DrawTexture(new Rect(0, 0, screen.width, screen.height), ourMonitor.noSignalTexture); } } break; case BackgroundType.Texture: //call clear before redraw of textures GL.Clear(true, true, ourMonitor.emptyColorValue); Graphics.DrawTexture(new Rect(0, 0, screen.width, screen.height), backgroundTexture); break; case BackgroundType.Handler: //No clear here as it would interfere with the handlers(Causing effects such as VesselViewer to blink) // If there's a handler references method, it gets called before each render. if (backgroundHandlerS.getHandlerReferences != null) { backgroundHandlerS.getHandlerReferences(pageHandlerModule, backgroundHandlerModule); } if (!backgroundHandlerMethod(screen, cameraAspect)) { if (ourMonitor.noSignalTexture != null && showNoSignal) { Graphics.DrawTexture(new Rect(0, 0, screen.width, screen.height), ourMonitor.noSignalTexture); } else { GL.Clear(true, true, ourMonitor.emptyColorValue); } } break; } // If the handlers aren't missing their popmatrix, it should be alright. if (interlayTexture != null) { Graphics.DrawTexture(new Rect(0, 0, screen.width, screen.height), interlayTexture); } }
public bool RenderCamera(RenderTexture screen, float cameraAspect) { // Just in case. if (!HighLogic.LoadedSceneIsFlight) { return(false); } if (cameras.Count < 1) { return(false); } var activeCamera = cameras[currentCamera]; if (string.IsNullOrEmpty(activeCamera.cameraTransform)) { return(false); } if (cameraObject == null) { cameraObject = new FlyingCamera(part, screen, cameraAspect); cameraObject.PointCamera(activeCamera.cameraTransform, activeCamera.currentFoV); } cameraObject.FOV = activeCamera.currentFoV; // Negate pitch - the camera object treats a negative pitch as "up" if (cameraObject.Render(activeCamera.currentYaw, -activeCamera.currentPitch)) { ITargetable target = FlightGlobals.fetch.VesselTarget; bool drawSomething = ((gizmoTexture != null && target != null && showTargetIcon) || homeCrosshairMaterial.color.a > 0); if (drawSomething) { GL.PushMatrix(); GL.LoadPixelMatrix(0, screen.width, screen.height, 0); } if (gizmoTexture != null && target != null && showTargetIcon) { // Figure out which direction the target is. Vector3 targetDisplacement = target.GetTransform().position - cameraObject.GetTransform().position; targetDisplacement.Normalize(); // Transform it using the active camera's rotation. var targetDisp = GetNormalizedScreenPosition(activeCamera, targetDisplacement, cameraAspect); var iconCenter = new Vector2(screen.width * targetDisp.x, screen.height * targetDisp.y); // Apply some clamping values to force the icon to stay on screen iconCenter.x = Math.Max(iconPixelSize * 0.5f, iconCenter.x); iconCenter.x = Math.Min(screen.width - iconPixelSize * 0.5f, iconCenter.x); iconCenter.y = Math.Max(iconPixelSize * 0.5f, iconCenter.y); iconCenter.y = Math.Min(screen.height - iconPixelSize * 0.5f, iconCenter.y); var position = new Rect(iconCenter.x - iconPixelSize * 0.5f, iconCenter.y - iconPixelSize * 0.5f, iconPixelSize, iconPixelSize); Graphics.DrawTexture(position, gizmoTexture, GizmoIcons.GetIconLocation(GizmoIcons.IconType.TARGETPLUS), 0, 0, 0, 0, iconMaterial); } if (homeCrosshairMaterial.color.a > 0) { // Mihara: Reference point cameras are different enough to warrant it. var cameraForward = cameraObject.GetTransformForward(); var crossHairCenter = GetNormalizedScreenPosition(activeCamera, cameraForward, cameraAspect); crossHairCenter.x *= screen.width; crossHairCenter.y *= screen.height; crossHairCenter.x = Math.Max(iconPixelSize * 0.5f, crossHairCenter.x); crossHairCenter.x = Math.Min(screen.width - iconPixelSize * 0.5f, crossHairCenter.x); crossHairCenter.y = Math.Max(iconPixelSize * 0.5f, crossHairCenter.y); crossHairCenter.y = Math.Min(screen.height - iconPixelSize * 0.5f, crossHairCenter.y); float zoomAdjustedIconSize = iconPixelSize * Mathf.Tan(Mathf.Deg2Rad * activeCamera.fovLimits.y * 0.5f) / Mathf.Tan(Mathf.Deg2Rad * activeCamera.currentFoV * 0.5f); homeCrosshairMaterial.SetPass(0); GL.Begin(GL.LINES); GL.Vertex3(crossHairCenter.x - zoomAdjustedIconSize * 0.5f, crossHairCenter.y, 0.0f); GL.Vertex3(crossHairCenter.x + zoomAdjustedIconSize * 0.5f, crossHairCenter.y, 0.0f); GL.Vertex3(crossHairCenter.x, crossHairCenter.y - zoomAdjustedIconSize * 0.5f, 0.0f); GL.Vertex3(crossHairCenter.x, crossHairCenter.y + zoomAdjustedIconSize * 0.5f, 0.0f); GL.End(); } if (drawSomething) { GL.PopMatrix(); } return(true); } return(false); }
public bool RenderHUD(RenderTexture screen, float cameraAspect) { if (screen == null || !startupComplete || HighLogic.LoadedSceneIsEditor) { return(false); } if (!firstRenderComplete) { firstRenderComplete = true; hudCamera.orthographicSize = (float)(screen.height) * 0.5f; hudCamera.aspect = (float)screen.width / (float)screen.height; InitializeRenderables(screen); } RPMVesselComputer comp = RPMVesselComputer.Instance(vessel); for (int i = 0; i < verticalBars.Count; ++i) { verticalBars[i].Update(comp); } for (int i = 0; i < horizontalBars.Count; ++i) { horizontalBars[i].Update(comp); } GL.Clear(true, true, backgroundColorValue); // Draw the camera's view, if configured. if (cameraObject != null) { cameraObject.Render(); } hudCamera.targetTexture = screen; // MOARdV TODO: I don't think this does anything... GL.Color(Color.white); Quaternion rotationVesselSurface = comp.RotationVesselSurface; if (headingMesh != null) { UpdateHeading(rotationVesselSurface, comp); JUtil.ShowHide(true, headingMesh); } if (ladderMesh != null) { // Viewport doesn't work with this, AFAICT. // Anyway, these numbers aren't right for the redesigned HUD. //JUtil.LogMessage(this, "screen is {0} x {1}, horizon size is {2} x {3}, making a rectangle at {4} x {5} with size of {6} x {7}", // screen.width,screen.height, // horizonSize.x, horizonSize.y, // (screen.width - horizonSize.x) * 0.5f, (screen.height - horizonSize.y) * 0.5f, // horizonSize.x, horizonSize.y); //GL.Viewport(new Rect((screen.width - horizonSize.x) * 0.5f, (screen.height - horizonSize.y) * 0.5f, horizonSize.x, horizonSize.y)); // Fix up UVs, apply rotation. UpdateLadder(rotationVesselSurface, comp); JUtil.ShowHide(true, ladderMesh); //hudCamera.Render(); //JUtil.ShowHide(false, ladderMesh); //GL.Viewport(new Rect(0, 0, screen.width, screen.height)); } if (overlayMesh != null) { JUtil.ShowHide(true, overlayMesh); } hudCamera.Render(); JUtil.ShowHide(false, overlayMesh, ladderMesh, headingMesh, progradeLadderIcon, progradeHeadingIcon); for (int i = 0; i < verticalBars.Count; ++i) { JUtil.ShowHide(false, verticalBars[i].barObject); } for (int i = 0; i < horizontalBars.Count; ++i) { JUtil.ShowHide(false, horizontalBars[i].barObject); } return(true); }
public bool RenderCamera(RenderTexture screen, float cameraAspect) { // Just in case. if (HighLogic.LoadedSceneIsEditor) { return(false); } if (cameras.Count < 1) { return(false); } var activeCamera = cameras[currentCamera]; if (string.IsNullOrEmpty(activeCamera.cameraTransform)) { return(false); } if (cameraObject == null) { cameraObject = new FlyingCamera(part, cameraAspect); cameraObject.PointCamera(activeCamera.cameraTransform, activeCamera.currentFoV); } cameraObject.FOV = activeCamera.currentFoV; if (rentexWidth == 0) { rentexWidth = screen.width; rentexHeight = screen.height; // Note to self: when rentex dims != screen dims, the FOV seems to be wrong (like FOV is smaller). } if (renderTex == null) { renderTex = new RenderTexture(rentexWidth, rentexHeight, screen.depth); renderTex.Create(); } // Negate pitch - the camera object treats a negative pitch as "up" if (cameraObject.Render(renderTex, activeCamera.currentYaw, -activeCamera.currentPitch)) { if (cameraEffectMaterial != null) { cameraEffectMaterial.SetVector("_ImageDims", new Vector4((float)renderTex.width, (float)renderTex.height, 1.0f / (float)renderTex.width, 1.0f / (float)renderTex.height)); for (int i = 0; i < ceVariables.Count; ++i) { float value = ceVariables[i].value.AsFloat(); cameraEffectMaterial.SetFloat(ceVariables[i].variable, value); } Graphics.Blit(renderTex, screen, cameraEffectMaterial); } else { Graphics.Blit(renderTex, screen); } renderTex.DiscardContents(); ITargetable target = FlightGlobals.fetch.VesselTarget; bool drawSomething = ((gizmoTexture != null && target != null && showTargetIcon) || homeCrosshairMaterial.color.a > 0); if (drawSomething) { GL.PushMatrix(); GL.LoadPixelMatrix(0, screen.width, screen.height, 0); } if (gizmoTexture != null && target != null && showTargetIcon) { // Figure out which direction the target is. Vector3 targetDisplacement = target.GetTransform().position - cameraObject.GetTransform().position; targetDisplacement.Normalize(); // Transform it using the active camera's rotation. var targetDisp = GetNormalizedScreenPosition(activeCamera, targetDisplacement, cameraAspect); var iconCenter = new Vector2(screen.width * targetDisp.x, screen.height * targetDisp.y); // Apply some clamping values to force the icon to stay on screen iconCenter.x = Math.Max(iconPixelSize * 0.5f, iconCenter.x); iconCenter.x = Math.Min(screen.width - iconPixelSize * 0.5f, iconCenter.x); iconCenter.y = Math.Max(iconPixelSize * 0.5f, iconCenter.y); iconCenter.y = Math.Min(screen.height - iconPixelSize * 0.5f, iconCenter.y); var position = new Rect(iconCenter.x - iconPixelSize * 0.5f, iconCenter.y - iconPixelSize * 0.5f, iconPixelSize, iconPixelSize); Graphics.DrawTexture(position, gizmoTexture, GizmoIcons.GetIconLocation(GizmoIcons.IconType.TARGETPLUS), 0, 0, 0, 0, iconMaterial); } if (homeCrosshairMaterial.color.a > 0) { // Mihara: Reference point cameras are different enough to warrant it. var cameraForward = cameraObject.GetTransformForward(); var crossHairCenter = GetNormalizedScreenPosition(activeCamera, cameraForward, cameraAspect); crossHairCenter.x *= screen.width; crossHairCenter.y *= screen.height; crossHairCenter.x = Math.Max(iconPixelSize * 0.5f, crossHairCenter.x); crossHairCenter.x = Math.Min(screen.width - iconPixelSize * 0.5f, crossHairCenter.x); crossHairCenter.y = Math.Max(iconPixelSize * 0.5f, crossHairCenter.y); crossHairCenter.y = Math.Min(screen.height - iconPixelSize * 0.5f, crossHairCenter.y); float zoomAdjustedIconSize = iconPixelSize * Mathf.Tan(Mathf.Deg2Rad * activeCamera.fovLimits.y * 0.5f) / Mathf.Tan(Mathf.Deg2Rad * activeCamera.currentFoV * 0.5f); homeCrosshairMaterial.SetPass(0); GL.Begin(GL.LINES); GL.Vertex3(crossHairCenter.x - zoomAdjustedIconSize * 0.5f, crossHairCenter.y, 0.0f); GL.Vertex3(crossHairCenter.x + zoomAdjustedIconSize * 0.5f, crossHairCenter.y, 0.0f); GL.Vertex3(crossHairCenter.x, crossHairCenter.y - zoomAdjustedIconSize * 0.5f, 0.0f); GL.Vertex3(crossHairCenter.x, crossHairCenter.y + zoomAdjustedIconSize * 0.5f, 0.0f); GL.End(); } if (drawSomething) { GL.PopMatrix(); } return(true); } else if (skipMissingCameras) { // This will handle cameras getting ejected while in use. SelectNextCamera(); } return(false); }
public bool RenderHUD(RenderTexture screen, float cameraAspect) { if (screen == null || !startupComplete || HighLogic.LoadedSceneIsEditor) { return(false); } // Clear the background, if configured. GL.Clear(true, true, backgroundColorValue); // Configure the camera, if configured. // MOARdV: Might be worthwhile to refactor the flying camera so // it is created in Start (like new FlyingCamera(part, cameraTransform)), // and pass the screen, FoV, and aspect ratio (or just screen and // FoV) as Render parameters, so there's no need to test if the // camera's been created every render call. if (cameraObject == null && !string.IsNullOrEmpty(cameraTransform)) { cameraObject = new FlyingCamera(part, screen, cameraAspect); cameraObject.PointCamera(cameraTransform, hudFov); } // Draw the camera's view, if configured. if (cameraObject != null) { cameraObject.Render(); } // Configure the matrix so that the origin is the center of the screen. GL.PushMatrix(); // Draw the HUD ladder // MOARdV note, 2014/03/19: swapping the y values, to invert the // coordinates so the prograde icon is right-side up. GL.LoadPixelMatrix(-horizonSize.x * 0.5f, horizonSize.x * 0.5f, horizonSize.y * 0.5f, -horizonSize.y * 0.5f); GL.Viewport(new Rect((screen.width - horizonSize.x) * 0.5f, (screen.height - horizonSize.y) * 0.5f, horizonSize.x, horizonSize.y)); Vector3 coM = vessel.findWorldCenterOfMass(); Vector3 up = (coM - vessel.mainBody.position).normalized; Vector3 forward = vessel.GetTransform().up; Vector3 right = vessel.GetTransform().right; Vector3 top = Vector3.Cross(right, forward); Vector3 north = Vector3.Exclude(up, (vessel.mainBody.position + (Vector3d)vessel.mainBody.transform.up * vessel.mainBody.Radius) - coM).normalized; Vector3d velocityVesselSurface = vessel.orbit.GetVel() - vessel.mainBody.getRFrmVel(coM); Vector3 velocityVesselSurfaceUnit = velocityVesselSurface.normalized; if (ladderMaterial) { // Figure out the texture coordinate scaling for the ladder. float ladderTextureOffset = horizonTextureSize.y / ladderMaterial.mainTexture.height; float cosUp = Vector3.Dot(forward, up); float cosRoll = Vector3.Dot(top, up); float sinRoll = Vector3.Dot(right, up); var normalizedRoll = new Vector2(cosRoll, sinRoll); normalizedRoll.Normalize(); if (normalizedRoll.magnitude < 0.99f) { // If we're hitting +/- 90 nearly perfectly, the sin and cos will // be too far out of whack to normalize. Arbitrarily pick // a roll of 0.0. normalizedRoll.x = 1.0f; normalizedRoll.y = 0.0f; } cosRoll = normalizedRoll.x; sinRoll = normalizedRoll.y; // Mihara: I'm pretty sure this was negative of what it should actually be, at least according to my mockup. float pitch = -(Mathf.Asin(cosUp) * Mathf.Rad2Deg); float ladderMidpointCoord; if (use360horizon) { // Straight up is texture coord 0.75; // Straight down is TC 0.25; ladderMidpointCoord = JUtil.DualLerp(0.25f, 0.75f, -90f, 90f, pitch); } else { // Straight up is texture coord 1.0; // Straight down is TC 0.0; ladderMidpointCoord = JUtil.DualLerp(0.0f, 1.0f, -90f, 90f, pitch); } ladderMaterial.SetPass(0); GL.Begin(GL.QUADS); // transform -x -y GL.TexCoord2(0.5f + horizonTextureSize.x, ladderMidpointCoord - ladderTextureOffset); GL.Vertex3(cosRoll * horizonSize.x + sinRoll * horizonSize.y, -sinRoll * horizonSize.x + cosRoll * horizonSize.y, 0.0f); // transform +x -y GL.TexCoord2(0.5f - horizonTextureSize.x, ladderMidpointCoord - ladderTextureOffset); GL.Vertex3(-cosRoll * horizonSize.x + sinRoll * horizonSize.y, sinRoll * horizonSize.x + cosRoll * horizonSize.y, 0.0f); // transform +x +y GL.TexCoord2(0.5f - horizonTextureSize.x, ladderMidpointCoord + ladderTextureOffset); GL.Vertex3(-cosRoll * horizonSize.x - sinRoll * horizonSize.y, sinRoll * horizonSize.x - cosRoll * horizonSize.y, 0.0f); // transform -x +y GL.TexCoord2(0.5f + horizonTextureSize.x, ladderMidpointCoord + ladderTextureOffset); GL.Vertex3(cosRoll * horizonSize.x - sinRoll * horizonSize.y, -sinRoll * horizonSize.x - cosRoll * horizonSize.y, 0.0f); GL.End(); float AoA = velocityVesselSurfaceUnit.AngleInPlane(right, forward); float AoATC; if (use360horizon) { // Straight up is texture coord 0.75; // Straight down is TC 0.25; AoATC = JUtil.DualLerp(0.25f, 0.75f, -90f, 90f, pitch + AoA); } else { // Straight up is texture coord 1.0; // Straight down is TC 0.0; AoATC = JUtil.DualLerp(0.0f, 1.0f, -90f, 90f, pitch + AoA); } float Ypos = JUtil.DualLerp( -horizonSize.y, horizonSize.y, ladderMidpointCoord - ladderTextureOffset, ladderMidpointCoord + ladderTextureOffset, AoATC); // Placing the icon on the (0, Ypos) location, so simplify the transform. DrawIcon(-sinRoll * Ypos, -cosRoll * Ypos, GizmoIcons.GetIconLocation(GizmoIcons.IconType.PROGRADE), progradeColorValue); } // Draw the rest of the HUD stuff (0,0) is the top left corner of the screen. GL.LoadPixelMatrix(0, screen.width, screen.height, 0); GL.Viewport(new Rect(0, 0, screen.width, screen.height)); if (headingMaterial != null) { Quaternion rotationSurface = Quaternion.LookRotation(north, up); Quaternion rotationVesselSurface = Quaternion.Inverse(Quaternion.Euler(90, 0, 0) * Quaternion.Inverse(vessel.GetTransform().rotation) * rotationSurface); float headingTexture = JUtil.DualLerp(0f, 1f, 0f, 360f, rotationVesselSurface.eulerAngles.y); float headingTextureOffset = (headingBarWidth / headingMaterial.mainTexture.width) / 2; headingMaterial.SetPass(0); GL.Begin(GL.QUADS); GL.TexCoord2(headingTexture - headingTextureOffset, 1.0f); GL.Vertex3(headingBarPosition.x, headingBarPosition.y, 0.0f); GL.TexCoord2(headingTexture + headingTextureOffset, 1.0f); GL.Vertex3(headingBarPosition.x + headingBarPosition.z, headingBarPosition.y, 0.0f); GL.TexCoord2(headingTexture + headingTextureOffset, 0.0f); GL.Vertex3(headingBarPosition.x + headingBarPosition.z, headingBarPosition.y + headingBarPosition.w, 0.0f); GL.TexCoord2(headingTexture - headingTextureOffset, 0.0f); GL.Vertex3(headingBarPosition.x, headingBarPosition.y + headingBarPosition.w, 0.0f); GL.End(); if (showHeadingBarPrograde) { float slipAngle = velocityVesselSurfaceUnit.AngleInPlane(up, forward); float slipTC = JUtil.DualLerp(0f, 1f, 0f, 360f, rotationVesselSurface.eulerAngles.y + slipAngle); float slipIconX = JUtil.DualLerp(headingBarPosition.x, headingBarPosition.x + headingBarPosition.z, headingTexture - headingTextureOffset, headingTexture + headingTextureOffset, slipTC); DrawIcon(slipIconX, headingBarPosition.y + headingBarPosition.w * 0.5f, GizmoIcons.GetIconLocation(GizmoIcons.IconType.PROGRADE), progradeColorValue); } } if (vertBar1Material != null) { float value = comp.ProcessVariable(vertBar1Variable).MassageToFloat(); if (float.IsNaN(value)) { value = 0.0f; } if (vertBar1UseLog10) { value = JUtil.PseudoLog10(value); } float vertBar1TexCoord = JUtil.DualLerp(vertBar1TextureLimit.x, vertBar1TextureLimit.y, vertBar1Limit.x, vertBar1Limit.y, value); vertBar1Material.SetPass(0); GL.Begin(GL.QUADS); GL.TexCoord2(0.0f, vertBar1TexCoord + vertBar1TextureSize); GL.Vertex3(vertBar1Position.x, vertBar1Position.y, 0.0f); GL.TexCoord2(1.0f, vertBar1TexCoord + vertBar1TextureSize); GL.Vertex3(vertBar1Position.x + vertBar1Position.z, vertBar1Position.y, 0.0f); GL.TexCoord2(1.0f, vertBar1TexCoord - vertBar1TextureSize); GL.Vertex3(vertBar1Position.x + vertBar1Position.z, vertBar1Position.y + vertBar1Position.w, 0.0f); GL.TexCoord2(0.0f, vertBar1TexCoord - vertBar1TextureSize); GL.Vertex3(vertBar1Position.x, vertBar1Position.y + vertBar1Position.w, 0.0f); GL.End(); } if (vertBar2Material != null) { float value = comp.ProcessVariable(vertBar2Variable).MassageToFloat(); if (float.IsNaN(value)) { value = 0.0f; } if (vertBar2UseLog10) { value = JUtil.PseudoLog10(value); } float vertBar2TexCoord = JUtil.DualLerp(vertBar2TextureLimit.x, vertBar2TextureLimit.y, vertBar2Limit.x, vertBar2Limit.y, value); vertBar2Material.SetPass(0); GL.Begin(GL.QUADS); GL.TexCoord2(0.0f, vertBar2TexCoord + vertBar2TextureSize); GL.Vertex3(vertBar2Position.x, vertBar2Position.y, 0.0f); GL.TexCoord2(1.0f, vertBar2TexCoord + vertBar2TextureSize); GL.Vertex3(vertBar2Position.x + vertBar2Position.z, vertBar2Position.y, 0.0f); GL.TexCoord2(1.0f, vertBar2TexCoord - vertBar2TextureSize); GL.Vertex3(vertBar2Position.x + vertBar2Position.z, vertBar2Position.y + vertBar2Position.w, 0.0f); GL.TexCoord2(0.0f, vertBar2TexCoord - vertBar2TextureSize); GL.Vertex3(vertBar2Position.x, vertBar2Position.y + vertBar2Position.w, 0.0f); GL.End(); } if (overlayMaterial != null) { overlayMaterial.SetPass(0); GL.Begin(GL.QUADS); GL.TexCoord2(0.0f, 1.0f); GL.Vertex3(0.0f, 0.0f, 0.0f); GL.TexCoord2(1.0f, 1.0f); GL.Vertex3(screen.width, 0.0f, 0.0f); GL.TexCoord2(1.0f, 0.0f); GL.Vertex3(screen.width, screen.height, 0.0f); GL.TexCoord2(0.0f, 0.0f); GL.Vertex3(0.0f, screen.height, 0.0f); GL.End(); } GL.PopMatrix(); return(true); }
public bool RenderHUD(RenderTexture screen, float cameraAspect) { if (screen == null || !startupComplete || HighLogic.LoadedSceneIsEditor) { return(false); } if (!firstRenderComplete) { firstRenderComplete = true; hudCamera.orthographicSize = (float)(screen.height) * 0.5f; hudCamera.aspect = (float)screen.width / (float)screen.height; InitializeRenderables(screen); } for (int i = 0; i < verticalBars.Count; ++i) { verticalBars[i].Update(); } for (int i = 0; i < horizontalBars.Count; ++i) { horizontalBars[i].Update(); } GL.Clear(true, true, backgroundColorValue); // Draw the camera's view, if configured. if (cameraObject != null) { if (renderTex == null) { renderTex = new RenderTexture(screen.width, screen.height, screen.depth); renderTex.Create(); } if (cameraObject.Render(renderTex, 0.0f, 0.0f)) { if (cameraEffectMaterial != null) { cameraEffectMaterial.SetVector("_ImageDims", new Vector4((float)renderTex.width, (float)renderTex.height, 1.0f / (float)renderTex.width, 1.0f / (float)renderTex.height)); for (int i = 0; i < ceVariables.Count; ++i) { float value = ceVariables[i].value.AsFloat(); cameraEffectMaterial.SetFloat(ceVariables[i].variable, value); } Graphics.Blit(renderTex, screen, cameraEffectMaterial); } else { Graphics.Blit(renderTex, screen); } renderTex.DiscardContents(); } } hudCamera.targetTexture = screen; // MOARdV TODO: I don't think this does anything... GL.Color(Color.white); RPMVesselComputer comp = RPMVesselComputer.Instance(vessel); Quaternion rotationVesselSurface = comp.RotationVesselSurface; if (headingMesh != null) { UpdateHeading(rotationVesselSurface); JUtil.ShowHide(true, headingMesh); } if (ladderMesh != null) { // Fix up UVs, apply rotation. UpdateLadder(rotationVesselSurface, comp); ladderMaterial.SetVector("_CropBound", cropBound); bool enable = (horizonEnable == null || horizonEnable.IsInRange()); JUtil.ShowHide(enable, ladderMesh); } if (overlayMesh != null) { JUtil.ShowHide(true, overlayMesh); } hudCamera.Render(); JUtil.ShowHide(false, overlayMesh, ladderMesh, headingMesh, progradeLadderIcon, progradeHeadingIcon); for (int i = 0; i < verticalBars.Count; ++i) { JUtil.ShowHide(false, verticalBars[i].barObject); } for (int i = 0; i < horizontalBars.Count; ++i) { JUtil.ShowHide(false, horizontalBars[i].barObject); } return(true); }