浏览代码
Merge branch 'master' of https://github.com/Unity-Technologies/ScriptableRenderLoop
/fptl_cleanup
Merge branch 'master' of https://github.com/Unity-Technologies/ScriptableRenderLoop
/fptl_cleanup
Rune Stubbe
7 年前
当前提交
e210fc3a
共有 43 个文件被更改,包括 978 次插入 和 930 次删除
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugDisplayLatlong.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugDisplayShadowMap.shader
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugViewMaterialGBuffer.shader
-
8Assets/ScriptableRenderPipeline/HDRenderPipeline/Debug/Resources/DebugViewTiles.shader
-
22Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Lighting.hlsl
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/Resources/Deferred.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/lightlistbuild-bigtile.compute
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/lightlistbuild-clustered.compute
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/lightlistbuild.compute
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/scrbound.compute
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Resources/shadeopaque.compute
-
30Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePass.hlsl
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Builtin/BuiltinData.hlsl
-
22Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
-
24Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
-
22Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
-
8Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitData.hlsl
-
24Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader
-
8Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CombineSubsurfaceScattering.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/PreIntegratedFGD.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/SubsurfaceScatteringProfile.cs
-
16Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Material.hlsl
-
12Assets/ScriptableRenderPipeline/HDRenderPipeline/Material/Unlit/Unlit.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/EyeAdaptation.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/EyeHistogram.compute
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/FinalPass.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/PostProcess/Resources/LutGen.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/Resources/DrawGaussianProfile.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/SceneSettings/Resources/DrawTransmittanceGraph.shader
-
2Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderPass/FragInputs.hlsl
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Resources/SkyHDRI.shader
-
6Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/ProceduralSky/Resources/SkyProcedural.shader
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/BuildProbabilityTables.compute
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/ComputeGgxIblSampleData.compute
-
4Assets/ScriptableRenderPipeline/HDRenderPipeline/Sky/Resources/GGXConvolve.shader
-
32Assets/ScriptableRenderPipeline/ShaderLibrary/Common.hlsl
-
157Assets/ScriptableRenderPipeline/common/Camera/CameraSwitcher.cs
-
102Assets/ScriptableRenderPipeline/common/Camera/FreeCamera.cs
-
191Assets/ScriptableRenderPipeline/common/Debugging.cs
-
415Assets/ScriptableRenderPipeline/common/SkyboxHelper.cs
-
689Assets/ScriptableRenderPipeline/common/TextureCache.cs
-
4Assets/TestScenes/HDTest/Rock/rcgRock012/Materials/rcgRock012Material.mat
|
|||
using UnityEngine; |
|||
|
|||
public class FreeCamera : MonoBehaviour |
|||
namespace UnityEngine.Experimental.Rendering |
|||
public float m_LookSpeedController = 120f; |
|||
public float m_LookSpeedMouse = 10.0f; |
|||
public float m_MoveSpeed = 50.0f; |
|||
public float m_Turbo = 10.0f; |
|||
public class FreeCamera : MonoBehaviour |
|||
{ |
|||
public float m_LookSpeedController = 120f; |
|||
public float m_LookSpeedMouse = 10.0f; |
|||
public float m_MoveSpeed = 50.0f; |
|||
public float m_Turbo = 10.0f; |
|||
private static string kMouseX = "Mouse X"; |
|||
private static string kMouseY = "Mouse Y"; |
|||
private static string kRightStickX = "Controller Right Stick X"; |
|||
private static string kRightStickY = "Controller Right Stick Y"; |
|||
private static string kVertical = "Vertical"; |
|||
private static string kHorizontal = "Horizontal"; |
|||
private string[] m_RequiredInputAxes = { kMouseX, kMouseY, kRightStickX, kRightStickY, kVertical, kHorizontal }; |
|||
private static string kMouseX = "Mouse X"; |
|||
private static string kMouseY = "Mouse Y"; |
|||
private static string kRightStickX = "Controller Right Stick X"; |
|||
private static string kRightStickY = "Controller Right Stick Y"; |
|||
private static string kVertical = "Vertical"; |
|||
private static string kHorizontal = "Horizontal"; |
|||
private string[] m_RequiredInputAxes = { kMouseX, kMouseY, kRightStickX, kRightStickY, kVertical, kHorizontal }; |
|||
|
|||
private bool m_Valid = true; |
|||
void OnEnable() |
|||
{ |
|||
m_Valid = Debugging.CheckRequiredInputAxisMapping(m_RequiredInputAxes); |
|||
} |
|||
private bool m_Valid = true; |
|||
void OnEnable() |
|||
{ |
|||
m_Valid = Debugging.CheckRequiredInputAxisMapping(m_RequiredInputAxes); |
|||
} |
|||
void Update() |
|||
{ |
|||
if(m_Valid) |
|||
void Update() |
|||
float inputRotateAxisX = 0.0f; |
|||
float inputRotateAxisY = 0.0f; |
|||
if (Input.GetMouseButton(1)) |
|||
if(m_Valid) |
|||
inputRotateAxisX = Input.GetAxis(kMouseX) * m_LookSpeedMouse; |
|||
inputRotateAxisY = Input.GetAxis(kMouseY) * m_LookSpeedMouse; |
|||
} |
|||
inputRotateAxisX += (Input.GetAxis(kRightStickX) * m_LookSpeedController * Time.deltaTime); |
|||
inputRotateAxisY += (Input.GetAxis(kRightStickY) * m_LookSpeedController * Time.deltaTime); |
|||
float inputRotateAxisX = 0.0f; |
|||
float inputRotateAxisY = 0.0f; |
|||
if (Input.GetMouseButton(1)) |
|||
{ |
|||
inputRotateAxisX = Input.GetAxis(kMouseX) * m_LookSpeedMouse; |
|||
inputRotateAxisY = Input.GetAxis(kMouseY) * m_LookSpeedMouse; |
|||
} |
|||
inputRotateAxisX += (Input.GetAxis(kRightStickX) * m_LookSpeedController * Time.deltaTime); |
|||
inputRotateAxisY += (Input.GetAxis(kRightStickY) * m_LookSpeedController * Time.deltaTime); |
|||
float inputVertical = Input.GetAxis(kVertical); |
|||
float inputHorizontal = Input.GetAxis(kHorizontal); |
|||
float inputVertical = Input.GetAxis(kVertical); |
|||
float inputHorizontal = Input.GetAxis(kHorizontal); |
|||
bool moved = inputRotateAxisX != 0.0f || inputRotateAxisY != 0.0f || inputVertical != 0.0f || inputHorizontal != 0.0f; |
|||
if (moved) |
|||
{ |
|||
float rotationX = transform.localEulerAngles.x; |
|||
float newRotationY = transform.localEulerAngles.y + inputRotateAxisX; |
|||
bool moved = inputRotateAxisX != 0.0f || inputRotateAxisY != 0.0f || inputVertical != 0.0f || inputHorizontal != 0.0f; |
|||
if (moved) |
|||
{ |
|||
float rotationX = transform.localEulerAngles.x; |
|||
float newRotationY = transform.localEulerAngles.y + inputRotateAxisX; |
|||
// Weird clamping code due to weird Euler angle mapping...
|
|||
float newRotationX = (rotationX - inputRotateAxisY); |
|||
if (rotationX <= 90.0f && newRotationX >= 0.0f) |
|||
newRotationX = Mathf.Clamp(newRotationX, 0.0f, 90.0f); |
|||
if (rotationX >= 270.0f) |
|||
newRotationX = Mathf.Clamp(newRotationX, 270.0f, 360.0f); |
|||
// Weird clamping code due to weird Euler angle mapping...
|
|||
float newRotationX = (rotationX - inputRotateAxisY); |
|||
if (rotationX <= 90.0f && newRotationX >= 0.0f) |
|||
newRotationX = Mathf.Clamp(newRotationX, 0.0f, 90.0f); |
|||
if (rotationX >= 270.0f) |
|||
newRotationX = Mathf.Clamp(newRotationX, 270.0f, 360.0f); |
|||
transform.localRotation = Quaternion.Euler(newRotationX, newRotationY, transform.localEulerAngles.z); |
|||
transform.localRotation = Quaternion.Euler(newRotationX, newRotationY, transform.localEulerAngles.z); |
|||
float moveSpeed = Time.deltaTime * m_MoveSpeed; |
|||
if (Input.GetMouseButton(1)) |
|||
moveSpeed *= Input.GetKey(KeyCode.LeftShift) ? m_Turbo : 1.0f; |
|||
else |
|||
moveSpeed *= Input.GetAxis("Fire1") > 0.0f ? m_Turbo : 1.0f; |
|||
transform.position += transform.forward * moveSpeed * inputVertical; |
|||
transform.position += transform.right * moveSpeed * inputHorizontal; |
|||
float moveSpeed = Time.deltaTime * m_MoveSpeed; |
|||
if (Input.GetMouseButton(1)) |
|||
moveSpeed *= Input.GetKey(KeyCode.LeftShift) ? m_Turbo : 1.0f; |
|||
else |
|||
moveSpeed *= Input.GetAxis("Fire1") > 0.0f ? m_Turbo : 1.0f; |
|||
transform.position += transform.forward * moveSpeed * inputVertical; |
|||
transform.position += transform.right * moveSpeed * inputHorizontal; |
|||
} |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue