Ejemplo n.º 1
0
        /// <summary>Let the mesh know that UV3 is required.</summary>
        public void RequireUV3()
        {
            if (UV3 != null)
            {
                return;
            }

            UV3 = new FixedSizeBuffer <Vector2>(4, false);

            BlockBuffer buff = FirstBuffer;

            while (buff != null)
            {
                buff.RequireUV3();
                buff = buff.Next;
            }
        }
Ejemplo n.º 2
0
        /// <summary>Let the mesh know that normals are required.</summary>
        public void RequireNormals()
        {
            if (Normals != null)
            {
                return;
            }

            Normals = new FixedSizeBuffer <Vector3>(4, false);

            BlockBuffer buff = FirstBuffer;

            while (buff != null)
            {
                buff.RequireNormals();
                buff = buff.Next;
            }
        }
Ejemplo n.º 3
0
        /// <summary>Permanently destroys this mesh.</summary>
        public void Destroy()
        {
            OutputMesh      = null;
            OutputTransform = null;

            if (OutputGameObject != null)
            {
                GameObject.Destroy(OutputGameObject);
                OutputGameObject = null;
            }

            UV        = null;
            UV2       = null;
            UV3       = null;
            Colours   = null;
            Normals   = null;
            Vertices  = null;
            Triangles = null;
        }
Ejemplo n.º 4
0
        /// <summary>Called only by constructors. This creates the actual mesh and the buffers for verts/tris etc.</summary>
        private void Setup()
        {
            UV        = new FixedSizeBuffer <Vector2>(4, false);
            Triangles = new FixedSizeBuffer <int>(6, true);
            Colours   = new FixedSizeBuffer <Color>(4, false);
            Vertices  = new FixedSizeBuffer <Vector3>(4, false);
            UV2       = new FixedSizeBuffer <Vector2>(4, false);

            OutputMesh       = new Mesh();
            OutputGameObject = new GameObject();
            OutputTransform  = OutputGameObject.GetComponent <Transform>();

            Renderer = OutputGameObject.AddComponent <MeshRenderer>();
            Renderer.sharedMaterial = Material;

            MeshFilter filter = OutputGameObject.AddComponent <MeshFilter>();

            filter.mesh = OutputMesh;
        }
Ejemplo n.º 5
0
 /// <summary>Let the mesh know that tangents are required.</summary>
 public void RequireTangents()
 {
     Tangents = new FixedSizeBuffer <Vector4>(4, false);
 }
Ejemplo n.º 6
0
 /// <summary>Let the mesh know that normals are required.</summary>
 public void RequireNormals()
 {
     Normals = new FixedSizeBuffer <Vector3>(4, false);
 }