/// <summary> /// /// </summary> /// <param name="owner"></param> /// <param name="material"></param> private void CreateMeshObj(WeaponTrail owner, Material material) { GameObject obj = new GameObject("_XWeaponTrailMesh:" + "|material:" + material.name); obj.layer = owner.gameObject.layer; obj.AddComponent <MeshFilter>(); obj.AddComponent <MeshRenderer>(); obj.transform.position = Vector3.zero; obj.transform.rotation = Quaternion.identity; _meshFilter = (MeshFilter)obj.GetComponent(typeof(MeshFilter)); var Meshrenderer = (MeshRenderer)obj.GetComponent(typeof(MeshRenderer)); //#if UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 // Meshrenderer.castShadows = false; //#else // Meshrenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; //#endif Meshrenderer.receiveShadows = false; Meshrenderer.GetComponent <Renderer>().sharedMaterial = material; Meshrenderer.sortingLayerName = _owner.SortingLayerName; Meshrenderer.sortingOrder = _owner.SortingOrder; _meshFilter.sharedMesh = new Mesh(); }
/// <summary> /// 顶点池 /// </summary> /// <param name="material"></param> /// <param name="owner"></param> public VertexPool(Material material, WeaponTrail owner) { VertexTotal = VertexUsed = 0; VertCountChanged = false; _owner = owner; if (owner.UseWith2D) { CreateMeshObj(owner, material); } else { _mesh2d = new Mesh(); } _material = material; InitArrays(); IndiceChanged = ColorChanged = UVChanged = UV2Changed = VertChanged = true; }