Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
RenderCamUpscaler.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEngine.UI;
3
4public class RenderCamUpscaler : MonoBehaviour, IChangeResolution
5{
7
8 public RenderTexture renderTex;
9
10 public RawImage image;
11
12 public bool active;
13
14 private void Awake()
15 {
16 Instance = this;
17 }
18
19 public void SetEnable(bool enable)
20 {
21 bool flag2 = (image.enabled = enable);
22 active = flag2;
23 if (active)
24 {
26 return;
27 }
28 if ((bool)renderTex)
29 {
30 renderTex.Release();
31 }
32 Camera.main.targetTexture = null;
33 }
34
35 public void OnChangeResolution()
36 {
37 if (active)
38 {
39 int num = Screen.width / 2;
40 int num2 = Screen.height / 2;
41 if (!renderTex || num != renderTex.width || num2 != renderTex.height)
42 {
43 CreateTex(num, num2);
44 }
45 image.Rect().sizeDelta = new Vector2(num * 2, num2 * 2);
46 }
47 }
48
49 public void CreateTex(int w, int h)
50 {
51 if ((bool)renderTex)
52 {
53 renderTex.Release();
54 }
55 renderTex = new RenderTexture(w, h, 32);
56 image.texture = renderTex;
57 renderTex.filterMode = FilterMode.Point;
58 Camera.main.targetTexture = renderTex;
59 }
60}
static RenderCamUpscaler Instance
void CreateTex(int w, int h)
RenderTexture renderTex
void SetEnable(bool enable)