示例#1
0
    int updateTranslations()
    {
        int   nT;       // becomes nTot
        float spacingSign = 1.0f;

        if (!pointyPartUp)
        {
            spacingSign = -1.0f;
        }
        nT = bb.MakeTranslations(spacingSign * spacing, nWide, nTall, ref translations);
        // negative spacing flags flatside up cell array.
        Mesh projectionMesh = new Mesh();

        bb.MakeHexMesh(translations, ref projectionMesh);
        // takes its flat side info clue from the step between translations
        PlaybackScreen.GetComponent <MeshFilter> ().sharedMesh = projectionMesh;

        // now find four corners, for drawing the gizmo representation of the camera frustums
        // to show the extent of what the lens array is looking at
        Vector3 txmin = translations[0];
        Vector3 txmax = translations[nT - 1];

        for (int i = 0; i < nT; i++)
        {
            txmin = Vector3.Min(txmin, translations[i]);
            txmax = Vector3.Max(txmax, translations[i]);
        }
        txulhc = new Vector3(txmin.x, txmax.y, 0);
        txurhc = new Vector3(txmax.x, txmax.y, 0);
        txllhc = new Vector3(txmin.x, txmin.y, 0);
        txlrhc = new Vector3(txmax.x, txmin.y, 0);

        return(nT);
    }