浏览代码

API change: VisibleLight has spotAngle now

/main
Aras Pranckevicius 8 年前
当前提交
bbf7731a
共有 3 个文件被更改,包括 3 次插入6 次删除
  1. 2
      Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs
  2. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs
  3. 5
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs

2
Assets/BasicRenderLoopTutorial/BasicRenderLoop.cs


var dir = light.localToWorld.GetColumn (2);
lightSpotDirections[i] = new Vector4 (-dir.x, -dir.y, -dir.z, 0);
float radAngle = Mathf.Deg2Rad * light.light.spotAngle;
float radAngle = Mathf.Deg2Rad * light.spotAngle;
float cosTheta = Mathf.Cos (radAngle * 0.25f);
float cosPhi = Mathf.Cos (radAngle * 0.5f);
float cosDiff = cosTheta - cosPhi;

2
Assets/ScriptableRenderLoop/HDRenderLoop/HDRenderLoop.cs


if (light.lightType == LightType.Spot)
{
var spotAngle = light.light.spotAngle;
var spotAngle = light.spotAngle;
var innerConePercent = AdditionalLightData.GetInnerSpotPercent01(additionalLightData);
var cosSpotOuterHalfAngle = Mathf.Clamp(Mathf.Cos(spotAngle * 0.5f * Mathf.Deg2Rad), 0.0f, 1.0f);

5
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs


const float pi = 3.1415926535897932384626433832795f;
const float degToRad = (float)(pi / 180.0);
const float radToDeg = (float)(180.0 / pi);
//float sa = cl.GetSpotAngle(); // total field of view from left to right side
var sa = radToDeg * (2 * Mathf.Acos(1.0f / cl.invCosHalfSpotAngle)); // spot angle doesn't exist in the structure so reversing it for now.
var sa = cl.spotAngle;
var cs = Mathf.Cos(0.5f * sa * degToRad);
var si = Mathf.Sin(0.5f * sa * degToRad);

正在加载...
取消
保存