File: EffectPassCollection.cs

package info (click to toggle)
monogame 2.5.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,060 kB
  • ctags: 10,325
  • sloc: cs: 65,996; xml: 591; makefile: 22; ansic: 8
file content (64 lines) | stat: -rw-r--r-- 1,604 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.Xna.Framework.Graphics
{
    public class EffectPassCollection : IEnumerable<EffectPass>
    {
		// Modified to be a list instead of dictionary object because a dictionary does not guarantee
		// the order is kept as it is a hash key.
		internal List<EffectPass> _passes = new List<EffectPass>();
        //Dictionary<string, EffectPass> _passes = new Dictionary<string, EffectPass>();
        private EffectTechnique _effectTechnique;

        public EffectPassCollection(EffectTechnique effectTechnique)
        {
            _effectTechnique = effectTechnique;
			
        }

        public EffectPass this[int index]
        {
            get { return _passes[index]; }
            set { 
				_passes[index] = value; 
			}
        }

        public EffectPass this[string name]
        {
            get {
				foreach (EffectPass pass in _passes) {
					if (pass.Name == name)
						return pass;
				}
				return null;
		}
            set {

				var pass = this[name];
				if (pass != null)
					pass = value;
				else
					_passes.Add(value);
			}
        }

        public int Count
        {
            get { return _passes.Count; }
        }

        public IEnumerator<EffectPass> GetEnumerator()
        {
            return _passes.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return _passes.GetEnumerator();
        }
    }
}