Skip to content

Commit 08fdf74

Browse files
committed
Command buffer and shader values are only updated when modified. No longer sets the camera depth/motion vectors flags, which were leftover from old tests. Also made orthographic projection support optional, as it's unnecessary for most users.
1 parent 97c564f commit 08fdf74

File tree

14 files changed

+121
-208
lines changed

14 files changed

+121
-208
lines changed

Assets/PCSS/Demo/Demo Assets/Palm/palm1.obj.meta

Lines changed: 0 additions & 139 deletions
This file was deleted.
0 Bytes
Binary file not shown.
52 Bytes
Binary file not shown.

Assets/PCSS/Demo/Demo Assets/Scripts/PCSSDemo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,21 @@ public void SetBlockerSamples (float samplesFloat)
3636
int samples = Mathf.RoundToInt(samplesFloat);
3737
pcssScript.Blocker_SampleCount = samples;
3838
blockerText.text = string.Format("Blocker Samples: {0}", samples);
39+
pcssScript.UpdateShaderValues();
3940
}
4041

4142
public void SetPCFSamples (float samplesFloat)
4243
{
4344
int samples = Mathf.RoundToInt(samplesFloat);
4445
pcssScript.PCF_SampleCount = samples;
4546
pcfText.text = string.Format("PCF Samples: {0}", samples);
47+
pcssScript.UpdateShaderValues();
4648
}
4749

4850
public void SetSoftness (float softness)
4951
{
5052
pcssScript.Softness = softness;
5153
softnessText.text = string.Format("Softness: {0}", softness.ToString("N2"));
54+
pcssScript.UpdateShaderValues();
5255
}
5356
}

Assets/PCSS/Demo/Demo Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/FirstPersonController.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,6 @@ private void GetInput(out float speed)
236236

237237
private void RotateView()
238238
{
239-
if (Cursor.visible)
240-
return;
241-
242239
m_MouseLook.LookRotation (transform, m_Camera.transform);
243240
}
244241

Assets/PCSS/Demo/Demo Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/MouseLook.cs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,26 @@ public void LookRotation(Transform character, Transform camera)
3434
float yRot = CrossPlatformInputManager.GetAxis("Mouse X") * XSensitivity;
3535
float xRot = CrossPlatformInputManager.GetAxis("Mouse Y") * YSensitivity;
3636

37-
m_CharacterTargetRot *= Quaternion.Euler (0f, yRot, 0f);
38-
m_CameraTargetRot *= Quaternion.Euler (-xRot, 0f, 0f);
39-
40-
if(clampVerticalRotation)
41-
m_CameraTargetRot = ClampRotationAroundXAxis (m_CameraTargetRot);
42-
43-
if(smooth)
44-
{
45-
character.localRotation = Quaternion.Slerp (character.localRotation, m_CharacterTargetRot,
46-
smoothTime * Time.deltaTime);
47-
camera.localRotation = Quaternion.Slerp (camera.localRotation, m_CameraTargetRot,
48-
smoothTime * Time.deltaTime);
49-
}
50-
else
37+
if (!Cursor.visible)
5138
{
52-
character.localRotation = m_CharacterTargetRot;
53-
camera.localRotation = m_CameraTargetRot;
39+
m_CharacterTargetRot *= Quaternion.Euler(0f, yRot, 0f);
40+
m_CameraTargetRot *= Quaternion.Euler(-xRot, 0f, 0f);
41+
42+
if (clampVerticalRotation)
43+
m_CameraTargetRot = ClampRotationAroundXAxis(m_CameraTargetRot);
44+
45+
if (smooth)
46+
{
47+
character.localRotation = Quaternion.Slerp(character.localRotation, m_CharacterTargetRot,
48+
smoothTime * Time.deltaTime);
49+
camera.localRotation = Quaternion.Slerp(camera.localRotation, m_CameraTargetRot,
50+
smoothTime * Time.deltaTime);
51+
}
52+
else
53+
{
54+
character.localRotation = m_CharacterTargetRot;
55+
camera.localRotation = m_CameraTargetRot;
56+
}
5457
}
5558

5659
UpdateCursorLock();
@@ -69,7 +72,7 @@ public void SetCursorLock(bool value)
6972
public void UpdateCursorLock()
7073
{
7174
//if the user set "lockCursor" we check & properly lock the cursos
72-
if (lockCursor)
75+
//if (lockCursor)
7376
InternalLockUpdate();
7477
}
7578

Assets/PCSS/Demo/PCSS Demo.unity

3.58 KB
Binary file not shown.

Assets/PCSS/Scripts/Editor.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor;
5+
6+
[CustomEditor(typeof(PCSSLight))]
7+
public class PCSSLightInspector : Editor
8+
{
9+
public override void OnInspectorGUI ()
10+
{
11+
PCSSLight script = target as PCSSLight;
12+
13+
EditorGUI.BeginChangeCheck();
14+
base.OnInspectorGUI();
15+
if(EditorGUI.EndChangeCheck())
16+
{
17+
script.UpdateShaderValues();
18+
}
19+
}
20+
}

Assets/PCSS/Scripts/Editor/PCSSLightInspector.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)