コード例 #1
0
    /// <summary>
    /// Returns list of all points in viewField using oc for occlusion approximation.
    /// Will update occluded and notInView to lists of vertices in those categories.
    /// NOTE: clearing lists, resetting metadata must be done BEFORE calling method.
    /// </summary>
    public List <CachedVertex> AllInView(List <SurfacePoints> extras, List <bool> meshGuide, Frustum viewField, Occlusion oc)
    {
        for (int i = 0; i < extras.Count; i++)
        {
            // check visibility
            if (meshGuide[i])
            {
                for (int j = 0; j < extras[i].Wvertices.Count; j++)
                {
                    Vector3    pt   = extras[i].Wvertices[j];
                    Vector3    Pvec = Vector(viewField.Transform.position, pt);
                    ViewVector vv   = viewField.ViewVec(pt);

                    if (viewField.FOV.Contains(vv))
                    {
                        Vector2      coords = vv.Map <Occlusion.OcclusionCell>(oc.grid, viewField.FOV);
                        CachedVertex cv     = new CachedVertex(pt, i, j);

                        if (oc.grid[(int)coords.x, (int)coords.y].nullCell ||
                            Pvec.magnitude < oc.grid[(int)coords.x, (int)coords.y].distance)
                        {
                            oc.grid[(int)coords.x, (int)coords.y].closest  = cv;
                            oc.grid[(int)coords.x, (int)coords.y].distance = Pvec.magnitude;
                            oc.grid[(int)coords.x, (int)coords.y].nullCell = false;
                            NonOccludedVertices++;
                        }
                        VerticesInView++;
                    }
                    CheckedVertices++;
                }
            }
        }
        return(oc.Points());
    }
コード例 #2
0
 public PointValue(Vector3 myPoint, T myValue)
 {
     Point = new CachedVertex(myPoint);
     Value = myValue;
 }