137 lines
3.5 KiB
C#
137 lines
3.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
|
|
// Token: 0x0200005E RID: 94
|
|
[ExecuteInEditMode]
|
|
public class CameraParams : MonoBehaviour
|
|
{
|
|
// Token: 0x06000B48 RID: 2888 RVA: 0x000DD544 File Offset: 0x000DB744
|
|
private void Start()
|
|
{
|
|
this.SetParams();
|
|
if (this.meshRenderer)
|
|
{
|
|
this.meshRenderer.shadowCastingMode = ShadowCastingMode.Off;
|
|
this.meshRenderer.receiveShadows = false;
|
|
if (this.meshRenderer && this.meshRenderer.sharedMaterial)
|
|
{
|
|
this.bakedShadows = this.meshRenderer.sharedMaterial.GetTexture("_ShadowsTex");
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000B49 RID: 2889 RVA: 0x000DD5B6 File Offset: 0x000DB7B6
|
|
private void OnEnable()
|
|
{
|
|
this.SetParams();
|
|
}
|
|
|
|
// Token: 0x06000B4A RID: 2890 RVA: 0x000DD5BE File Offset: 0x000DB7BE
|
|
private void Update()
|
|
{
|
|
this.SetParams();
|
|
}
|
|
|
|
// Token: 0x06000B4B RID: 2891 RVA: 0x000DD5C8 File Offset: 0x000DB7C8
|
|
public void SetParams()
|
|
{
|
|
if (this.cam)
|
|
{
|
|
this.sceneMatrix = this.cam.cameraToWorldMatrix;
|
|
if (this.meshRenderer && this.meshRenderer.sharedMaterial)
|
|
{
|
|
this.meshRenderer.sharedMaterial.SetMatrix("_Scene_CamToWorld", this.sceneMatrix);
|
|
this.projMatrix = GL.GetGPUProjectionMatrix(this.cam.projectionMatrix, true) * this.cam.worldToCameraMatrix;
|
|
this.meshRenderer.sharedMaterial.SetMatrix("_Scene_CameraProjectionMatrix", this.projMatrix);
|
|
if (this.shadowParams)
|
|
{
|
|
this.meshRenderer.sharedMaterial.SetMatrix("_Scene_ShadowMatrix_", this.shadowParams.shadowMatrixMorning);
|
|
}
|
|
else
|
|
{
|
|
this.meshRenderer.sharedMaterial.SetMatrix("_Scene_ShadowMatrix_", this.shadowMatrixMorning);
|
|
}
|
|
float num = 1f;
|
|
this.projParams = new Vector4(num, this.cam.nearClipPlane, this.cam.farClipPlane, 1f / this.cam.farClipPlane);
|
|
this.meshRenderer.sharedMaterial.SetVector("_Scene_ProjectionParams", this.projParams);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x04001048 RID: 4168
|
|
[Header("CAMERA VARIABLES")]
|
|
public Matrix4x4 projMatrix;
|
|
|
|
// Token: 0x04001049 RID: 4169
|
|
public Matrix4x4 sceneMatrix;
|
|
|
|
// Token: 0x0400104A RID: 4170
|
|
public Vector4 projParams;
|
|
|
|
// Token: 0x0400104B RID: 4171
|
|
public Matrix4x4 shadowMatrixMorning;
|
|
|
|
// Token: 0x0400104C RID: 4172
|
|
public Matrix4x4 shadowMatrixAfternoon;
|
|
|
|
// Token: 0x0400104D RID: 4173
|
|
public Matrix4x4 shadowMatrixEvening;
|
|
|
|
// Token: 0x0400104E RID: 4174
|
|
public Matrix4x4 shadowMatrixNight;
|
|
|
|
// Token: 0x0400104F RID: 4175
|
|
public Matrix4x4 shadowMatrixIndoor;
|
|
|
|
// Token: 0x04001050 RID: 4176
|
|
public Texture2D shadowsMorning;
|
|
|
|
// Token: 0x04001051 RID: 4177
|
|
public Texture2D shadowsAfternoon;
|
|
|
|
// Token: 0x04001052 RID: 4178
|
|
public Texture2D shadowsEvening;
|
|
|
|
// Token: 0x04001053 RID: 4179
|
|
public Texture2D shadowsNight;
|
|
|
|
// Token: 0x04001054 RID: 4180
|
|
public Texture2D shadowsIndoors;
|
|
|
|
// Token: 0x04001055 RID: 4181
|
|
public Texture bakedShadows;
|
|
|
|
// Token: 0x04001056 RID: 4182
|
|
public Texture2D pointLightShadow1;
|
|
|
|
// Token: 0x04001057 RID: 4183
|
|
public Texture2D pointLightShadow2;
|
|
|
|
// Token: 0x04001058 RID: 4184
|
|
public Texture2D pointLightShadow3;
|
|
|
|
// Token: 0x04001059 RID: 4185
|
|
public Texture2D pointLightShadow4;
|
|
|
|
// Token: 0x0400105A RID: 4186
|
|
public Texture2D pointLightShadow5;
|
|
|
|
// Token: 0x0400105B RID: 4187
|
|
public Texture2D pointLightShadow6;
|
|
|
|
// Token: 0x0400105C RID: 4188
|
|
public Vector3 center;
|
|
|
|
// Token: 0x0400105D RID: 4189
|
|
[Header("RENDERER")]
|
|
public MeshRenderer meshRenderer;
|
|
|
|
// Token: 0x0400105E RID: 4190
|
|
[Header("CAMERA")]
|
|
public Camera cam;
|
|
|
|
// Token: 0x0400105F RID: 4191
|
|
public CameraParams shadowParams;
|
|
}
|