浏览代码

Runned auto format tool.

/main
Felipe Lira 7 年前
当前提交
fa504521
共有 24 个文件被更改,包括 55 次插入53 次删除
  1. 4
      ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs
  2. 2
      ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineResource.cs
  3. 8
      ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightAssetEditor.cs
  4. 2
      ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightCameraEditor.cs
  5. 6
      ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightLightEditor.cs
  6. 4
      ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightShaderGUI.cs
  7. 8
      ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardGUI.cs
  8. 2
      ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardParticlesShaderGUI.cs
  9. 3
      ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardSimpleLightingGUI.cs
  10. 4
      ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightUnlitGUI.cs
  11. 2
      ScriptableRenderPipeline/LightweightPipeline/LightweightConstantBuffer.cs
  12. 20
      ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs
  13. 16
      ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineUtils.cs
  14. 6
      ScriptableRenderPipeline/LightweightPipeline/LightweightShaderUtils.cs
  15. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightBlit.shader
  16. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCopyDepth.shader
  17. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightInput.cginc
  18. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightLighting.cginc
  19. 3
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandard.shader
  20. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticles.shader
  21. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticlesUnlit.shader
  22. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardTerrain.shader
  23. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightSurfaceInput.cginc
  24. 2
      ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader

4
ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineAsset.cs


instance.m_CopyDepthShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_DEPTH_COPY));
string assetPath = UnityEditor.EditorUtility.SaveFilePanelInProject("Save Lightweight Asset", "LightweightAsset", "asset",
"Please enter a file name to save the asset to");
"Please enter a file name to save the asset to");
#endif
protected override IRenderPipeline InternalCreatePipeline()

{
return null;
}
public override Shader GetDefaultShader()
{
return m_DefaultShader;

2
ScriptableRenderPipeline/LightweightPipeline/Data/LightweightPipelineResource.cs


using UnityEngine;
using UnityEngine;
public class LightweightPipelineResource : ScriptableObject
{

8
ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightAssetEditor.cs


"Number of cascades used in directional lights shadows");
public static GUIContent shadowCascadeSplit = new GUIContent("Cascades Split",
"Percentages to split shadow volume");
"Percentages to split shadow volume");
"Material to use when creating 3D objects");
"Material to use when creating 3D objects");
"Material to use when creating Particle Systems");
"Material to use when creating Particle Systems");
"Material to use in Terrains");
"Material to use in Terrains");
public static GUIContent msaaContent = new GUIContent("Anti Aliasing (MSAA)", "Controls the global anti aliasing settings.");

2
ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightCameraEditor.cs


using System;
using System;
using UnityEditor.AnimatedValues;
using UnityEngine;
using UnityEngine.Rendering;

6
ScriptableRenderPipeline/LightweightPipeline/Editor/LightweightLightEditor.cs


using UnityEditor.AnimatedValues;
using UnityEditor.AnimatedValues;
using UnityEngine;
using UnityEngine.Experimental.Rendering.LightweightPipeline;

get
{
return TypeIsSame && LightProperty.type == LightType.Point &&
ShadowTypeIsSame && IsShadowEnabled &&
LightmappingTypeIsSame && !settings.isCompletelyBaked;
ShadowTypeIsSame && IsShadowEnabled &&
LightmappingTypeIsSame && !settings.isCompletelyBaked;
}
}

4
ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightShaderGUI.cs


using UnityEditor;
using UnityEditor;
using UnityEngine;
public abstract class LightweightShaderGUI : ShaderGUI

public static void SetupMaterialBlendMode(Material material)
{
BlendMode blendMode = (BlendMode) material.GetFloat("_Mode");
BlendMode blendMode = (BlendMode)material.GetFloat("_Mode");
switch (blendMode)
{
case BlendMode.Opaque:

8
ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardGUI.cs


using System;
using System;
using UnityEngine;
using UnityEngine.Experimental.Rendering;

if (oldShader.name.Equals("Standard (Specular setup)"))
{
material.SetFloat("_WorkflowMode", (float) WorkflowMode.Specular);
material.SetFloat("_WorkflowMode", (float)WorkflowMode.Specular);
Texture texture = material.GetTexture("_SpecGlossMap");
if (texture != null)
material.SetTexture("_MetallicSpecGlossMap", texture);

material.SetFloat("_WorkflowMode", (float) WorkflowMode.Metallic);
material.SetFloat("_WorkflowMode", (float)WorkflowMode.Metallic);
Texture texture = material.GetTexture("_MetallicGlossMap");
if (texture != null)
material.SetTexture("_MetallicSpecGlossMap", texture);

{
string[] metallicSpecSmoothnessChannelName;
bool hasGlossMap = false;
if ((WorkflowMode) workflowMode.floatValue == WorkflowMode.Metallic)
if ((WorkflowMode)workflowMode.floatValue == WorkflowMode.Metallic)
{
hasGlossMap = metallicGlossMap.textureValue != null;
metallicSpecSmoothnessChannelName = Styles.metallicSmoothnessChannelNames;

2
ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardParticlesShaderGUI.cs


using System;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

3
ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightStandardSimpleLightingGUI.cs


int glossSource = (int)glossinessSourceProp.floatValue;
m_MaterialEditor.TexturePropertySingleLine(Styles.albedoGlosinessLabels[glossSource], albedoMapProp,
albedoColorProp);
m_MaterialEditor.TextureScaleOffsetProperty(albedoMapProp);}
m_MaterialEditor.TextureScaleOffsetProperty(albedoMapProp);
}
else
{
m_MaterialEditor.TexturePropertySingleLine(Styles.albedoAlphaLabel, albedoMapProp, albedoColorProp);

4
ScriptableRenderPipeline/LightweightPipeline/Editor/ShaderGUI/LightweightUnlitGUI.cs


EditorGUI.BeginChangeCheck();
{
DoPopup(Styles.renderingModeLabel, blendModeProp, Styles.blendNames);
int modeValue = (int) blendModeProp.floatValue;
int modeValue = (int)blendModeProp.floatValue;
if ((UpgradeBlendMode) modeValue == UpgradeBlendMode.Cutout)
if ((UpgradeBlendMode)modeValue == UpgradeBlendMode.Cutout)
m_MaterialEditor.RangeProperty(alphaCutoffProp, Styles.alphaCutoffLabel);
EditorGUILayout.Space();

2
ScriptableRenderPipeline/LightweightPipeline/LightweightConstantBuffer.cs


using UnityEngine;
using UnityEngine;
namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{

20
ScriptableRenderPipeline/LightweightPipeline/LightweightPipeline.cs


continue;
cullingParameters.shadowDistance = Mathf.Min(m_ShadowSettings.maxShadowDistance,
m_CurrCamera.farClipPlane);
m_CurrCamera.farClipPlane);
#if UNITY_EDITOR
// Emit scene view UI

// If no additional lights then no light sorting is performed and the indices match.
int shadowOriginalIndex = (lightData.totalAdditionalLightsCount > 0) ? GetLightUnsortedIndex(lightData.mainLightIndex) : lightData.mainLightIndex;
lightData.shadowsRendered = RenderShadows(ref m_CullResults, ref mainLight,
shadowOriginalIndex, ref context);
shadowOriginalIndex, ref context);
}
}
}

m_IntermediateTextureArray = false;
bool intermediateTexture = m_CurrCamera.targetTexture != null || m_CurrCamera.cameraType == CameraType.SceneView ||
m_Asset.RenderScale < 1.0f || m_CurrCamera.allowHDR;
m_Asset.RenderScale < 1.0f || m_CurrCamera.allowHDR;
m_ColorFormat = m_CurrCamera.allowHDR ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.ARGB32;
m_RequiredDepth = false;

// We do it by settings the perObjectLightIndexMap to the appropriate additionalLightIndex.
perObjectLightIndexMap[GetLightUnsortedIndex(i)] = additionalLightIndex;
InitializeLightConstants(lights, i, out m_LightPositions[additionalLightIndex],
out m_LightColors[additionalLightIndex],
out m_LightDistanceAttenuations[additionalLightIndex],
out m_LightSpotDirections[additionalLightIndex],
out m_LightSpotAttenuations[additionalLightIndex]);
out m_LightColors[additionalLightIndex],
out m_LightDistanceAttenuations[additionalLightIndex],
out m_LightSpotDirections[additionalLightIndex],
out m_LightSpotAttenuations[additionalLightIndex]);
additionalLightIndex++;
}
}

lightData.totalAdditionalLightsCount, 0.0f, 0.0f));
lightData.totalAdditionalLightsCount, 0.0f, 0.0f));
cmd.SetGlobalVectorArray(PerCameraBuffer._AdditionalLightPosition, m_LightPositions);
cmd.SetGlobalVectorArray(PerCameraBuffer._AdditionalLightColor, m_LightColors);
cmd.SetGlobalVectorArray(PerCameraBuffer._AdditionalLightDistanceAttenuation, m_LightDistanceAttenuations);

cmd.SetGlobalVectorArray("_DirShadowSplitSpheres", m_DirectionalShadowSplitDistances);
cmd.SetGlobalVector("_ShadowData", new Vector4(strength, bias, normalBias, nearPlane));
cmd.SetGlobalVector("_ShadowOffset0", new Vector4(-invShadowResolution, -invShadowResolution, 0.0f, 0.0f));
cmd.SetGlobalVector("_ShadowOffset1", new Vector4( invShadowResolution, -invShadowResolution, 0.0f, 0.0f));
cmd.SetGlobalVector("_ShadowOffset1", new Vector4(invShadowResolution, -invShadowResolution, 0.0f, 0.0f));
cmd.SetGlobalVector("_ShadowOffset3", new Vector4( invShadowResolution, invShadowResolution, 0.0f, 0.0f));
cmd.SetGlobalVector("_ShadowOffset3", new Vector4(invShadowResolution, invShadowResolution, 0.0f, 0.0f));
}
private void SetShaderKeywords(CommandBuffer cmd, ref LightData lightData, VisibleLight[] visibleLights)

16
ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineUtils.cs


using System;
using System;
using System.Collections.Generic;
using UnityEngine.Rendering;

// Punctual lights are sorted per-object by the engine based on distance to object center + luminance
// Here we sort globally the light list per camera distance to fit the closest lights in the global light buffer
// Check MAX_VISIBLE_LIGHTS in the LightweightLighting.cginc to see the max global buffer list size
int lhsDistance = (int) (SquaredDistanceToCamera(lhsLight.transform.position)*100.0f);
int rhsDistance = (int) (SquaredDistanceToCamera(rhsLight.transform.position)*100.0f);
int lhsDistance = (int)(SquaredDistanceToCamera(lhsLight.transform.position) * 100.0f);
int rhsDistance = (int)(SquaredDistanceToCamera(rhsLight.transform.position) * 100.0f);
int result = lhsDistance - rhsDistance;
return result;
}

if (light.lightType == LightType.Directional)
{
float scale = 1.0f/light.light.cookieSize;
float scale = 1.0f / light.light.cookieSize;
cookieMatrix.SetRow(0, new Vector4(row0.x*scale, row0.y*scale, row0.z*scale, row0.w*scale + 0.5f));
cookieMatrix.SetRow(1, new Vector4(row1.x*scale, row1.y*scale, row1.z*scale, row1.w*scale + 0.5f));
cookieMatrix.SetRow(0, new Vector4(row0.x * scale, row0.y * scale, row0.z * scale, row0.w * scale + 0.5f));
cookieMatrix.SetRow(1, new Vector4(row1.x * scale, row1.y * scale, row1.z * scale, row1.w * scale + 0.5f));
}
else if (light.lightType == LightType.Spot)
{

{
new Vector3(-1.0f, -1.0f, 0.0f),
new Vector3(-1.0f, 1.0f, 0.0f),
new Vector3( 1.0f, -1.0f, 0.0f),
new Vector3( 1.0f, 1.0f, 0.0f)
new Vector3(1.0f, -1.0f, 0.0f),
new Vector3(1.0f, 1.0f, 0.0f)
};
mesh.uv = new Vector2[]

6
ScriptableRenderPipeline/LightweightPipeline/LightweightShaderUtils.cs


namespace UnityEngine.Experimental.Rendering.LightweightPipeline
namespace UnityEngine.Experimental.Rendering.LightweightPipeline
{
public enum ShaderPathID
{

public static string GetShaderPath(ShaderPathID id)
{
int index = (int) id;
if (index < 0 && index >= (int) ShaderPathID.SHADER_PATH_COUNT)
int index = (int)id;
if (index < 0 && index >= (int)ShaderPathID.SHADER_PATH_COUNT)
{
Debug.LogError("Trying to access lightweight shader path out of bounds");
return "";

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightBlit.shader


Shader "Hidden/LightweightPipeline/Blit"
Shader "Hidden/LightweightPipeline/Blit"
{
SubShader
{

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightCopyDepth.shader


Shader "Hidden/LightweightPipeline/CopyDepth"
Shader "Hidden/LightweightPipeline/CopyDepth"
{
SubShader
{

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightInput.cginc


#ifndef LIGHTWEIGHT_INPUT_INCLUDED
#ifndef LIGHTWEIGHT_INPUT_INCLUDED
#define LIGHTWEIGHT_INPUT_INCLUDED
#define MAX_VISIBLE_LIGHTS 16

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightLighting.cginc


#ifndef LIGHTWEIGHT_LIGHTING_INCLUDED
#ifndef LIGHTWEIGHT_LIGHTING_INCLUDED
#define LIGHTWEIGHT_LIGHTING_INCLUDED
#include "LightweightCore.cginc"

3
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandard.shader


Shader "LightweightPipeline/Standard (Physically Based)"
Shader "LightweightPipeline/Standard (Physically Based)"
{
Properties
{

FallBack "Hidden/InternalErrorShader"
CustomEditor "LightweightStandardGUI"
}

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticles.shader


Shader "LightweightPipeline/Particles/Standard"
Shader "LightweightPipeline/Particles/Standard"
{
Properties
{

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardParticlesUnlit.shader


Shader "LightweightPipeline/Particles/Standard Unlit"
Shader "LightweightPipeline/Particles/Standard Unlit"
{
Properties
{

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightStandardTerrain.shader


Shader "LightweightPipeline/Standard Terrain"
Shader "LightweightPipeline/Standard Terrain"
{
Properties
{

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightSurfaceInput.cginc


#ifndef LIGHTWEIGHT_SURFACE_INPUT_INCLUDED
#ifndef LIGHTWEIGHT_SURFACE_INPUT_INCLUDED
#define LIGHTWEIGHT_SURFACE_INPUT_INCLUDED
#include "LightweightCore.cginc"

2
ScriptableRenderPipeline/LightweightPipeline/Shaders/LightweightUnlit.shader


Shader "LightweightPipeline/Standard Unlit"
Shader "LightweightPipeline/Standard Unlit"
{
Properties
{

正在加载...
取消
保存