Beispiel #1
0
    void calculateParamMargins()
    {
        float indicatorMargin0Bound = Mathf.Max(_margin0LLength, _margin0RLength);
        float indicatorMargin1Bound = Mathf.Max(_margin1LLength, _margin1RLength);

        renderingFragements = RoadRenderer.splitByMargin(curve, indicatorMargin0Bound, indicatorMargin1Bound);
        if (renderingFragements[0] != null)
        {
            margin0Param = curve.paramOf(renderingFragements[0].At(1f)) ?? 0f;
        }
        else
        {
            margin0Param = 0;
        }
        if (renderingFragements[2] != null)
        {
            margin1Param = curve.paramOf(renderingFragements[2].At(0f)) ?? 0f;
        }
        else
        {
            margin1Param = 1;
        }

        if (!virtualRoad)
        {
            for (int i = 0; i != 3; ++i)
            {
                if (renderingFragements[i] != null)
                {
                    renderingFragements[i].InitAllBuffers();
                }
                curve.InitAllBuffers();
            }
        }
    }
Beispiel #2
0
    public void setMargins(float _margin0L, float _margin0R, float _margin1L, float _margin1R)
    {
        float indicatorMargin0Bound = Mathf.Max(_margin0L, _margin0R);
        float indicatorMargin1Bound = Mathf.Max(_margin1L, _margin1R);

        renderingFragements = RoadRenderer.splitByMargin(curve, indicatorMargin0Bound, indicatorMargin1Bound);
        if (renderingFragements[0] != null)
        {
            margin0End = curve.paramOf(renderingFragements[0].at(1f)) ?? 0f;
        }
        else
        {
            margin0End = 0;
        }
        if (renderingFragements[2] != null)
        {
            margin1End = curve.paramOf(renderingFragements[2].at(0f)) ?? 0f;
        }
        else
        {
            margin1End = 1;
        }
    }
Beispiel #3
0
    void calculateParamMargins()
    {
        float indicatorMargin0Bound = Mathf.Max(_margin0LLength, _margin0RLength);
        float indicatorMargin1Bound = Mathf.Max(_margin1LLength, _margin1RLength);

        renderingFragements = RoadRenderer.splitByMargin(curve, indicatorMargin0Bound, indicatorMargin1Bound);
        if (renderingFragements[0] != null)
        {
            _margin0Param = curve.paramOf(renderingFragements[0].at(1f)) ?? 0f;
        }
        else
        {
            _margin0Param = 0;
        }
        if (renderingFragements[2] != null)
        {
            _margin1Param = curve.paramOf(renderingFragements[2].at(0f)) ?? 0f;
        }
        else
        {
            _margin1Param = 1;
        }
    }