コード例 #1
0
 public VertexPool(Material material, AltTrail owner)
 {
     _vertexTotal      = _vertexUsed = 0;
     _vertCountChanged = false;
     _owner            = owner;
     CreateMeshObj(owner, material);
     _material = material;
     InitArrays();
     IndiceChanged = ColorChanged = UVChanged = UV2Changed = VertChanged = true;
 }
コード例 #2
0
        void CreateMeshObj(AltTrail owner, Material material)
        {
            GameObject obj = new GameObject("SaberTrail");

            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));

            Meshrenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
            Meshrenderer.receiveShadows    = false;
            Meshrenderer.GetComponent <Renderer>().sharedMaterial = material;
            Meshrenderer.sortingLayerName = _owner.SortingLayerName;
            Meshrenderer.sortingOrder     = _owner.SortingOrder;
            _meshFilter.sharedMesh        = new Mesh();
        }