Skip to content

Commit

Permalink
Fix #84: deactivate the heading and overlay objects so the normal cam…
Browse files Browse the repository at this point in the history
…era doesn't render them
  • Loading branch information
JonnyOThan committed Feb 15, 2023
1 parent 01bf605 commit e425008
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions RasterPropMonitor/Handlers/JSIPrimaryFlightDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ private void ConfigureElements(float screenWidth, float screenHeight)
overlay.layer = drawingLayer;
overlay.transform.position = new Vector3(0, 0, overlayDepth);
overlay.GetComponent<Renderer>().material = overlayMaterial;

overlay.SetActive(false);
}

if (!string.IsNullOrEmpty(headingBar))
Expand All @@ -178,6 +180,8 @@ private void ConfigureElements(float screenWidth, float screenHeight)
Renderer hdgMatl = null;
heading.GetComponentCached<Renderer>(ref hdgMatl).material = headingMaterial;
hdgMatl.material.SetTextureScale("_MainTex", new Vector2(headingSpan, 1f));

heading.SetActive(false);
}

Texture2D gizmoTexture = JUtil.GetGizmoTexture();
Expand Down Expand Up @@ -367,6 +371,11 @@ public bool RenderPFD(RenderTexture screen, float aspect)
overlayMaterial.SetPass(0);
Graphics.DrawMeshNow(overlayMesh, overlay.transform.localToWorldMatrix);

var headingMesh = heading.GetComponent<MeshFilter>().mesh;
var headingMaterial = heading.GetComponent<MeshRenderer>().material;
headingMaterial.SetPass(0);
Graphics.DrawMeshNow(headingMesh, heading.transform.localToWorldMatrix);

GL.PopMatrix();

return true;
Expand Down Expand Up @@ -506,6 +515,8 @@ public void Start()
}

navBall.GetComponent<Renderer>().material.SetFloat("_Opacity", ballOpacity);

navBall.SetActive(false);

startupComplete = true;
}
Expand Down

0 comments on commit e425008

Please sign in to comment.