浏览代码

Rename 'camera' to 'view' (where applicable) for clarity

/RenderPassXR_Sandbox
Evgenii Golubev 7 年前
当前提交
52044713
共有 1 个文件被更改,包括 10 次插入10 次删除
  1. 20
      Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariablesFunctions.hlsl

20
Assets/ScriptableRenderPipeline/HDRenderPipeline/ShaderVariablesFunctions.hlsl


return pos;
}
// Returns the position of the primary (scene view) camera.
// Note: '_WorldSpaceCameraPos' is set by the legacy Unity code.
float3 GetPrimaryCameraPosition()
{

float3 GetCurrentCameraPosition()
// Could be e.g. the position of a primary camera or a shadow-casting light.
float3 GetCurrentViewPosition()
{
#if defined(SHADERPASS) && (SHADERPASS != SHADERPASS_SHADOWS)
return GetPrimaryCameraPosition();

#endif
}
// Returns the forward direction of the current camera in the world space.
float3 GetCameraForwardDir()
// Returns the forward (central) direction of the current view in the world space.
float3 GetViewForwardDir()
// Returns 'true' if the current camera performs a perspective projection.
bool IsPerspectiveCamera()
// Returns 'true' if the current view performs a perspective projection.
bool IsPerspectiveProjection()
{
#if defined(SHADERPASS) && (SHADERPASS != SHADERPASS_SHADOWS)
return (unity_OrthoParams.w == 0);

#endif
}
// Computes the world space view direction (pointing towards the camera).
// Computes the world space view direction (pointing towards the viewer).
if (IsPerspectiveCamera())
if (IsPerspectiveProjection())
float3 V = GetCurrentCameraPosition() - positionWS;
float3 V = GetCurrentViewPosition() - positionWS;
return -GetCameraForwardDir();
return -GetViewForwardDir();
}
}

正在加载...
取消
保存