コード例 #1
0
    /// <summary>
    /// создание тессеракта
    /// </summary>
    /// <returns></returns>
    public static TesseractMesh GenerateHypercube()
    {
        //задаем вершины
        vertices = new Vector4[] {
            new Vector4(-1.0f, -1.0f, -1.0f, 1.0f),
            new Vector4(1.0f, -1.0f, -1.0f, 1.0f),
            new Vector4(1.0f, -1.0f, 1.0f, 1.0f),
            new Vector4(-1.0f, -1.0f, 1.0f, 1.0f),

            new Vector4(-1.0f, 1.0f, 1.0f, 1.0f),
            new Vector4(1.0f, 1.0f, 1.0f, 1.0f),
            new Vector4(1.0f, 1.0f, -1.0f, 1.0f),
            new Vector4(-1.0f, 1.0f, -1.0f, 1.0f),

            new Vector4(-1.0f, -1.0f, -1.0f, -1.0f),
            new Vector4(1.0f, -1.0f, -1.0f, -1.0f),
            new Vector4(1.0f, -1.0f, 1.0f, -1.0f),
            new Vector4(-1.0f, -1.0f, 1.0f, -1.0f),

            new Vector4(-1.0f, 1.0f, 1.0f, -1.0f),
            new Vector4(1.0f, 1.0f, 1.0f, -1.0f),
            new Vector4(1.0f, 1.0f, -1.0f, -1.0f),
            new Vector4(-1.0f, 1.0f, -1.0f, -1.0f),
        };
        //задаем грани проекции
        quads = new int[] {
            0, 1, 2, 3,
            4, 5, 6, 7,
            7, 6, 1, 0,
            6, 5, 2, 1,
            5, 4, 3, 2,
            4, 7, 0, 3,

            8, 9, 10, 11,
            12, 13, 14, 15,
            15, 14, 9, 8,
            14, 13, 10, 9,
            13, 12, 11, 10,
            12, 15, 8, 11,
        };
        //задаем ребра проекции
        lines = new int[] {
            0, 1, 1, 2, 2, 3, 3, 0,
            4, 5, 5, 6, 6, 7, 7, 4,
            0, 7, 1, 6, 2, 5, 3, 4,

            8, 9, 9, 10, 10, 11, 11, 8,
            12, 13, 13, 14, 14, 15, 15, 12,
            8, 15, 9, 14, 10, 13, 11, 12,

            0, 8, 1, 9, 2, 10, 3, 11,
            4, 12, 5, 13, 6, 14, 7, 15,
        };
        //создаем новый объект класса TesseractMesh
        TesseractMesh tesseract = new TesseractMesh("Tesseract");

        return(tesseract);
    }
コード例 #2
0
    /// <summary>
    /// Создаем тессеракт
    /// </summary>
    void Start()
    {
        meshObject = TesseractMesh.GenerateHypercube();
        projection = new GameObject(meshObject.Name);
        projection.AddComponent <MeshFilter>();
        MeshRenderer meshrenderer = projection.AddComponent <MeshRenderer>();

        meshrenderer.materials = new Material[] { edgeColor, innerColor };
    }