Ejemplo n.º 1
0
    public void CalcSignificantIndicies(int index, Vector3 trunkLocalPos, ref List <int> output)
    {
        int top = sceneTrunkMgr.GetTopTrunkIndex(index);

        if (top != -1)
        {
            output.Add(top);
        }
        int right = sceneTrunkMgr.GetRightTrunkIndex(index);

        if (right != -1)
        {
            output.Add(right);
        }
        int bottom = sceneTrunkMgr.GetBottomTrunkIndex(index);

        if (bottom != -1)
        {
            output.Add(bottom);
        }
        int left = sceneTrunkMgr.GetLeftTrunkIndex(index);

        if (left != -1)
        {
            output.Add(left);
        }

        int i = -1;

        if (left != -1)
        {
            i = sceneTrunkMgr.GetTopTrunkIndex(left);
            if (i != -1)
            {
                output.Add(i);
            }

            i = sceneTrunkMgr.GetBottomTrunkIndex(left);
            if (i != -1)
            {
                output.Add(i);
            }
        }

        if (right != -1)
        {
            i = sceneTrunkMgr.GetTopTrunkIndex(right);
            if (i != -1)
            {
                output.Add(i);
            }

            i = sceneTrunkMgr.GetBottomTrunkIndex(right);
            if (i != -1)
            {
                output.Add(i);
            }
        }

        if (trunkLocalPos.x < preloadThreshold)
        {
            if (left != -1)
            {
                i = sceneTrunkMgr.GetLeftTrunkIndex(left);
                if (i != -1)
                {
                    output.Add(i);
                }
            }
        }
        else if (trunkLocalPos.x > sceneTrunkMgr.trunkSize - preloadThreshold)
        {
            if (right != -1)
            {
                i = sceneTrunkMgr.GetRightTrunkIndex(right);
                if (i != -1)
                {
                    output.Add(i);
                }
            }
        }

        if (trunkLocalPos.z < preloadThreshold)
        {
            if (bottom != -1)
            {
                i = sceneTrunkMgr.GetBottomTrunkIndex(bottom);
                if (i != -1)
                {
                    output.Add(i);
                }
            }
        }
        else if (trunkLocalPos.z > sceneTrunkMgr.trunkSize - preloadThreshold)
        {
            if (top != -1)
            {
                i = sceneTrunkMgr.GetTopTrunkIndex(top);
                if (i != -1)
                {
                    output.Add(i);
                }
            }
        }
    }
Ejemplo n.º 2
0
    public void CalcSignificantIndicies(int index, Vector3 trunkLocalPos, ref List <int> output)
    {
        float halfSize = sceneTrunkMgr.trunkSize * .5f;
        int   i        = -1;

        bool left = false;

        if (trunkLocalPos.x >= halfSize)
        {
            left = false;
            i    = sceneTrunkMgr.GetRightTrunkIndex(index);
            if (i != -1)
            {
                output.Add(i);
            }
        }
        else
        {
            left = true;
            i    = sceneTrunkMgr.GetLeftTrunkIndex(index);
            if (i != -1)
            {
                output.Add(i);
            }
        }

        if (trunkLocalPos.z >= halfSize)
        {
            i = sceneTrunkMgr.GetTopTrunkIndex(index);
            if (i != -1)
            {
                output.Add(i);

                if (left)
                {
                    i = sceneTrunkMgr.GetLeftTrunkIndex(i);
                    if (i != -1)
                    {
                        output.Add(i);
                    }
                }
                else
                {
                    i = sceneTrunkMgr.GetRightTrunkIndex(i);
                    if (i != -1)
                    {
                        output.Add(i);
                    }
                }
            }
        }
        else
        {
            i = sceneTrunkMgr.GetBottomTrunkIndex(index);
            if (i != -1)
            {
                output.Add(i);

                if (left)
                {
                    i = sceneTrunkMgr.GetLeftTrunkIndex(i);
                    if (i != -1)
                    {
                        output.Add(i);
                    }
                }
                else
                {
                    i = sceneTrunkMgr.GetRightTrunkIndex(i);
                    if (i != -1)
                    {
                        output.Add(i);
                    }
                }
            }
        }
    }