Esempio n. 1
0
    void Awake()
    {
        // a quick and dirty way to ensure that only 1 instance is assigned per gameObject
        lock (gameObject) {
            if (gameObject.GetComponents <NprEffects> ().Length > 1)
            {
                Debug.LogWarning("NPR warning: only one instance of " + typeof(NprEffects) + " is allowed per each camera.");
                enabled = false;
                DestroyImmediate(this);
                return;
            }
        }

        edgeMap = shadowMap = null;
        CreateIfNotNull <NprEdgeSettings>(ref edgeSettings);
        CreateIfNotNull <NprSimplificationSettings>(ref simplificationSettings);
        CreateIfNotNull <NprShadowSettings>(ref shadowSettings);
        CreateIfNotNull <NprFadeControl>(ref fadeControlDesaturation);
        CreateIfNotNull <NprFadeControl>(ref fadeControlEdges);
        CreateIfNotNull <NprFadeControl>(ref fadeControlSimplification);
        CreateIfNotNull <NprColorTransferSettings>(ref colorTransferSettings);
        CreateAndAttachIfNottNull <NprDesaturate>(ref desaturator);
        CreateAndAttachIfNottNull <NprEdgeRender>(ref edgeRenderer);
        CreateAndAttachIfNottNull <NprImageSimplification>(ref simplifier);
        CreateAndAttachIfNottNull <NprShadowCreate>(ref shadowCreator);
        CreateAndAttachIfNottNull <NprCompositor>(ref compositor);
        CreateAndAttachIfNottNull <NprColorTransfer>(ref colorTransferRenderer);

        // there is no direct user control over this
        prefilterSettings = new NprSimplificationSettings();
        prefilterSettings.quantizationAmount = 0;

        lights = GameObject.FindObjectsOfType(typeof(Light)) as Light[];
    }
Esempio n. 2
0
 public void Init(NprSimplificationSettings simplificationSettings, NprFadeControl fadeControl)
 {
     useHDRTemporaries = true;
     IsSupported();
     string [] shaderNames =
     {
         "Hidden/NPR/RGBToCIELab",
         "Hidden/NPR/CIELabToRGB",
         "Hidden/NPR/SimplificationSmooth",
         "Hidden/NPR/SimplificationGradient",
         "Hidden/NPR/SimplificationQuantize"
     };
     InitMaterials(shaderNames);
     this.simplificationSettings = simplificationSettings;
     this.fadeControl            = fadeControl;
 }