zoukankan      html  css  js  c++  java
  • Unity3D在一建筑GL材料可以改变颜色和显示样本

        void CreateLineMaterial()
        {
            if (!mat)
            {
                mat = new Material("Shader "Lines/Colored Blended" {" +
                    "SubShader { Pass { " +
                    "    Blend SrcAlpha OneMinusSrcAlpha " +
                    "    ZWrite Off Cull Off Fog { Mode Off } " +
                    "    BindChannels {" +
                    "      Bind "vertex", vertex Bind "color", color }" +
                    "} } }");
                mat.hideFlags = HideFlags.HideAndDontSave;
                mat.shader.hideFlags = HideFlags.HideAndDontSave;
            }
        }


        void OnPostRender()
        {
            if (!mat)
            {
                CreateLineMaterial();
                return;
            }
            GL.PushMatrix();
            mat.SetPass(0);
            GL.LoadOrtho();
            GL.Begin(GL.QUADS);
            GL.Color(Color.red);
            GL.Vertex3(0, 0.5F, 0);
            GL.Vertex3(0.5F, 1, 0);
            GL.Vertex3(1, 0.5F, 0);
            GL.Vertex3(0.5F, 0, 0);
            GL.Color(Color.cyan);
            GL.Vertex3(0, 0, 0);
            GL.Vertex3(0, 0.25F, 0);
            GL.Vertex3(0.25F, 0.25F, 0);
            GL.Vertex3(0.25F, 0, 0);
            GL.End();
            GL.PopMatrix();
        }
  • 相关阅读:
    iOS跳转系统设置界面
    Swift中GCD与NSOperation相关
    将某字段按逗号分隔展示
    Java参考资料
    iOS消息推送相关
    [转]8 Regular Expressions You Should Know
    Oracle表锁住处理
    iframe自适应高度处理方案
    Mac常用软件推荐
    java代码块
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5040881.html
Copyright © 2011-2022 走看看