Skip to content

Commit e425008

Browse files
committed
Fix #84: deactivate the heading and overlay objects so the normal camera doesn't render them
1 parent 01bf605 commit e425008

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

RasterPropMonitor/Handlers/JSIPrimaryFlightDisplay.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ private void ConfigureElements(float screenWidth, float screenHeight)
163163
overlay.layer = drawingLayer;
164164
overlay.transform.position = new Vector3(0, 0, overlayDepth);
165165
overlay.GetComponent<Renderer>().material = overlayMaterial;
166+
167+
overlay.SetActive(false);
166168
}
167169

168170
if (!string.IsNullOrEmpty(headingBar))
@@ -178,6 +180,8 @@ private void ConfigureElements(float screenWidth, float screenHeight)
178180
Renderer hdgMatl = null;
179181
heading.GetComponentCached<Renderer>(ref hdgMatl).material = headingMaterial;
180182
hdgMatl.material.SetTextureScale("_MainTex", new Vector2(headingSpan, 1f));
183+
184+
heading.SetActive(false);
181185
}
182186

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

374+
var headingMesh = heading.GetComponent<MeshFilter>().mesh;
375+
var headingMaterial = heading.GetComponent<MeshRenderer>().material;
376+
headingMaterial.SetPass(0);
377+
Graphics.DrawMeshNow(headingMesh, heading.transform.localToWorldMatrix);
378+
370379
GL.PopMatrix();
371380

372381
return true;
@@ -506,6 +515,8 @@ public void Start()
506515
}
507516

508517
navBall.GetComponent<Renderer>().material.SetFloat("_Opacity", ballOpacity);
518+
519+
navBall.SetActive(false);
509520

510521
startupComplete = true;
511522
}

0 commit comments

Comments
 (0)