Beispiel #1
0
        public void General(float r, float g, float b, TextureParam output, ShaderOp _shaderOp)
        {
            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            timer.Start();

            Material mat = GetMaterial("CreateTexture");

            mat.SetVector("_Multiply", new Vector4(r, g, b, m_Value4));
            mat.SetVector("_Multiply2", new Vector4(m_Value5, m_Value6, m_Value7 * m_Value5, m_Value8 * m_Value6));
            SetCommonVars(mat);
            mat.SetFloat("_Frequency", m_frequency);
            mat.SetFloat("_Lacunarity", m_lacunarity);
            mat.SetFloat("_Gain", m_gain);
            mat.SetFloat("_Jitter", m_jitter);
            mat.SetFloat("_Octaves", m_Octaves);

            if (m_perlin != null)
            {
                mat.SetTexture("_PermTable1D", m_perlin.GetPermutationTable1D());
                mat.SetTexture("_Gradient2D", m_perlin.GetGradient2D());
            }
            m_debugGradient = m_perlin.GetGradient2D();
            RenderTexture destination = CreateRenderDestination(output);

            Graphics.Blit(null, destination, GetMaterial("CreateTexture"), (int)_shaderOp);
//        Debug.LogError(""+_shaderOp+" time: " + timer.ElapsedMilliseconds + " ms");
        }
        public void General(TextureParam _input, TextureParam _inputB, TextureParam _output, ShaderOp _shaderOp)
        {
            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            timer.Start();
            Material mat = GetMaterial("TextureOps");

            SetCommonVars(mat);
            mat.SetInt("_MainIsGrey", _input.IsGrey()?1:0);
            mat.SetInt("_TextureBIsGrey", _inputB.IsGrey() ? 1 : 0);

            mat.SetVector("_Multiply", new Vector4(m_Value, m_Value, m_Value, m_Value));
            mat.SetTexture("_GradientTex", _inputB.GetHWSourceTexture());
            mat.SetVector("_TexSizeRecip", new Vector4(1.0f / (float)_inputB.m_Width, 1.0f / (float)_inputB.m_Height, m_Value, 0));
            CalcOutputFormat(_input, _inputB);

            RenderTexture destination = CreateRenderDestination(_input, _output);

            Graphics.Blit(_input.GetHWSourceTexture(), destination, mat, (int)_shaderOp);
//        Debug.LogError(""+ _shaderOp+"  in Final" + timer.ElapsedMilliseconds + " ms");
        }
        public void General(float _r, float _g, float _b, TextureParam _input, TextureParam _output, ShaderOp _shaderOp)
        {
            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            timer.Start();
            Material mat = GetMaterial("TextureOps");

//        if (Inputs.Count>1 && Inputs[1].connection != null)
//            _r=Inputs[1].connection.GetValue<float>();
            mat.SetVector("_TexSizeRecip", new Vector4(1.0f / (float)_input.m_Width, 1.0f / (float)_input.m_Height, _input.m_Width, 0));
            mat.SetVector("_Multiply", new Vector4(_r, _g, _b, 1));
            mat.SetInt("_MainIsGrey", _input.IsGrey() ? 1 : 0);
            SetCommonVars(mat);

            CalcOutputFormat(_input);
            RenderTexture destination = CreateRenderDestination(_input, _output);


            Graphics.Blit(_input.GetHWSourceTexture(), destination, mat, (int)_shaderOp);
        }
Beispiel #4
0
    public void General(float _r, float _g, float _b, TextureParam _input, TextureParam _output, ShaderOp _shaderOp)
    {
        System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
        timer.Start();

        TexOpMaterial.SetVector("_Multiply", new Vector4(_r, _g, _b, 1));
        SetCommonVars(TexOpMaterial);
        RenderTexture destination = CreateRenderDestination(_input, _output);

        Graphics.Blit(_input.GetHWSourceTexture(), destination, TexOpMaterial, (int)_shaderOp);
//        Debug.LogError(" multiply in Final" + timer.ElapsedMilliseconds + " ms");
    }