Skip to content

Commit 6e622d0

Browse files
authored
refactor: cleanup source code and documentation (tabs, UTF-8 BOM, etc) (#574)
1 parent 3f04372 commit 6e622d0

File tree

314 files changed

+20950
-20950
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+20950
-20950
lines changed

AutoGenerateParts/ReadmeFooter.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
1+
22

33
# Post-Cloning Setup on Windows
44

5-
This repository utilizes symbolic links to share code across multiple projects.
6-
On Windows 10 or later, symbolic link creation is restricted by default for regular users,
7-
which can lead to issues when working with this repository.
5+
This repository utilizes symbolic links to share code across multiple projects.
6+
On Windows 10 or later, symbolic link creation is restricted by default for regular users,
7+
which can lead to issues when working with this repository.
88

99
To resolve this, follow the steps below to enable symbolic link creation and configure Git appropriately.
1010

AutoGenerateParts/ReadmeHeader.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Latest official docs
1+
# Latest official docs
22
- [English](https://docs.unity3d.com/Packages/com.unity.toonshader@latest)
33
- [日本語](https://docs.unity3d.com/ja/Packages/com.unity.toonshader@latest)
44

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Contributing
2-
3-
## If you are interested in contributing, here are some ground rules:
4-
* Talk to us before doing the work -- we love contributions, but we might already be working on the same thing, or we might have different opinions on how it should be implemented.
5-
6-
## All contributions are subject to the [Unity Contribution Agreement(UCA)](https://unity3d.com/legal/licenses/Unity_Contribution_Agreement)
7-
By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions.
8-
9-
## Once you have a change ready following these ground rules. Simply make a pull request
1+
# Contributing
2+
3+
## If you are interested in contributing, here are some ground rules:
4+
* Talk to us before doing the work -- we love contributions, but we might already be working on the same thing, or we might have different opinions on how it should be implemented.
5+
6+
## All contributions are subject to the [Unity Contribution Agreement(UCA)](https://unity3d.com/legal/licenses/Unity_Contribution_Agreement)
7+
By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions.
8+
9+
## Once you have a change ready following these ground rules. Simply make a pull request
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Base
22

3-
Running the Base scene you will be able to switch between all scenes in the project in play mode.
3+
Running the Base scene you will be able to switch between all scenes in the project in play mode.
44

ECS_ProjectURP/Assets/SampleScenes/0. Base/SRPBatcherProfiler.cs

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class SRPBatcherProfiler : MonoBehaviour
1212
public bool m_Enable = true;
1313
private const float kAverageStatDuration = 1.0f; // stats refresh each second
1414
private int m_frameCount;
15-
private float m_AccDeltaTime;
15+
private float m_AccDeltaTime;
1616
private string m_statsLabel;
1717
private GUIStyle m_style;
1818
private bool m_oldBatcherEnable;
@@ -26,26 +26,26 @@ internal class RecorderEntry
2626
public Recorder recorder;
2727
};
2828

29-
enum SRPBMarkers
30-
{
31-
kStdRenderDraw,
32-
kStdShadowDraw,
33-
kSRPBRenderDraw,
34-
kSRPBShadowDraw,
35-
kRenderThreadIdle,
36-
kStdRenderApplyShader,
37-
kStdShadowApplyShader,
38-
kSRPBRenderApplyShader,
39-
kSRPBShadowApplyShader,
40-
kPrepareBatchRendererGroupNodes,
29+
enum SRPBMarkers
30+
{
31+
kStdRenderDraw,
32+
kStdShadowDraw,
33+
kSRPBRenderDraw,
34+
kSRPBShadowDraw,
35+
kRenderThreadIdle,
36+
kStdRenderApplyShader,
37+
kStdShadowApplyShader,
38+
kSRPBRenderApplyShader,
39+
kSRPBShadowApplyShader,
40+
kPrepareBatchRendererGroupNodes,
4141
kRenderLoopPrepare,
4242
kRenderLoopSort,
4343
kRenderShadowSort,
4444
};
45-
45+
4646
RecorderEntry[] recordersList =
4747
{
48-
// Warning: Keep that list in the exact same order than SRPBMarkers enum
48+
// Warning: Keep that list in the exact same order than SRPBMarkers enum
4949
new RecorderEntry() { name="RenderLoop.Draw" },
5050
new RecorderEntry() { name="Shadows.Draw" },
5151
new RecorderEntry() { name="RenderLoop.DrawSRPBatcher", oldName="RenderLoopNewBatcher.Draw" },
@@ -68,12 +68,12 @@ void Awake()
6868
var sampler = Sampler.Get(recordersList[i].name);
6969
if (sampler.isValid)
7070
recordersList[i].recorder = sampler.GetRecorder();
71-
else if ( recordersList[i].oldName != null )
72-
{
73-
sampler = Sampler.Get(recordersList[i].oldName);
74-
if (sampler.isValid)
75-
recordersList[i].recorder = sampler.GetRecorder();
76-
}
71+
else if ( recordersList[i].oldName != null )
72+
{
73+
sampler = Sampler.Get(recordersList[i].oldName);
74+
if (sampler.isValid)
75+
recordersList[i].recorder = sampler.GetRecorder();
76+
}
7777
}
7878

7979
m_style =new GUIStyle();
@@ -97,10 +97,10 @@ void RazCounters()
9797

9898
void ResetStats()
9999
{
100-
m_statsLabel = "Gathering data...";
100+
m_statsLabel = "Gathering data...";
101101
RazCounters();
102102
}
103-
103+
104104
void ToggleStats()
105105
{
106106
m_Enable = !m_Enable;
@@ -126,62 +126,62 @@ void Update()
126126
ToggleStats();
127127
}
128128

129-
if (m_Enable)
130-
{
129+
if (m_Enable)
130+
{
131131

132-
bool SRPBatcher = GraphicsSettings.useScriptableRenderPipelineBatching;
132+
bool SRPBatcher = GraphicsSettings.useScriptableRenderPipelineBatching;
133133

134-
m_AccDeltaTime += Time.unscaledDeltaTime;
135-
m_frameCount++;
134+
m_AccDeltaTime += Time.unscaledDeltaTime;
135+
m_frameCount++;
136136

137-
// get timing & update average accumulators
138-
for (int i = 0; i < recordersList.Length; i++)
139-
{
140-
if ( recordersList[i].recorder != null )
141-
{
142-
recordersList[i].accTime += recordersList[i].recorder.elapsedNanoseconds / 1000000.0f; // acc time in ms
143-
recordersList[i].callCount += recordersList[i].recorder.sampleBlockCount;
144-
}
145-
}
137+
// get timing & update average accumulators
138+
for (int i = 0; i < recordersList.Length; i++)
139+
{
140+
if ( recordersList[i].recorder != null )
141+
{
142+
recordersList[i].accTime += recordersList[i].recorder.elapsedNanoseconds / 1000000.0f; // acc time in ms
143+
recordersList[i].callCount += recordersList[i].recorder.sampleBlockCount;
144+
}
145+
}
146146

147-
if (m_AccDeltaTime >= kAverageStatDuration)
148-
{
147+
if (m_AccDeltaTime >= kAverageStatDuration)
148+
{
149149

150-
float ooFrameCount = 1.0f / (float)m_frameCount;
150+
float ooFrameCount = 1.0f / (float)m_frameCount;
151151

152-
float avgStdRender = recordersList[(int)SRPBMarkers.kStdRenderDraw].accTime * ooFrameCount;
153-
float avgStdShadow = recordersList[(int)SRPBMarkers.kStdShadowDraw].accTime * ooFrameCount;
154-
float avgSRPBRender = recordersList[(int)SRPBMarkers.kSRPBRenderDraw].accTime * ooFrameCount;
155-
float avgSRPBShadow = recordersList[(int)SRPBMarkers.kSRPBShadowDraw].accTime * ooFrameCount;
156-
float RTIdleTime = recordersList[(int)SRPBMarkers.kRenderThreadIdle].accTime * ooFrameCount;
157-
float avgPIRPrepareGroupNodes = recordersList[(int)SRPBMarkers.kPrepareBatchRendererGroupNodes].accTime * ooFrameCount;
152+
float avgStdRender = recordersList[(int)SRPBMarkers.kStdRenderDraw].accTime * ooFrameCount;
153+
float avgStdShadow = recordersList[(int)SRPBMarkers.kStdShadowDraw].accTime * ooFrameCount;
154+
float avgSRPBRender = recordersList[(int)SRPBMarkers.kSRPBRenderDraw].accTime * ooFrameCount;
155+
float avgSRPBShadow = recordersList[(int)SRPBMarkers.kSRPBShadowDraw].accTime * ooFrameCount;
156+
float RTIdleTime = recordersList[(int)SRPBMarkers.kRenderThreadIdle].accTime * ooFrameCount;
157+
float avgPIRPrepareGroupNodes = recordersList[(int)SRPBMarkers.kPrepareBatchRendererGroupNodes].accTime * ooFrameCount;
158158

159159
float avgRenderLoopPrepare = recordersList[(int)SRPBMarkers.kRenderLoopPrepare].accTime * ooFrameCount;
160160
float avgRenderLoopSort = recordersList[(int)SRPBMarkers.kRenderLoopSort].accTime * ooFrameCount;
161161
float avgRenderShadowSort = recordersList[(int)SRPBMarkers.kRenderShadowSort].accTime * ooFrameCount;
162162

163-
m_statsLabel = string.Format("Accumulated time for RenderLoop.Draw and ShadowLoop.Draw (all threads)\n{0:F2}ms CPU Rendering time ( incl {1:F2}ms RT idle )\n", avgStdRender + avgStdShadow + avgSRPBRender + avgSRPBShadow + avgPIRPrepareGroupNodes, RTIdleTime);
164-
if (SRPBatcher)
165-
{
166-
m_statsLabel += string.Format(" {0:F2}ms SRP Batcher code path\n", avgSRPBRender + avgSRPBShadow);
167-
m_statsLabel += string.Format(" {0:F2}ms All objects ( {1} ApplyShader calls )\n", avgSRPBRender, recordersList[(int)SRPBMarkers.kSRPBRenderApplyShader].callCount / m_frameCount);
168-
m_statsLabel += string.Format(" {0:F2}ms Shadows ( {1} ApplyShader calls )\n", avgSRPBShadow, recordersList[(int)SRPBMarkers.kSRPBShadowApplyShader].callCount / m_frameCount);
169-
}
170-
m_statsLabel += string.Format(" {0:F2}ms Standard code path\n", avgStdRender + avgStdShadow);
171-
m_statsLabel += string.Format(" {0:F2}ms All objects ( {1} ApplyShader calls )\n", avgStdRender, recordersList[(int)SRPBMarkers.kStdRenderApplyShader].callCount / m_frameCount);
172-
m_statsLabel += string.Format(" {0:F2}ms Shadows ( {1} ApplyShader calls )\n", avgStdShadow, recordersList[(int)SRPBMarkers.kStdShadowApplyShader].callCount / m_frameCount);
173-
m_statsLabel += string.Format(" {0:F2}ms PIR Prepare Group Nodes ( {1} calls )\n", avgPIRPrepareGroupNodes, recordersList[(int)SRPBMarkers.kPrepareBatchRendererGroupNodes].callCount / m_frameCount);
174-
m_statsLabel += string.Format("Global Main Loop: {0:F2}ms ({1} FPS)\n", m_AccDeltaTime * 1000.0f * ooFrameCount, (int)(((float)m_frameCount) / m_AccDeltaTime));
163+
m_statsLabel = string.Format("Accumulated time for RenderLoop.Draw and ShadowLoop.Draw (all threads)\n{0:F2}ms CPU Rendering time ( incl {1:F2}ms RT idle )\n", avgStdRender + avgStdShadow + avgSRPBRender + avgSRPBShadow + avgPIRPrepareGroupNodes, RTIdleTime);
164+
if (SRPBatcher)
165+
{
166+
m_statsLabel += string.Format(" {0:F2}ms SRP Batcher code path\n", avgSRPBRender + avgSRPBShadow);
167+
m_statsLabel += string.Format(" {0:F2}ms All objects ( {1} ApplyShader calls )\n", avgSRPBRender, recordersList[(int)SRPBMarkers.kSRPBRenderApplyShader].callCount / m_frameCount);
168+
m_statsLabel += string.Format(" {0:F2}ms Shadows ( {1} ApplyShader calls )\n", avgSRPBShadow, recordersList[(int)SRPBMarkers.kSRPBShadowApplyShader].callCount / m_frameCount);
169+
}
170+
m_statsLabel += string.Format(" {0:F2}ms Standard code path\n", avgStdRender + avgStdShadow);
171+
m_statsLabel += string.Format(" {0:F2}ms All objects ( {1} ApplyShader calls )\n", avgStdRender, recordersList[(int)SRPBMarkers.kStdRenderApplyShader].callCount / m_frameCount);
172+
m_statsLabel += string.Format(" {0:F2}ms Shadows ( {1} ApplyShader calls )\n", avgStdShadow, recordersList[(int)SRPBMarkers.kStdShadowApplyShader].callCount / m_frameCount);
173+
m_statsLabel += string.Format(" {0:F2}ms PIR Prepare Group Nodes ( {1} calls )\n", avgPIRPrepareGroupNodes, recordersList[(int)SRPBMarkers.kPrepareBatchRendererGroupNodes].callCount / m_frameCount);
174+
m_statsLabel += string.Format("Global Main Loop: {0:F2}ms ({1} FPS)\n", m_AccDeltaTime * 1000.0f * ooFrameCount, (int)(((float)m_frameCount) / m_AccDeltaTime));
175175

176176
m_statsLabel += string.Format(" {0:F2}ms RenderLoop Prepare ( {1} calls )\n", avgRenderLoopPrepare, recordersList[(int)SRPBMarkers.kRenderLoopPrepare].callCount / m_frameCount);
177177
m_statsLabel += string.Format(" {0:F2}ms RenderLoop Sort ( {1} calls )\n", avgRenderLoopSort, recordersList[(int)SRPBMarkers.kRenderLoopSort].callCount / m_frameCount);
178178
m_statsLabel += string.Format(" {0:F2}ms Shadow Sort ( {1} calls )\n", avgRenderShadowSort, recordersList[(int)SRPBMarkers.kRenderShadowSort].callCount / m_frameCount);
179179

180180

181181
RazCounters();
182-
}
182+
}
183183

184-
}
184+
}
185185
}
186186

187187
void OnGUI()

ECS_ProjectURP/Assets/SampleScenes/0. Base/SimpleCameraController.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using UnityEngine;
1+
using UnityEngine;
22

33
namespace UnityTemplateProjects
44
{
@@ -37,7 +37,7 @@ public void LerpTowards(CameraState target, float positionLerpPct, float rotatio
3737
yaw = Mathf.Lerp(yaw, target.yaw, rotationLerpPct);
3838
pitch = Mathf.Lerp(pitch, target.pitch, rotationLerpPct);
3939
roll = Mathf.Lerp(roll, target.roll, rotationLerpPct);
40-
40+
4141
x = Mathf.Lerp(x, target.x, positionLerpPct);
4242
y = Mathf.Lerp(y, target.y, positionLerpPct);
4343
z = Mathf.Lerp(z, target.z, positionLerpPct);
@@ -49,7 +49,7 @@ public void UpdateTransform(Transform t)
4949
t.position = new Vector3(x, y, z);
5050
}
5151
}
52-
52+
5353
CameraState m_TargetCameraState = new CameraState();
5454
CameraState m_InterpolatingCameraState = new CameraState();
5555

@@ -105,17 +105,17 @@ Vector3 GetInputTranslationDirection()
105105
}
106106
return direction;
107107
}
108-
108+
109109
void Update()
110110
{
111-
// Exit Sample
111+
// Exit Sample
112112

113113
if (Input.GetKey(KeyCode.Escape))
114114
{
115115
Application.Quit();
116-
#if UNITY_EDITOR
117-
UnityEditor.EditorApplication.isPlaying = false;
118-
#endif
116+
#if UNITY_EDITOR
117+
UnityEditor.EditorApplication.isPlaying = false;
118+
#endif
119119
}
120120
// Hide and lock cursor when right mouse button pressed
121121
if (Input.GetMouseButtonDown(1))
@@ -134,13 +134,13 @@ void Update()
134134
if (Input.GetMouseButton(1))
135135
{
136136
var mouseMovement = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1));
137-
137+
138138
var mouseSensitivityFactor = mouseSensitivityCurve.Evaluate(mouseMovement.magnitude);
139139

140140
m_TargetCameraState.yaw += mouseMovement.x * mouseSensitivityFactor;
141141
m_TargetCameraState.pitch += mouseMovement.y * mouseSensitivityFactor;
142142
}
143-
143+
144144
// Translation
145145
var translation = GetInputTranslationDirection() * Time.deltaTime;
146146

@@ -149,7 +149,7 @@ void Update()
149149
{
150150
translation *= 10.0f;
151151
}
152-
152+
153153
// Modify movement by a boost factor (defined in Inspector and modified in play mode through the mouse scroll wheel)
154154
boost += Input.mouseScrollDelta.y * 0.2f;
155155
translation *= Mathf.Pow(2.0f, boost);

ECS_ProjectURP/Assets/SampleScenes/0. Base/SimpleSceneSwitch.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void Start()
2525
}
2626

2727
void Update()
28-
{
28+
{
2929
if(useInputButton)
3030
{
3131
if (Input.GetButtonDown("Fire1"))
@@ -47,7 +47,7 @@ void OnGUI()
4747
customButton = new GUIStyle("button");
4848
customButton.fontSize = GUI.skin.label.fontSize;
4949
}
50-
50+
5151
GUI.skin.label.fontSize = Mathf.RoundToInt ( 16 * scale );
5252
GUI.color = new Color(1, 1, 1, 1);
5353
float w = 410 * scale;
@@ -111,7 +111,7 @@ public void SwitchScene(int loadIndex)
111111
bool isSubscene = entityManager.HasComponent<SubScene>(entities[i]);
112112
bool isSceneSection = entityManager.HasComponent<SceneSection>(entities[i]);
113113

114-
//Runtime generated entities requires manual deletion,
114+
//Runtime generated entities requires manual deletion,
115115
//but we need to skip for some specific entities otherwise there will be spamming error
116116
if( ename != "SceneSectionStreamingSingleton" && !isSubscene && !isSceneSection && !ename.Contains("GameObject Scene:") )
117117
{

ECS_ProjectURP/Assets/SampleScenes/3. Hybrid components/HybridEntitiesConversion/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The scene contains a Subscene in which there are Lights, Volumes, and other obje
1212

1313
1. In the Hierarchy, select the Subscene
1414
2. In the Inspector, click Open
15-
3. In the Hierarchy, see the objects in the Subscene. Note that URP needs to be configured to use the Forward+ rendering mode in order to see **point**, **spot** and **area** lights with Entities Graphics.
15+
3. In the Hierarchy, see the objects in the Subscene. Note that URP needs to be configured to use the Forward+ rendering mode in order to see **point**, **spot** and **area** lights with Entities Graphics.
1616

1717
## More information
1818

ECS_ProjectURP/Assets/SampleScenes/3. Hybrid components/TriggerParticles/SceneAssets/JumpingSpherePSTagAuthoring.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Unity.Entities;
1+
using Unity.Entities;
22
using UnityEngine;
33

44
public struct JumpingSpherePSTag : IComponentData

ECS_ProjectURP/Assets/SampleScenes/3. Hybrid components/TriggerParticles/SceneAssets/JumpingSphereTagAuthoring.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Unity.Entities;
1+
using Unity.Entities;
22
using UnityEngine;
33

44
public struct JumpingSphereTag : IComponentData

0 commit comments

Comments
 (0)