浏览代码

Bugfix CullTriangleFrustum()

/Yibing-Project-2
GitHub 7 年前
当前提交
1f72b2dd
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 12
      ScriptableRenderPipeline/Core/ShaderLibrary/GeometricTools.hlsl

12
ScriptableRenderPipeline/Core/ShaderLibrary/GeometricTools.hlsl


// 'epsilon' is the (negative) distance to (outside of) the frustum below which we cull the triangle.
bool CullTriangleFrustum(float3 p0, float3 p1, float3 p2, float epsilon, float4 frustumPlanes[4])
{
bool hidden = false;
bool outside = false;
for (int i = 0; i < 3; i++)
for (int i = 0; i < 4; i++)
hidden = hidden || Max3(DistanceFromPlane(p0, frustumPlanes[i]),
DistanceFromPlane(p1, frustumPlanes[i]),
DistanceFromPlane(p2, frustumPlanes[i])) < epsilon;
outside = outside || Max3(DistanceFromPlane(p0, frustumPlanes[i]),
DistanceFromPlane(p1, frustumPlanes[i]),
DistanceFromPlane(p2, frustumPlanes[i])) < epsilon;
return hidden;
return outside;
}
// Returns 'true' if a triangle defined by 3 vertices is back-facing.

正在加载...
取消
保存