浏览代码

Merge pull request #32 from johnsietsma/FeatheredPlane_CodeConventions

Fix code to match coding conventions.
/1.5-preview
GitHub 6 年前
当前提交
81e38dde
共有 1 个文件被更改,包括 12 次插入6 次删除
  1. 18
      Assets/Scripts/ARFeatheredPlaneMeshVisualizer.cs

18
Assets/Scripts/ARFeatheredPlaneMeshVisualizer.cs


[RequireComponent(typeof(ARPlaneMeshVisualizer), typeof(MeshRenderer), typeof(ARPlane))]
public class ARFeatheredPlaneMeshVisualizer : MonoBehaviour
{
float featheringWidth
{
get { return m_FeatheringWidth; }
set { m_FeatheringWidth = value; }
}
[Tooltip("The width of the texture feathering (in world units).")]
[SerializeField]
float m_FeatheringWidth = 0.2f;

Material m_FeatheredPlaneMaterial;
private void Awake()
void Awake()
{
m_PlaneMeshVisualizer = GetComponent<ARPlaneMeshVisualizer>();
m_ARPlane = GetComponent<ARPlane>();

private void OnEnable()
void OnEnable()
private void OnDisable()
void OnDisable()
private void ARPlaneMeshVisualizer_meshUpdated(ARPlaneMeshVisualizer planeMeshVisualizer)
void ARPlaneMeshVisualizer_meshUpdated(ARPlaneMeshVisualizer planeMeshVisualizer)
{
GenerateBoundaryUVs(planeMeshVisualizer.mesh);
}

/// is fairly uniform and the center vert is close to the barycentric center.
/// </remarks>
/// <param name="mesh">The <c>Mesh</c> generated by <c>ARPlaneMeshVisualizer</c></param>
public void GenerateBoundaryUVs(Mesh mesh)
void GenerateBoundaryUVs(Mesh mesh)
{
int vertexCount = mesh.vertexCount;

// Remap the UV so that a UV of "1" marks the feathering boudary.
// The ratio of featherBoundaryDistance/edgeDistance is the same as featherUV/edgeUV.
// Rearrange to get the edge UV.
float uvMapping = vertexDist / (vertexDist - m_FeatheringWidth);
float uvMapping = vertexDist / (vertexDist - featheringWidth);
uv.x = uvMapping;
// All the UV mappings will be different. In the shader we need to know the UV value we need to fade out by.

正在加载...
取消
保存