Exemple #1
0
        internal MyVertexInputLayout Append(MyVertexInputComponentType type, int slot = 0, MyVertexInputComponentFreq freq = MyVertexInputComponentFreq.PER_VERTEX)
        {
            MyVertexInputComponent component = new MyVertexInputComponent();

            component.Type = type;
            component.Slot = slot;
            component.Freq = freq;

            int nextHash = MyHashHelper.Combine(m_hash, component.GetHashCode());

            MyVertexInputLayout next;

            if (m_cached.TryGetValue(nextHash, out next))
            {
                return(next);
            }

            next              = new MyVertexInputLayout();
            next.m_hash       = nextHash;
            next.m_id         = m_cached.Count;
            next.m_components = m_components.Concat(component.Yield()).ToArray();
            next.Build();

            m_cached[nextHash] = next;
            return(next);
        }
        internal MyVertexInputLayout Append(MyVertexInputComponentType type, int slot = 0, MyVertexInputComponentFreq freq = MyVertexInputComponentFreq.PER_VERTEX)
        {
            MyVertexInputComponent component = new MyVertexInputComponent();
            component.Type = type;
            component.Slot = slot;
            component.Freq = freq;

            int nextHash = MyHashHelper.Combine(m_hash, component.GetHashCode());

            MyVertexInputLayout next;
            if(m_cached.TryGetValue(nextHash, out next))
            {
                return next;
            }

            next = new MyVertexInputLayout();
            next.m_hash = nextHash;
            next.m_id = m_cached.Count;
            next.m_components = m_components.Concat(component.Yield()).ToArray();
            next.Build();

            m_cached[nextHash] = next;
            return next;
        }