예제 #1
0
    //-----------------------------------------------------
    public static void SynthesizeFromBaseTex(Texture2D baseTex)
    {
        image i = new image(c_sampleSize, c_sampleSize);
        i.setPixels(baseTex);

        // -- Synthétisation de la texture à partir de l'échantillon --
        TextureSynthesizer ts = new TextureSynthesizer(128, 128);
        i = ts.synthesize(i);
        s_synthTex = i.getTextureRGB();
        s_synthTex.Apply();
        //            byte[] bytes = m_synthTex.EncodeToPNG();   // Sauvegarde en fichier
        //            System.IO.File.WriteAllBytes(Application.dataPath+"/Resources/grass/synth/grassSynth0.png", bytes);

        // -- Enregistrer la texture et l'appliquer aux plans de gazon --
        GameObject.Find("grassSkybox").GetComponent<GrassHandler>().AddSynthTex(s_synthTex,
                                                                                     baseTex, true);
        // -- Modifier l'interface (devrait être fait dans le contrôleur) --
        //          GameObject.Find("MainScene").GetComponent<GUIMenuMain>().SetHideAll(false);
        //        GameObject.Find("mainCam").transform.camera.cullingMask = m_camMaskBk;
        GameObject.Find("MainScene").GetComponent<PleaseWaitUI>().SetDisplayIcon(false);
    }