Пример #1
0
 private void Start()
 {
     this._mainCamera = Camera.get_main();
     this._mainCamera.set_depthTextureMode(1);
     this._depthShader      = ShaderManager.Find("OutLine/Depth");
     this._cameraGameObject = new GameObject();
     this._cameraGameObject.get_transform().set_parent(this._mainCamera.get_transform());
     this._cameraGameObject.get_transform().set_localPosition(Vector3.get_zero());
     this._cameraGameObject.get_transform().set_localScale(Vector3.get_one());
     this._cameraGameObject.get_transform().set_localRotation(Quaternion.get_identity());
     this._camera = this._cameraGameObject.AddComponent <Camera>();
     this._camera.set_aspect(this._mainCamera.get_aspect());
     this._camera.set_fieldOfView(this._mainCamera.get_fieldOfView());
     this._camera.set_orthographic(false);
     this._camera.set_nearClipPlane(this._mainCamera.get_nearClipPlane());
     this._camera.set_farClipPlane(this._mainCamera.get_farClipPlane());
     this._camera.set_rect(this._mainCamera.get_rect());
     this._camera.set_depthTextureMode(0);
     this._camera.set_cullingMask(1 << LayerMask.NameToLayer("Player"));
     this._camera.set_enabled(false);
     this._materialOcclusion = new Material(ShaderManager.Find("OutLine/Occlusion"));
     this._materialStretch   = new Material(ShaderManager.Find("OutLine/Stretch"));
     this._materialMix       = new Material(ShaderManager.Find("OutLine/Mix"));
     Shader.SetGlobalColor(ShaderPIDManager._OutLineColor, this.OutLineColor);
     if (!this._depthShader.get_isSupported() || !this._materialMix.get_shader().get_isSupported() || !this._materialMix.get_shader().get_isSupported() || !this._materialOcclusion.get_shader().get_isSupported())
     {
         Debug.LogError("no isSupported");
         return;
     }
 }
Пример #2
0
    public static Material CreateAutoFlashLightMat(float timeOnce = 0.4f, float interval = 5f)
    {
        Material material = new Material(ShaderManager.Find("Hsh(Mobile)/UI/AutoFlashLight"));

        material.SetFloat(ShaderPIDManager._BeginTime, 0f);
        material.SetFloat(ShaderPIDManager._Interval, interval);
        material.SetFloat(ShaderPIDManager._TimeOnce, timeOnce);
        return(material);
    }
Пример #3
0
 public static void CheckInternalErrorShader(Material[] m_materials)
 {
     for (int i = 0; i < m_materials.Length; i++)
     {
         if (m_materials[i] != null && m_materials[i].get_shader() != null && m_materials[i].get_shader().get_name() == "Hidden/InternalErrorShader")
         {
             m_materials[i].set_shader(ShaderManager.Find("MatCap/Vertex/Textured Multiply(NoTransparent)"));
         }
     }
 }
Пример #4
0
 public static void SetShader(Material[] m_materials, string name)
 {
     for (int i = 0; i < m_materials.Length; i++)
     {
         if (m_materials[i] != null && m_materials[i].get_shader() != null)
         {
             m_materials[i].set_shader(ShaderManager.Find(name));
         }
     }
 }
Пример #5
0
 private void Start()
 {
     this.BlurBoxShader = ShaderManager.Find("Unlit/GaussianBlur");
     if (!SystemInfo.get_supportsImageEffects())
     {
         base.set_enabled(false);
         return;
     }
     if (!this.BlurBoxShader || !this.BlurBoxShader.get_isSupported())
     {
         base.set_enabled(false);
     }
 }
Пример #6
0
    public static Shader FindShader(string name)
    {
        Shader shader = ShaderManager.Find(name);

        if (shader == null)
        {
            Debuger.Error("Error find shader : " + name, new object[0]);
            return(null);
        }
        if (!shader.get_isSupported())
        {
            Debuger.Error("Shader not supported on this platform : " + name, new object[0]);
            return(null);
        }
        return(shader);
    }
Пример #7
0
 private void OnPostRender()
 {
     if (!this.mat)
     {
         this.mat = new Material(ShaderManager.Find("Hsh(Mobile)/FX/ParticleAlphaBlended"));
         this.mat.get_shader().set_hideFlags(61);
         this.mat.set_hideFlags(61);
     }
     GL.PushMatrix();
     GL.LoadOrtho();
     for (int i = 0; i < this.mat.get_passCount(); i++)
     {
         this.mat.SetPass(i);
         GL.Begin(7);
         GL.Vertex3(0f, 0f, 0.1f);
         GL.Vertex3(1f, 0f, 0.1f);
         GL.Vertex3(1f, 1f, 0.1f);
         GL.Vertex3(0f, 1f, 0.1f);
         GL.End();
     }
     GL.PopMatrix();
 }
Пример #8
0
 private void GetMaterials()
 {
     this.dofHdrMaterial = new Material(ShaderManager.Find("Hidden/Dof/DepthOfFieldHdr"));
 }
Пример #9
0
    private void DoSetShader(ActorFXSpine actorSpine, bool stencilMask, FXSpine dataSpine)
    {
        if (actorSpine == null)
        {
            return;
        }
        using (Dictionary <int, ActorFXSpine> .ValueCollection.Enumerator enumerator = this.m_fxSpines.get_Values().GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                ActorFXSpine current = enumerator.get_Current();
                if (!(current == null))
                {
                    if (current._dataSpine != null && actorSpine._dataSpine != null)
                    {
                        if (current._uid != actorSpine._uid)
                        {
                            if (!(current.myRenderer == null) && !(actorSpine.myRenderer == null))
                            {
                                if (current.myRenderer.get_sharedMaterial() == null)
                                {
                                    Debug.Log("tspine.myRenderer.sharedMaterial is null");
                                }
                                else if (!(current.myRenderer.get_sharedMaterial().get_mainTexture() == null))
                                {
                                    if (current._dataSpine.id == actorSpine._dataSpine.id && current._stencilMask == actorSpine._stencilMask)
                                    {
                                        actorSpine.myRenderer.set_sharedMaterial(current.myRenderer.get_sharedMaterial());
                                        return;
                                    }
                                    if (current._dataSpine.name == actorSpine._dataSpine.name && current._dataSpine.blendWay == actorSpine._dataSpine.blendWay && current._dataSpine.BrightnessRatio == actorSpine._dataSpine.BrightnessRatio && current._stencilMask == actorSpine._stencilMask && (current._dataSpine.blendWay != 0 || current._dataSpine.rgbEffect == actorSpine._dataSpine.rgbEffect))
                                    {
                                        actorSpine.myRenderer.set_sharedMaterial(current.myRenderer.get_sharedMaterial());
                                        return;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        Material material = actorSpine.GetComponent <MeshRenderer>().get_material();
        Shader   shader;

        if (stencilMask)
        {
            if (dataSpine.blendWay == 0)
            {
                shader = ShaderManager.Find("Hsh(Mobile)/UI/UIStencilAlphaBlended");
            }
            else
            {
                shader = ShaderManager.Find("Hsh(Mobile)/UI/UIStencilAdd");
            }
        }
        else
        {
            int blendWay = dataSpine.blendWay;
            if (blendWay != 1)
            {
                if (blendWay != 2)
                {
                    if (dataSpine.rgbEffect == 0)
                    {
                        shader = ShaderManager.Find("Hsh(Mobile)/UI/UISpineAlphaBlended");
                    }
                    else
                    {
                        shader = ShaderManager.Find("Hsh(Mobile)/FX/ParticleAlphaBlended");
                    }
                }
                else
                {
                    shader = ShaderManager.Find("Particles/Additive");
                }
            }
            else
            {
                shader = ShaderManager.Find("Hsh(Mobile)/UI/UISpineAdd");
            }
        }
        material.set_shader(shader);
        material.SetFloat(ShaderPIDManager._BrightnessRatio, dataSpine.BrightnessRatio);
    }