예제 #1
0
        public static string GetPositionAssignment(IEnumerable <ShaderAttribute> attributes, string matrixName)
        {
            // TODO: Use the first attribute as position?
            var positionAttribute = attributes.FirstOrDefault();

            if (positionAttribute == null)
            {
                return("");
            }

            string positionVariable = GlslVectorUtils.ConstructVector(ValueCount.Four, positionAttribute.ValueCount, positionAttribute.Name);

            return($"gl_Position = {matrixName} * {positionVariable};");
        }
예제 #2
0
        private static List <CaseStatement> GetCases(IEnumerable <ShaderAttribute> attributes)
        {
            var cases = new List <CaseStatement>();
            var index = 0;

            foreach (var attribute in attributes)
            {
                string body = GlslVectorUtils.ConstructVector(ValueCount.Three, attribute.ValueCount, vertexOutputPrefix + attribute.Name);
                cases.Add(new CaseStatement(index.ToString(), body));
                index++;
            }

            return(cases);
        }