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();
        }
  • 相关阅读:
    线程同步技术
    线程调用
    进程与线程
    网络配置
    vi
    文件系统
    系统管理命令
    Linux常用命令
    Shell编程
    新版chrome touch警告处理办法
  • 原文地址:https://www.cnblogs.com/yxwkf/p/5040881.html
Copyright © 2011-2022 走看看