示例#1
0
        // ------------------------------------------------------------------------
        // end: line

        // rect
        // ------------------------------------------------------------------------

        // draw a rectangle on the XZ plane centered at origin in object space, dimensions = (X dimension, Z dimension)
        public static void DrawRect(Vector3 center, Quaternion rotation, Vector2 dimensions, Color color, bool depthTest = true)
        {
            Mesh mesh = PrimitiveMeshFactory.Rect();

            if (mesh == null)
            {
                return;
            }

            Material material = GetMaterial(depthTest);
            MaterialPropertyBlock materialProperties = GetMaterialPropertyBlock();

            materialProperties.SetColor("_Color", color);
            materialProperties.SetVector("_Dimensions", new Vector4(dimensions.x, 0.0f, dimensions.y, 0.0f));

            Graphics.DrawMesh(mesh, center, rotation, material, 0, null, 0, materialProperties, false, false, false);
        }