Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     if (colorGradient == null)
     {
         colorGradient = new ColorMixer();
         colorGradient.InsertColorNode(Color.red, 0.2f);
         colorGradient.InsertColorNode(new Color(1, 1, 0), 0.6f);
         colorGradient.InsertColorNode(Color.green, 1);
     }
     initialOffset = bar.offsetMax.x;
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     transform.LookAt(cameraMain.transform);
     transform.localScale = new Vector3(1, 1, 1);
     if (colorMix == null)
     {
         colorMix = new ColorMixer();
         colorMix.InsertColorNode(Color.red, 0.2f);
         colorMix.InsertColorNode(new Color(1, 1, 0), 0.6f);
         colorMix.InsertColorNode(Color.green, 1);
     }
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        cameraMain = GameObject.FindGameObjectWithTag("MainCamera").transform;
        Unit parentUnit = GetComponentInParent <Unit>();

        if (parentUnit != null)
        {
            unit = parentUnit;
        }

        if (autoRotate)
        {
            bar.LookAt(cameraMain.transform);
        }
        bar.localScale = new Vector3(1, 1, 1);
        if (colorGradient == null)
        {
            colorGradient = new ColorMixer();
            colorGradient.InsertColorNode(Color.red, 0.2f);
            colorGradient.InsertColorNode(new Color(1, 1, 0), 0.6f);
            colorGradient.InsertColorNode(Color.green, 1);
        }
    }
Exemplo n.º 4
0
    // Start is called at the beginng
    void Start()
    {
        mainMat = earth.GetComponent<MeshRenderer>().material;
        pins = new List<GameObject>();

        // Initializing meshes
        highG = MeshFactory.ReadMeshFromFile("OFF/high_genus", 0.2f, new Vector3(0, 0, -0.6f));
        MeshFactory.ReorderVertexIndices(highG, 0);

        bague = MeshFactory.ReadMeshFromFile("OFF/bague", 0.5f);
        MeshFactory.ReorderVertexIndices(bague, 0);

        cow = MeshFactory.ReadMeshFromFile("OFF/cow", 1.5f, new Vector3(0.15f, 0.15f, 0));

        triceratops = MeshFactory.ReadMeshFromFile("OFF/tri_triceratops", 0.2f, new Vector3(0.15f, 0, 0));

        horse = MeshFactory.ReadMeshFromFile("OFF/horse1", 12f, new Vector3(0f, 0f, -0.3f), Quaternion.Euler(-90, 0, 0));
        MeshFactory.ReorderVertexIndices(horse, 2);

        sphere = Instantiate<Mesh>(sphere);
        sphere2 = Instantiate<Mesh>(sphere);
        sphere3 = MeshFactory.CreateSphere(1, 48);
        MeshFactory.MergeOverlappingPoints(sphere2);

        hemisphere = Instantiate<Mesh>(hemisphere);
        MeshFactory.MergeOverlappingPoints(hemisphere);
        MeshFactory.TransformMesh(hemisphere, Vector3.zero, Quaternion.Euler(-90, 0, 0));

        skull = Instantiate<Mesh>(skull);
        MeshFactory.MergeOverlappingPoints(skull);
        MeshFactory.TransformMesh(skull, new Vector3(0, -0.5f, 0), Quaternion.Euler(-90, 0, 0));
        MeshFactory.ReorderVertexIndices(skull, 1);

        road = Instantiate<Mesh>(road);
        MeshFactory.TransformMesh(road, Vector3.zero, Quaternion.Euler(-180, 0, 0));

        dragon = Instantiate<Mesh>(dragon);
        MeshFactory.MergeOverlappingPoints(dragon);
        MeshFactory.TransformMesh(dragon, Vector3.zero, Quaternion.Euler(0, 90, 0), new Vector3(0.75f, 0.75f, 0.75f));
        MeshFactory.ReorderVertexIndices(dragon, 0);

        // Emission animation
        float tTotal = 6f, tBlink = 0.10f;
        float cMax = 0.9f, cM1 = 0.3f, cM2 = 0.5f;
        anim1 = new ColorMixer();
        anim1.InsertColorNode(new Color(cMax, cMax, cMax), 0f);
        anim1.InsertColorNode(new Color(cMax, cMax, cMax), 0.5f - 3f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(cM1, cM1, cM1), 0.5f - 2.5f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(cMax, cMax, cMax), 0.5f - 2f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(cM1, cM1, cM1), 0.5f - 1.5f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(cMax, cMax, cMax), 0.5f - 1f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(0f, 0f, 0f), 0.5f);
        anim1.InsertColorNode(new Color(0f, 0f, 0f), 1f - 3f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(cM2, cM2, cM2), 1f - 2.5f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(0f, 0f, 0f), 1f - 2f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(cM2, cM2, cM2), 1f - 1.5f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(0f, 0f, 0f), 1f - 1f * tBlink / tTotal);
        anim1.InsertColorNode(new Color(cMax, cMax, cMax), 1f);

        // Start with the first mesh
        SetLevel(0);
        UpdateInfoText();
    }
Exemplo n.º 5
0
    /// <summary>
    /// Generate and add texture to the mesh.
    /// </summary>
    public void SetTexture(int type)
    {
        textureIndex = type;

        ColorMixer background;
        ColorMixer stripe;
        Texture2D tex;
        Material mat = mainMat;

        int period;
        int width;

        switch (type) {

        case 0:
        default:
            // White purple rubber, bright yellow gap
            period = 82;
            width = 11;
            Settings.mappingDistance = 3;
            Settings.ScrollSpeed = 0.066f;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.9f, 1f), 0.1f);
            background.InsertColorNode(new Color(1f, 0, 1f), 0.4f);
            background.InsertColorNode(new Color(0.4f, 0, 0.6f), 0.7f);
            background.InsertColorNode(new Color(0.4f, 0, 0.6f), 0.8f);
            background.InsertColorNode(new Color(1f, 0, 1f), 0.9f);
            background.InsertColorNode(new Color(1f, 0.9f, 1f), 1f);
            stripe.InsertColorNode(new Color(0.9f,0.9f,0.45f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe);
            mat.mainTexture = tex;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.2f, 1f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.2f, 0f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe, true);
            mat.SetTexture("_BumpMap", tex);
            mat.EnableKeyword("_NORMALMAP");

            mat.DisableKeyword("_SPECGLOSSMAP");
            mat.DisableKeyword("_EMISSION");
            break;

        case 1:
            // White-blue rubber, silver metal wire
            period = 60;
            width = 8;
            Settings.mappingDistance = 4;
            Settings.ScrollSpeed = 0.05f;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(Color.white, 0.0f);
            background.InsertColorNode(new Color(0.5f, 0.75f, 1f), 0.3f);
            background.InsertColorNode(Color.blue, 0.7f);
            background.InsertColorNode(Color.blue, 0.8f);
            background.InsertColorNode(new Color(0.5f, 0.75f, 1f), 0.9f);
            background.InsertColorNode(Color.white, 1f);
            stripe.InsertColorNode(new Color(0.5f,0.5f,0.5f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe);
            mat.mainTexture = tex;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0.43f, 0.43f, 0.43f, 0.6f), 0);
            stripe.InsertColorNode(new Color(0.9f, 0.9f, 0.9f, 0.85f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe);
            mat.SetTexture("_SpecGlossMap", tex);
            mat.EnableKeyword("_SPECGLOSSMAP");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.25f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.75f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe, true);
            mat.SetTexture("_BumpMap", tex);
            mat.EnableKeyword("_NORMALMAP");

            mat.DisableKeyword("_EMISSION");
            break;

        case 2:
            // Dark green shell, light green fluorescence
            period = 60;
            width = 8;
            Settings.mappingDistance = 4;
            Settings.ScrollSpeed = 0.08f;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0.081f, 0.1137f, 0.06f), 0f);
            stripe.InsertColorNode(new Color(0f, 0f, 0f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe);
            mat.mainTexture = tex;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0f, 0f, 0f, 0f), 0);
            stripe.InsertColorNode(new Color(0.6f, 1f, 0.4f, 1f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.SetTexture("_EmissionMap", tex);
            mat.SetColor("_EmissionColor", new Color(0.9f, 0.9f, 0.9f));
            mat.EnableKeyword("_EMISSION");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 1f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.15f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.85f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe, true);
            mat.SetTexture("_BumpMap", tex);
            mat.EnableKeyword("_NORMALMAP");

            mat.DisableKeyword("_SPECGLOSSMAP");
            break;

        case 3:
            // Gold, bright lamp
            period = 60;
            width = 10;
            Settings.mappingDistance = 4;
            Settings.ScrollSpeed = 0.05f;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.7f, 0.3f), 0f);
            stripe.InsertColorNode(new Color(0.125f, 0.125f, 0.1f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.mainTexture = tex;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.7f, 0.3f, 0.75f), 0);
            stripe.InsertColorNode(new Color(0.3f, 0.3f, 0.3f, 0.4f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.SetTexture("_SpecGlossMap", tex);
            mat.EnableKeyword("_SPECGLOSSMAP");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0f, 0f, 0f, 0f), 0);
            stripe.InsertColorNode(new Color(1f, 1f, 0.8f, 1f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.SetTexture("_EmissionMap", tex);
            mat.SetColor("_EmissionColor", new Color(0f, 0f, 0f));
            mat.EnableKeyword("_EMISSION");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 1f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.15f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.85f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe, true);
            mat.SetTexture("_BumpMap", tex);
            mat.EnableKeyword("_NORMALMAP");
            break;

        case 4:
            // Grey stone, lava band
            period = 60;
            width = 10;
            Settings.mappingDistance = 4;
            Settings.ScrollSpeed = 0.05f;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0.25f, 0.25f, 0.25f), 0f);
            stripe.InsertColorNode(new Color(0.05f, 0.05f, 0.05f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.mainTexture = tex;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0f, 0f, 0f, 0.25f), 0);
            stripe.InsertColorNode(new Color(0.25f, 0.25f, 0.25f, 0.5f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.SetTexture("_SpecGlossMap", tex);
            mat.EnableKeyword("_SPECGLOSSMAP");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0f, 0f, 0f, 0f), 0);
            stripe.InsertColorNode(new Color(0.85f, 0.7f, 0.1f, 1f), 0.1f);
            stripe.InsertColorNode(new Color(1f, 0.05f, 0f, 1f), 0.3f);
            stripe.InsertColorNode(new Color(0f, 0f, 0f, 1f), 0.5f);
            stripe.InsertColorNode(new Color(0f, 0f, 0f, 1f), 0.6f);
            stripe.InsertColorNode(new Color(1f, 0.05f, 0f, 1f), 0.8f);
            stripe.InsertColorNode(new Color(0.85f, 0.7f, 0.1f, 1f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.SetTexture("_EmissionMap", tex);
            mat.SetColor("_EmissionColor", new Color(1f, 1f, 1f));
            mat.EnableKeyword("_EMISSION");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 1f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.15f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.85f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe, true);
            mat.SetTexture("_BumpMap", tex);
            mat.EnableKeyword("_NORMALMAP");
            break;

        case 5:
            // White plaster, black porcelain
            background = new ColorMixer();
            stripe = new ColorMixer();
            period = 60;
            width = 30;
            Settings.mappingDistance = 4;
            Settings.ScrollSpeed = 0.05f;

            background.InsertColorNode(Color.white, 0f);
            stripe.InsertColorNode(Color.black, 0f);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.mainTexture = tex;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0.2f, 0.2f, 0.2f, 0.5f), 0);
            stripe.InsertColorNode(new Color(0.3f, 0.3f, 0.3f, 0.85f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.SetTexture("_SpecGlossMap", tex);
            mat.EnableKeyword("_SPECGLOSSMAP");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.1f, 1f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.1f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.9f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.1f, 0f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe, true);
            mat.SetTexture("_BumpMap", tex);
            mat.EnableKeyword("_NORMALMAP");

            mat.DisableKeyword("_EMISSION");
            break;

        case 6:
            // Yellow-red-black rubber + light
            period = 82;
            width = 12;
            Settings.mappingDistance = 3;
            Settings.ScrollSpeed = 0.066f;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(Color.yellow, 0.1f);
            background.InsertColorNode(Color.red, 0.4f);
            background.InsertColorNode(Color.black, 0.7f);
            background.InsertColorNode(Color.black, 0.8f);
            background.InsertColorNode(Color.red, 0.9f);
            background.InsertColorNode(Color.yellow, 1f);
            tex = MeshFactory.CreateStripedTexture(2048, period, 0, 20, background, stripe);
            mat.mainTexture = tex;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(Color.black, 0f);
            stripe.InsertColorNode(Color.yellow, 0.1f);
            stripe.InsertColorNode(Color.red, 0.4f);
            stripe.InsertColorNode(Color.black, 0.7f);
            stripe.InsertColorNode(Color.black, 0.8f);
            stripe.InsertColorNode(Color.red, 0.9f);
            stripe.InsertColorNode(Color.yellow, 1f);
            tex = MeshFactory.CreateStripedTexture(2048, period, width-2, 21, background, stripe);
            mat.SetTexture("_EmissionMap", tex);
            mat.SetColor("_EmissionColor", new Color(0.5f, 0.5f, 0.5f));
            mat.EnableKeyword("_EMISSION");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.1f, 0f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.2f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.8f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.1f, 1f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe, true);
            mat.SetTexture("_BumpMap", tex);
            mat.EnableKeyword("_NORMALMAP");

            mat.DisableKeyword("_SPECGLOSSMAP");
            break;

        case 7:
            // White-yellow-orange plaster, black stripe
            period = 82;
            width = 11;
            Settings.mappingDistance = 3;
            Settings.ScrollSpeed = 0.066f;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 1f, 0.8f), 0.1f);
            background.InsertColorNode(new Color(1f, 1f, 0f), 0.3f);
            background.InsertColorNode(new Color(1f, 0.3f, 0f), 0.7f);
            background.InsertColorNode(new Color(1f, 0.3f, 0f), 0.8f);
            background.InsertColorNode(new Color(1f, 1f, 0f), 0.93f);
            background.InsertColorNode(new Color(1f, 1f, 0.8f), 1f);
            stripe.InsertColorNode(new Color(0.1f, 0.1f, 0.1f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe);
            mat.mainTexture = tex;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0.33f, 0.33f, 0.33f, 0.33f), 0);
            stripe.InsertColorNode(new Color(0.4f, 0.4f, 0.4f, 0.5f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe);
            mat.SetTexture("_SpecGlossMap", tex);
            mat.EnableKeyword("_SPECGLOSSMAP");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.2f, 1f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.2f, 0f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe, true);
            mat.SetTexture("_BumpMap", tex);
            mat.EnableKeyword("_NORMALMAP");

            mat.DisableKeyword("_EMISSION");
            break;

        case 8:
            // White bone, metal band
            period = 82;
            width = 22;
            Settings.mappingDistance = 3;
            Settings.ScrollSpeed = 0.066f;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0.6f, 0.6f, 0.6f), 0f);
            stripe.InsertColorNode(new Color(0f, 0f, 0f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe);
            mat.mainTexture = tex;

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(0f, 0f, 0f, 0.4f), 0);
            stripe.InsertColorNode(new Color(0.7f, 0.7f, 0.7f, 0.8f), 0);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe);
            mat.SetTexture("_SpecGlossMap", tex);
            mat.EnableKeyword("_SPECGLOSSMAP");

            background = new ColorMixer();
            stripe = new ColorMixer();
            background.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.2f, 0f), 0);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.1f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.5f, 0.5f), 0.9f);
            stripe.InsertColorNode(new Color(1f, 0.5f, 0.2f, 1f), 1);
            tex = MeshFactory.CreateStripedTexture(2048, period, width, 20, background, stripe, true);
            mat.SetTexture("_BumpMap", tex);
            mat.EnableKeyword("_NORMALMAP");

            mat.DisableKeyword("_EMISSION");
            break;
        }
    }