Example #1
0
        private void CalculateVertexStep(int instanceCount)
        {
            for (int i = 0; i < instanceCount; i++)
            {
                foreach (var instancedAttribute in InstancedAttributes[_activeVertexShader])
                {
                    SetAttribute(_activeVertexShader, instancedAttribute.Key, instancedAttribute.Value[i]);
                }

                for (int j = 0; j < RenderData[ActiveVAO].Count; j++)
                {
                    foreach (var attribute in Attributes[_activeVertexShader])
                    {
                        SetAttribute(_activeVertexShader, attribute.Key, attribute.Value[(int)RenderData[ActiveVAO][j]]);
                    }

                    _activeVertexShader.Main();

                    _vertexPositions.Add(_activeVertexShader.Position * (1 / _activeVertexShader.Position.W));

                    foreach (var outValue in _activeVertexShader.GetOutValues())
                    {
                        if (_vertexValues.ContainsKey(outValue.Key))
                        {
                            _vertexValues[outValue.Key].Add(outValue.Value);
                        }
                        else
                        {
                            _vertexValues.Add(outValue.Key, new List <object> {
                                outValue.Value
                            });
                        }
                    }
                }
            }
        }