浏览代码

HDRenderLoop: Fix few warning

/main
Sebastien Lagarde 8 年前
当前提交
6088f80d
共有 3 个文件被更改,包括 29 次插入6 次删除
  1. 23
      Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl
  2. 6
      Assets/ScriptableRenderLoop/ShaderLibrary/CommonMaterial.hlsl
  3. 6
      Assets/ScriptableRenderLoop/fptl/FptlLighting.cs

23
Assets/ScriptableRenderLoop/ShaderLibrary/Common.hlsl


0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0 };
// Using pow often result to a warning like this
// "pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them"
// PositivePow remove this warning when you know the value is positive and avoid inf/NAN.
float PositivePow(float base, float power)
{
return pow(max(abs(base), float(FLT_EPSILON)), power);
}
float2 PositivePow(float2 base, float2 power)
{
return pow(max(abs(base), float2(FLT_EPSILON, FLT_EPSILON)), power);
}
float3 PositivePow(float3 base, float3 power)
{
return pow(max(abs(base), float3(FLT_EPSILON, FLT_EPSILON, FLT_EPSILON)), power);
}
float4 PositivePow(float4 base, float4 power)
{
return pow(max(abs(base), float4(FLT_EPSILON, FLT_EPSILON, FLT_EPSILON, FLT_EPSILON)), power);
}
// ----------------------------------------------------------------------------
// World position reconstruction / transformation
// ----------------------------------------------------------------------------

6
Assets/ScriptableRenderLoop/ShaderLibrary/CommonMaterial.hlsl


return blendWeights;
}
float LerpWhiteTo(float b, float t)
{
float oneMinusT = 1.0 - t;
return oneMinusT + b * t;
}
float3 LerpWhiteTo(float3 b, float t)
{
float oneMinusT = 1.0 - t;

6
Assets/ScriptableRenderLoop/fptl/FptlLighting.cs


var bnds = rl.bounds;
var boxOffset = rl.center; // reflection volume offset relative to cube map capture point
var blendDistance = rl.blendDistance;
float imp = rl.importance;
//Matrix4x4 mat = rl.transform.localToWorldMatrix;
Vector3 cubeCapturePos = mat.GetColumn(3); // cube map capture position in world space
// implicit in CalculateHDRDecodeValues() --> float ints = rl.intensity;
var boxProj = (rl.boxProjection != 0);

//Vector3 C = bnds.center; // P + boxOffset;
var C = mat.MultiplyPoint(boxOffset); // same as commented out line above when rot is identity
//Vector3 posForShaderParam = bnds.center - boxOffset; // gives same as rl.GetComponent<Transform>().position;
var posForShaderParam = cubeCapturePos; // same as commented out line above when rot is identity
var combinedExtent = e + new Vector3(blendDistance, blendDistance, blendDistance);
Vector3 vx = mat.GetColumn(0);

正在加载...
取消
保存